/* Gas Kim Hồng admin (05/11/2026). Layout after the Nam Phát admin, Kim Hồng maroon from the Mini App. */
:root {
  --red: #8f3140; --red-dark: #742535; --soft: #f6edef; --soft-line: #ecd6db;
  --ink: #24313b; --muted: #637079; --line: #e5e8eb; --page: #f4f5f7; --card: #fff;
  --green: #17703f; --green-soft: #e5f4ea; --amber: #8a5207; --amber-soft: #fff4dc;
  --blue: #2a55b8; --blue-soft: #e9effb; --grey: #5d6870; --grey-soft: #eef0f2; --danger: #b3261e; --danger-soft: #fdecea;
  --radius: 14px; --shadow: 0 1px 2px rgb(36 49 59 / .06), 0 4px 16px rgb(36 49 59 / .05);
  font-family: 'Be Vietnam Pro', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--page);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.3; letter-spacing: -.3px; }
h2 { font-size: 17px; line-height: 1.35; }
h3 { font-size: 15px; }
.icon { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.muted { color: var(--muted); }
small { font-size: 13px; }
.small { font-size: 13px; }
.mono { font-family: Consolas, 'Cascadia Mono', monospace; font-size: 13px; }
td .mono { white-space: nowrap; }
.skip-link { position: fixed; top: -80px; left: 12px; z-index: 99; background: #fff; padding: 12px; }
.skip-link:focus { top: 8px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-text { color: var(--muted); }
:focus-visible { outline: 3px solid rgb(143 49 64 / .35); outline-offset: 2px; }

/* Shell */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 252px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 52px; height: 42px; object-fit: contain; }
.brand span { display: flex; flex-direction: column; }
.brand strong { font-size: 15px; color: var(--red); letter-spacing: .2px; }
.brand em { font-style: normal; font-size: 13px; color: var(--muted); }
.navigation { flex: 1; overflow: auto; padding: 12px 10px; }
.nav-group { display: block; margin: 16px 12px 6px; font-size: 13px; font-weight: 700; letter-spacing: 1px; color: #8b959c; text-transform: uppercase; }
.nav-group:first-child { margin-top: 4px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; margin: 2px 0; border-radius: 10px; color: #4c5961; font-weight: 600; }
.nav-item:hover { background: #f5f6f8; text-decoration: none; }
.nav-item.active { background: var(--soft); color: var(--red); }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; border-left: 3px solid var(--red); border-radius: 0 3px 3px 0; }
.nav-count { margin-left: auto; min-width: 24px; padding: 1px 7px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 13px; font-weight: 700; text-align: center; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.workspace { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 28px; background: rgb(255 255 255 / .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-title { font-weight: 700; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.who strong { font-size: 14px; }
.who span { font-size: 13px; color: var(--muted); }
main { flex: 1; padding: 24px 28px 40px; max-width: 1320px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 18px; }
.page-head > div:first-child { flex: 1 1 320px; }
.page-head p { margin-top: 4px; color: var(--muted); }
.icon-button.mobile-menu { display: none; }
.scrim { display: none; }

/* Controls */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; background: var(--red); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap; }
.button:hover { background: var(--red-dark); text-decoration: none; }
.button.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.button.secondary:hover { background: #f6f7f8; }
.button.danger { background: #fff; color: var(--danger); border-color: #f0c7c3; }
.button.danger:hover { background: var(--danger-soft); }
.button.ghost { background: transparent; color: var(--ink); border-color: transparent; }
.button.ghost:hover { background: #f1f2f4; }
.button.small { min-height: 44px; padding: 6px 12px; font-size: 13px; }
.button:disabled { opacity: .55; cursor: wait; }
.icon-button { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-weight: 600; font-size: 13px; }
.field small { color: var(--muted); font-size: 13px; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d5dade; border-radius: 10px; background: #fff; }
textarea.input { min-height: 88px; resize: vertical; }
.input:focus { border-color: var(--red); outline: 3px solid rgb(143 49 64 / .14); }
.search { position: relative; flex: 1 1 260px; }
.search .icon { position: absolute; left: 12px; top: 12px; color: var(--muted); }
.search .input { padding-left: 40px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { flex: 0 1 180px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }

/* Cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * > .card:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.grid.two { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.grid.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi strong { font-size: 24px; letter-spacing: -.3px; }
.kpi em { font-style: normal; font-size: 13px; color: var(--muted); }
.todo { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--ink); }
.todo + .todo { margin-top: 8px; }
.todo:hover { background: #fafafb; text-decoration: none; }
.todo strong { margin-left: auto; font-size: 18px; }
.todo.hot { border-color: #f0c7c3; background: var(--danger-soft); }
.todo.hot strong { color: var(--danger); }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 6px; height: 170px; padding-top: 10px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar i { display: block; width: 100%; max-width: 30px; min-height: 3px; border-radius: 6px 6px 2px 2px; background: var(--red); opacity: .85; }
.bar i.zero { background: #dde1e5; }
.bar span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.legend { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: 13px; color: var(--muted); font-weight: 700; background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #fbf6f7; }
td.num, th.num { text-align: right; white-space: nowrap; }
td .sub { display: block; color: var(--muted); font-size: 13px; }
.card table th { background: transparent; }
.card .table-plain td, .card .table-plain th { padding: 10px 6px; }
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 12px; color: var(--muted); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--grey-soft); color: var(--grey); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.plain::before { display: none; }

/* Detail */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 18px; }
.detail-head h1 { font-size: 22px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; }
.facts dt { color: var(--muted); font-size: 13px; font-weight: 600; padding-top: 1px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.timeline li::after { content: ""; position: absolute; left: 7.5px; top: 18px; bottom: 0; border-left: 1px dashed #d4d9dd; }
.timeline li:last-child::after { display: none; }
.timeline time { display: block; font-size: 13px; color: var(--muted); }
.note-box { padding: 12px; border-radius: 10px; background: #fafbfc; border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid; margin-bottom: 16px; }
.alert .icon { margin-top: 1px; }
.alert.warn { background: var(--amber-soft); border-color: #f2dca8; color: #6b4206; }
.alert.danger { background: var(--danger-soft); border-color: #f0c7c3; color: #8c1d16; }
.alert.info { background: var(--blue-soft); border-color: #cddaf5; color: #213f86; }
.alert.ok { background: var(--green-soft); border-color: #c4e5cf; color: #0f5530; }
.alert p + p { margin-top: 4px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist .ok { color: var(--green); }
.checklist .bad { color: var(--danger); }
.secret { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 12px; background: var(--soft); border: 1px dashed var(--soft-line); font-size: 20px; font-weight: 700; letter-spacing: 1px; }

/* Login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 460px); }
.login-side { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 48px; background: linear-gradient(150deg, #8f3140 0%, #6d2231 100%); color: #fff; }
.login-side::after { content: ""; position: absolute; right: -120px; top: -120px; width: 420px; height: 420px; border-radius: 50%; background: rgb(255 255 255 / .06); }
.login-side img { width: 220px; height: auto; background: #fff; border-radius: 16px; padding: 14px 18px; margin-bottom: auto; }
.login-side h1 { font-size: 32px; max-width: 520px; }
.login-side p { max-width: 480px; opacity: .88; }
.login-form { display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: 48px 40px; background: #fff; }
.login-form h2 { font-size: 22px; }
.password-row { position: relative; }
.password-row .input { padding-right: 52px; }
.password-row button { position: absolute; right: 2px; top: 2px; width: 44px; height: 40px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; font-weight: 600; }
.form-stack { display: flex; flex-direction: column; gap: 14px; max-width: 440px; }

/* Dialog and toast */
dialog { width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 16px; padding: 0; box-shadow: 0 24px 60px rgb(0 0 0 / .2); }
dialog::backdrop { background: rgb(20 26 31 / .45); }
.dialog-body { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fafbfc; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 240px; max-width: 380px; padding: 12px 16px; border-radius: 12px; background: #24313b; color: #fff; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }

@media (max-width: 1100px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .grid.halves { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgb(0 0 0 / .18); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgb(20 26 31 / .35); border: 0; }
  .workspace { margin-left: 0; }
  .icon-button.mobile-menu { display: inline-grid; }
  .topbar { padding: 8px 16px; }
  main { padding: 18px 16px 32px; }
  .who { display: none; }
  .login { grid-template-columns: 1fr; }
  .login-side { min-height: 220px; padding: 28px 20px; }
  .login-side img { width: 170px; }
  .login-side h1 { font-size: 24px; }
  .login-form { padding: 28px 20px; }
  .bars span { writing-mode: vertical-rl; }
}
@media (max-width: 700px) {
  /* Tables become one card per row, each value with its column label. */
  .table-wrap { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { margin-bottom: 10px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
  .table-wrap td { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); text-align: left; }
  .table-wrap td.num { text-align: left; }
  /* Long values without spaces (order ids, product codes, audit notes) wrap inside the card instead of widening the page. */
  .table-wrap td, .table-wrap td > * { min-width: 0; overflow-wrap: anywhere; }
  .table-wrap td .mono { white-space: normal; }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td::before { content: attr(data-label); color: var(--muted); font-size: 13px; font-weight: 600; }
  .table-wrap td.cell-actions { display: block; }
  .table-wrap td.cell-actions::before { content: none; }
  .table-wrap .empty { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
  .card .table-wrap tr { box-shadow: none; }
}
@media (max-width: 560px) {
  .grid.kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi strong { font-size: 20px; }
  .card { padding: 14px; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin-bottom: 8px; }
}
