:root {
  --bg-app: #eef2f6;
  --bg-surface: #ffffff;
  --primary: #1a73e8;
  --primary-dark: #174ea6;
  --navy-bar: #1e293b;
  --tbl-hdr: #d9e2ec;
  --tbl-hdr-text: #102a43;
  --green: #137333;
  --amber: #b06000;
  --red: #c5221f;
  --border-strong: #9fb3c8;
  --border: #bcccdc;
  --border-cell: #cbd5e1;
  --text-main: #1e293b;
  --text-muted: #52606d;
}

* {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: 'Segoe UI', Inter, Roboto, Arial, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ==========================================================================
   1. THANH ĐIỀU HƯỚNG TỐI TƯƠNG PHẢN CAO (TÁCH BIỆT RÕ VỚI VÙNG BẢNG TÍNH)
   ========================================================================== */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #1e293b;
  color: #ffffff;
  padding: 0 14px;
  min-height: 44px;
  border-bottom: 2px solid #0f172a;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 14px;
  color: #ffffff;
  white-space: nowrap;
}

.mode-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.mode-pill.online {
  background: #14532d;
  border-color: #4ade80;
  color: #dcfce7;
}
.mode-pill.local {
  background: #78350f;
  border-color: #fbbf24;
  color: #fef3c7;
}

.nav-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-top: 6px;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  border: 1px solid transparent;
  border-bottom: none;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.nav-tab:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}
