/* =========================================================
   TUDO INVOICE — giao diện theo mockup giaodien-v2.1 / v2.2
   Nạp sau style.css + huvi.css để ghi đè.
   ========================================================= */
:root {
  --t-navy: #0b2344;
  --t-blue: #1a73e8;
  --t-blue-d: #0d5fd8;
  --t-blue-soft: #e8f1fd;
  --t-ink: #13294b;
  --t-text: #1f3352;
  --t-muted: #5d7190;
  --t-line: #dde6f1;
  --t-line-soft: #edf2f8;
  --t-green: #13914d;
  --t-orange: #f08a00;
  --t-red: #e5484d;
  --t-bg: #eef3f9;
  --t-card-shadow: 0 6px 22px rgba(23, 63, 122, 0.07);
}
body {
  background: var(--t-bg);
  font-family: "Be Vietnam Pro", Inter, "Segoe UI", Arial, sans-serif;
  color: var(--t-text);
}
.ic { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }

/* ---------- TOPBAR ---------- */
.topbar {
  height: 64px;
  padding: 0 20px 0 18px;
  background: linear-gradient(90deg, #0a2142 0%, #0d2b55 45%, #11366c 100%);
  box-shadow: 0 3px 14px rgba(8, 28, 58, 0.3);
  border: 0;
  gap: 16px;
}
.topbar-left { gap: 26px; min-width: 0; }
.brand { gap: 11px; }
.brand .logo-img { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .25)); }
.brand-text strong { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.1; }
.brand-text small { font-size: 12.5px; color: #c3d3ea; margin-top: 2px; }

.module-switcher { background: none; padding: 0; gap: 10px; }
.module-tab {
  height: 42px;
  padding: 0 20px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e3ecf8;
  font-size: 14px;
  font-weight: 600;
  gap: 9px;
}
.module-tab:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.module-tab.active {
  background: linear-gradient(180deg, #2a83f5, #1868e0);
  border-color: #3b8ef7;
  color: #fff;
  box-shadow: 0 4px 14px rgba(26, 115, 232, 0.45);
}
.module-ic { width: 18px; height: 18px; }
.module-ic.bolt { color: #ffc21a; }
.module-tab.active .module-ic.bolt { color: #ffd34d; }
.module-badge {
  background: #16a34a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: none;
}

.topbar-right { gap: 12px; }
.top-account-picker {
  height: 42px;
  min-width: 225px;
  padding: 0 10px 0 14px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.top-account-picker select { font-size: 13px; font-weight: 600; flex: 1; height: 100%; padding: 0 4px; }
.account {
  height: 42px;
  margin: 0;
  padding: 0 12px 0 14px;
  border-radius: 9px;
  background: #fff;
  border: 1px solid #fff;
  color: #13294b;
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.account:hover { background: #f1f6fd; }
.account .ic-chev { width: 15px; height: 15px; color: #4d6283; margin-left: 2px; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: #a3b1c4; flex-shrink: 0; }
.conn-dot.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
.conn-dot.local { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18); }
.sync-btn {
  height: 42px;
  padding: 0 18px;
  border-radius: 9px;
  border: 0;
  background: linear-gradient(180deg, #ff9a1f, #f27c00);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(242, 124, 0, 0.38);
}
.sync-btn:hover { background: linear-gradient(180deg, #ffa53a, #e67400); }
.sync-btn .ic { width: 17px; height: 17px; stroke-width: 2.4; }
.topbar-icon-btn {
  position: relative;
  width: 40px; height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar-icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.topbar-icon-btn .ic { width: 23px; height: 23px; }
.bell-dot {
  position: absolute; top: 6px; right: 8px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #ff3b3b; border: 2px solid #11366c;
}
.topbar-avatar {
  width: 38px; height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: #fff;
  color: #0d2b55;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar-avatar:hover { background: #e9f1fc; }
.topbar-avatar .ic { width: 22px; height: 22px; fill: currentColor; stroke: none; }

/* ---------- WORKSPACE ---------- */
.workspace {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  padding: 16px 20px 28px 10px;
  min-height: auto;
}
main { width: auto; max-width: none; padding: 0; position: relative; }

/* ---------- SIDEBAR ---------- */
#left-sidebar {
  width: auto;
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--t-line);
  border-radius: 14px;
  box-shadow: var(--t-card-shadow);
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
}
.aside-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.3px;
  color: #22385a;
  margin: 2px 8px 12px;
}
.aside-title .ic { width: 18px; height: 18px; color: #3d5478; }
#filters .filter-group {
  margin: 0;
  padding: 10px 0 12px;
  border: 0;
  border-top: 1px solid var(--t-line-soft);
}
#filters .filter-group:first-child { border-top: 0; padding-top: 0; }
#filters .filter-group legend {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  float: left;
  margin: 0 0 4px;
  padding: 8px 10px;
  font-size: 14px; font-weight: 700;
  color: #1d4f91;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}
#filters .filter-group legend + * { clear: both; }
#filters .filter-group legend .ic { width: 19px; height: 19px; }
#filters .fg-workflow legend {
  text-transform: none;
  font-size: 15px; font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #2a83f5, #1868e0);
  border-radius: 9px;
  padding: 10px 14px;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
  margin-bottom: 8px;
}
#filters .filter-group label.fopt {
  clear: both;
  display: flex; align-items: center; gap: 14px;
  margin: 1px 0;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 15px; font-weight: 500;
  color: var(--t-text);
  cursor: pointer;
  transition: background .12s;
}
#filters .filter-group label.fopt::before { display: none; }
#filters .filter-group label.fopt:hover { background: #f2f7fe; }
#filters .fopt input[type=radio] { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.fopt-ic { display: inline-flex; color: #3e5273; }
.fopt-ic .ic { width: 20px; height: 20px; stroke-width: 1.8; }
#filters label.fopt:has(input:checked) { font-weight: 700; color: #0f2a4f; }
#filters label.fopt:has(input:checked) .fopt-ic { color: var(--t-blue); }
#filters label.fopt:not([class*="-all"]):has(input:checked) { background: #e6effc; }
#filters label.fopt-type-uncoded .fopt-ic { color: #f07c12; }
#filters label.fopt-type-uncoded:has(input:checked) .fopt-ic .ic { fill: #f39220; stroke: #fff; }
#filters label.fopt-type-uncoded:has(input:checked) .fopt-ic { color: #fff; }
#filters label.fopt:focus-within { outline: 2px solid #8dbcf7; outline-offset: 1px; }

.aside-note {
  position: relative;
  overflow: hidden;
  margin: 10px 2px 0;
  padding: 16px 14px 46px;
  border: 1px solid #d8e7fb;
  border-radius: 12px;
  background: linear-gradient(160deg, #f1f7ff 0%, #e2eefd 100%);
  color: #2e4566;
  font-size: 13px;
  line-height: 1.6;
  display: block;
}
.aside-note p { margin: 10px 0 0; position: relative; z-index: 1; }
.aside-note-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--t-blue); color: #fff !important; font-size: inherit !important;
  box-shadow: 0 3px 8px rgba(26, 115, 232, .35);
}
.aside-note-ic .ic { width: 18px; height: 18px; stroke-width: 2.6; }
.aside-note-wave { position: absolute; left: 0; right: 0; bottom: -6px; width: 100%; opacity: .75; pointer-events: none; }

/* ---------- PAGE HERO ---------- */
.page-hero {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  min-height: 82px;
  margin: 0 0 12px;
  padding: 6px 4px 0;
  background: none; border: 0; border-radius: 0; overflow: visible;
}
.page-hero-left { display: flex; align-items: center; gap: 14px; position: relative; z-index: 2; }
.page-hero-icon {
  width: 50px; height: 50px; border-radius: 11px;
  background: linear-gradient(160deg, #3d93ff, #1663de);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(22, 99, 222, 0.32);
}
.page-hero-icon .ic { width: 28px; height: 28px; stroke-width: 1.9; }
.page-hero-text h1 { margin: 0; font-size: 25px; font-weight: 800; color: var(--t-ink); letter-spacing: -0.4px; }
.page-hero-text p { margin: 4px 0 0; font-size: 15px; color: #2f4668; }
.page-hero-art {
  position: absolute; right: -20px; top: -16px;
  width: 560px; height: 140px;
  pointer-events: none; z-index: 1;
}
.hero-wave { position: absolute; right: 0; top: 0; width: 520px; height: 120px; object-fit: cover; object-position: left; opacity: .55; }
.hero-img { position: absolute; right: 70px; top: 4px; width: 210px; filter: drop-shadow(0 10px 18px rgba(20, 80, 170, .22)); }

/* ---------- FILTER CARD ---------- */
.huvi-filter-card {
  position: relative; z-index: 3;
  padding: 16px 20px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--t-line);
  border-radius: 14px;
  box-shadow: var(--t-card-shadow);
}
.huvi-filter-row {
  display: grid;
  grid-template-columns: auto minmax(150px, 0.9fr) minmax(150px, 0.9fr) minmax(150px, 0.9fr) minmax(220px, 2fr);
  gap: 16px;
  align-items: end;
}
.huvi-field { gap: 7px; }
.huvi-field label { font-size: 14px; font-weight: 600; color: var(--t-text); }
.huvi-field select, .huvi-field input {
  height: 38px; border-radius: 8px; border: 1px solid #cfdbe9;
  font-size: 14px; color: var(--t-text); padding: 0 12px; width: 100%;
}
.huvi-field select:focus, .huvi-field input:focus { border-color: #5a9cf5; box-shadow: 0 0 0 3px rgba(26,115,232,.12); outline: none; }
.input-ic { position: relative; display: flex; align-items: center; }
.input-ic > .ic { position: absolute; left: 12px; width: 17px; height: 17px; color: #5d7190; pointer-events: none; }
.input-ic > input, .input-ic > select { padding-left: 38px !important; }
.direction-segmented {
  height: 38px; padding: 0; gap: 6px;
  background: none; border: 0;
}
.direction-segmented button {
  height: 38px; padding: 0 16px; border-radius: 8px;
  background: #eef3f9; border: 1px solid #dbe5f1;
  color: #2b4062; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.direction-segmented button .ic { width: 17px; height: 17px; }
.direction-segmented button.active {
  background: linear-gradient(180deg, #2a83f5, #1868e0);
  border-color: #1868e0; color: #fff;
  box-shadow: 0 3px 10px rgba(26, 115, 232, 0.35);
}
.huvi-filter-btns { display: flex; gap: 10px; margin-top: 14px; height: auto; }
.btn-huvi-outline {
  height: 38px; padding: 0 16px; border-radius: 8px;
  border: 1px solid #d3deeb; background: #fff;
  color: var(--t-text); font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 1px 2px rgba(16, 42, 80, .04);
}
.btn-huvi-outline .ic { width: 17px; height: 17px; }
.btn-huvi-outline:hover { border-color: var(--t-blue); color: var(--t-blue); background: #f3f8ff; }
.btn-huvi-outline.active { border-color: var(--t-blue); color: var(--t-blue); background: #edf5ff; }
#advanced-filter-count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 10px; background: var(--t-blue); color: #fff; font-size: 11px; }
.btn-huvi-clear {
  height: 38px; padding: 0 16px; border-radius: 8px;
  border: 1px solid #f6b8b8; background: #fff2f2;
  color: var(--t-red); font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-huvi-clear .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.btn-huvi-clear:hover { background: #ffe4e4; }

.info-box {
  display: flex; align-items: center; gap: 14px;
  margin-top: 14px;
  padding: 12px 16px;
  border: 1px solid #cfe0f7;
  border-radius: 10px;
  background: #eef5ff;
}
.info-box-ic {
  flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--t-blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.info-box-ic .ic { width: 18px; height: 18px; stroke-width: 2.6; }
.info-box-body { min-width: 0; flex: 1; font-size: 13.5px; line-height: 1.6; color: #2c4566; }
.info-box-body p { margin: 0 0 2px; }
.info-box .sync-status {
  margin: 0; padding: 0; border: 0; background: none;
  color: #2c4566; font-size: 13.5px; line-height: 1.6;
}
.info-box .sync-status strong { color: #12305a; }
.info-box .sync-status button { height: 30px; padding: 0 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--t-blue); color: var(--t-blue); background: #fff; }

.huvi-action-bar { margin-top: 16px; padding-top: 0; border-top: 0; gap: 12px; }
.huvi-action-left { gap: 14px; }
.dropdown-toggle {
  height: 42px; padding: 0 16px 0 18px; border-radius: 8px;
  font-size: 15px; font-weight: 600; gap: 10px;
}
.dropdown-toggle .ic { width: 19px; height: 19px; }
.dropdown-toggle .caret { display: inline-flex; margin-left: 10px; }
.dropdown-toggle .caret .ic { width: 16px; height: 16px; stroke-width: 2.4; }
.btn-huvi-blue {
  background: linear-gradient(180deg, #2a83f5, #1466dc);
  border: 1px solid #1466dc; color: #fff;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}
.btn-huvi-blue:hover { background: linear-gradient(180deg, #1f7af0, #0f5bcc); }
.btn-huvi-green {
  background: linear-gradient(180deg, #1fa35b, #0d8344);
  border: 1px solid #0d8344; color: #fff;
  box-shadow: 0 4px 12px rgba(19, 145, 77, 0.3);
}
.btn-huvi-green:hover { background: linear-gradient(180deg, #179650, #0a7239); }
.btn-huvi-green .ic:first-child { color: #ffd84d; }
.btn-huvi-secondary { background: #fff; border: 1px solid #d3deeb; color: var(--t-text); box-shadow: 0 1px 2px rgba(16,42,80,.04); }
.btn-huvi-secondary:hover { border-color: var(--t-blue); color: var(--t-blue); background: #f3f8ff; }
.dropdown-menu { border-radius: 12px; border-color: var(--t-line); box-shadow: 0 16px 36px rgba(15, 40, 80, 0.18); }
.dropdown-menu button strong { font-size: 13.5px; }
.dropdown-menu button span { font-size: 12px; }

/* ---------- KPI BAR ---------- */
.huvi-kpi-bar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 10px 12px;
  padding: 9px 12px;
  margin-bottom: 14px;
  background: #fff;
  border: 1px solid var(--t-line);
  border-radius: 12px;
  box-shadow: var(--t-card-shadow);
  justify-content: flex-start;
}
.kpi-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: 9px;
  background: #fff; border: 1px solid #e1e9f3;
  font-size: 14px; color: var(--t-text);
}
.kpi-pill .ic { width: 19px; height: 19px; }
.kpi-pill strong { font-size: 15px; font-weight: 800; color: var(--t-ink); }
.kpi-pill.total-pill { background: var(--t-blue-soft); border-color: #cfe0fa; color: #1559c4; font-size: 16px; font-weight: 700; }
.kpi-pill.total-pill strong { color: #1559c4; font-size: 17px; }
.kp-coded .ic { color: #2a3f60; }
.kp-uncoded .ic { color: var(--t-red); }
.kp-pos .ic { color: #2a3f60; }
.kpi-pill.pdf-ready-pill { background: #e7f7ec; border-color: #bfe9cc; color: #13803f; font-weight: 600; }
.kpi-pill.pdf-ready-pill strong { color: #13803f; }
.kpi-pill.pdf-ready-pill .ic { color: #19a04f; }
.kpi-money-item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; color: var(--t-text);
  padding: 0 6px;
}
.km-sub { margin-left: auto; }
.kpi-money-item .ic { width: 19px; height: 19px; color: var(--t-blue); }
.kpi-money-item strong { font-size: 16px; font-weight: 800; color: var(--t-ink); font-variant-numeric: tabular-nums; }
.kpi-money-item.grand .ic { color: #f5a10f; }
.kpi-money-item.grand strong { color: var(--t-orange); font-size: 17px; }

/* ---------- TABLE CARD ---------- */
.content-card {
  border: 1px solid var(--t-line);
  border-radius: 14px;
  box-shadow: var(--t-card-shadow);
  overflow: visible;
}
.content-card .table-wrap { border-radius: 14px 14px 0 0; }
.huvi-table { min-width: 1120px; font-size: 13.5px; }
.huvi-table th, .huvi-table td { padding: 10px 9px; border-bottom: 1px solid var(--t-line-soft); font-size: 13.5px; }
.huvi-table thead tr:first-child th {
  background: #fff; color: var(--t-text);
  font-size: 14px; font-weight: 700;
  padding: 14px 9px 12px;
  border-bottom: 0;
}
.huvi-table thead tr:first-child th:first-child { border-top-left-radius: 14px; }
.huvi-table thead tr:first-child th:last-child { border-top-right-radius: 14px; }
.huvi-table thead tr.inline-filter-row th { background: #fff; padding: 2px 6px 12px; border-bottom: 1px solid var(--t-line); }
.inline-filter-row input, .inline-filter-row select {
  height: 34px; border-radius: 7px; border: 1px solid #d3deeb;
  font-size: 13px; padding: 0 10px; color: var(--t-text);
}
.huvi-table th button#sort-date { font-size: 14px; font-weight: 700; color: var(--t-text); }
.huvi-table tbody tr:hover { background: #f7faff; }
.huvi-table input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--t-blue); }

.col-check { width: 36px; }
.col-stt { width: 32px; font-weight: 500; color: #3a4f70; }
.col-symbol { width: 96px; }
.col-number { width: 122px; }
.col-date { width: 104px; }
.col-seller { min-width: 230px; }
.col-status { width: 118px; }
.col-money { width: 98px; }
.col-tax { width: 92px; }
.col-total { width: 106px; }
.col-note { width: 140px; }
.col-action { width: 46px; }
td.col-seller { white-space: normal; }

.symbol-code { font-family: inherit; font-size: 14px; font-weight: 700; color: #1667dc; }
.number-code { font-family: inherit; font-size: 14.5px; font-weight: 700; color: #16243b; }
.col-date strong { font-size: 14px; font-weight: 500; color: #16243b; }
.sign-date { font-size: 11.5px; color: #7487a3; }
.seller-name { font-size: 14px; font-weight: 600; color: #16243b; line-height: 1.35; }
.seller-mst { font-family: inherit; font-size: 12.5px; color: #4d6283; }
.cell-inline { gap: 10px; }

.huvi-badge {
  padding: 1px 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; line-height: 1.5;
}
.huvi-badge-pdf { background: #e2f6e7; color: #18843f; border-color: #c6ecd2; }
.huvi-badge-pdf:hover { background: #d0f0da; }
.huvi-badge-rendered { background: #e6f1fe; color: #1767d6; border-color: #c9defb; }
.huvi-badge-rendered:hover { background: #d6e7fd; }
.huvi-badge-lookup { background: #fff; color: #4d6283; border-color: #cfd9e6; }
.huvi-badge-lookup:hover { background: #f1f5fa; }
.huvi-btn-view {
  padding: 3px 11px; border-radius: 6px;
  background: #e6effd; color: #1667dc; border: 0;
  font-size: 13px; font-weight: 700;
}
.huvi-btn-view:hover { background: #d5e5fc; }
.huvi-btn-xml {
  padding: 0 7px; border-radius: 5px;
  background: #eef2f7; color: #3a4f70; border: 1px solid #d8e0eb;
  font-size: 10.5px; font-weight: 700;
}
.status-pill { padding: 2px 10px; font-size: 12px; background: #e2f6e7; color: #18843f; }
.status-pill.status-2, .status-pill.status-3 { background: #fff3dc; color: #a46405; }
.status-pill.status-4, .status-pill.status-5, .status-pill.status-6 { background: #fde8e8; color: #c0353a; }
.sub-type { font-size: 12px; color: #6b7f9c; }
.col-money, .col-tax { color: #16243b; }
td.col-total strong { font-size: 14.5px; font-weight: 800; color: #10335f; }
.note-input { height: 32px; border-radius: 7px; border-color: #d3deeb; font-size: 12.5px; }
.btn-row-dots {
  width: 34px; height: 30px; border: 0; background: transparent;
  color: #2b4062; border-radius: 7px;
}
.btn-row-dots .ic { width: 22px; height: 22px; }
.btn-row-dots:hover { background: #eef3fa; }
.row-action-menu { border-radius: 10px; border-color: var(--t-line); }

/* ---------- PAGINATION ---------- */
.pagination {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 14px 20px 16px;
  font-size: 14px; color: var(--t-text);
  border-top: 0;
}
.pagination-info { display: flex; align-items: center; gap: 10px; }
.pagination-info label { margin: 0; font-size: 14px; color: var(--t-text); }
.pagination-info select { width: 72px; height: 38px; border-radius: 8px; border: 1px solid #d3deeb; padding: 0 10px; font-size: 14px; font-weight: 600; }
.pg-sep { width: 1px; height: 18px; background: #cdd8e6; margin: 0 6px; }
#row-count strong { font-weight: 700; }
.pagination .pagination-controls { display: flex; align-items: center; gap: 10px; }
.page-numbers { display: inline-flex; gap: 8px; background: none; padding: 0; }
.pagination .pagination-controls button {
  min-width: 40px; height: 36px; padding: 0 10px;
  border-radius: 8px; border: 1px solid #d3deeb; background: #fff;
  color: #2b4062; font-size: 16px; font-weight: 600;
}
.pagination .pagination-controls button:hover:not(:disabled) { border-color: var(--t-blue); color: var(--t-blue); }
.pagination .pagination-controls button.current {
  background: linear-gradient(180deg, #2a83f5, #1466dc); border-color: #1466dc; color: #fff;
  box-shadow: 0 3px 9px rgba(26, 115, 232, .35);
}
.pagination .pagination-controls button:disabled { opacity: .45; }
.page-nav { font-size: 18px !important; line-height: 1; }

.selection { border-radius: 10px; margin-bottom: 12px; padding: 10px 16px; background: #e8f1fd; border: 1px solid #cfe0fa; font-size: 13.5px; }
.selection button { border-radius: 7px; height: 32px; padding: 0 12px; font-size: 13px; }
.history { margin: 16px 4px 0; }

/* =========================================================
   PHÂN HỆ HẠCH TOÁN (v2.2)
   ========================================================= */
.accounting-workspace { max-width: none; margin: 0; padding: 0 20px 36px; position: relative; }
.acc-hero {
  position: relative;
  display: flex; align-items: center;
  min-height: 178px;
  padding: 26px 20px 18px;
  margin: 0 -20px 4px;
  background: linear-gradient(180deg, #e9f2fd 0%, #f2f7fd 70%, rgba(238,243,249,0) 100%);
  overflow: hidden;
}
.acc-hero-wave { position: absolute; right: -40px; top: -30px; width: 900px; opacity: .45; pointer-events: none; }
.acc-hero-main { display: flex; align-items: flex-start; gap: 18px; position: relative; z-index: 2; max-width: 780px; }
.acc-hero-icon {
  margin-top: 26px;
  flex-shrink: 0;
  width: 58px; height: 58px; border-radius: 13px;
  background: linear-gradient(160deg, #3d93ff, #1663de);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 18px rgba(22, 99, 222, 0.35);
}
.acc-hero-icon .ic { width: 32px; height: 32px; color: #fff; }
.acc-eyebrow { font-size: 15px; font-weight: 800; color: #1565d8; letter-spacing: 0.2px; }
.acc-title-block h1 { margin: 6px 0 8px; font-size: 29px; font-weight: 800; color: var(--t-ink); letter-spacing: -0.5px; }
.acc-title-block p { margin: 0; font-size: 15px; line-height: 1.55; color: #2d4565; max-width: 700px; }
.acc-hero-art {
  position: absolute; z-index: 1;
  right: 660px; top: 6px;
  width: 330px; filter: drop-shadow(0 12px 20px rgba(20, 80, 170, .2));
  pointer-events: none;
}
.acc-header-actions {
  position: absolute; z-index: 3; right: 20px; top: 92px;
  display: flex; gap: 12px;
}
.acc-header-actions .btn-huvi-outline, .acc-header-actions .btn-huvi-green { height: 44px; font-size: 13.5px; padding: 0 16px; border-radius: 9px; }
.acc-header-actions .btn-huvi-green .ic:first-child { color: #fff; }

.acc-config-card {
  background: #fff; border: 1px solid var(--t-line); border-radius: 14px;
  box-shadow: var(--t-card-shadow);
  padding: 14px 18px 16px;
  margin-bottom: 14px;
}
.acc-config-bar { display: grid; grid-template-columns: minmax(240px, 330px) minmax(280px, 410px) 1fr; align-items: end; gap: 18px; padding: 0; }
.acc-config-bar select { height: 46px !important; font-size: 14.5px !important; font-weight: 500; }
.misa-logo {
  position: absolute; left: 12px;
  width: 22px; height: 22px; border-radius: 50%;
  background: conic-gradient(#e53935 0 25%, #1e88e5 0 50%, #43a047 0 75%, #fb8c00 0);
  color: #fff; font-size: 11px; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.misa-ic select { padding-left: 44px !important; }
.acc-kpi-summary { margin-left: 0; gap: 12px; justify-content: flex-end; flex-wrap: wrap; }
.acc-kpi-summary .ak {
  display: inline-flex; align-items: center; gap: 9px;
  height: 48px; padding: 0 16px;
  background: #fff; border: 1px solid #dfe7f2; border-radius: 11px;
  box-shadow: 0 2px 6px rgba(16, 42, 80, .05);
  font-size: 14.5px; color: var(--t-text);
}
.acc-kpi-summary .ak .ic { width: 21px; height: 21px; }
.acc-kpi-summary b { color: var(--t-blue); font-weight: 800; }
.ak-inv .ic { color: #1a73e8; }
.ak-ven .ic { color: #2f6fd6; }
.ak-goods .ic { color: #f0a020; }
.ak-svc .ic { color: #9b5de5; }
.ak-items .ic { color: #8e5bea; }

.acc-steps-nav {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px; border: 0; margin-bottom: 16px; overflow: visible;
}
.acc-step-btn {
  height: 56px; padding: 0 16px;
  background: #fff; border: 1px solid #e1e9f3; border-radius: 12px;
  box-shadow: 0 3px 10px rgba(23, 63, 122, .06);
  font-size: 14.5px; font-weight: 500; color: var(--t-text);
  justify-content: flex-start; gap: 10px;
  white-space: normal; line-height: 1.25; text-align: left;
  position: relative;
}
.acc-step-btn:hover { background: #f6f9ff; color: var(--t-blue); }
.acc-step-btn.active {
  background: #fff; color: #1565d8; font-weight: 700;
  border-color: #cfe0fa;
  box-shadow: inset 0 -3px 0 var(--t-blue), 0 4px 14px rgba(26, 115, 232, .12);
}
.step-num { width: 30px; height: 30px; font-size: 14px; background: #e6edf7; color: #2b4062; flex-shrink: 0; }
.acc-step-btn.active .step-num { background: linear-gradient(160deg, #2a83f5, #1466dc); color: #fff; }
.acc-step-btn small { flex-shrink: 0; margin-left: 4px; background: #eef2f7; color: #3a4f70; font-size: 12px; padding: 2px 9px; font-weight: 600; }
.step-chev { margin-left: auto; display: inline-flex; color: #1565d8; }
.step-chev .ic { width: 18px; height: 18px; stroke-width: 2.4; }

.acc-tab-panel { border: 1px solid var(--t-line); border-radius: 14px; box-shadow: var(--t-card-shadow); padding: 18px; }
#acc-panel-finish { background: none; border: 0; box-shadow: none; padding: 0; }
.acc-panel-toolbar { border-bottom-color: var(--t-line-soft); }
.acc-pill { height: 34px; padding: 0 14px; font-size: 13px; }
.acc-pill.active { background: linear-gradient(180deg, #2a83f5, #1466dc); border-color: #1466dc; }
.acc-inv-card { border-color: var(--t-line); border-radius: 12px; }
.acc-inv-card-head { background: #f7faff; }

.acc-finish-banner {
  position: relative;
  display: flex; align-items: center; gap: 22px;
  min-height: 104px;
  padding: 18px 210px 18px 30px;
  margin-bottom: 18px;
  border: 1px solid #cdeedd;
  border-radius: 16px;
  background: linear-gradient(100deg, #ecf9f2 0%, #f5fbfa 55%, #eef6ff 100%);
  box-shadow: var(--t-card-shadow);
  overflow: hidden;
}
.finish-check {
  flex-shrink: 0;
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(160deg, #2ccf74, #12a14f); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 14px rgba(18, 161, 79, .35);
}
.finish-check .ic { width: 30px; height: 30px; stroke-width: 2.6; }
.finish-check .ic circle { display: none; }
.acc-finish-banner h2 { margin: 0 0 6px; font-size: 23px; font-weight: 800; color: #0c5a32; letter-spacing: -0.3px; }
.acc-finish-banner p { margin: 0; font-size: 14px; color: #2d4565; line-height: 1.55; }
.finish-art { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); width: 160px; filter: drop-shadow(0 8px 14px rgba(20, 80, 170, .2)); }

.acc-export-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.acc-export-card {
  position: relative; overflow: hidden;
  min-height: 300px;
  display: flex; gap: 14px; align-items: flex-start;
  padding: 24px 20px 22px;
  background: linear-gradient(170deg, #ffffff 0%, #fbfdff 100%);
  border: 1px solid #dfe8f3; border-radius: 16px;
  box-shadow: 0 6px 18px rgba(23, 63, 122, .07);
}
.acc-card-icon {
  width: 58px; height: 58px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.acc-card-icon img { width: 44px; height: 44px; object-fit: contain; }
.ci-purple { background: #efeafe; }
.ci-amber { background: #fff2dc; }
.ci-pink { background: #fde9ee; }
.ci-blue { background: #e7f0fe; }
.acc-card-body { position: relative; z-index: 2; gap: 8px; min-width: 0; }
.acc-step-tag { font-size: 12.5px; font-weight: 800; color: #1565d8; letter-spacing: 0.1px; }
.acc-card-body h3 { margin: 0; font-size: 19px; font-weight: 800; color: var(--t-ink); letter-spacing: -0.3px; }
.acc-card-body p { font-size: 14px; line-height: 1.55; color: #33496a; margin: 0 0 4px; }
.acc-card-buttons { flex-direction: column; align-items: flex-start; gap: 14px; margin-top: 10px; }
.acc-card-buttons button { height: 46px; padding: 0 18px; border-radius: 9px; font-size: 14.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 10px; }
.acc-card-buttons .btn-huvi-outline { background: #f5f8fc; height: 42px; }
.acc-card-buttons .btn-huvi-green .ic { color: #fff; }
.card-deco { position: absolute; right: 12px; bottom: 12px; width: 110px; z-index: 1; pointer-events: none; filter: drop-shadow(0 8px 12px rgba(20, 60, 120, .18)); }
.card-deco-wave { left: 0; right: 0; bottom: -10px; width: 100%; opacity: .6; filter: none; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1500px) {
  .top-account-picker { min-width: 190px; }
  .module-tab { padding: 0 14px; font-size: 13.5px; }
  .acc-step-btn { font-size: 13px; padding: 0 12px; gap: 8px; }
}
@media (max-width: 1600px) {
  .acc-hero-art { display: none; }
  .acc-config-bar { grid-template-columns: 1fr 1fr; }
  .acc-kpi-summary { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 1350px) {
  .brand-text small { display: none; }
  .huvi-filter-row { grid-template-columns: auto 1fr 1fr 1fr; }
  .huvi-search-quick { grid-column: 1 / -1; }
  .page-hero-art { width: 420px; }
  .hero-wave { width: 400px; }
  .acc-hero { flex-wrap: wrap; }
  .acc-hero-art { display: none; }
  .acc-header-actions { position: static; margin: 14px 0 0 76px; }
  .acc-export-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acc-steps-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .acc-kpi-summary { margin-left: 0; }
}
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; padding: 12px; }
  #left-sidebar { display: none; }
  .module-switcher { display: none; }
  .page-hero-art { display: none; }
  .km-sub { margin-left: 0; }
}
@media (max-width: 750px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .topbar-right { flex-wrap: wrap; }
  .top-account-picker { min-width: 0; }
  .huvi-filter-row { grid-template-columns: 1fr 1fr; }
  .huvi-filter-row > .huvi-field:first-child { grid-column: 1 / -1; }
  .page-hero-text h1 { font-size: 20px; }
  .acc-export-grid, .acc-steps-nav { grid-template-columns: 1fr; }
  .acc-finish-banner { padding-right: 20px; }
  .finish-art { display: none; }
  .acc-header-actions { margin-left: 0; flex-wrap: wrap; }
  .acc-config-bar { grid-template-columns: 1fr; }
}

/* =========================================================
   TÀI KHOẢN MST · MENU NGƯỜI DÙNG · TIẾN ĐỘ ĐỒNG BỘ · TOAST
   ========================================================= */
.add-account-btn {
  height: 42px; padding: 0 16px; border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .1); color: #fff;
  font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 7px;
}
.add-account-btn:hover { background: rgba(255, 255, 255, .2); }
.add-account-btn .ic { width: 17px; height: 17px; stroke-width: 2.6; }

.user-menu { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 8px 0 4px; max-width: 260px;
  border: 0; border-radius: 12px; background: transparent; color: #fff; text-align: left;
}
.user-chip:hover, .user-menu.open .user-chip { background: rgba(255, 255, 255, .1); }
.user-chip .topbar-avatar { flex-shrink: 0; }
.user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.user-text strong { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-text small { font-size: 11.5px; color: #b9cbe6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chev { width: 16px; height: 16px; color: #c7d6ec; transition: transform .15s; }
.user-menu.open .user-chev { transform: rotate(180deg); }
.user-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 400;
  min-width: 270px; padding: 8px;
  background: #fff; border: 1px solid var(--t-line); border-radius: 14px;
  box-shadow: 0 18px 40px rgba(12, 35, 70, .22);
}
.user-menu.open .user-dropdown { display: flex; flex-direction: column; gap: 2px; }
.user-dropdown button {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 14px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--t-text); font-size: 14px; font-weight: 500; text-align: left;
}
.user-dropdown button .ic { width: 18px; height: 18px; color: #4d6283; }
.user-dropdown button:hover:not(:disabled), .user-dropdown button:focus-visible { background: #f0f6ff; border-color: #cfe0fa; color: #1559c4; }
.user-dropdown button:hover:not(:disabled) .ic { color: #1559c4; }
.user-dropdown button.danger, .user-dropdown button.danger .ic { color: #e5484d; }
.user-dropdown button.danger:hover:not(:disabled) { background: #fff1f1; border-color: #fbd0d0; color: #d23c41; }
.user-dropdown button:disabled { opacity: .45; }
.user-dropdown hr { border: 0; border-top: 1px solid var(--t-line-soft); margin: 4px 6px; }

/* Hộp thoại thêm tài khoản (giống Huvisoft) */
.tct-account-dialog { width: min(600px, calc(100vw - 30px)); padding: 26px 28px 22px; border-radius: 18px; }
.tct-account-dialog h2 { font-size: 20px; font-weight: 700; color: #16243b; margin: 0; }
.tct-account-intro { margin: 18px 0 20px !important; font-size: 15px !important; color: #2b3b52 !important; line-height: 1.6 !important; }
.tct-account-intro a { color: #13914d; font-weight: 700; text-decoration: none; }
.tct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; align-items: end; }
.tct-field { margin: 0 !important; font-size: 14px; color: #3a4b62; }
.tct-field b { color: #e5484d; font-weight: 600; }
.tct-field input { margin-top: 8px; height: 46px; border-radius: 10px; border: 1px solid #d6dde8; background: #f4f6fa; font-size: 14.5px; padding: 0 14px; }
.tct-field input:focus { background: #fff; border-color: #5a9cf5; box-shadow: 0 0 0 3px rgba(26, 115, 232, .12); outline: none; }
.tct-field input[readonly] { color: #8291a6; }
.tct-captcha { display: flex; align-items: center; gap: 10px; height: 46px; }
.tct-captcha-img { flex: 1; height: 46px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: #fff; overflow: hidden; color: #8291a6; font-size: 12.5px; }
.tct-captcha-img img { height: 46px; width: auto; max-width: 100%; }
.tct-reload { width: 42px; height: 42px; padding: 0; border-radius: 10px; border: 0; background: #dbe9fd; color: #1667dc; display: inline-flex; align-items: center; justify-content: center; }
.tct-reload:hover { background: #c9ddfc; }
.tct-reload .ic { width: 20px; height: 20px; stroke-width: 2.4; }
.tct-pass { position: relative; display: block; }
.tct-pass input { padding-right: 46px; }
.tct-pass button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin-top: 4px; width: 36px; height: 34px; padding: 0; border: 0; background: transparent; color: #8291a6; display: inline-flex; align-items: center; justify-content: center; }
.tct-pass button:hover { background: transparent; color: #3a4b62; }
.tct-pass button .ic { width: 20px; height: 20px; }
.tct-note { margin: 12px 0 0 !important; font-size: 13px !important; color: #3a4b62 !important; }
.tct-note span { color: #8291a6; }
.tct-note.gem { color: #1559c4 !important; }
.tct-full { display: block; margin-top: 16px !important; }
.tct-remember { display: flex !important; align-items: center; gap: 8px; margin-top: 14px !important; font-size: 13px !important; color: #4d6283 !important; }
.tct-remember input { margin: 0; }
.tct-account-dialog .modal-actions { margin-top: 22px; gap: 14px; }
.link-danger { border: 0 !important; background: none !important; color: #e5484d !important; font-weight: 600; font-size: 15px; }
#ta-submit { min-width: 92px; height: 46px; border-radius: 11px; font-size: 15px; background: #1a73e8; border-color: #1a73e8; }

/* Danh sách tài khoản */
.accounts-dialog h2 small { font-size: 13px; color: #6b7f9c; font-weight: 500; }
.accounts-list { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; max-height: 60vh; overflow: auto; }
.acc-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--t-line); border-radius: 12px; background: #fff; }
.acc-row.active { border-color: #9cc2f7; background: #f2f7ff; }
.acc-avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #3d93ff, #1663de); color: #fff; font-weight: 800; font-size: 17px; }
.acc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.acc-info strong { font-size: 15px; color: #16243b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-info small { font-size: 12.5px; color: #6b7f9c; }
.acc-state { font-size: 12.5px; font-weight: 700; color: #13914d; padding: 0 6px; white-space: nowrap; }
.acc-row .btn-huvi-outline, .acc-row .btn-huvi-clear { height: 34px; padding: 0 12px; font-size: 13px; }

/* Bảng tiến độ đồng bộ */
.sync-progress {
  position: fixed; right: 24px; bottom: 24px; z-index: 500;
  width: 330px; padding: 18px 20px 16px;
  background: #fff; border: 1px solid var(--t-line); border-radius: 12px;
  box-shadow: 0 14px 38px rgba(12, 35, 70, .2);
  font-size: 13px; color: #3a4b62;
}
.sync-progress[hidden] { display: none !important; }
.sp-close { position: absolute; top: 8px; right: 10px; width: 26px; height: 26px; padding: 0; border: 0; background: none; color: #9aa7b8; font-size: 20px; line-height: 1; }
.sp-close:hover { color: #3a4b62; background: none; }
.sp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding-right: 18px; }
.sp-head strong { font-size: 15px; font-weight: 600; color: #16243b; }
.sp-ic { display: inline-flex; color: #5b5bd6; }
.sp-ic .ic { width: 19px; height: 19px; stroke-width: 2.4; }
.sync-progress.running .sp-ic .ic { animation: sp-spin 1.1s linear infinite; }
.sync-progress.completed .sp-ic { color: #13914d; }
.sync-progress.failed .sp-ic, .sync-progress.interrupted .sp-ic { color: #e5484d; }
.sync-progress.partial .sp-ic { color: #f08a00; }
@keyframes sp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sync-progress.running .sp-ic .ic { animation: none; } }
.sp-range { color: #4d5b6e; margin-bottom: 6px; }
.sp-months { color: #5b5bd6; font-weight: 600; margin-bottom: 6px; }
.sp-step { font-size: 12.5px; color: #3a4b62; margin-bottom: 8px; line-height: 1.45; }
.sp-bar { height: 4px; border-radius: 4px; background: #e8ecf3; overflow: hidden; margin-bottom: 10px; }
.sp-bar span { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #6366f1, #5b5bd6); transition: width .5s ease; }
.sync-progress.completed .sp-bar span { background: #19a04f; }
.sp-count { font-size: 12px; color: #6b7a8d; margin-bottom: 10px; }
.sp-owner { padding-top: 10px; border-top: 1px solid var(--t-line-soft); color: #4d5b6e; }

/* Toast có thanh thời gian */
#toast {
  position: fixed; left: 24px; right: auto; bottom: 24px; top: auto; transform: none; z-index: 600;
  display: flex; align-items: center; gap: 12px;
  min-width: 300px; max-width: min(520px, calc(100vw - 48px));
  padding: 16px 44px 18px 18px;
  background: #fff; color: #4d5b6e; border: 1px solid var(--t-line); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(12, 35, 70, .18);
  font-size: 15px; line-height: 1.45; overflow: hidden;
}
#toast[hidden] { display: none !important; }
.toast-ic { display: inline-flex; flex-shrink: 0; }
.toast-ic .ic { width: 24px; height: 24px; }
.toast-success .toast-ic .ic { fill: #19a04f; stroke: #fff; stroke-width: 2.6; }
.toast-error .toast-ic .ic { fill: #e5484d; stroke: #fff; stroke-width: 2.6; }
.toast-info .toast-ic .ic { fill: #1a73e8; stroke: #fff; stroke-width: 2.6; }
.toast-msg { flex: 1; }
.toast-close { position: absolute; top: 6px; right: 8px; width: 26px; height: 26px; padding: 0; border: 0; background: none; color: #9aa7b8; font-size: 18px; line-height: 1; }
.toast-close:hover { color: #3a4b62; background: none; }
.toast-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; transform-origin: left; background: #19a04f; }
.toast-error .toast-bar { background: #e5484d; }
.toast-info .toast-bar { background: #1a73e8; }

@media (max-width: 1500px) {
  .user-text { display: none; }
  .add-account-btn { padding: 0 12px; }
}
@media (max-width: 750px) {
  .tct-grid { grid-template-columns: 1fr; }
  .sync-progress { left: 12px; right: 12px; width: auto; bottom: 12px; }
  #toast { left: 12px; bottom: 12px; }
}

/* =========================================================
   KỲ HÓA ĐƠN — bộ chọn nhanh · nút Đồng bộ trong khung lọc
   ========================================================= */
.huvi-filter-row { grid-template-columns: auto minmax(200px, 1.2fr) minmax(160px, 1fr) minmax(160px, 1fr) auto; }
.sync-field .sync-btn { height: 38px; padding: 0 22px; border-radius: 8px; white-space: nowrap; }
.sync-field .sync-btn:disabled { opacity: .6; cursor: progress; }

.period-picker { position: relative; }
.period-toggle {
  width: 100%; height: 38px; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid #cfdbe9; border-radius: 8px; background: #fff;
  color: var(--t-text); font-size: 14px; font-weight: 500; text-align: left;
}
.period-toggle:hover { border-color: #9fbfe9; background: #fff; }
.period-picker.open .period-toggle { border-color: #5a9cf5; box-shadow: 0 0 0 3px rgba(26, 115, 232, .12); }
#period-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-chev { width: 16px; height: 16px; color: #5d7190; transition: transform .15s; }
.period-picker.open .pp-chev { transform: rotate(180deg); }
.period-panel {
  display: none; position: absolute; left: 0; top: calc(100% + 6px); z-index: 450;
  width: 680px; max-width: calc(100vw - 40px);
  padding: 14px 10px 10px;
  background: #fff; border: 1px solid #e3e8ef; border-radius: 12px;
  box-shadow: 0 16px 40px rgba(12, 35, 70, .2);
}
.period-picker.open .period-panel { display: block; }
.pp-head { display: flex; align-items: center; gap: 10px; padding: 0 8px 14px; flex-wrap: nowrap; white-space: nowrap; }
.pp-range { flex: 0 1 auto; min-width: 0; }
.pp-range input { min-width: 0; }
.pp-row button { white-space: nowrap; }
.pp-head-label { font-size: 14px; color: #1f2a37; }
.pp-range {
  display: flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 10px;
  border: 2px solid #1f2a37; border-radius: 10px;
}
.pp-range input { width: 122px; height: 34px; border: 0; padding: 0 2px; font-size: 14px; background: transparent; }
.pp-range input:focus { outline: none; box-shadow: none; }
.pp-range span { color: #8a94a3; }
.pp-apply { height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: #e2e5ea; color: #1f2a37; font-size: 13px; font-weight: 600; }
.pp-apply:hover { background: #d3d8df; }
.pp-all { height: 34px; padding: 0 12px; border: 1px solid #d6dde8; border-radius: 8px; background: #fff; color: #1559c4; font-size: 13px; font-weight: 600; margin-left: auto; }
.pp-all:hover, .pp-all.active { background: #eaf2ff; border-color: #9cc2f7; }
.pp-grid { display: flex; flex-direction: column; }
.pp-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 2px 0; }
.pp-row:nth-child(odd) { background: #f3f4f6; }
.pp-row button {
  height: 36px; border: 0; border-radius: 8px; background: transparent;
  color: #1f2a37; font-size: 14px; font-weight: 400;
}
.pp-row button:hover { background: #e5e7eb; }
.pp-row button.active { background: #dfe2e7; font-weight: 600; }

@media (max-width: 1350px) {
  .huvi-filter-row { grid-template-columns: auto minmax(180px, 1fr) minmax(150px, 1fr) minmax(150px, 1fr) auto; }
}
@media (max-width: 1100px) {
  .huvi-filter-row { grid-template-columns: 1fr 1fr; }
  .period-panel { width: min(610px, calc(100vw - 40px)); }
  .pp-row { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================
   HÀNG LỌC 1 DÒNG · BÁNH RĂNG THIẾT LẬP · CỘT · TÊN FILE · LỊCH VN
   ========================================================= */
.huvi-filter-row {
  grid-template-columns: auto minmax(190px, 1.4fr) minmax(150px, 1fr) minmax(150px, 1fr) auto auto;
  gap: 14px;
}
.huvi-filter-row .huvi-filter-btns { display: flex; flex-direction: column; gap: 7px; margin: 0; height: auto; }
.filter-btn-group { display: flex; gap: 8px; }
.filter-btn-group > button { padding: 0 12px; }
@media (max-width: 1500px) {
  .huvi-filter-row { grid-template-columns: auto minmax(170px, 1.3fr) minmax(130px, 1fr) minmax(130px, 1fr) auto; }
  .huvi-filter-row .huvi-filter-btns { grid-column: 1 / -1; }
  .huvi-filter-row .huvi-filter-btns > label { display: none; }
}
@media (max-width: 1100px) {
  .huvi-filter-row { grid-template-columns: 1fr 1fr; }
}

.btn-gear { width: 42px; padding: 0 !important; justify-content: center; }
.btn-gear .ic { width: 20px; height: 20px; }
.view-settings-menu { min-width: 330px; padding: 8px; }
.vs-title { padding: 6px 12px 8px; font-size: 12px; font-weight: 700; letter-spacing: .5px; color: #6b7a8d; }
.dropdown-menu .vs-item { flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
.dropdown-menu .vs-item:hover { background: #eef2f7; }
.vs-ic { display: inline-flex; color: #1a73e8; }
.vs-ic .ic { width: 22px; height: 22px; }
.vs-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dropdown-menu .vs-text strong { font-size: 15px; font-weight: 500; color: #16243b; }
.dropdown-menu .vs-text span { font-size: 12.5px; color: #6b7a8d; }
.vs-chev { width: 16px; height: 16px; color: #9aa7b8; }

/* Tùy chỉnh tên file */
#filename-dialog label { margin-top: 16px; font-size: 13px; font-weight: 600; color: #2b3b52; }
#filename-dialog input { margin-top: 6px; height: 42px; font-size: 14px; }
.fn-tokens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.fn-tokens button { height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid #cfe0fa; background: #f2f7ff; color: #1559c4; font-size: 12.5px; font-weight: 600; }
.fn-tokens button:hover { background: #e0ecfd; }
.fn-preview { margin-top: 8px; font-size: 12.5px; color: #6b7a8d; }
.fn-preview code { background: #f1f4f8; border: 1px solid #e1e7ef; border-radius: 6px; padding: 2px 8px; color: #16243b; word-break: break-all; }
#fn-reset { margin-right: auto; border-color: transparent; color: #4d6283; }

/* Tùy chỉnh cột */
#columns-dialog { width: min(480px, calc(100vw - 30px)); }
.columns-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 58vh; overflow: auto; }
.columns-list li { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 6px; border: 1px solid var(--t-line); border-radius: 10px; background: #fff; position: relative; }
.columns-list li.is-hidden label { color: #9aa7b8; }
.columns-list li.dragging { opacity: .45; }
.columns-list li.drop-before { box-shadow: 0 -3px 0 #1a73e8; }
.columns-list li.drop-after { box-shadow: 0 3px 0 #1a73e8; }
.col-grip { display: inline-flex; color: #9aa7b8; cursor: grab; padding: 4px; }
.col-grip .ic { width: 18px; height: 18px; }
.columns-list label { flex: 1; display: flex !important; align-items: center; gap: 10px; margin: 0 !important; font-size: 14px !important; color: #16243b !important; cursor: pointer; }
.columns-list label input { margin: 0; width: 17px; height: 17px; accent-color: #1a73e8; }
.col-move { display: inline-flex; gap: 4px; }
.col-move button { width: 30px; height: 28px; padding: 0; border-radius: 7px; font-size: 11px; color: #4d6283; }
.col-move button:disabled { opacity: .3; }
#columns-reset { margin-right: auto; border-color: transparent; color: #4d6283; }

/* Ô ngày tiếng Việt */
.vn-date { width: 100%; }
.vn-date.invalid { border-color: #e5484d !important; box-shadow: 0 0 0 3px rgba(229, 72, 77, .12) !important; }
.huvi-field .vn-date, .tct-field .vn-date { height: 38px; }
.pp-range .vn-date { width: 112px; height: 34px; border: 0; padding: 0 2px; font-size: 14px; background: transparent; }
.pp-range .vn-date:focus { outline: none; box-shadow: none; }
dialog .date-row .vn-date, dialog label > .vn-date { display: block; margin-top: 7px; font-size: 14px; }
.vn-cal {
  position: fixed; z-index: 2000; width: 292px; padding: 12px;
  background: #fff; border: 1px solid #dfe5ee; border-radius: 12px;
  box-shadow: 0 16px 40px rgba(12, 35, 70, .22);
  font-size: 13px; color: #16243b;
}
.vn-cal[hidden] { display: none !important; }
.vn-cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.vn-cal-head select { flex: 1; height: 32px; padding: 0 6px; border-radius: 7px; border: 1px solid #d6dde8; font-size: 13px; font-weight: 600; min-width: 0; }
.vn-nav { width: 32px; height: 32px; padding: 0; border-radius: 7px; border: 1px solid #d6dde8; background: #fff; font-size: 18px; line-height: 1; color: #2b4062; }
.vn-nav:hover { border-color: #1a73e8; color: #1a73e8; background: #f3f8ff; }
.vn-cal-week, .vn-cal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.vn-cal-week span { text-align: center; font-size: 12px; font-weight: 700; color: #6b7a8d; padding: 4px 0; }
.vn-cal-week span:last-child { color: #e5484d; }
.vn-cal-days button { height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 13.5px; color: #16243b; }
.vn-cal-days button:hover { background: #eaf2ff; color: #1559c4; }
.vn-cal-days button.out { color: #b4bfcc; }
.vn-cal-days button.sun { color: #e5484d; }
.vn-cal-days button.out.sun { color: #f1a7a9; }
.vn-cal-days button.today { box-shadow: inset 0 0 0 1.5px #1a73e8; font-weight: 700; }
.vn-cal-days button.selected { background: #1a73e8; color: #fff; font-weight: 700; }
.vn-cal-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eef1f6; }
.vn-cal-foot button { height: 30px; padding: 0 12px; border-radius: 7px; border: 0; background: #eef3fa; color: #1559c4; font-size: 13px; font-weight: 600; }
.vn-cal-foot button:hover { background: #dfeafb; }
.vn-cal-foot [data-cal-clear] { background: transparent; color: #6b7a8d; }


/* =========================================================
   KHUNG XEM PDF HÓA ĐƠN (trượt từ phải)
   ========================================================= */
.pdf-viewer {
  position: fixed; inset: 0 0 0 auto; margin: 0;
  width: min(980px, 58vw); max-width: 100vw; height: 100vh; max-height: 100vh;
  padding: 0; border: 0; border-radius: 16px 0 0 16px;
  background: #fff; box-shadow: -18px 0 50px rgba(12, 35, 70, .25);
  display: none; flex-direction: column; overflow: hidden;
}
.pdf-viewer[open] { display: flex; animation: pv-in .22s ease-out; }
.pdf-viewer::backdrop { background: rgba(11, 30, 60, .28); }
@keyframes pv-in { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pdf-viewer[open] { animation: none; } }
.pv-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 12px 22px; border-bottom: 1px solid var(--t-line-soft); }
.pv-heading { flex: 1; min-width: 0; }
.pv-kind { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.pv-kind.orig { background: #e2f6e7; color: #18843f; }
.pv-kind.rendered { background: #e6f1fe; color: #1767d6; }
.pv-heading h2 { margin: 6px 0 2px; font-size: 18px; font-weight: 700; color: #16243b; }
.pv-heading small { display: block; font-size: 13px; color: #5d7190; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-nav { display: flex; gap: 6px; margin-top: 4px; }
.pv-nav button { width: 34px; height: 34px; padding: 0; border-radius: 8px; border: 1px solid #d6dde8; background: #fff; font-size: 20px; line-height: 1; color: #2b4062; }
.pv-nav button:hover:not(:disabled) { border-color: #1a73e8; color: #1a73e8; }
.pv-nav button:disabled { opacity: .35; }
.pdf-viewer .close { margin-top: 2px; }
.pv-body { position: relative; flex: 1; min-height: 0; background: #e9edf2; }
.pv-body iframe { width: 100%; height: 100%; border: 0; display: block; background: #e9edf2; }
.pv-body iframe[hidden] { display: none; }
.pv-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #4d6283; font-size: 14px; padding: 30px; text-align: center; }
.pv-loading[hidden] { display: none; }
.pv-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #cfdcee; border-top-color: #1a73e8; animation: sp-spin .9s linear infinite; }
.pv-loading.error { color: #c0353a; }
.pv-loading.error .pv-spin { display: none; }
.pv-foot { display: flex; align-items: center; gap: 12px; padding: 12px 22px 16px; border-top: 1px solid var(--t-line-soft); }
.pv-btn { height: 42px; padding: 0 18px; border-radius: 10px; border: 0; background: #e7e9ee; color: #16243b; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.pv-btn:hover:not(:disabled) { background: #d9dde4; }
.pv-btn .ic { width: 19px; height: 19px; }
.pv-close { height: 42px; padding: 0 12px; border: 0; background: none; color: #e5484d; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.pv-close:hover { background: #fff1f1; }
.pv-close .ic { width: 17px; height: 17px; stroke-width: 2.4; }
#invoice-body tr.row-viewing, #invoice-body tr.row-viewing:hover { background: #fff8d6; }
.huvi-badge-pdf, .huvi-badge-rendered { cursor: zoom-in; }
@media (max-width: 1100px) { .pdf-viewer { width: 100vw; border-radius: 0; } }

/* Nút × ẩn hộp thông báo đồng bộ */
.info-box { position: relative; padding-right: 44px; }
.info-box[hidden] { display: none !important; }
.info-box-close { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: #6b7f9c; font-size: 20px; line-height: 1; }
.info-box-close:hover { background: #dbe8fb; color: #1f3352; }

/* =========================================================
   Lọc Ngày lập trong bảng · hộp thoại Tùy chỉnh tên file
   ========================================================= */
.col-date-filter { position: relative; }
.col-date-btn {
  width: 100%; height: 34px; padding: 0 8px 0 10px; border-radius: 7px; border: 1px solid #d3deeb; background: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 12.5px; font-weight: 400 !important; color: #8291a6 !important; white-space: nowrap;
}
.col-date-btn .ic { width: 15px; height: 15px; color: #5d7190; flex-shrink: 0; }
.col-date-btn.active { border-color: #9cc2f7; background: #f2f7ff; color: #1559c4 !important; font-weight: 600 !important; }
#col-date-label { overflow: hidden; text-overflow: ellipsis; }
.col-date-pop {
  position: fixed; z-index: 1500; width: 230px; padding: 12px;
  background: #fff; border: 1px solid #dfe5ee; border-radius: 12px; box-shadow: 0 14px 34px rgba(12, 35, 70, .2);
  text-align: left; font-weight: 400; white-space: normal;
}
.col-date-pop[hidden] { display: none !important; }
.col-date-pop label { display: block; margin: 0 0 5px; font-size: 12.5px; font-weight: 600; color: #3a4b62; }
.col-date-pop .vn-date { height: 36px; margin-bottom: 10px; font-size: 13.5px; }
.col-date-actions { display: flex; justify-content: space-between; gap: 8px; }
.col-date-actions button { height: 32px; padding: 0 12px; border-radius: 7px; font-size: 13px; }
#col-date-clear { border-color: transparent; color: #6b7a8d; }

.filename-dialog { width: min(560px, calc(100vw - 30px)); padding: 20px 8px 14px 20px; max-height: 92vh; display: none; flex-direction: column; }
.filename-dialog[open] { display: flex; }
.filename-dialog .modal-title { padding-right: 12px; }
.filename-dialog h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; }
.filename-dialog h2 .ic { width: 20px; height: 20px; color: #3a4b62; }
.fn-scroll { overflow-y: auto; padding: 14px 12px 4px 0; display: flex; flex-direction: column; gap: 12px; }
.fn-card { border: 1px solid #e3e8ef; border-radius: 12px; padding: 14px; background: #fff; }
.fn-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.fn-card-head strong { font-size: 14.5px; font-weight: 600; color: #16243b; }
.fn-state { font-size: 11.5px; padding: 2px 9px; border-radius: 99px; background: #eef1f5; color: #5d6b7e; white-space: nowrap; }
.fn-state.custom { background: #e2f6e7; color: #18843f; }
.fn-state.dirty { background: #fff3dc; color: #a46405; }
.fn-hint { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px !important; padding: 8px 10px; border-radius: 8px; background: #f5f7fa; font-size: 12.5px !important; color: #5d6b7e !important; line-height: 1.5 !important; }
.fn-hint .ic { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }
.fn-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 40px; padding: 5px 8px; border: 1px solid #d6dde8; border-radius: 9px; cursor: text; }
.fn-editor:focus-within { border-color: #5a9cf5; box-shadow: 0 0 0 3px rgba(26, 115, 232, .12); }
.fn-editor-chips { display: contents; }
.fn-free { flex: 1; min-width: 120px; border: 0 !important; padding: 4px 2px !important; height: 28px; font-size: 13px; box-shadow: none !important; outline: none; }
.fn-chip, .fn-text { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px 0 8px; border-radius: 6px; font-size: 13px; }
.fn-chip { background: #dbe9fd; color: #1559c4; font-weight: 500; }
.fn-text { background: #f1f3f6; color: #3a4b62; white-space: pre; }
.fn-chip button, .fn-text button { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: inherit; font-size: 14px; line-height: 1; opacity: .7; }
.fn-chip button:hover, .fn-text button:hover { opacity: 1; background: rgba(0, 0, 0, .06); }
.fn-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fn-tag { position: relative; display: inline-flex; border: 1px solid #d6dde8; border-radius: 8px; background: #fff; }
.fn-tag > button { height: 30px; padding: 0 10px; border: 0; background: transparent; font-size: 13px; color: #2b3b52; border-radius: 8px; }
.fn-tag > button:hover { background: #f2f7ff; color: #1559c4; }
.fn-tag .fn-tag-more { padding: 0 6px; border-left: 1px solid #e3e8ef; border-radius: 0 8px 8px 0; }
.fn-tag-more .ic { width: 14px; height: 14px; }
.fn-fmt-menu { position: absolute; left: 0; top: calc(100% + 4px); z-index: 5; min-width: 190px; padding: 6px; background: #fff; border: 1px solid #e3e8ef; border-radius: 10px; box-shadow: 0 10px 26px rgba(12, 35, 70, .16); display: flex; flex-direction: column; }
.fn-fmt-menu[hidden] { display: none; }
.fn-fmt-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; }
.fn-fmt-menu button:hover { background: #f2f7ff; }
.fn-fmt-menu b { font-size: 13.5px; font-weight: 500; color: #16243b; }
.fn-fmt-menu small { font-size: 11px; color: #8291a6; font-family: ui-monospace, Consolas, monospace; }
.fn-accent { display: flex !important; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 0 !important; padding: 8px 10px; border-radius: 8px; background: #f5f7fa; cursor: pointer; }
.fn-accent span { display: flex; flex-direction: column; }
.fn-accent b { font-size: 13px; font-weight: 500; color: #2b3b52; }
.fn-accent small { font-size: 11.5px; color: #6b7a8d; }
.fn-accent input { appearance: none; -webkit-appearance: none; width: 36px !important; height: 20px; margin: 0; border-radius: 99px; background: #d3d9e2; position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; }
.fn-accent input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.fn-accent input:checked { background: #1a73e8; }
.fn-accent input:checked::after { transform: translateX(16px); }
.fn-preview-box { margin-top: 10px; padding: 10px 12px; border: 1px solid #b9d4f8; border-radius: 9px; background: #eaf3ff; }
.fn-preview-label { display: block; font-size: 11px; font-weight: 700; color: #1a73e8; letter-spacing: .3px; margin-bottom: 4px; }
.fn-preview-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.fn-preview-chips .fn-chip, .fn-preview-chips .fn-text { padding: 0 6px; height: 24px; }
.fn-preview-chips .fn-text { background: transparent; }
.fn-ext { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: #2b3b52; }
.fn-example { display: block; margin-top: 6px; font-size: 12px; color: #5d6b7e; background: none; padding: 0; word-break: break-all; }
.fn-example:not(:empty)::before { content: "Ví dụ: "; font-family: inherit; color: #8291a6; }
.fn-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.fn-actions .primary { height: 34px; padding: 0 14px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }
.fn-actions .primary .ic { width: 15px; height: 15px; }
.fn-reset { height: 34px; padding: 0 8px; border: 0 !important; background: none !important; color: #6b7a8d; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.fn-reset .ic { width: 14px; height: 14px; }
.fn-batch { border: 1px solid #e3e8ef; border-radius: 12px; background: #fff; }
.fn-batch summary { display: flex; align-items: center; justify-content: space-between; padding: 14px; cursor: pointer; list-style: none; }
.fn-batch summary::-webkit-details-marker { display: none; }
.fn-batch summary span { display: flex; flex-direction: column; }
.fn-batch summary b { font-size: 14.5px; font-weight: 600; color: #16243b; }
.fn-batch summary small { font-size: 12px; color: #6b7a8d; }
.fn-batch summary .ic { width: 16px; height: 16px; color: #8291a6; transform: rotate(90deg); transition: transform .15s; }
.fn-batch[open] summary .ic { transform: rotate(0deg); }
.fn-batch .fn-card { margin: 0 12px 12px; }

/* Thanh trên cùng: không xuống dòng chữ ở màn hình vừa */
.module-tab, .add-account-btn, .sync-btn, .account { white-space: nowrap; }
.top-account-picker { min-width: 0; max-width: 300px; }
.top-account-picker select { min-width: 0; max-width: 240px; text-overflow: ellipsis; }
.topbar-left { flex-shrink: 1; min-width: 0; }
@media (max-width: 1500px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .topbar-left { gap: 14px; }
  .brand-text small { display: none; }
  .module-tab { padding: 0 12px; gap: 6px; }
  .topbar-right { gap: 8px; }
  .top-account-picker select { max-width: 190px; }
}
@media (max-width: 1250px) {
  .module-badge { display: none; }
  .add-account-btn { width: 42px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .add-account-btn .ic { width: 19px; height: 19px; }
  .top-account-picker > span { display: none; }
}

.brand { flex-shrink: 0; }
.brand-text strong, .brand-text small { white-space: nowrap; }
@media (max-width: 1650px) { .brand-text small { display: none; } }

/* sửa công tắc giữ dấu */
.fn-card .fn-accent input[type=checkbox] { display: block; width: 38px !important; min-width: 38px; height: 22px !important; padding: 0 !important; margin: 0 !important; border: 0 !important; border-radius: 99px !important; background: #d3d9e2; appearance: none; -webkit-appearance: none; }
.fn-card .fn-accent input[type=checkbox]::after { top: 3px; left: 3px; }
.fn-card .fn-accent input[type=checkbox]:checked { background: #1a73e8; }
/* thanh trên cùng: phần trái không co, phần phải co lại */
.topbar-left { flex-shrink: 0; min-width: auto; }
.topbar-right { flex-shrink: 1; min-width: 0; }
.top-account-picker { flex-shrink: 1; min-width: 120px; overflow: hidden; }
@media (max-width: 1800px) { .user-text { display: none; } }
@media (max-width: 1650px) { .module-badge { display: none; } .top-account-picker select { max-width: 170px; } }

/* Đồng bộ lúc: … trước nút Đồng bộ TCT */
.sync-row { display: flex; align-items: center; gap: 12px; }
.sync-ago { font-size: 13.5px; color: #6b7a8d; white-space: nowrap; }
.sync-ago b { color: #2b3b52; font-weight: 600; }
@media (max-width: 1500px) { .sync-ago { font-size: 12.5px; } }
/* Hộp thoại Tùy chỉnh tên file rộng hơn */
.filename-dialog { width: min(920px, calc(100vw - 40px)); }
.fn-free { min-width: 220px; }

.direction-segmented button, .filter-btn-group > button, .sync-btn { white-space: nowrap; }
.huvi-filter-row { grid-template-columns: auto minmax(170px, 1.2fr) minmax(140px, 1fr) minmax(140px, 1fr) auto auto; }
@media (max-width: 1800px) {
  .huvi-filter-row { grid-template-columns: auto minmax(170px, 1.3fr) minmax(140px, 1fr) minmax(140px, 1fr) auto; }
  .huvi-filter-row .huvi-filter-btns { grid-column: 1 / -1; }
  .huvi-filter-row .huvi-filter-btns > label { display: none; }
}
@media (max-width: 1100px) { .huvi-filter-row { grid-template-columns: 1fr 1fr; } .sync-row { flex-wrap: wrap; } }
.huvi-filter-row .huvi-filter-btns { align-items: flex-start; justify-content: flex-start; }

/* Ô MST nền trắng có chấm trạng thái · nút Sửa như nút Thêm mới */
.top-account-picker { background: #fff !important; border: 1px solid #fff !important; color: #13294b !important; gap: 8px; }
.top-account-picker > span:not(.conn-dot) { color: #4d6283; font-weight: 600; }
.top-account-picker select { color: #13294b !important; font-weight: 600; }
.top-account-picker select option { color: #13294b; }
.top-account-picker .conn-dot { flex-shrink: 0; }
.edit-account-btn {
  height: 42px; padding: 0 16px; border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .1); color: #fff;
  font-size: 14px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.edit-account-btn:hover { background: rgba(255, 255, 255, .2); }
.edit-account-btn .ic { width: 16px; height: 16px; stroke-width: 2.4; }

/* Nút Xóa tài khoản (nền đỏ, góc dưới bên trái) */
.tct-account-dialog .modal-actions .ta-delete {
  margin-right: auto; height: 46px; padding: 0 16px; border-radius: 11px; border: 0 !important;
  background: #e5484d !important; color: #fff !important; font-size: 14.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.tct-account-dialog .modal-actions .ta-delete:hover { background: #cf3a3f !important; }
.tct-account-dialog .modal-actions .ta-delete[hidden] { display: none !important; }
.ta-delete .ic { width: 17px; height: 17px; }

/* Ô MST: căn thẳng hàng chấm, chữ "MST:" và tên công ty */
.top-account-picker { display: inline-flex !important; align-items: center !important; flex-direction: row; }
.top-account-picker > span { display: inline-flex; align-items: center; line-height: 1; margin: 0; }
.top-account-picker select { margin: 0 !important; height: 32px !important; line-height: 32px; padding-top: 0 !important; padding-bottom: 0 !important; align-self: center; font-size: 13.5px !important; }

/* ---------- Đăng nhập AITUDO ID ---------- */
.auth-gate { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(135deg, #0a2142 0%, #11366c 60%, var(--t-blue) 100%); }
.auth-gate[hidden] { display: none; }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 32px 28px; box-shadow: 0 18px 50px rgba(8, 28, 58, .35); display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.auth-card h1 { margin: 0; font-size: 24px; font-weight: 800; color: var(--t-ink); }
.auth-card p { margin: 0; color: var(--t-muted); font-size: 14px; line-height: 1.5; }
.auth-card small { color: var(--t-muted); font-size: 12px; line-height: 1.5; margin-top: 6px; }
.auth-card small a { color: var(--t-blue); font-weight: 600; }
.auth-error { width: 100%; background: #fdecec; color: var(--t-red) !important; border-radius: 8px; padding: 8px 10px; }
.auth-btn { width: 100%; display: block; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--t-line); color: var(--t-ink); font-weight: 600; text-decoration: none; }
.auth-btn.primary { background: var(--t-blue); border-color: var(--t-blue); color: #fff; }
.auth-btn.primary:hover { background: var(--t-blue-d); }
.auth-btn:not(.primary):hover { background: var(--t-blue-soft); }
.menu-id-user { display: block; padding: 6px 14px; color: var(--t-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown a[role="menuitem"] { display: flex; align-items: center; gap: 8px; text-decoration: none; color: inherit; }
