:root{
  --navy:#122A42;
  --navy-2:#1C3E5E;
  --navy-3:#28527A;
  --amber:#E39027;
  --amber-dark:#B5701A;
  --paper:#FBFAF7;
  --ink:#171D24;
  --muted:#66707C;
  --line:#DCE2E7;
  --line-2:#EDF0F3;
  --success:#2B8A4E;
  --success-bg:#E7F5EC;
  --danger:#C6432F;
  --danger-bg:#FBEAE6;
  --draft:#6E7A87;
  --draft-bg:#EBEEF1;
  --sent-bg:#E7F5EC;
  --shadow: 0 1px 2px rgba(18,42,66,.06), 0 8px 24px -12px rgba(18,42,66,.18);
}
*{box-sizing:border-box;}
[hidden]{ display:none !important; }
html,body{margin:0;padding:0;}
body{
  font-family:'Inter',sans-serif;
  color:var(--ink);
  background:
    linear-gradient(180deg, var(--navy) 0px, var(--navy) 148px, transparent 148px),
    #F1F3F5;
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
}
.mono{ font-family:'IBM Plex Mono',monospace; }
a{ color:inherit; }
button{ font-family:inherit; cursor:pointer; }
input, select, textarea{ font-family:inherit; }
::selection{ background:var(--amber); color:#fff; }
:focus-visible{ outline:2px solid var(--amber); outline-offset:2px; }

/* ---------- Shell / header ---------- */
#shell{ max-width:1340px; margin:0 auto; padding:0 24px 64px; }
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:28px 0 22px; gap:16px; flex-wrap:wrap;
}
.brand{ display:flex; align-items:center; gap:14px; min-width:0; }
.brand-mark{
  width:44px; height:44px; border-radius:10px;
  background:#fff; padding:5px;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-family:'IBM Plex Mono',monospace; font-weight:700; font-size:15px;
  box-shadow:0 6px 16px -6px rgba(0,0,0,.35);
  flex-shrink:0;
}
.brand-text h1{ margin:0; font-size:18px; font-weight:700; color:#fff; letter-spacing:.2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.brand-text p{ margin:2px 0 0; font-size:12.5px; color:#AEC0D2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.tabs{
  display:flex; gap:4px; background:rgba(255,255,255,.08);
  padding:4px; border-radius:11px; border:1px solid rgba(255,255,255,.12);
  flex-wrap:wrap;
}
.tab-btn{
  border:none; background:transparent; color:#CBD9E5;
  padding:9px 13px; border-radius:8px; font-size:13.5px; font-weight:600;
  transition:background .15s, color .15s;
  text-decoration:none; display:inline-flex; align-items:center;
  white-space:nowrap; flex-shrink:0;
}
.tab-btn.active{ background:#fff; color:var(--navy); }
.tab-btn:hover:not(.active){ color:#fff; }
@media(max-width:640px){
  .topbar{ flex-direction:column; align-items:stretch; }
  .tabs{ justify-content:center; }
  .logout-btn{ align-self:center; }
}

.card{
  background:#fff; border-radius:14px; border:1px solid var(--line);
  box-shadow:var(--shadow);
}

/* ---------- Stat cards ---------- */
.stats{ display:grid; grid-template-columns:repeat(5,1fr); gap:14px; margin-bottom:20px; }
.stat{ padding:18px 18px 16px; }
.stat .num{ font-family:'IBM Plex Mono',monospace; font-size:26px; font-weight:600; color:var(--navy); line-height:1; }
.stat .lbl{ margin-top:8px; font-size:12.5px; color:var(--muted); font-weight:500; }
.stat.accent .num{ color:var(--amber-dark); }
@media(max-width:920px){ .stats{ grid-template-columns:repeat(2,1fr); } }

/* ---------- Toolbar ---------- */
.toolbar{ display:flex; gap:10px; align-items:center; margin-bottom:16px; flex-wrap:wrap; }
.search-wrap{ position:relative; flex:1; min-width:220px; }
.search-wrap svg{ position:absolute; left:12px; top:50%; transform:translateY(-50%); opacity:.45; }
input.search{
  width:100%; padding:10px 12px 10px 36px; border-radius:9px; border:1px solid var(--line);
  font-size:13.5px; background:#fff;
}
select.filter{
  padding:10px 30px 10px 12px; border-radius:9px; border:1px solid var(--line);
  font-size:13.5px; background:#fff; color:var(--ink);
}
.date-range{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.date-range label{ display:flex; align-items:center; gap:6px; font-size:13px; color:var(--muted); }
input.filter[type="date"]{
  padding:9px 10px; border-radius:9px; border:1px solid var(--line);
  font-size:13.5px; background:#fff; color:var(--ink);
}
.btn{
  display:inline-flex; align-items:center; gap:7px; justify-content:center;
  padding:10px 16px; border-radius:9px; border:1px solid transparent;
  font-size:13.5px; font-weight:600; white-space:nowrap;
  transition:filter .12s, transform .05s;
  text-decoration:none;
}
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--amber); color:#fff; }
.btn-primary:hover{ filter:brightness(1.06); }
.btn-navy{ background:var(--navy); color:#fff; }
.btn-navy:hover{ filter:brightness(1.15); }
.btn-ghost{ background:#fff; color:var(--ink); border-color:var(--line); }
.btn-ghost:hover{ background:#F5F7F8; }
.btn-success{ background:var(--success); color:#fff; }
.btn-success:hover{ filter:brightness(1.08); }
.btn-danger{ background:var(--danger); color:#fff; border-color:var(--danger); }
.btn-danger:hover{ filter:brightness(1.08); }
.btn-danger-ghost{ background:#fff; color:var(--danger); border-color:var(--line); }
.btn-danger-ghost:hover{ background:var(--danger-bg); }
.btn-icon{ padding:8px; }
.btn[disabled]{ opacity:.45; cursor:not-allowed; }
.btn-sm{ padding:7px 11px; font-size:12.5px; border-radius:7px; }

/* ---------- List table ---------- */
.table-scroll{ overflow-x:auto; }
.list-table{ width:100%; border-collapse:collapse; }
.list-table thead th{
  text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.06em;
  color:var(--muted); font-weight:600; padding:13px 16px; border-bottom:1px solid var(--line);
}
/* sortable headers (sortHeader in index.html) */
.list-table thead th.sortable button{
  all:unset; cursor:pointer; display:inline-flex; align-items:center; gap:5px;
  font:inherit; text-transform:inherit; letter-spacing:inherit; color:inherit;
}
.list-table thead th.sortable button:hover,
.list-table thead th.sorted button{ color:var(--navy); }
.list-table thead th.sortable button:focus-visible{ outline:2px solid var(--amber); outline-offset:2px; border-radius:3px; }
.list-table thead th .sort-ind{ font-size:9px; opacity:.45; }
.list-table thead th.sorted .sort-ind{ opacity:1; }
.list-table tbody td{ padding:14px 16px; border-bottom:1px solid var(--line-2); font-size:13.5px; vertical-align:middle; }
.list-table tbody tr:last-child td{ border-bottom:none; }
.list-table tbody tr:hover{ background:#FAFBFC; }
.ref-cell{ font-family:'IBM Plex Mono',monospace; font-weight:600; color:var(--navy); }
.ref-cell .no-ref{ font-family:'Inter',sans-serif; font-weight:500; font-style:italic; color:var(--muted); }
.ref-cell .date{ display:block; font-weight:400; color:var(--muted); font-size:11.5px; margin-top:2px; font-family:'Inter',sans-serif; }
.company-cell .name{ font-weight:600; }
.company-cell .sub{ color:var(--muted); font-size:12px; margin-top:2px; }
.amount-cell{ font-family:'IBM Plex Mono',monospace; font-weight:600; white-space:nowrap; }
/* list page: keep ref / date / customer on one line, cut long text with "…"
   (full text in the title tooltip) */
.list-table td.nowrap{ white-space:nowrap; }
.list-table .ref-cell,
.list-table .company-cell .name,
.list-table .company-cell .sub{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.list-table .ref-cell{ max-width:150px; }
.list-table .company-cell .name,
.list-table .company-cell .sub{ max-width:220px; }
/* Quản lý báo giá list (index.html): compact so every column fits the page
   width without horizontal scrolling; the customer name wraps instead of
   being cut. .table-scroll still scrolls on narrow screens. */
.quote-list thead th{ padding:11px 8px; font-size:10.5px; letter-spacing:.04em; }
.quote-list tbody td{ padding:10px 8px; font-size:12.5px; }
.quote-list thead th:first-child, .quote-list tbody td:first-child{ padding-left:16px; }
.quote-list thead th:last-child, .quote-list tbody td:last-child{ padding-right:16px; }
.quote-list .ref-cell{ max-width:none; white-space:nowrap; font-size:12px; }
.quote-list .company-cell{ min-width:180px; }
.quote-list .company-cell .name,
.quote-list .company-cell .sub{ max-width:none; white-space:normal; overflow:visible; font-size:12px; line-height:1.35; overflow-wrap:anywhere; }
.quote-list .company-cell .sub{ font-size:11.5px; }
/* Khách hàng list: show the full customer name, wrapped */
.customer-list .company-cell .name,
.customer-list .company-cell .sub{ max-width:260px; white-space:normal; overflow:visible; overflow-wrap:anywhere; }
.quote-list .amount-cell{ font-size:12px; }
.quote-list .badge{ white-space:nowrap; padding:3px 8px 3px 7px; font-size:11px; }
.quote-list .row-actions{ gap:3px; }
.quote-list .row-actions .btn-icon{ padding:6px; }
.badge{
  display:inline-flex; align-items:center; gap:5px; padding:4px 10px 4px 8px;
  border-radius:999px; font-size:11.5px; font-weight:600;
}
.badge:before{ content:''; width:6px; height:6px; border-radius:50%; }
.badge.draft{ background:var(--draft-bg); color:var(--draft); }
.badge.draft:before{ background:var(--draft); }
.badge.completed{ background:#FDF1E1; color:var(--amber-dark); }
.badge.completed:before{ background:var(--amber); }
.badge.sent{ background:var(--sent-bg); color:var(--success); }
.badge.sent:before{ background:var(--success); }
.row-actions{ display:flex; gap:6px; justify-content:flex-end; }
.empty-state{ padding:70px 20px; text-align:center; color:var(--muted); }
.empty-state svg{ opacity:.35; margin-bottom:14px; }
.empty-state h3{ margin:0 0 6px; color:var(--ink); font-size:15px; }
.empty-state p{ margin:0 0 18px; font-size:13.5px; }

/* ---------- Form layout ---------- */
/* Kết quả dropdown in the quotation list; coloured by the saved value */
.result-select{
  padding:5px 8px; border-radius:7px; border:1px solid var(--line); font-size:12px; font-weight:600;
  background:#fff; color:var(--ink); cursor:pointer;
}
.result-select[data-result="win"]{ color:#16803c; background:#eaf7ee; border-color:#16803c; }
.result-select[data-result="lose"]{ color:#b42318; background:#fff0ee; border-color:#b42318; }
.result-select[data-result="open"]{ color:var(--draft); background:var(--draft-bg); border-color:var(--draft); }
.result-select option{ color:var(--ink); background:#fff; }
.result-select[disabled]{ opacity:.5; cursor:wait; }
/* Ngày đặt hàng / Ngày giao hàng cells; a button (editable) on Win rows */
.order-date-text{ color:var(--muted); }
.order-date-btn{
  padding:4px 8px; border-radius:7px; border:1px dashed transparent; background:none;
  font:inherit; color:var(--ink); cursor:pointer;
}
.order-date-btn:hover{ border-color:var(--line); background:#FAFBFC; }
.order-date-btn.empty{ color:var(--muted); border-color:var(--line); }
.modal-field input[type="date"]{ width:100%; box-sizing:border-box; }
.modal-field-error{ margin:-4px 0 12px; font-size:12.5px; color:#b42318; }
.form-header{ display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; gap:12px; flex-wrap:wrap; }
.back-link{ display:inline-flex; align-items:center; gap:6px; color:#DCE6EF; font-size:13px; font-weight:600; margin-bottom:14px; text-decoration:none; }
.back-link:hover{ color:#fff; }
.stepper{ display:flex; align-items:center; gap:0; }
.step{ display:flex; align-items:center; gap:8px; }
.step .dot{
  width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:700; background:var(--line-2); color:var(--muted); font-family:'IBM Plex Mono',monospace;
  border:2px solid var(--line-2);
}
.step.done .dot{ background:var(--success); border-color:var(--success); color:#fff; }
.step.current .dot{ background:#fff; border-color:var(--amber); color:var(--amber-dark); }
.step .lbl{ font-size:12px; font-weight:600; color:var(--muted); }
.step.done .lbl, .step.current .lbl{ color:var(--ink); }
.step-line{ width:28px; height:2px; background:var(--line); margin:0 4px; }

.form-grid{ display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr); gap:20px; align-items:flex-start; }
@media(max-width:980px){ .form-grid{ grid-template-columns:1fr; } }

.section{ padding:22px 22px 24px; margin-bottom:16px; }
.section h2{ margin:0 0 4px; font-size:14.5px; font-weight:700; }
.section .hint{ margin:0 0 16px; font-size:12px; color:var(--muted); }
.field-grid{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.field-grid.cols-3{ grid-template-columns:1fr 1fr 1fr; }
.field-grid.cols-4{ grid-template-columns:repeat(4, minmax(0, 1fr)); }
@media(max-width:900px){ .field-grid.cols-4{ grid-template-columns:1fr 1fr; } }
@media(max-width:560px){ .field-grid, .field-grid.cols-3, .field-grid.cols-4{ grid-template-columns:1fr; } }
.field label{ display:block; font-size:12px; font-weight:600; color:var(--muted); margin-bottom:6px; }
.field label .req{ color:var(--danger); }
.field input, .field select, .field textarea{
  width:100%; padding:9px 11px; border:1px solid var(--line); border-radius:8px; font-size:13.5px; color:var(--ink);
  background:#fff;
}
.field input:focus, .field select:focus, .field textarea:focus{ border-color:var(--amber); }
.field input[readonly]{ background:#F5F7F8; color:var(--navy); font-weight:600; cursor:default; }
.field input[readonly]:focus{ border-color:var(--line); }
.field textarea{ resize:vertical; min-height:64px; }
.field textarea.term-text{ min-height:0; resize:none; overflow:hidden; line-height:1.4; }
.field{ margin-bottom:14px; }
.field:last-child{ margin-bottom:0; }

/* items table */
.items-table-wrap{ overflow-x:auto; border:1px solid var(--line); border-radius:10px; }
table.items{ width:100%; border-collapse:collapse; min-width:900px; }
table.items thead th{
  background:#F7F8F9; text-align:left; font-size:10.5px; text-transform:uppercase; letter-spacing:.05em;
  color:var(--muted); font-weight:700; padding:9px 10px; border-bottom:1px solid var(--line);
}
table.items tbody td{ padding:7px 8px; border-bottom:1px solid var(--line-2); vertical-align:top; }
table.items tbody tr:last-child td{ border-bottom:none; }
table.items input, table.items select, table.items textarea{ border:1px solid transparent; background:transparent; padding:7px 8px; border-radius:6px; font-size:13px; width:100%; }
table.items input:hover, table.items select:hover, table.items textarea:hover{ border-color:var(--line); }
table.items input:focus, table.items select:focus, table.items textarea:focus{ border-color:var(--amber); background:#fff; }
table.items td.num input{ text-align:right; font-family:'IBM Plex Mono',monospace; }
table.items td.sn{ width:52px; padding-left:2px; padding-right:2px; }
table.items td.sn input{ text-align:center; padding-left:2px; padding-right:2px; font-family:'IBM Plex Mono',monospace; font-size:12.5px; }
table.items td.sn input::placeholder{ color:var(--muted); opacity:1; }
/* description: multi-line, grows with its content (see autosize()) */
table.items textarea{ display:block; font-family:inherit; line-height:1.4; resize:none; overflow:hidden; min-height:34px; }
/* description editor: rich text (bold / colours via the .fmt-bar under it) */
table.items .desc-edit{ border:1px solid transparent; padding:7px 8px; border-radius:6px; font-size:13px; line-height:1.4; min-height:34px; white-space:pre-wrap; overflow-wrap:anywhere; outline:none; cursor:text; }
table.items .desc-edit:hover{ border-color:var(--line); }
table.items .desc-edit:focus{ border-color:var(--amber); background:#fff; }
table.items .fmt-bar{ display:none; align-items:center; gap:5px; margin-left:auto; }
table.items td.desc-cell:focus-within .fmt-bar{ display:inline-flex; }
table.items .fmt-btn{ width:24px; height:22px; border:1px solid var(--line); border-radius:5px; background:#fff; color:var(--ink); font-size:12.5px; cursor:pointer; padding:0; }
table.items .fmt-btn:hover{ border-color:var(--navy-3); }
table.items .fmt-color{ width:16px; height:16px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1px var(--line); cursor:pointer; padding:0; }
table.items .fmt-color:hover{ box-shadow:0 0 0 1px var(--navy-3); }
table.items td.total input{ font-weight:600; }
table.items td.code input{ font-family:'IBM Plex Mono',monospace; }
table.items td.rm{ width:30px; text-align:center; padding-top:12px; }
/* optional product photo under the description (see renderItemRows) */
table.items .item-image{ display:flex; align-items:center; gap:10px; padding:2px 8px 0; }
table.items .item-image img{ display:block; max-width:72px; max-height:54px; border-radius:4px; border:1px solid var(--line); object-fit:contain; background:#fff; }
.btn-link{ border:none; background:transparent; padding:0; font-size:12px; font-weight:600; color:var(--muted); cursor:pointer; }
.btn-link:hover{ color:var(--navy); text-decoration:underline; }
.btn-link.danger:hover{ color:var(--danger); }
table.items td.desc-cell.drop-over{ outline:2px dashed var(--navy-3); outline-offset:-3px; background:#F2F6FA; }
.image-drop{ border:2px dashed var(--line); border-radius:10px; padding:28px 16px; margin:6px 0 16px; text-align:center; background:#FAFBFC; outline:none; }
.image-drop:focus{ border-color:var(--navy-3); }
.image-drop.drop-over{ border-color:var(--navy-3); background:#F2F6FA; }
.image-drop-title{ font-size:13.5px; font-weight:600; color:var(--ink); }
.image-drop-sub{ font-size:12px; color:var(--muted); margin-top:4px; }
.section-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.section-head h2{ margin:0; }
.excel-btn{ display:inline-flex; align-items:center; gap:6px; padding:4px 10px 4px 6px; border:1px solid var(--line); border-radius:8px; background:#fff; font-size:12px; font-weight:600; color:#1D6F42; cursor:pointer; }
.excel-btn:hover{ border-color:#1D6F42; background:#F1F8F4; }
.excel-bar{ display:flex; align-items:center; flex-wrap:wrap; gap:8px 10px; margin-top:10px; padding:9px 12px; border:1px solid #CFE6D8; border-radius:8px; background:#F1F8F4; font-size:12.5px; color:var(--ink); }
.excel-bar svg{ flex:none; }
.excel-bar > span:first-of-type{ flex:1; min-width:200px; }
.excel-bar-actions{ display:flex; gap:14px; }
.rm-btn{ border:none; background:transparent; color:var(--muted); width:24px; height:24px; border-radius:6px; font-size:15px; line-height:1; }
.rm-btn:hover{ background:var(--danger-bg); color:var(--danger); }
.add-row-btn{
  display:flex; align-items:center; gap:6px; width:100%; justify-content:center;
  padding:10px; border:1px dashed var(--line); background:#FAFBFC; color:var(--navy-3);
  font-size:12.5px; font-weight:600; border-radius:0 0 9px 9px; border-top:none;
}
.add-row-btn:hover{ background:#F1F4F7; }
/* "+ Thêm dòng" and "+ Ghi chú" side by side under the items table */
.add-row-bar{ display:flex; }
.add-row-bar .add-row-btn{ flex:1; border-radius:0; }
.add-row-bar .add-row-btn:first-child{ border-bottom-left-radius:9px; }
.add-row-bar .add-row-btn:last-child{ border-bottom-right-radius:9px; }
.add-row-bar .add-row-btn + .add-row-btn{ flex:0 0 160px; border-left:none; }
table.items tr.note-row td{ background:#FFFDF6; }
table.items tr.note-row textarea{ font-style:italic; }

.totals-box{ margin-top:14px; display:flex; justify-content:flex-end; }
.totals-inner{ width:100%; max-width:320px; }
.totals-inner .trow{ display:flex; justify-content:space-between; padding:7px 0; font-size:13px; color:var(--muted); }
.totals-inner .trow span:last-child{ font-family:'IBM Plex Mono',monospace; color:var(--ink); font-weight:500; }
.totals-inner .trow.grand{ border-top:1.5px solid var(--ink); margin-top:6px; padding-top:12px; }
.totals-inner .trow.grand span:first-child{ font-weight:700; color:var(--ink); font-size:13.5px; }

/* ---------- Analytics page ---------- */
.analytics-grid{
  display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:16px; margin-top:18px;
}
.analytic-panel{
  padding:20px 20px 18px;
}
.analytic-panel h3{
  margin:0 0 14px; font-size:15px; color:var(--navy);
}
.status-row{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:10px 0; border-bottom:1px solid var(--line-2); font-size:13px; color:var(--ink);
}
.status-row:last-child{ border-bottom:none; }
.status-row strong{ font-family:'IBM Plex Mono',monospace; }
.kpi-stack{ display:grid; gap:12px; }
.kpi-item{ padding:12px 14px; border:1px solid var(--line); border-radius:10px; background:#FAFBFC; }
.kpi-label{ font-size:12px; color:var(--muted); margin-bottom:6px; }
.kpi-value{ font-size:22px; font-weight:700; color:var(--navy); font-family:'IBM Plex Mono',monospace; }
.wide-panel{ margin-top:18px; }
.empty-kpi{ margin:0; color:var(--muted); font-size:13px; }
@media(max-width:760px){ .analytics-grid{ grid-template-columns:1fr; } }
.totals-inner .trow.grand span:last-child{ font-weight:700; font-size:17px; color:var(--amber-dark); }

/* ---------- Chart primitives (bar / stacked bar / column / tooltip) ---------- */
.bar-chart{ display:grid; gap:14px; }
.bar-row{ display:grid; grid-template-columns:112px 1fr auto; align-items:center; gap:10px; }
.bar-row .bar-label{ font-size:12.5px; color:var(--ink); font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-track{ position:relative; height:20px; background:var(--line-2); border-radius:4px; overflow:hidden; }
.bar-fill{
  position:absolute; left:0; top:0; height:100%;
  border-radius:0 4px 4px 0; background:var(--navy);
  transition:filter .12s;
}
.bar-fill:hover, .bar-fill:focus-visible{ filter:brightness(1.12); outline:none; }
.bar-row .bar-value{ font-family:'IBM Plex Mono',monospace; font-size:12.5px; font-weight:600; color:var(--ink); white-space:nowrap; text-align:right; }
@media(max-width:560px){ .bar-row{ grid-template-columns:84px 1fr auto; } }

.stacked-bar{ display:flex; width:100%; height:22px; border-radius:5px; overflow:hidden; background:var(--line-2); gap:2px; }
.stacked-seg{ height:100%; min-width:3px; transition:filter .12s; }
.stacked-seg:hover, .stacked-seg:focus-visible{ filter:brightness(1.1); outline:none; }

.mini-legend{ display:flex; flex-wrap:wrap; gap:16px; margin-top:14px; }
.mini-legend-item{ display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--ink); }
.mini-legend-dot{ width:10px; height:10px; border-radius:3px; flex-shrink:0; }
.mini-legend-item strong{ font-family:'IBM Plex Mono',monospace; }

.column-chart{ display:flex; align-items:flex-end; gap:10px; height:180px; padding-top:22px; }
.col-item{ flex:1; display:flex; flex-direction:column; align-items:center; height:100%; min-width:0; }
.col-track{ flex:1; width:100%; max-width:34px; display:flex; align-items:flex-end; position:relative; }
.col-fill{
  width:100%; border-radius:4px 4px 0 0; background:var(--navy);
  transition:filter .12s; position:relative;
}
.col-fill:hover, .col-fill:focus-visible{ filter:brightness(1.12); outline:none; }
.col-fill .col-cap{
  position:absolute; top:-18px; left:50%; transform:translateX(-50%);
  font-size:10.5px; font-weight:700; color:var(--navy); white-space:nowrap; font-family:'IBM Plex Mono',monospace;
}
.col-item .col-label{ margin-top:8px; font-size:11px; color:var(--muted); text-align:center; }
@media(max-width:560px){ .column-chart{ gap:5px; } .col-item .col-label{ font-size:9.5px; } }

.chart-tooltip{
  position:fixed; z-index:9997; pointer-events:none; background:var(--ink); color:#fff;
  padding:7px 10px; border-radius:7px; font-size:12px; line-height:1.4; box-shadow:0 8px 20px rgba(0,0,0,.22);
  opacity:0; transform:translate(-50%,calc(-100% - 10px)); transition:opacity .1s; max-width:220px;
}
.chart-tooltip.show{ opacity:1; }
.chart-tooltip .tt-title{ font-weight:700; margin-bottom:2px; }
.chart-tooltip .tt-value{ font-family:'IBM Plex Mono',monospace; }

.chart-empty{ padding:32px 0; text-align:center; color:var(--muted); font-size:13px; }
.section-hint{ margin:-8px 0 14px; font-size:12px; color:var(--muted); }

/* action bar */
.action-bar{
  display:flex; gap:10px; flex-wrap:wrap; padding:16px 22px; position:sticky; bottom:16px;
  margin-top:4px; background:#fff; border-radius:12px; border:1px solid var(--line); box-shadow:var(--shadow);
}
.action-bar .spacer{ flex:1; }

/* preview doc */
.preview-wrap{ position:sticky; top:16px; }
.preview-frame{ padding:0; overflow:hidden; }
.preview-scale{ width:100%; overflow:auto; max-height:78vh; padding:16px; background:#EAEDEF; border-radius:14px; }

/* toast */
#toast-host{ position:fixed; bottom:20px; left:50%; transform:translateX(-50%); z-index:9999; display:flex; flex-direction:column; gap:8px; align-items:center; }
.toast{
  background:var(--ink); color:#fff; padding:11px 18px; border-radius:9px; font-size:13px; font-weight:500;
  box-shadow:0 8px 24px rgba(0,0,0,.25); display:flex; align-items:center; gap:9px;
  animation:toast-in .18s ease-out;
}
.toast.success{ background:var(--success); }
.toast.error{ background:var(--danger); }
@keyframes toast-in{ from{ opacity:0; transform:translateY(8px);} to{opacity:1; transform:translateY(0);} }

/* modal */
.modal-backdrop{ position:fixed; inset:0; background:rgba(15,23,32,.55); display:flex; align-items:center; justify-content:center; z-index:9998; padding:20px; }
.modal{ background:#fff; border-radius:14px; max-width:440px; width:100%; padding:26px; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.modal h3{ margin:0 0 8px; font-size:16px; }
.modal p{ margin:0 0 18px; font-size:13.5px; color:var(--muted); line-height:1.5; }
.modal .row{ display:flex; gap:10px; justify-content:flex-end; }
.modal-field{ margin-bottom:12px; }
.modal-field label{ display:block; font-size:11.5px; font-weight:600; color:var(--muted); margin-bottom:4px; }
.modal-field .box{ padding:9px 11px; border:1px solid var(--line); border-radius:8px; font-size:13px; background:#FAFBFC; white-space:pre-wrap; }

.status-pill-lg{ display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:700; padding:5px 12px; border-radius:999px; }

.sr-only{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

/* ---------- Login gate ---------- */
.login-wrap{ min-height:60vh; display:flex; align-items:center; justify-content:center; padding:40px 0; }
.login-card{ background:#fff; border-radius:14px; border:1px solid var(--line); box-shadow:var(--shadow); width:100%; max-width:360px; padding:32px 28px; text-align:center; }
.login-logo{ width:56px; height:56px; margin:0 auto 16px; border-radius:12px; background:#fff; border:1px solid var(--line); padding:6px; display:flex; align-items:center; justify-content:center; }
.login-logo img{ width:100%; height:100%; object-fit:contain; }
.login-card h2{ margin:0 0 6px; font-size:17px; }
.login-card .hint{ margin:0 0 20px; font-size:12.5px; color:var(--muted); }
.login-card .field{ text-align:left; }
.logout-btn{ background:transparent; border:1px solid rgba(255,255,255,.25); color:#CBD9E5; padding:8px 14px; border-radius:8px; font-size:12.5px; font-weight:600; }
.logout-btn:hover{ background:rgba(255,255,255,.1); color:#fff; }
.current-user-badge{ color:#CBD9E5; font-size:12.5px; font-weight:600; margin-right:4px; white-space:nowrap; }
button.current-user-badge{ background:transparent; border:1px dashed rgba(255,255,255,.3); border-radius:8px; padding:7px 10px; cursor:pointer; font-family:inherit; }
button.current-user-badge:hover{ background:rgba(255,255,255,.1); color:#fff; }
.login-error{ margin:-4px 0 14px; font-size:12.5px; color:var(--danger); text-align:left; }
.login-remember{ display:flex; align-items:center; gap:8px; margin:-2px 0 14px; font-size:12.5px; color:var(--muted); text-align:left; cursor:pointer; }

/* ---------- Save error bar / load error ---------- */
.save-error-bar{
  position:fixed; left:50%; bottom:20px; transform:translateX(-50%); z-index:9999;
  width:min(720px, calc(100% - 32px)); display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background:#fff; border:1px solid var(--danger); border-left:5px solid var(--danger); border-radius:10px;
  padding:12px 14px; box-shadow:0 12px 32px rgba(0,0,0,.22); font-size:13px;
}
.save-error-bar .msg{ flex:1; min-width:200px; color:var(--ink); }
.save-error-bar strong{ color:var(--danger); }
.load-error{ padding:48px 24px; text-align:center; }
.load-error h3{ margin:0 0 8px; color:var(--danger); }
.load-error p{ margin:0 0 18px; color:var(--muted); font-size:13.5px; }

/* ---------- Wide modal + lists inside modals ---------- */
.modal.modal-wide{ max-width:720px; max-height:calc(100vh - 40px); overflow:auto; }
.modal.modal-wide > h3{ margin-bottom:14px; }
.modal .row.wrap{ flex-wrap:wrap; }
.modal.modal-preview{ max-width:780px; max-height:calc(100vh - 40px); display:flex; flex-direction:column; padding:18px; }
.modal-preview .preview-modal-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
.modal-preview .preview-modal-head h3{ margin:0; }
.modal-preview .preview-scale{ flex:1; min-height:0; max-height:none; }
.modal-list{ border:1px solid var(--line); border-radius:10px; margin-bottom:16px; max-height:52vh; overflow:auto; }
.modal-list-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 14px; border-bottom:1px solid var(--line-2); font-size:13px; }
.modal-list-row:last-child{ border-bottom:none; }
.modal-list-row .sub, .modal-list-row > .sub{ color:var(--muted); font-size:12px; margin-top:2px; }
.modal-list-row .actions{ display:flex; gap:6px; flex-shrink:0; }
.modal-section{ margin-bottom:18px; }
.modal-section h4{ margin:0 0 8px; font-size:13.5px; }
.modal-section .btns{ display:flex; gap:8px; flex-wrap:wrap; }
.modal-section .hint{ margin:0 0 10px; font-size:12px; color:var(--muted); }

/* ---------- Form extras ---------- */
.discount-row{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 0; font-size:13px; color:var(--muted); }
.discount-row .ctrl{ display:flex; gap:6px; }
.discount-row input, .discount-row select{ padding:6px 8px; border:1px solid var(--line); border-radius:7px; font-size:13px; background:#fff; }
.discount-row input{ width:110px; text-align:right; font-family:'IBM Plex Mono',monospace; }
.totals-inner .words{ margin-top:8px; font-size:12px; color:var(--muted); font-style:italic; text-align:right; }
.section-actions{ display:flex; gap:8px; flex-wrap:wrap; margin-top:14px; }
.save-state{ font-size:12px; color:var(--muted); align-self:center; }
.save-state.dirty{ color:var(--amber-dark); }

/* ---------- Customers page (khachhang.html) ---------- */
.stats.cols-4{ grid-template-columns:repeat(4,1fr); }
@media(max-width:920px){ .stats.cols-4{ grid-template-columns:repeat(2,1fr); } }
.badge.directory{ background:var(--sent-bg); color:var(--success); }
.badge.directory:before{ background:var(--success); }
.badge.from-quotes{ background:#FDF1E1; color:var(--amber-dark); }
.badge.from-quotes:before{ background:var(--amber); }
.code-cell{ font-family:'IBM Plex Mono',monospace; font-weight:600; color:var(--navy); white-space:nowrap; }
.muted{ color:var(--muted); }
.customer-form .field-grid{ margin-bottom:0; }
.customer-form .field-grid .field{ margin-bottom:14px; }
.customer-form .field textarea{ min-height:52px; }
.customer-quotes{ margin:4px 0 16px; }
.customer-quotes h4{ margin:0 0 8px; font-size:13px; }
.customer-quotes a{ text-decoration:none; }
.customer-quotes a:hover .ref-cell{ text-decoration:underline; }

/* =========================================================================
   MOBILE (≤640px) — desktop styles above are unchanged. Bigger touch
   targets, 16px inputs (no iOS zoom on focus), tables shown as cards
   (labels from each cell's data-label), a compact bottom action bar.
   ========================================================================= */
@media(max-width:640px){
  body{ background:linear-gradient(180deg, var(--navy) 0px, var(--navy) 132px, transparent 132px), #F1F3F5; }
  #shell{ padding:0 12px 40px; }

  /* header: logo + logout on one row, tabs as one swipeable row */
  .topbar{ display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:8px; padding:14px 0; }
  button.current-user-badge{ margin:0; max-width:120px; overflow:hidden; text-overflow:ellipsis; padding:8px 10px; }
  .brand{ gap:10px; }
  .brand-mark{ width:36px; height:36px; padding:4px; border-radius:9px; }
  .brand-text h1{ font-size:16px; }
  .brand-text p{ font-size:11.5px; }
  .logout-btn{ align-self:center; padding:8px 12px; }
  .tabs{
    grid-column:1 / -1; order:3; flex-wrap:nowrap; justify-content:flex-start;
    overflow-x:auto; scrollbar-width:none; -webkit-overflow-scrolling:touch;
  }
  .tabs::-webkit-scrollbar{ display:none; }
  .tab-btn{ padding:10px 14px; font-size:13.5px; }

  /* touch-friendly controls */
  .btn{ padding:11px 14px; font-size:14px; border-radius:10px; }
  .btn-sm{ padding:9px 12px; font-size:13px; }
  .btn-icon.btn-sm{ padding:9px; }
  .field input, .field select, .field textarea,
  input.search, select.filter, input.filter[type="date"]{ font-size:16px; padding:11px 12px; border-radius:10px; }
  input.search{ padding-left:38px; }
  .field label{ font-size:12.5px; }

  /* stats */
  .stats, .stats.cols-4{ grid-template-columns:repeat(2,1fr); gap:10px; margin-bottom:14px; }
  .stat{ padding:14px 14px 12px; }
  .stat .num{ font-size:22px; }
  .stat .lbl{ font-size:12px; margin-top:6px; }
  .stats .stat:last-child:nth-child(odd){ grid-column:1 / -1; }

  /* toolbar: search full width, filters in two columns, buttons fill rows */
  .toolbar{ display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-bottom:12px; }
  .toolbar > *{ min-width:0; }
  .toolbar .search-wrap{ grid-column:1 / -1; min-width:0; }
  .toolbar select.filter{ width:100%; }
  .toolbar .date-range{ grid-column:1 / -1; display:grid; grid-template-columns:1fr 1fr auto; gap:8px; }
  .toolbar .date-range label{ min-width:0; }
  .toolbar .date-range input{ flex:1; min-width:0; width:100%; }
  .toolbar .btn-primary, .toolbar select.filter:only-of-type{ grid-column:1 / -1; }

  /* list tables → cards */
  .table-scroll{ overflow:visible; }
  .list-table, .list-table tbody{ display:block; }
  .list-table thead{ display:none; }
  .list-table tbody tr{ display:block; padding:14px 16px; border-bottom:1px solid var(--line); }
  .list-table tbody tr:last-child{ border-bottom:none; }
  .list-table tbody tr:hover{ background:transparent; }
  .list-table tbody td{ display:block; padding:0; border:none; font-size:13.5px; }
  .list-table .ref-cell, .list-table .company-cell .name, .list-table .company-cell .sub{ max-width:none; white-space:normal; }

  /* quotation list card: ref · status / customer / date · amount / creator · result / actions */
  .quote-list tbody tr{
    display:grid; grid-template-columns:1fr auto; gap:8px 12px; align-items:center;
    grid-template-areas:"ref status" "company company" "date amount" "creator result" "orderdate deliverydate" "actions actions";
  }
  .quote-list tbody td{ padding:0 !important; font-size:13px; }
  .quote-list .c-ref{ grid-area:ref; }
  .quote-list .c-ref .ref-cell{ font-size:14px; }
  .quote-list .c-status{ grid-area:status; justify-self:end; }
  .quote-list .c-company{ grid-area:company; }
  .quote-list .company-cell .name{ font-size:14.5px; font-weight:700; }
  .quote-list .company-cell .sub{ font-size:12.5px; }
  .quote-list .c-date{ grid-area:date; color:var(--muted); }
  .quote-list .c-amount{ grid-area:amount; justify-self:end; font-size:14.5px; color:var(--navy); }
  .quote-list .c-creator{ grid-area:creator; color:var(--muted); }
  .quote-list .c-creator::before{ content:"Người tạo: "; }
  .quote-list .c-result{ grid-area:result; justify-self:end; }
  .quote-list .result-select{ font-size:14px; padding:7px 10px; }
  .quote-list .c-order-date{ grid-area:orderdate; color:var(--muted); }
  .quote-list .c-delivery-date{ grid-area:deliverydate; justify-self:end; color:var(--muted); }
  .quote-list .c-order-date::before{ content:"Đặt: "; }
  .quote-list .c-delivery-date::before{ content:"Giao: "; }
  .quote-list .c-actions{ grid-area:actions; padding-top:8px !important; border-top:1px dashed var(--line); }
  .quote-list .row-actions{ justify-content:space-between; gap:6px; }
  .quote-list .row-actions .btn-icon{ flex:1; padding:10px; }

  /* customer / product list cards: title first, then label · value rows */
  .card-list tbody tr{ display:flex; flex-direction:column; gap:6px; }
  .card-list tbody td.c-title{ order:-1; font-weight:700; font-size:14.5px; }
  .card-list tbody td[data-label]{ display:flex; gap:10px; justify-content:space-between; text-align:right !important; }
  .card-list tbody td[data-label]::before{ content:attr(data-label); color:var(--muted); font-size:12px; font-weight:600; text-align:left; flex-shrink:0; font-family:'Inter',sans-serif; }
  .card-list .company-cell{ text-align:right; }
  .customer-list .company-cell .name, .customer-list .company-cell .sub{ max-width:none; }
  .card-list tbody td.c-actions:not(:has(button)){ display:none; }
  .card-list .row-actions{ gap:8px; margin-top:4px; }
  .card-list .row-actions .btn-icon{ flex:1; padding:10px; }

  /* quotation form */
  .back-link{ font-size:14px; margin:4px 0 12px; }
  .form-header{ margin-bottom:12px; }
  .form-header > .card{ width:100%; }
  .stepper{ justify-content:space-between; }
  .step-line{ flex:1; width:auto; min-width:10px; }
  .form-grid{ gap:12px; }
  .section{ padding:16px 14px 18px; margin-bottom:12px; border-radius:12px; }
  .section h2{ font-size:15px; }
  .field-grid{ gap:0 12px; }
  .field-grid .field{ margin-bottom:14px; }
  .section-head{ margin-bottom:12px; }
  .excel-btn{ padding:7px 12px 7px 8px; font-size:13px; }

  /* line items → one card per line */
  .items-table-wrap{ overflow:visible; border:none; border-radius:0; }
  table.items{ min-width:0; display:block; }
  table.items thead{ display:none; }
  table.items tbody{ display:flex; flex-direction:column; gap:10px; }
  table.items tbody tr{
    display:grid; grid-template-columns:64px 1fr 1fr 40px; gap:8px;
    grid-template-areas:"sn code code rm" "desc desc desc desc" "qty qty uom uom" "price price total total" "vat vat disc disc";
    padding:12px; border:1px solid var(--line); border-radius:12px; background:#fff;
  }
  table.items tbody td{ display:block; padding:0; border:none !important; min-width:0; width:auto !important; }
  table.items tbody td[data-label]::before{
    content:attr(data-label); display:block; margin:0 0 4px 2px;
    font-size:11px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted);
  }
  table.items td.rm{ grid-area:rm; padding:0; display:flex; align-items:flex-start; justify-content:flex-end; }
  table.items td.sn{ grid-area:sn; padding:0; }
  table.items td.code{ grid-area:code; }
  table.items td.desc-cell{ grid-area:desc; }
  table.items td.c-qty{ grid-area:qty; }
  table.items td.c-uom{ grid-area:uom; }
  table.items td.c-price{ grid-area:price; }
  table.items td.c-total{ grid-area:total; }
  table.items td.c-vat{ grid-area:vat; }
  table.items td.c-disc{ grid-area:disc; }
  table.items input, table.items select, table.items textarea{
    font-size:16px; padding:10px 11px; border:1px solid var(--line); background:#fff; border-radius:9px;
  }
  table.items td.sn input{ font-size:16px; padding:10px 4px; }
  table.items textarea{ min-height:44px; }
  table.items .desc-edit{ font-size:16px; padding:10px 11px; border:1px solid var(--line); background:#fff; border-radius:9px; min-height:44px; }
  table.items .fmt-btn{ width:30px; height:28px; font-size:14px; }
  table.items .fmt-color{ width:22px; height:22px; }
  .rm-btn{ width:36px; height:36px; font-size:17px; background:var(--line-2); border-radius:9px; }
  table.items .item-image{ padding:8px 2px 0; gap:16px; }
  table.items .item-image .btn-link{ font-size:13.5px; padding:4px 0; }
  table.items .item-image img{ max-width:88px; max-height:66px; }
  table.items tr.note-row{ grid-template-columns:1fr 40px; grid-template-areas:"note rm"; background:#FFFDF6; }
  table.items tr.note-row td{ background:transparent; }
  table.items tr.note-row td:not(.rm){ grid-area:note; }
  .add-row-bar{ margin-top:10px; gap:8px; }
  .add-row-bar .add-row-btn, .add-row-bar .add-row-btn + .add-row-btn{
    flex:1; border:1.5px dashed var(--line); border-radius:10px; padding:13px; font-size:14px;
  }
  .add-row-bar .add-row-btn + .add-row-btn{ flex:0 0 38%; }
  .excel-bar{ font-size:13px; }
  .excel-bar > span:first-of-type{ min-width:0; flex-basis:100%; }

  .totals-box{ margin-top:16px; }
  .totals-inner{ max-width:none; background:#F7F8F9; border-radius:10px; padding:8px 14px 12px; }
  .totals-inner .trow{ font-size:13.5px; }
  .discount-row input{ width:96px; font-size:16px; }
  .discount-row select{ font-size:16px; }
  .section-actions .btn{ flex:1; }

  /* preview: the A4 page shrunk to the screen width (see zoom steps below) */
  .preview-wrap{ position:static; }
  .preview-scale{ max-height:none; padding:10px; border-radius:12px; }
  .preview-scale .doc{ zoom:.8; }

  /* bottom action bar: icon above label, all actions in one row */
  .action-bar{
    position:sticky; bottom:0; z-index:50; margin:12px -12px 0; padding:8px 8px calc(8px + env(safe-area-inset-bottom));
    border-radius:16px 16px 0 0; border-bottom:none; display:flex; flex-wrap:wrap; gap:4px;
    box-shadow:0 -6px 20px -8px rgba(18,42,66,.25);
  }
  .action-bar .spacer, .action-bar #cancel-btn{ display:none; }
  .action-bar .save-state{ flex:0 0 100%; text-align:center; font-size:11.5px; order:-1; }
  .action-bar .save-state:empty{ display:none; }
  .action-bar .btn{
    flex:1 1 0; min-width:0; flex-direction:column; gap:4px; padding:8px 4px; font-size:11.5px; line-height:1.2;
    white-space:normal; text-align:center; border-radius:10px;
  }
  .action-bar .btn svg{ width:18px; height:18px; }

  /* modals: sheet from the bottom, full width */
  .modal-backdrop{ align-items:flex-end; padding:0; }
  .modal, .modal.modal-wide, .modal.modal-preview{
    max-width:none; border-radius:18px 18px 0 0; padding:20px 16px calc(18px + env(safe-area-inset-bottom));
    max-height:92vh; overflow:auto;
  }
  .modal .row{ flex-wrap:wrap; }
  .modal .row .btn{ flex:1 1 auto; }
  .modal-list-row{ flex-wrap:wrap; }
  .customer-form .field-grid{ grid-template-columns:1fr; }

  #toast-host{ bottom:calc(96px + env(safe-area-inset-bottom)); width:calc(100% - 24px); }
  .toast{ width:100%; justify-content:center; text-align:center; }
  .save-error-bar{ bottom:calc(96px + env(safe-area-inset-bottom)); }

  .analytic-panel{ padding:16px 14px; }
}
@media(max-width:560px){ .preview-scale .doc{ zoom:.68; } }
@media(max-width:480px){ .preview-scale .doc{ zoom:.56; } }
@media(max-width:420px){ .preview-scale .doc{ zoom:.53; } }
@media(max-width:380px){ .preview-scale .doc{ zoom:.48; } }
@media(max-width:340px){ .preview-scale .doc{ zoom:.43; } }

/* ---------- Multi-tenant additions (baogiacongty) ---------- */
.brand-mark img{ width:100%; height:100%; object-fit:contain; border-radius:7px; }
.quota-badge{ color:#CBD9E5; font-size:12px; font-weight:600; white-space:nowrap; text-decoration:none;
  border:1px solid rgba(255,255,255,.25); border-radius:999px; padding:6px 11px; margin-right:4px; }
.quota-badge:hover{ background:rgba(255,255,255,.1); color:#fff; }
.quota-badge.low{ border-color:var(--amber); color:#FFD9A8; }
.quota-badge.out{ border-color:var(--danger); background:var(--danger); color:#fff; }
.profile-banner{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  background:#FFF6E8; border:1px solid #F3D2A2; color:#6B4410; border-radius:12px; padding:10px 14px; margin:0 0 16px; font-size:13px; }
.login-alt{ margin:16px 0 0; font-size:13px; color:var(--muted); }
.login-alt a{ color:var(--amber-dark); font-weight:600; }
.login-card.wide{ max-width:440px; }
.login-terms{ display:flex; align-items:flex-start; gap:8px; margin:0 0 14px; font-size:12.5px; color:var(--muted); text-align:left; }

/* Công ty page */
.page-grid{ display:grid; grid-template-columns:minmax(0,2fr) minmax(0,1fr); gap:18px; align-items:start; }
.page-grid .card{ padding:22px; }
.page-grid h3{ margin:0 0 4px; font-size:16px; }
.page-grid .card > p.sub{ margin:0 0 18px; font-size:12.5px; color:var(--muted); }
.logo-picker{ display:flex; align-items:center; gap:14px; }
.logo-preview{ width:96px; height:64px; border:1px dashed var(--line); border-radius:10px; display:flex; align-items:center; justify-content:center; background:#fff; overflow:hidden; color:var(--muted); font-size:11px; }
.logo-preview img{ max-width:100%; max-height:100%; object-fit:contain; }
.quota-meter{ height:10px; border-radius:999px; background:var(--line-2); overflow:hidden; margin:10px 0 6px; }
.quota-meter > div{ height:100%; background:var(--success); border-radius:999px; }
.quota-meter.low > div{ background:var(--amber); }
.quota-meter.out > div{ background:var(--danger); }
.quota-num{ font-size:26px; font-weight:800; color:var(--navy); }
.ref-preview{ font-family:'IBM Plex Mono',monospace; font-weight:600; color:var(--navy); }
@media(max-width:860px){ .page-grid{ grid-template-columns:1fr; } }

/* Quản trị nền tảng */
.admin-table{ width:100%; border-collapse:collapse; font-size:13px; }
.admin-table th, .admin-table td{ text-align:left; padding:10px 8px; border-bottom:1px solid var(--line-2); vertical-align:top; }
.admin-table th{ font-size:11.5px; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; }
.admin-table .num{ text-align:right; font-variant-numeric:tabular-nums; }
.admin-table input{ width:90px; padding:6px 8px; border:1px solid var(--line); border-radius:8px; font:inherit; }
.status-pill{ display:inline-block; padding:2px 8px; border-radius:999px; font-size:11.5px; font-weight:600; background:var(--success-bg); color:var(--success); }
.status-pill.suspended{ background:var(--danger-bg); color:var(--danger); }
.table-scroll{ overflow-x:auto; }
.perm-box{ border:1px solid var(--line); border-radius:10px; padding:12px 14px; margin:4px 0 14px; background:#FAFBFC; }
.perm-box.disabled{ opacity:.55; }
.perm-title{ font-size:12px; font-weight:700; color:var(--muted); margin-bottom:8px; }
.perm-row{ display:flex; align-items:flex-start; gap:8px; font-size:13px; padding:4px 0; cursor:pointer; }
.perm-row small{ display:block; color:var(--muted); font-size:11.5px; }