.nav-tab.active {
  background: #ffffff;
  color: #0f3d8a;
  font-weight: 800;
  border-color: #0f172a;
  border-top: 3px solid #1a73e8;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

/* ==========================================================================
   2. NÚT BẤM PHẲNG VUÔNG CẠNH, ĐỘ TƯƠNG PHẢN RÕ
   ========================================================================== */
.btn {
  border: 1px solid #94a3b8;
  background: #ffffff;
  color: #1e293b;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #475569;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #174ea6; color: #ffffff; border-color: #0f3d8a; }
.btn-primary:hover:not(:disabled) { background: #0f3d8a; color: #ffffff; }
.btn-success { background: #188038; color: #ffffff; border-color: #13652c; }
.btn-success:hover:not(:disabled) { background: #13652c; color: #ffffff; }
.btn-amber { background: #fff8e1; color: #8c4a00; border-color: #eab308; }
.btn-amber:hover:not(:disabled) { background: #fef08a; }
.btn-danger { background: #fef2f2; color: #b91c1c; border-color: #f87171; }
.btn-danger:hover:not(:disabled) { background: #fee2e2; }
.btn-ghost-white {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 5px 10px;
  font-size: 12px;
}
.btn-ghost-white:hover { background: rgba(255, 255, 255, 0.24); color: #ffffff; }
.btn-sm { padding: 4px 8px; font-size: 11.5px; }

/* ==========================================================================
   3. KHUNG LÀM VIỆC & THANH CHỌN THÁNG / KPI RÕ RÀNG
   ========================================================================== */
.workspace {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 10px 12px 36px;
}

.month-bar {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  padding: 6px 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.month-pills {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.m-pill {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.m-pill:hover { background: #e2e8f0; border-color: #64748b; color: #0f172a; }
.m-pill.is-today { border-bottom: 3px solid #188038; background: #f0fdf4; color: #14532d; }
.m-pill.active {
  background: #174ea6;
  color: #ffffff;
  border-color: #0f3d8a;
}
.m-pill .cnt {
  font-size: 10.5px;
  opacity: 0.85;
  font-weight: 600;
}

.old-month-banner {
  background: #fef08a;
  color: #713f12;
  border: 1px solid #eab308;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

/* DẢI TỔNG HỢP SỐ LIỆU CÓ VIỀN TRÁI PHÂN BIỆT RÕ TỪNG Ô */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-left: 4px solid #475569;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.kpi-card.blue-tint { border-left-color: #174ea6; }
.kpi-card.green-tint { border-left-color: #188038; }
.kpi-card.red-tint { border-left-color: #c5221f; }
.kpi-lbl { font-size: 11px; font-weight: 800; text-transform: uppercase; color: #475569; letter-spacing: 0.2px; }
.kpi-num { font-size: 18px; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: #64748b; }

/* ==========================================================================
   4. BẢNG TÍNH ĐỘ TƯƠNG PHẢN CAO — DÒNG KẺ ĐẬM, ZEBRA RÕ, KHÔNG HÒA CHỮ!
   ========================================================================== */
.sheet-card {
  background: #ffffff;
  border: 1px solid #829ab1;
  overflow: hidden;
}

.sheet-toolbar {
  padding: 7px 12px;
  background: #e2e8f0;
  color: #0f172a;
  border-bottom: 1px solid #829ab1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.search-inp {
  padding: 5px 10px;
  border: 1px solid #64748b;
  font-size: 12.5px;
  min-width: 240px;
  background: #ffffff;
  color: #0f172a;
}
.search-inp:focus {
  outline: none;
  border-color: #174ea6;
  box-shadow: inset 0 0 0 1px #174ea6;
}

.grid-scroll {
  width: 100%;
  overflow-x: auto;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}

.payroll-full-wrap {
  width: 100%;
  overflow-x: visible;
}

table.excel-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

table.excel-grid.payroll-full-grid {
  width: 100%;
  table-layout: fixed;
}

/* TIÊU ĐỀ CỘT ĐẬM RÕ KIỂU BẢNG TÍNH CHUYÊN NGHIỆP */
table.excel-grid thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #243b53;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  padding: 8px 6px;
  border-bottom: 2px solid #102a43;
  border-right: 1px solid #486581;
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.15px;
}
table.excel-grid thead th.hdr-blue {
  background: #1d4ed8;
  color: #ffffff;
  border-right-color: #1e40af;
}
table.excel-grid thead th.hdr-green {
  background: #15803d;
  color: #ffffff;
  border-right-color: #166534;
}

table.excel-grid.payroll-full-grid thead th {
  white-space: normal;
  line-height: 1.25;
}

/* TÁCH BIỆT RÕ TỪNG DÒNG BẰNG ĐƯỜNG KẺ RÕ + ZEBRA CHẴN/LẺ + VẠCH NGĂN NGÀY */
table.excel-grid tbody td {
  padding: 0;
  border-bottom: 1px solid #cbd5e1;
  border-right: 1px solid #cbd5e1;
  height: 32px;
  vertical-align: middle;
  background: #ffffff;
}

table.excel-grid tbody tr.row-alt td {
  background: #f4f7fa;
}

/* Khi sang một ngày khác -> kẻ đường ranh giới đậm hơn để mắt nhìn tách cụm ngày ngay lập tức! */
table.excel-grid tbody tr.date-group-start td {
  border-top: 2px solid #64748b;
}

/* Đánh dấu nhẹ ở lề trái cho các dòng cùng chung 1 Job lớn chia nhiều người/nhiều dịch vụ */
table.excel-grid tbody tr.shared-job-row td.job-cell-td {
  border-left: 3px solid #2563eb;
  background: rgba(219, 234, 254, 0.28);
}

table.excel-grid tbody tr:hover td {
  background: #f1f5f9;
}

/* ==========================================================================
   CHẾ ĐỘ CHỌN Ô / CHỌN VÙNG / COPY-PASTE CHUẨN GOOGLE SHEETS (ASSIGN TASK)
   - Click 1 lần: Chỉ khoanh viền xanh chọn ô (không bung con trỏ chữ, không tự xổ menu)
   - Kéo chuột / Shift+Click: Chọn nhiều ô hoặc chọn nguyên dòng (bấm số #)
   - Nháy đúp / Enter / Gõ phím: Mới mở ô nhập chữ
   ========================================================================== */
table.excel-grid.sheet-select-grid tbody td {
  position: relative;
  user-select: none;
  cursor: cell;
}
table.excel-grid.sheet-select-grid tbody td.row-idx-cell,
table.excel-grid.sheet-select-grid tbody td.new-entry-badge {
  cursor: pointer;
}
table.excel-grid.sheet-select-grid tbody td.row-idx-cell:hover {
  background: #cbd5e1 !important;
  color: #0f172a !important;
}
table.excel-grid.sheet-select-grid tbody td.row-idx-cell.sheet-idx-row-active {
  background: #bfdbfe !important;
  color: #1e3a8a !important;
}
table.excel-grid.sheet-select-grid tbody td.row-idx-cell.sheet-idx-fullrow {
  background: #1a73e8 !important;
  color: #ffffff !important;
}

table.excel-grid.sheet-select-grid tbody td.sheet-in-range {
  background-color: rgba(26, 115, 232, 0.12) !important;
}
table.excel-grid.sheet-select-grid tbody tr.new-entry-row td.sheet-in-range {
  background-color: #bbf7d0 !important;
}
table.excel-grid.sheet-select-grid tbody td.sheet-cell-selected {
  outline: 2px solid #1a73e8 !important;
  outline-offset: -2px;
  z-index: 5;
}
table.excel-grid.sheet-select-grid tbody tr.new-entry-row td.sheet-cell-selected {
  z-index: 9;
}
table.excel-grid.sheet-select-grid tbody td.sheet-cell-copied {
  outline: 2px dashed #1a73e8 !important;
  outline-offset: -2px;
}

.sheet-cell-view {
  width: 100%;
  height: 31px;
  padding: 0 7px;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.sheet-cell-view.cell-center { justify-content: center; }
.sheet-cell-view.cell-right { justify-content: flex-end; }
.sheet-cell-view.has-arrow { padding-right: 19px; }
.sheet-cell-placeholder {
  color: #94a3b8;
  font-weight: 400;
  font-size: 12px;
}
table.excel-grid tbody tr.new-entry-row .sheet-cell-view {
  background: #ffffff;
  border: 1px solid #6ee7b7;
  height: 30px;
}

.sheet-status-view {
  width: 100%;
  height: 31px;
  padding: 0 18px 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  position: relative;
}
table.excel-grid tbody tr.new-entry-row .sheet-status-view {
  border: 1px solid #6ee7b7;
  height: 30px;
}
.st-arrow-btn {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 26px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 9.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.78;
  padding: 0;
}
.st-arrow-btn:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.1);
}

.sheet-active-editor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 15;
  background: #ffffff !important;
  color: #0f172a !important;
  border: 2px solid #1a73e8 !important;
  padding: 0 7px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  box-shadow: 0 3px 10px rgba(26, 115, 232, 0.22);
}

/* DÒNG + NHẬP JOB MỚI: GHIM CỐ ĐỊNH TRÊN ĐẦU, NỔI BẬT HẲN VỚI Ô TRẮNG SÁNG RÕ */
table.excel-grid tbody tr.new-entry-row td {
  position: sticky;
  top: 33px;
  z-index: 8;
  background: #dcfce7 !important;
  padding: 4px 3px !important;
  height: 40px;
  border-top: 1px solid #16a34a;
  border-bottom: 3px solid #15803d !important;
  border-right: 1px solid #86efac;
  box-shadow: 0 3px 6px rgba(15, 23, 42, 0.08);
}

table.excel-grid tbody tr.new-entry-row:hover td {
  background: #d1fae5 !important;
}

table.excel-grid tbody tr.new-entry-row td.new-entry-badge {
  background: #15803d !important;
  color: #ffffff !important;
  font-weight: 800;
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.3px;
  padding: 0 4px !important;
  border-right: 1px solid #14532d !important;
  user-select: none;
}

table.excel-grid tbody tr.new-entry-row .cell-inp {
  background: #ffffff !important;
  border: 1px solid #6ee7b7;
  height: 30px;
}

table.excel-grid tbody tr.new-entry-row .st-sel {
  border: 1px solid #6ee7b7;
  height: 30px;
}

/* Ô CÓ MENU GỢI Ý CHUẨN SHEET (CÓ MŨI TÊN MẢNH BÊN PHẢI, KHÔNG DÙNG POPUP ĐEN TRÌNH DUYỆT) */
.combo-cell-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
}
.combo-cell-wrap .cell-inp {
  padding-right: 19px;
}
.combo-arrow-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 22px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 10px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.65;
}
.combo-cell-wrap:hover .combo-arrow-btn,
.combo-arrow-btn:hover {
  opacity: 1;
  color: #174ea6;
  background: rgba(26, 115, 232, 0.08);
}

table.excel-grid tbody tr.just-saved-row td {
  animation: highlightSaved 1.6s ease-out;
}
@keyframes highlightSaved {
  0% { background-color: #fef08a; }
  100% { background-color: inherit; }
}

.row-idx-cell {
  background: #e2e8f0 !important;
  color: #334155 !important;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  border-right: 1px solid #94a3b8 !important;
  user-select: none;
}

.cell-inp, .cell-sel {
  width: 100%;
  height: 31px;
  border: 1.5px solid transparent;
  padding: 2px 7px;
  font-size: 13px;
  background: transparent;
  color: inherit;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.cell-inp:focus, .cell-sel:focus {
  background: #ffffff !important;
  border-color: #1a73e8;
  box-shadow: inset 0 0 0 1px #1a73e8;
}

/* MÀU CHỮ PHÂN TẦNG RÕ RÀNG TỪNG LOẠI CỘT ĐỂ KHÔNG BỊ HÒA VÀO NHAU */
.cell-center { text-align: center; }
.cell-right { text-align: right; }
.cell-bold { font-weight: 700; }
.cell-cus { color: #0f3d8a; font-weight: 700; }
.cell-job { color: #1155cc; font-weight: 600; }
.cell-svc { color: #334155; font-weight: 600; }
.cell-ed { color: #0f5132; font-weight: 700; }
.cell-qty { color: #c5221f; font-weight: 800; text-align: center; }
.cell-tip { color: #137333; font-weight: 700; text-align: right; }

.cell-readonly {
  padding: 0 8px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: text;
}
.cell-formula-vnd {
  background: #f8fafc !important;
  color: #0f172a;
}
.cell-formula-usd {
  background: #f0f6ff !important;
  color: #174ea6;
}
.cell-wrap {
  padding: 5px 8px !important;
  white-space: normal !important;
  word-break: break-word;
  line-height: 1.35;
  font-weight: 500;
  color: #334155;
}
.custom-price-pin {
  background: #fef08a !important;
  color: #854d0e !important;
  font-weight: 800;
}

/* Ô TRẠNG THÁI (STATUS) MÀU CHUẨN GOOGLE SHEETS THEO MẪU STUDIO */
.st-sel {
  font-weight: 700;
  font-size: 12px;
  text-align: center;
  height: 31px;
  width: 100%;
  margin: 0;
  padding: 0 4px;
  cursor: pointer;
  border: none;
  outline: none;
}
.st-sel:focus {
  box-shadow: inset 0 0 0 2px #1a73e8;
}

.st-cell-btn {
  width: 100%;
  height: 31px;
  border: none;
  padding: 0 18px 0 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  outline: none;
  user-select: none;
}
.st-cell-btn:focus {
  box-shadow: inset 0 0 0 2px #1a73e8;
}
.st-cell-arrow {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 9.5px;
  opacity: 0.78;
  pointer-events: none;
}
table.excel-grid tbody tr.new-entry-row .st-cell-btn {
  border: 1px solid #6ee7b7;
  height: 30px;
}

/* 4 MÀU STATUS CHUẨN PIXEL GOOGLE SHEETS: Done (#11734b), Waiting (#808080), Ready (#ffe5a0), Doing (#d4edbc) */
.st-Done { background: #11734b !important; color: #d4edbc !important; }
.st-Waiting { background: #808080 !important; color: #f2f2f2 !important; }
.st-Ready { background: #ffe5a0 !important; color: #473821 !important; }
.st-Doing { background: #d4edbc !important; color: #11734b !important; }
.st-Auto { background: #f8fafc !important; color: #334155 !important; }
.st-Revision { background: #fce5cd !important; color: #b45f06 !important; }
.st-Pending { background: #e2e8f0 !important; color: #475569 !important; }
.st-Cancelled { background: #f4cccc !important; color: #990000 !important; text-decoration: line-through; }

/* MENU POPUP CHỌN STATUS KIỂU GOOGLE SHEETS */
.status-popup {
  position: fixed;
  z-index: 260;
  background: #ffffff;
  border: 1px solid #94a3b8;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  min-width: 158px;
  padding: 4px 0;
}
.status-opt-row {
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
}
.status-opt-row:hover,
.status-opt-row.active {
  background: #f2f2f2;
}
.status-chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  min-width: 64px;
}
.status-opt-hint {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}

.pill-paid { background: #188038 !important; color: #ffffff !important; }
.pill-sent { background: #f9cb9c !important; color: #783f04 !important; }
.pill-partial { background: #ffe599 !important; color: #7f6000 !important; }
.pill-unpaid { background: #f4cccc !important; color: #990000 !important; }
.pill-none { background: #f8fafc !important; color: #94a3b8 !important; }

/* BỐ CỤC CÔNG NỢ & BÁO CÁO */
.ledger-split {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ledger-logs-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 14px;
}
@media (max-width: 1100px) {
  .ledger-logs-grid { grid-template-columns: 1fr; }
}

.report-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cus-mint-cell {
  background: #c9ead8 !important;
  color: #0d3b26 !important;
  font-weight: 800;
  padding: 6px 10px !important;
  text-align: left;
  white-space: nowrap;
}
.m-cell-paid { background: #e6f4ea !important; color: #137333 !important; font-weight: 700; }
.m-cell-partial { background: #fff2cc !important; color: #b45f06 !important; font-weight: 700; }
.m-cell-unpaid { background: #ffffff !important; color: #1e293b !important; font-weight: 700; }
.m-cell-none { background: #ffffff !important; color: #cbd5e1 !important; }

/* ==========================================================================
   5. GIAO DIỆN HÓA ĐƠN KHÁCH QUỐC TẾ BAN ĐẦU (KHÔI PHỤC NGUYÊN BẢN ĐẸP SẮC NÉT)
   ========================================================================== */
.invoice-layout {
  display: grid;
  grid-template-columns: 325px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1024px) {
  .invoice-layout { grid-template-columns: 1fr; }
}

.invoice-controls {
  background: #ffffff;
  border: 1px solid var(--border-strong);
  padding: 15px;
}
.ctrl-group { margin-bottom: 11px; }
.ctrl-lbl { display: block; font-size: 11.5px; font-weight: 800; color: #334155; margin-bottom: 4px; }
.ctrl-inp {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #94a3b8;
  font-size: 13px;
  background: #ffffff;
  color: #0f172a;
}
.ctrl-inp:focus {
  outline: none;
  border-color: #174ea6;
  box-shadow: inset 0 0 0 1px #174ea6;
}

.invoice-paper {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 34px 38px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  max-width: 900px;
  color: #202124;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 2.5px solid #174ea6;
  margin-bottom: 18px;
  gap: 16px;
}
.inv-studio-name { font-size: 19px; font-weight: 800; color: #174ea6; margin-bottom: 4px; }
.inv-studio-sub { font-size: 12px; color: #5f6368; line-height: 1.45; }
.inv-title { font-size: 28px; font-weight: 900; color: #174ea6; text-align: right; letter-spacing: 0.8px; }
.inv-no { font-size: 13px; font-weight: 700; text-align: right; margin-top: 4px; color: #202124; }

.inv-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}
.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
  font-size: 12.5px;
}
.inv-table th {
  background: #174ea6;
  color: #ffffff;
  padding: 8px 10px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
}
.inv-table.details th {
  background: #2c3e50;
  color: #ffffff;
}
.inv-table td {
  padding: 7px 10px;
  border: 1px solid #dadce0;
}
.inv-table tr:nth-child(even) td {
  background: #f8fafc;
}

.inv-totals-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}
.inv-totals-box {
  width: 340px;
  border-collapse: collapse;
  font-size: 13px;
}
.inv-totals-box td {
  padding: 6px 10px;
}
.inv-totals-box tr.grand-row td {
  background: #174ea6;
  color: #ffffff;
  font-weight: 800;
  font-size: 14.5px;
  padding: 9px 10px;
}

.inv-footer-box {
  background: #f8f9fa;
  border: 1px solid #dadce0;
  padding: 11px 14px;
  font-size: 12px;
  line-height: 1.55;
}

/* ==========================================================================
   6. MÀN HÌNH ĐĂNG NHẬP (ƯU TIÊN NHÂN VIÊN, LÀM MỜ LEADER)
   ========================================================================== */
.auth-screen {
  min-height: calc(100vh - 50px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 14px;
}
.auth-card {
  width: 100%;
  max-width: 410px;
  background: #ffffff;
  border: 1px solid #829ab1;
  border-top: 3px solid #174ea6;
  padding: 24px 24px 20px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}
.leader-muted-zone {
  margin-top: 14px;
  text-align: center;
}
.leader-muted-link {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 11.5px;
  opacity: 0.48;
  cursor: pointer;
  padding: 4px 8px;
}
.leader-muted-link:hover {
  opacity: 0.95;
  color: #1e293b;
  text-decoration: underline;
}

/* ==========================================================================
   7. POPUP GỢI Ý DROPDOWN CHUẨN GOOGLE SHEETS & HỘP THOẠI MODAL TÙY CHỈNH
   ========================================================================== */
.combo-popup {
  position: fixed;
  z-index: 250;
  background: #ffffff;
  border: 1px solid #64748b;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  max-height: 268px;
  overflow-y: auto;
  min-width: 190px;
}

.combo-popup-hdr {
  padding: 4px 10px;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.combo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  font-size: 12.5px;
  color: #0f172a;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  border-left: 3px solid transparent;
}
.combo-item:last-child {
  border-bottom: none;
}
.combo-item:hover,
.combo-item.active {
  background: #e8f0fe;
  color: #0f3d8a;
  border-left-color: #1a73e8;
}
.combo-item-lbl {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-item-hint {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.combo-item.active .combo-item-hint,
.combo-item:hover .combo-item-hint {
  color: #1d4ed8;
}

/* DẢI NÚT CHỌN KỲ LƯƠNG NHANH TRONG NHẬT KÝ ỨNG LƯƠNG EDITOR */
.adv-month-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
  font-size: 11.5px;
}
.adv-mk-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.adv-mk-btn:hover {
  background: #e2e8f0;
  border-color: #64748b;
}
.adv-mk-btn.active {
  background: #15803d;
  color: #ffffff;
  border-color: #14532d;
}

/* HỘP THOẠI MODAL TÙY CHỈNH (THAY THẾ ALERT / PROMPT / CONFIRM TRÌNH DUYỆT) */
.studio-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.studio-modal-box {
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  border: 1px solid #475569;
  border-top: 3px solid #174ea6;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
}
.studio-modal-hdr {
  padding: 11px 16px;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-size: 14px;
  color: #0f172a;
}
.studio-modal-body {
  padding: 16px;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.5;
}
.studio-modal-ftr {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* TOAST NOTIFICATION */
.toast-container {
  position: fixed;
  bottom: 14px;
  right: 14px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.toast-item {
  background: #1e293b;
  color: #ffffff;
  padding: 9px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid #0f172a;
}
.toast-item.ok { border-left: 4px solid #22c55e; }
.toast-item.warn { border-left: 4px solid #eab308; }
.toast-item.err { border-left: 4px solid #ef4444; }

.inv-print-frame {
  width: 100%;
  border-collapse: collapse;
}
.inv-print-spacer {
  display: none;
}

/* XUẤT PDF INVOICE SẮC NÉT — XÓA SẠCH DÒNG NGÀY GIỜ & ĐƯỜNG DẪN FILE:/// CỦA TRÌNH DUYỆT! */
@media print {
  @page {
    size: A4 portrait;
    margin: 0mm !important;
  }
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
  }
  .app-topbar,
  .month-bar,
  .invoice-controls,
  .no-print,
  .combo-popup,
  .status-popup,
  #studioModalRoot,
  .toast-container {
    display: none !important;
  }
  .workspace {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  .invoice-layout {
    display: block !important;
  }
  .invoice-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 13mm !important;
    max-width: 100% !important;
  }
  .inv-print-spacer {
    display: table-cell !important;
    height: 11mm !important;
    border: none !important;
    padding: 0 !important;
  }
  .inv-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .inv-table th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .inv-totals-box tr.grand-row td {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
