/* Kho & Phiếu — skin in the style of Apple's own apps (loaded after style.css).
   Follows the iOS / macOS system look: grouped grey background, white inset-grouped cards with hairline separators,
   one system-blue tint, system fonts, translucent navigation and tab bars, push transition for detail screens.
   No gradients, no decorative shadows, no emoji. Light + dark use Apple's system colours. */
:root, :root[data-theme="light"] {
  --mat: #007aff;            /* systemBlue */
  --mat-strong: #0062cc;
  --mat-soft: #e5f1ff;
  --go: #34c759;             /* systemGreen */
  --go-2: #2fb350;
  --bg: #f2f2f7;             /* systemGroupedBackground */
  --surface: #ffffff;
  --sunken: #ececf0;         /* tertiary fill */
  --fill: rgba(118, 118, 128, .12);
  --hover: #f7f7f9;
  --press: #e5e5ea;
  --ink: #000000;
  --ink-2: #3c3c43;
  --muted: #8a8a8e;          /* secondaryLabel */
  --line: #c6c6c8;           /* separator */
  --edge: #d1d1d6;
  --ok: #248a3d;   --ok-bg: #e4f6e8;
  --wait: #c93400; --wait-bg: #fff0e0;
  --work: #007aff; --work-bg: #e5f1ff;
  --err: #d70015;  --err-bg: #ffe6e4;
  --violet: #8944ab;
  --bars: rgba(249, 249, 249, .94);
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --r: 10px;
  --r-sm: 8px;
  --hair: .5px;
  --rail: 240px;
  --top: 56px;
  --panel: min(560px, 46vw);
  --shadow-sm: none;
  --shadow: 0 2px 10px rgba(0, 0, 0, .08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .18);
  --push: cubic-bezier(.32, .72, 0, 1);   /* UIKit navigation push */
  color-scheme: light;
}
:root[data-theme="dark"] {
  --mat: #0a84ff; --mat-strong: #409cff; --mat-soft: #0a2a4d;
  --go: #30d158; --go-2: #28b84c;
  --bg: #000000; --surface: #1c1c1e; --sunken: #2c2c2e; --fill: rgba(118, 118, 128, .24); --hover: #242426; --press: #3a3a3c;
  --ink: #ffffff; --ink-2: #ebebf0; --muted: #8d8d93; --line: #38383a; --edge: #48484a;
  --ok: #30d158; --ok-bg: #0f2e18; --wait: #ff9f0a; --wait-bg: #33230a; --work: #0a84ff; --work-bg: #0a2a4d;
  --err: #ff453a; --err-bg: #3a1311; --violet: #bf5af2;
  --bars: rgba(22, 22, 24, .9);
  --shadow: 0 2px 10px rgba(0, 0, 0, .5);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
html { background: var(--bg); }
body { font: 16px/1.4 var(--body); letter-spacing: -.01em; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1 { font: 700 28px/1.15 var(--display); letter-spacing: .01em; color: var(--ink); }
h2 { font: 600 20px/1.25 var(--display); letter-spacing: .01em; }
h3, .b-title { font: 400 13px/1.3 var(--body); color: var(--muted); text-transform: uppercase; letter-spacing: -.005em; }
a, .link { color: var(--mat); text-decoration: none; }
a:active, .link:active { opacity: .45; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--mat) 45%, transparent); outline-offset: 1px; border-radius: 6px; }
.mono, .code, .imei { font-family: var(--mono); font-size: .93em; letter-spacing: 0; }
.code { font-weight: 500; color: var(--ink); }
.muted { color: var(--muted); }
#statusStrip { display: none !important; }
::selection { background: color-mix(in srgb, var(--mat) 25%, transparent); }

/* empty state: grey glyph + grey text, like an empty Notes / Mail folder */
.empty { border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--muted); padding: 48px 20px; font-size: 15px; }
.empty::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 10px; background-color: var(--muted); opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z'/%3E%3C/svg%3E") center / contain no-repeat; }
.empty.sm { padding: 8px 0; font-size: 14px; }
.empty.sm::before { display: none; }

/* ---------- buttons: filled (primary), gray (secondary), plain text ---------- */
.btn { border-radius: var(--r); border: 0; background: var(--fill); color: var(--mat); font: 600 15px/1 var(--body); letter-spacing: -.01em;
  min-height: 40px; padding: 10px 16px; box-shadow: none; transition: opacity .15s, background-color .15s; }
.btn:hover { background: color-mix(in srgb, var(--fill) 100%, rgba(118, 118, 128, .06)); }
.btn:active { transform: none; opacity: .55; }
.btn.primary { background: var(--mat); color: #fff; }
.btn.primary:hover { background: var(--mat-strong); }
.btn.ghost, .btn.light { background: var(--fill); color: var(--mat); }
.btn.danger { background: var(--fill); color: var(--err); }
.btn.danger:hover { background: var(--err-bg); }
.btn.danger.block, .danger-zone .btn.danger { background: var(--err); color: #fff; }
.btn.sm { min-height: 32px; padding: 7px 12px; font-size: 14px; border-radius: var(--r-sm); }
.btn:disabled, .btn:disabled:hover { background: var(--fill); color: color-mix(in srgb, var(--muted) 70%, transparent); opacity: 1; }
a.btn, a.btn:hover { text-decoration: none; }
.icon-btn { border-radius: 50%; border: 0; background: var(--fill); color: var(--mat); width: 36px; height: 36px; box-shadow: none; }
.icon-btn:active { opacity: .55; }
.icon-btn i, .tabbar i { border-radius: 9px; background: #ff3b30; color: #fff; font: 600 11px/18px var(--body); min-width: 18px; height: 18px; box-shadow: none; }

/* ---------- inputs ---------- */
input, select, textarea { border-radius: var(--r-sm); border: var(--hair) solid var(--edge); background: var(--surface); color: var(--ink); font: 16px var(--body);
  padding: 9px 12px; min-height: 42px; box-shadow: none; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--mat); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mat) 22%, transparent); outline: none; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input.filled { background: color-mix(in srgb, #ffcc00 14%, var(--surface)); }
.field > span { font-size: 13px; font-weight: 400; color: var(--muted); text-transform: uppercase; }
.field em { color: var(--err); font-style: normal; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--mat); min-height: 0; }
/* search fields: grey filled, no border (UISearchBar) */
input.search, .search input, .gsearch input, input[type="search"] { background-color: var(--fill); border: 0; border-radius: 10px; min-height: 38px; }
input.search:focus, .gsearch input:focus, input[type="search"]:focus { box-shadow: none; background-color: var(--fill); }

/* chips: capsule filters; the selected one is filled with the tint */
.chips { gap: 8px; }
.chips button { border-radius: 999px; border: 0; background: var(--fill); color: var(--ink); padding: 7px 14px; font-size: 14px; font-weight: 500; transition: background-color .15s, color .15s; }
.chips button:active { opacity: .55; }
.chips button.on, .chips.pick button.on { background: var(--mat); color: #fff; }

/* seg: UISegmentedControl */
.seg { background: var(--fill); border: 0; border-radius: 9px; padding: 2px; gap: 0; }
.seg button { border: 0; border-radius: 7px; padding: 6px 14px; font-size: 13.5px; font-weight: 500; color: var(--ink); background: none; transition: background-color .2s, box-shadow .2s; }
.seg button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }
:root[data-theme="dark"] .seg button.active { background: #636366; }
.seg b { border-radius: 9px; background: #ff3b30; color: #fff; font-weight: 600; padding: 0 6px; font-size: 11px; margin-left: 5px; }

/* ---------- labels ---------- */
.pill { border-radius: 6px; padding: 2px 8px; font: 500 12.5px/1.45 var(--body); border: 0; animation: none !important; }
.pill::before { display: none; }
.pill.done, .pill.cancel { background: var(--fill); color: var(--muted); }
.tag, .tier, .type, .dept-tag { border-radius: 6px; font: 500 12px/1.5 var(--body); text-transform: none; letter-spacing: 0; padding: 1px 7px; }
.dept-tag { background: var(--fill); color: var(--muted); }
.tag.red { background: var(--err-bg); color: var(--err); }
.type.t-ban { background: var(--ok-bg); color: var(--ok); } .type.t-sua { background: var(--wait-bg); color: var(--wait); }
.type.t-cskh { background: color-mix(in srgb, var(--violet) 14%, var(--surface)); color: var(--violet); }
.tier.dealer { background: var(--work-bg); color: var(--work); }
.avatar { background: #8e8e93; color: #fff; font-weight: 600; }
.msg { border-radius: var(--r-sm); }
.msg.err:not(:empty) { background: var(--err-bg); color: var(--err); padding: 10px 12px; }
.msg.ok:not(:empty) { background: var(--ok-bg); color: var(--ok); padding: 10px 12px; }
.toast { border-radius: 12px; background: rgba(30, 30, 30, .88); color: #fff; border: 0; box-shadow: var(--shadow); font: 500 15px var(--body); padding: 12px 18px;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
:root[data-theme="dark"] .toast { background: rgba(60, 60, 62, .92); }
.pulse-btn, .staff-chat-banner, .chat-status-bar, #topChatBadge, .top-chat-btn i { animation: none !important; }

/* ---------- inset grouped cards ---------- */
.group { background: var(--surface); border: 0; border-radius: var(--r); box-shadow: none; padding: 2px 16px 12px; margin-bottom: 20px; }
.group h3 { margin: 12px 0 6px; }
.kv { border-color: var(--line); border-bottom-width: var(--hair); padding: 11px 0; }
.kv > span { color: var(--ink); }
.kv > b { font-weight: 400; color: var(--muted); }
.kv.strong > b { font-weight: 600; color: var(--ink); }
.rep-grid > div { background: var(--bg); border: 0; border-radius: var(--r-sm); }
.rep-grid span { font-size: 13px; color: var(--muted); }
.rep-grid b { font: 600 17px var(--body); }

/* KPI tiles; icons are small solid rounded squares like the Settings app */
.kpis { gap: 10px; }
.kpi { background: var(--surface); border: 0; border-radius: var(--r); box-shadow: none; padding: 14px; }
.kpi-ic { width: 29px; height: 29px; border-radius: 7px; background: var(--mat); color: #fff; }
.kpi-ic .ic { width: 17px; height: 17px; }
.kpi:nth-child(2) .kpi-ic { background: var(--go); color: #fff; }
.kpi:nth-child(3) .kpi-ic { background: #ff9500; color: #fff; }
.kpi:nth-child(4) .kpi-ic { background: #af52de; color: #fff; }
.kpi-l { font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 400; }
.kpi-v { font: 700 24px/1.15 var(--display); letter-spacing: .01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart .b-sale { fill: var(--mat); }
.meter { border-radius: 999px; background: var(--fill); } .meter i { border-radius: 999px; background: var(--mat); }

/* ---------- lists & tables ---------- */
.list { border: 0; border-radius: var(--r); box-shadow: none; background: var(--surface); }
.trow { border-top: var(--hair) solid var(--line); padding: 12px 16px; transition: background-color .2s; }
.trow:hover { background-color: var(--hover); }
.trow:active { background-color: var(--press); transition: none; }
.trow.current { background-color: var(--mat-soft); box-shadow: none; }
.thead, .thead:hover { background: var(--surface) !important; color: var(--muted) !important; font: 400 13px var(--body) !important; text-transform: uppercase !important; letter-spacing: 0 !important; }
.tk .c-cust b { font-weight: 600; }
.table-wrap { border: 0; border-radius: var(--r); background: var(--surface); box-shadow: none; }
.tbl th { background: var(--surface); color: var(--muted); text-transform: uppercase; letter-spacing: 0; font: 400 12.5px var(--body); padding: 10px 12px; border-bottom: var(--hair) solid var(--line); }
.tbl td { padding: 11px 12px; border-bottom: var(--hair) solid var(--line); }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tfoot td { background: var(--surface); font-weight: 600; }
.hist-row, .route, .prof-row, .si-row, .task, .staff, .stock, .bc, .pick-item { border-radius: var(--r) !important; box-shadow: none !important; }

/* ---------- other components ---------- */
.type-pick { gap: 0; background: var(--surface); border-radius: var(--r); overflow: hidden; }
.type-pick a, .type-pick button { border: 0; border-top: var(--hair) solid var(--line); border-radius: 0; background: var(--surface) no-repeat right 16px center / 8px 13px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath d='M1.5 1.5 6.5 6.5 1.5 11.5' fill='none' stroke='%23c4c4c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  padding: 12px 36px 12px 16px; box-shadow: none; }
.type-pick > :first-child { border-top: 0; }
.type-pick a:hover, .type-pick button:hover { border-color: var(--line); background-color: var(--hover); }
.type-pick a:active, .type-pick button:active { background-color: var(--press); }
.type-pick b { font-weight: 400; color: var(--ink); font-size: 17px; }
.type-pick span { font-size: 13.5px; }
.pay-ed, .ph-pick { background: var(--bg); border: 0; border-radius: var(--r-sm); }
.pay-x { border-radius: var(--r-sm); }
.punch { border-radius: var(--r); box-shadow: none; border: 0; }
.punch-btn { border-radius: 12px; font-size: 17px; min-height: 50px; }
.punch-btn.primary { background: var(--go); color: #fff; }
.punch-btn:disabled, .punch-btn.primary:disabled { background: var(--fill); color: var(--muted); }
.board-stats button { border-radius: var(--r); border: 0; background: var(--surface); box-shadow: none; }
.board-stats button:active { opacity: .6; }
.board-stats button.on { background: var(--mat); color: #fff; }
.board-stats button.on span, .board-stats button.on b { color: #fff; }
.g-results { border-radius: 12px; border: var(--hair) solid var(--line); box-shadow: var(--shadow-lg); background: var(--surface); }
/* detail tabs inside a ticket: segmented control */
.dtabs { background: var(--bg); border-bottom: 0; gap: 0; padding: 6px 0 !important; }
.dtabs::before { content: ""; position: absolute; inset: 6px 0; background: var(--fill); border-radius: 9px; z-index: -1; }
.dtab { flex: 1; justify-content: center; border: 0; border-radius: 7px; padding: 6px 8px; margin: 2px; font-size: 13.5px; font-weight: 500; color: var(--ink); background: none; }
.dtab.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); border: 0; }
:root[data-theme="dark"] .dtab.on { background: #636366; }
.danger-zone { border: 0; }
.chat-group-card { display: flex; align-items: center; gap: 10px; border: 0; border-top: var(--hair) solid var(--line); background: none; border-radius: 0; padding: 10px 0 !important; margin: 0 !important; }
.chat-group-card:hover { background: none; transform: none; box-shadow: none; }
.chat-group-card.pending-card { background: none; border-color: var(--line); }
.chat-group-title { flex: 1; min-width: 0; }
.chat-group-title b { font-weight: 400; font-size: 16px; }
.chat-group-title .ok { color: var(--ok); font-weight: 400 !important; }
.chat-group-title .neg { color: var(--wait); font-weight: 400 !important; }
.chat-group-card .btn { flex: 0 0 auto; }
.chat-alert-box { border: 0; border-radius: var(--r-sm); background: var(--bg) !important; color: var(--ink) !important; }
.chat-alert-box b { color: var(--ink); }
.chat-alert-box p b { display: inline; margin: 0; }
.account > div { min-width: 0; }
.account > div > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour { background: rgba(0, 0, 0, .4); }
.tour-card { border-radius: 14px; box-shadow: var(--shadow-lg); text-align: center; animation: alertIn .25s ease-out; }
.tour-card b { font: 600 17px var(--body); }
.tour-card .btns { justify-content: stretch; }
.tour-card .btns .btn { flex: 1; }
@keyframes alertIn { from { opacity: 0; transform: scale(1.1); } to { opacity: 1; transform: none; } }

/* Google Chat reminder: one plain row with a Messages-style icon */
.staff-chat-banner { margin: 4px 0 16px; padding: 10px 14px; gap: 12px; border: 0; border-radius: var(--r); box-shadow: none; background: var(--surface);
  flex-direction: row !important; align-items: center !important; cursor: pointer; }
.staff-chat-banner:hover { transform: none; box-shadow: none; }
.staff-chat-banner .banner-icon { width: 29px; height: 29px; border-radius: 7px; background: var(--go); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.staff-chat-banner .banner-icon .ic { width: 17px; height: 17px; }
.staff-chat-banner .banner-body b { font: 400 16px var(--body); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-chat-banner .banner-body span { display: none; }
.staff-chat-banner button { width: auto !important; flex: 0 0 auto; min-height: 30px; padding: 6px 12px; font-size: 14px; border-radius: 999px; }

.login { background: var(--bg); }

/* ---------- motion: quick fade between tabs, UIKit push for detail screens ---------- */
.view:not([hidden]) { animation: tabFade .18s ease-out both; }
@keyframes tabFade { from { opacity: 0; } to { opacity: 1; } }
.sheet { background: var(--bg); }
.sheet:not([hidden]) { animation: pushIn .5s var(--push) both; }
.sheet.closing { animation: pushOut .3s var(--push) both; pointer-events: none; }
@keyframes pushIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes pushOut { from { transform: none; } to { transform: translateX(100%); } }
#sheetBody > * { animation: none; }
.sheet-head { background: var(--bars); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); border-bottom: var(--hair) solid transparent;
  transition: border-color .2s; }
.sheet.scrolled .sheet-head { border-bottom-color: var(--line); }
.sheet-head #sheetTitle { font: 600 17px var(--body); letter-spacing: -.02em; text-align: center; }
.sheet-head .back { display: inline-flex; align-items: center; gap: 2px; font: 400 17px var(--body); color: var(--mat); }
.sheet-head .back .ic { width: 22px; height: 22px; margin-left: -6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ================= phone & tablet ================= */
@media (max-width: 1023px) {
  body { font-size: 16px; padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 84px); }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 34px; }

  /* navigation bar with large title: transparent at the top, translucent + hairline once scrolled */
  .bar { position: sticky; top: 0; z-index: 20; margin: 0 -16px 6px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 8px;
    background: var(--bg); border-bottom: var(--hair) solid transparent; transition: background-color .2s, border-color .2s, padding .25s ease; }
  .bar h1 { font-size: 34px; font-weight: 700; letter-spacing: .012em; transition: font-size .25s ease; }
  body.scrolled .bar { padding-top: calc(env(safe-area-inset-top, 0px) + 8px); padding-bottom: 8px; background: var(--bars);
    backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); border-bottom-color: var(--line); }
  body.scrolled .bar h1 { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
  .sheet { padding: 0 16px calc(env(safe-area-inset-bottom, 0px) + 32px); }
  .sheet-head { margin: 0 -16px 8px; padding: calc(env(safe-area-inset-top, 0px) + 8px) 8px 8px; min-height: 44px; }
  .dtabs { top: calc(env(safe-area-inset-top, 0px) + 52px); margin: 0 0 12px; }

  /* tab bar: full width, translucent, tinted icon + label */
  .tabbar { left: 0; right: 0; bottom: 0; border: 0; border-top: var(--hair) solid rgba(0, 0, 0, .3); border-radius: 0; padding: 2px 4px calc(env(safe-area-inset-bottom, 0px) + 2px);
    background: var(--bars); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px); box-shadow: none; }
  :root[data-theme="dark"] .tabbar { border-top-color: rgba(255, 255, 255, .15); }
  .tabbar button { gap: 2px; padding: 6px 2px 2px; color: #8e8e93; font-size: 10px; font-weight: 500; letter-spacing: .01em; border-radius: 0; background: none; }
  .tabbar button .ic { width: 25px; height: 25px; }
  .tabbar button.on { color: var(--mat); background: none; box-shadow: none; }
  .tabbar button::before { display: none; }
  .tabbar i { top: 1px; right: calc(50% - 22px); }
  body.sheet-open .tabbar { display: none; }

  .fab { right: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 66px); width: 54px; height: 54px; border-radius: 50%; background: var(--mat); color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .22); }
  .fab:active { opacity: .7; }
  .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); }

  .group { padding: 2px 16px 12px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .board-stats { gap: 8px; }
  /* tappable rows get the disclosure chevron */
  .list > .trow:not(.thead) { padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath d='M1.5 1.5 6.5 6.5 1.5 11.5' fill='none' stroke='%23c4c4c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 8px 13px; }
}

/* ================= desktop (macOS-style window: sidebar, toolbar, content) ================= */
@media (min-width: 1024px) {
  body { font-size: 14px; padding: 0 32px 48px calc(var(--rail) + 32px); }
  .view { max-width: 1320px; margin: 0 auto; }
  .bar { padding: 24px 0 14px; border: 0; }
  h1 { font-size: 26px; font-weight: 700; }
  input, select, textarea { font-size: 14px; min-height: 34px; padding: 7px 10px; }
  .btn { font-size: 14px; min-height: 34px; padding: 8px 14px; border-radius: 8px; }
  .btn.sm { font-size: 13px; min-height: 28px; padding: 5px 10px; border-radius: 7px; }
  .kv { padding: 9px 0; }
  .kpi-v { font-size: 26px; }

  /* sidebar */
  .tabbar { width: var(--rail); padding: 14px 10px; gap: 1px; background: color-mix(in srgb, var(--bg) 70%, var(--surface)); border-right: var(--hair) solid var(--line);
    overflow-y: auto; scrollbar-width: thin; transition: width .25s ease; }
  :root[data-theme="dark"] .tabbar { background: #161618; }
  .tabbar .brand { padding: 4px 10px 18px; gap: 10px; position: relative; }
  .tabbar .brand .logo { width: 32px; height: 32px; border-radius: 8px; background: var(--mat); color: #fff; font: 700 13px var(--display); box-shadow: none; flex: 0 0 auto; }
  .tabbar .brand b { font: 600 15px/1.15 var(--display); }
  .tabbar .brand span { font-size: 12px; color: var(--muted); }
  .tabbar button, .tabbar.many button { gap: 9px; padding: 7px 10px; font-size: 14px; font-weight: 400; color: var(--ink); border-radius: 7px; white-space: nowrap; transition: none; }
  .tabbar button .ic { width: 18px; height: 18px; color: var(--mat); }
  .tabbar button:hover { background: rgba(0, 0, 0, .05); }
  :root[data-theme="dark"] .tabbar button:hover { background: rgba(255, 255, 255, .07); }
  .tabbar button.on { background: var(--mat); color: #fff; font-weight: 500; }
  .tabbar button.on .ic { color: #fff; }
  .tabbar i { box-shadow: none; }
  .tabbar button.on i { background: #fff; color: var(--mat); }
  .tabbar .nav-user { border-color: var(--line); border-top-width: var(--hair); padding: 12px 10px 2px; }
  .tabbar .rail-toggle { position: absolute; right: 0; top: 6px; width: 26px; height: 26px; padding: 0; flex: 0 0 auto; border: 0; border-radius: 6px; background: none;
    color: var(--muted); display: grid; place-items: center; cursor: pointer; }
  .tabbar .rail-toggle:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
  body.rail-mini { --rail: 64px; }
  body.rail-mini .tabbar { padding: 14px 8px; }
  body.rail-mini .tabbar .brand { flex-direction: column; padding: 4px 0 14px; }
  body.rail-mini .tabbar .brand > div, body.rail-mini .tabbar span, body.rail-mini .tabbar .nav-user { display: none; }
  body.rail-mini .tabbar button { justify-content: center; padding: 9px 0; }
  body.rail-mini .tabbar i { right: 4px; top: 4px; transform: none; min-width: 9px; width: 9px; height: 9px; padding: 0; font-size: 0; }
  body.rail-mini .tabbar .rail-toggle { position: static; transform: rotate(180deg); margin-top: 8px; }

  /* toolbar */
  .topbar { margin: 0 -32px; padding: 0 32px; height: 56px; background: var(--bars); backdrop-filter: saturate(1.8) blur(20px); -webkit-backdrop-filter: saturate(1.8) blur(20px);
    border-bottom: var(--hair) solid transparent; transition: border-color .2s; }
  body.scrolled .topbar { border-bottom-color: var(--line); }
  .gsearch input { height: 34px; border-radius: 8px; box-shadow: none; }
  .gsearch kbd { border-radius: 5px; background: var(--surface); border: var(--hair) solid var(--line); }
  #topCreate { height: 34px; }
  .top-user { border-radius: 8px; font-weight: 500; }
  .top-user:hover { background: rgba(0, 0, 0, .05); }
  .top-chat-btn { height: 34px; }
  .toast { bottom: 32px; left: calc(50% + var(--rail) / 2); }

  /* inspector drawer on the right */
  .sheet { inset: 0 0 0 auto; width: var(--panel); border-left: var(--hair) solid var(--line); box-shadow: var(--shadow-lg); padding: 0 22px 32px; }
  .sheet:not([hidden]) { animation-duration: .4s; }
  .sheet-head { margin: 0 -22px; padding: 10px 22px; }
  .sheet-head .back { font-size: 14px; }
  .dtabs { top: 49px; }
  .view, .topbar { transition: margin-right .4s var(--push); }
  .search { max-width: 460px; }
  .kpis { gap: 12px; }
  .staff-chat-banner { margin: 0 0 16px; }
  .staff-chat-banner .banner-body b { font-size: 14px; }
  .list { margin-top: 12px; }
  .type-pick b { font-size: 15px; }
}
@media (min-width: 1024px) and (max-width: 1699px) {
  body.sheet-open .view, body.sheet-open .topbar { margin-right: 0; }
}

/* ---------- photo viewer ---------- */
body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 200; background: #0b0f14; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px 16px; color: #fff; }
.viewer-cap { flex: 1; font-size: 14px; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-x { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; padding: 9px 16px; font: 500 15px var(--body); cursor: pointer; }
.viewer-x:hover { background: rgba(255, 255, 255, .24); }
.viewer-stage { flex: 1; display: grid; place-items: center; padding: 8px 8px calc(env(safe-area-inset-bottom, 0px) + 16px); min-height: 0; }
.viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 2px; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 64px; border: 0; background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 34px; line-height: 1; cursor: pointer; border-radius: 6px; }
.viewer-nav.prev { left: 10px; } .viewer-nav.next { right: 10px; }
.gallery a.ph { cursor: zoom-in; }


/* stock: phone rows inside a model card never overflow; actions line up */
.stock-detail .kv, .stock-item { align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.stock-item > span:first-child { flex: 1 1 260px; min-width: 0; }
.stock-item > span:first-child small { white-space: normal; overflow-wrap: anywhere; margin-top: 2px; }
.stock-item .row-acts { display: flex; gap: 14px; align-items: center; flex: 0 0 auto; margin-left: auto; padding-top: 2px; }
.stock-item .row-acts .link, .stock-item .row-acts button { font: 500 13px var(--body); margin: 0; padding: 0; }
.stock-row > span { min-width: 0; }
.stock-row small { white-space: normal; }
.price-btn { display: inline-block; margin: 0 0 8px; font: 500 13px var(--body); padding: 0; }
.link.danger-link, .danger-link { color: var(--err); }
.kv > span { min-width: 0; }


/* ================= splash screen ================= */
#splash { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; background: var(--bg); color: var(--ink);
  transition: opacity .3s ease, visibility .3s; }
#splash.out { opacity: 0; visibility: hidden; }
.splash-box { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.splash-logo { width: 64px; height: 64px; border-radius: 14px; background: var(--mat); color: #fff; display: grid; place-items: center;
  font: 700 24px var(--display); margin-bottom: 10px; box-shadow: none; }
.splash-box b { font: 600 22px var(--display); letter-spacing: .01em; }
.splash-sub { font-size: 13px; color: var(--muted); }
.splash-bar { width: 160px; height: 3px; border-radius: 3px; background: var(--fill); overflow: hidden; margin-top: 22px; }
.splash-bar i { display: block; width: 40%; height: 100%; background: var(--mat); border-radius: 3px; animation: splash 1.1s ease-in-out infinite; }
@keyframes splash { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .splash-bar i { animation: none; width: 100%; } }

/* ================= targets / shifts / rules / stock age ================= */
#repExtra { display: grid; gap: 16px; margin-top: 16px; }
.tg-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 14px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tg-row:last-child { border-bottom: 0; }
.tg-who small, .tg-bar small { display: block; color: var(--muted); font-size: 12.5px; }
.meter i.ok { background: var(--ok); } .meter i.wait { background: var(--wait); } .meter i.hold { background: var(--err); }
.meter.big { height: 10px; } .tg-mine { margin: 8px 0 0; }
.tbl td small { display: block; color: var(--muted); font-size: 12px; white-space: normal; }
.rules summary { cursor: pointer; padding: 2px 0 8px; }
.rules[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }
#ruleBox { margin-bottom: 12px; }
.stock-item .age { font: 500 11.5px var(--body); color: var(--muted); background: var(--sunken); border-radius: 3px; padding: 1px 6px; margin-left: 6px; }
.stock-item.slow .age { color: var(--wait); background: var(--wait-bg); }
#themeBtn { flex: 0 0 auto; }
@media (min-width: 1024px) { #repExtra { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .tg-row { grid-template-columns: 1fr; gap: 6px; } }
@media (max-width: 1023px) { #themeBtn { display: none; } }
.consent { font-size: 13px; color: var(--muted); margin: -4px 0 6px; }
.paper .privacy-note { display: block; font-size: 9px; margin-top: 4px; color: #333; }
.appr { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.appr:last-child { border-bottom: 0; } .appr small { display: block; color: var(--muted); }
.appr .row-acts { display: flex; gap: 8px; }
.approvals { border-color: var(--wait); }
.close-card .btn { margin-top: 4px; }
.ask-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; } .ask-row input { flex: 1 1 200px; }
.ok-txt { color: var(--ok); } .err-txt { color: var(--err); }
.goods-pick { border: 1px dashed var(--edge); border-radius: var(--r); padding: 10px; margin: 6px 0 10px; }
.gp-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
#invTabs { margin-bottom: 12px; }
.sign-pad { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin: 8px 0; background: var(--sunken); }
.sign-pad canvas { width: 100%; max-width: 100%; aspect-ratio: 3 / 1; background: #fff; border: 1px dashed var(--edge); border-radius: 4px; touch-action: none; display: block; }
.sign-pad .btns { margin-top: 6px; justify-content: space-between; display: flex; }
.qc-box { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.qc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; margin: 6px 0; }
.paper .sig { display: block; max-width: 140px; max-height: 50px; margin: 2px auto; }
#offlineBar { position: fixed; left: 0; right: 0; top: 0; z-index: 400; background: #b26a00; color: #fff; font: 500 13px var(--body); text-align: center;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 6px; }
.guide ol { margin: 8px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.guide summary { cursor: pointer; }
.tour { position: fixed; inset: 0; z-index: 300; background: rgba(10,20,30,.55); display: grid; place-items: center; padding: 16px; }
.tour-card { background: var(--surface); color: var(--ink); padding: 20px; width: min(420px, 100%); box-shadow: var(--shadow-lg); }
.tour-card small { color: var(--muted); } .tour-card b { display: block; font: 500 19px var(--body); margin: 4px 0 8px; }
.tour-card .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.att-head input[type="date"], .att-head input[type="month"] { width: auto; flex: 0 0 auto; }
.kv > b small { display: block; text-align: right; }

/* small corrections */
.punch-btn, .punch-btn:disabled { box-shadow: none !important; border: 0 !important; }
.chat-alert-box, .chat-alert-box.wait, .chat-alert-box.ok { border: 0 !important; }
.check-line { display: flex; align-items: center; gap: 10px; padding: 10px 0 6px; font-size: 15px; }
.check-line input { width: 20px; height: 20px; }
.paid-method { margin: 4px 0 6px; }
form:has(input[name="paid"]:not(:checked)) .paid-method { display: none; }
.paid-hint { font-size: 12.5px; margin: 4px 0 8px; }

/* tasks: who → whom, details, photos */
.task-who { margin: 2px 0 4px; }
.task-note { margin: 4px 0 6px; white-space: pre-line; color: var(--ink-2); font-size: 15px; }
.task-pics { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.task-pic { position: relative; display: block; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--fill); }
.task-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.task-pic button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; line-height: 22px; padding: 0; cursor: pointer; }
.task.unseen { box-shadow: inset 3px 0 0 var(--mat); }
.task-act .task-res { width: 100%; margin: 8px 0; }
.task-banner .banner-icon { background: var(--mat); }

/* partner shops */
form:has(#srcSel option:checked:not([value=""])) .shop-only { display: none; }
form:not(:has(#srcSel option:checked:not([value=""]))) .partner-only { display: none; }
.partner-tag { background: color-mix(in srgb, #af52de 14%, var(--surface)); color: #8944ab; margin-right: 4px; }
.partner-row { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ppay-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 4px; }
.ppay-row select { flex: 0 0 auto; width: auto; }

/* ================= phone: the page never scrolls sideways ================= */
#repExtra, .rep-grid, .kpis { min-width: 0; }
#repExtra > *, .rep-grid > *, .kpis > *, .group, .list, .table-wrap { min-width: 0; max-width: 100%; }
.kv { gap: 10px; }
.kv > span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.kv > .btn, .kv > a.btn, .kv > b { flex: 0 0 auto; }
.att-head, .btns, .bar { flex-wrap: wrap; }
@media (max-width: 1023px) {
  html, body { overflow-x: clip; max-width: 100%; }
  #repExtra { grid-template-columns: minmax(0, 1fr); }
  /* tables become one card per row: label on the left, value on the right */
  .tbl, .tbl tbody, .tbl tfoot, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { padding: 10px 14px; border-bottom: var(--hair) solid var(--line); }
  .tbl tbody tr:last-child { border-bottom: 0; }
  .tbl td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex: 0 0 auto; max-width: 45%; }
  .tbl td:first-child { display: block; text-align: left; font-size: 15px; padding-bottom: 6px; }
  .tbl td:first-child::before { display: none; }
  .tbl td[colspan] { display: block; text-align: left; }
  .tbl td[colspan]::before { display: none; }
  .tbl td small { display: block; }
  .tbl tfoot tr { background: var(--sunken); border-radius: var(--r-sm); }
  .table-wrap { overflow-x: visible; }
}

/* Thu chi */
.cash-card { padding-top: 16px; }
.cash-l { display: block; font-size: 13px; color: var(--muted); }
.cash-v { display: block; font: 700 32px/1.15 var(--display); letter-spacing: .01em; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.cash-methods { margin: 10px 0 4px; }
.cash-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.cash-acts .btn { width: 100%; }
.exp-total { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0 2px; font-size: 15px; }
.exp-total b { font-size: 18px; }
.exp-row small { display: block; }
.exp-row b .link { display: block; margin-top: 4px; font-size: 13px; }
.lock-box summary { cursor: pointer; padding: 12px 0; list-style: none; }
.lock-box #lockDay { width: 100%; }
#finPeriod { margin: 4px 0 6px; }

/* ================= Thêm: iOS Settings-style list ================= */
.set-profile { display: flex; gap: 14px; align-items: center; background: var(--surface); border-radius: var(--r); padding: 14px 16px; margin: 4px 0 6px; }
.set-profile > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-profile b { font-size: 19px; font-weight: 600; }
.set-profile .muted { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-profile .dept-tag { align-self: flex-start; }
.set-h { margin: 22px 16px 6px; }
.set-list { background: var(--surface); border-radius: var(--r); overflow: hidden; margin-bottom: 6px; }
.set-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 14px; border: 0; background: none; color: var(--ink);
  font: 400 16px var(--body); text-align: left; cursor: pointer; position: relative; }
.set-row + .set-row, .set-list > .set-row ~ .set-row, .set-chat > .set-sub { border-top: var(--hair) solid var(--line); }
.set-row:active { background: var(--press); }
.set-ic { width: 29px; height: 29px; border-radius: 7px; background: var(--mat); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.set-ic .ic { width: 17px; height: 17px; color: #fff; }
.set-ic.ic-green { background: var(--go); }
.set-l { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-l small { font-size: 13px; }
.chev { width: 8px; height: 13px; flex: 0 0 auto; background: no-repeat center / 8px 13px
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath d='M1.5 1.5 6.5 6.5 1.5 11.5' fill='none' stroke='%23c4c4c7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.row-badge { font-style: normal; background: #ff3b30; color: #fff; border-radius: 9px; min-width: 20px; height: 20px; padding: 0 6px; font: 600 12px/20px var(--body); text-align: center; }
.danger-row { color: var(--err); justify-content: center; }
.danger-row .set-ic { background: var(--err); }
.danger-row .chev { display: none; }
.set-chat summary { list-style: none; }
.set-chat summary::-webkit-details-marker { display: none; }
.set-chat[open] summary .chev { transform: rotate(90deg); }
.set-chat .chev { transition: transform .2s; }
.set-sub { cursor: default; padding-left: 55px; }
.set-sub .btn { flex: 0 0 auto; }
.set-note { margin: 0; padding: 8px 14px 8px 55px; font-size: 14px; color: var(--ink-2); border-top: var(--hair) solid var(--line); }
.set-foot { text-align: center; margin: 18px 0 8px; }
#sheetBody > .group:has(#themeChips), #sheetBody > .group:has(#soundChips) { margin-bottom: 6px; }
.back-more { display: inline-block; margin: 4px 0 10px; font-size: 16px; }
/* chat reminder can be hidden for today */
.staff-chat-banner .banner-x { flex: 0 0 auto; width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--fill); color: var(--muted);
  font-size: 18px; line-height: 30px; padding: 0; cursor: pointer; }
.cash-v-sm { font-size: 20px; line-height: 1.3; margin: 4px 0 6px; }
.nocost-bar { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 10px; margin: 0 0 12px; padding: 12px 14px; border: 0;
  border-radius: var(--r); background: var(--wait-bg); color: var(--wait); font: 500 15px var(--body); cursor: pointer; text-align: left; }
.nocost-bar b { color: var(--mat); font-weight: 600; flex: 0 0 auto; }
.nocost-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px; gap: 10px; align-items: center; cursor: default; }
.nocost-row .nc-price { min-height: 38px; text-align: right; }
@media (max-width: 420px) { .nocost-row { grid-template-columns: 1fr; } .nocost-row .nc-price { text-align: left; } }
.list.nocost-list > .trow:not(.thead) { background-image: none; padding-right: 16px; }
/* review fixes */
@media (max-width: 1023px) { .kpi-v { font-size: clamp(17px, 5vw, 24px); white-space: normal; overflow-wrap: anywhere; } }
.cnt-g.save-err { border-color: var(--err); background: var(--err-bg); }

/* branches: shop picker (managers / accountants) or shop name (staff) in the top bar */
.branch-pick { height: 34px; max-width: 160px; border: 0; border-radius: 8px; background-color: var(--fill); color: var(--ink); font: inherit; font-weight: 600; padding: 0 28px 0 10px; flex: 0 1 auto; min-width: 0; text-overflow: ellipsis; }
.branch-tag { height: 28px; line-height: 28px; padding: 0 10px; border-radius: 14px; background: var(--fill); color: var(--ink-2); font-weight: 600; font-size: 13px; white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.staff select.branch { max-width: 120px; }
.staff.off { opacity: .6; }
.tr-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; padding: 12px 14px; border-bottom: 1px solid var(--hair); }
.tr-row:last-child { border-bottom: 0; }
.tr-row:active { background: var(--press); }
.tr-row .muted { display: block; margin-top: 2px; font-size: 13px; }
.tr-row .staff-main { flex: 1 1 220px; min-width: 0; }
@media (max-width: 640px) { .branch-pick { max-width: 110px; } .branch-tag { max-width: 80px; } }
.branch-strip { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; border-radius: 10px; margin: 8px 0 0; padding: 8px 12px;
  background: var(--fill); color: var(--ink-2); font: inherit; font-size: 13px; text-align: left; }
.branch-strip b { color: var(--ink); }
.branch-strip span { margin-left: auto; color: var(--mat); }
@media (min-width: 1024px) { .branch-strip { display: none; } }

/* task board (kéo thả kiểu Trello) */
#taskMode { margin: 4px 0 10px; max-width: 260px; }
.tb-people, .tb-tagbar { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.tb-people::-webkit-scrollbar, .tb-tagbar::-webkit-scrollbar { display: none; }
.tb-person { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; height: 34px; padding: 0 12px 0 4px; border: 0; border-radius: 17px;
  background: var(--fill); color: var(--ink); font: inherit; font-size: 14px; white-space: nowrap; }
.tb-person:first-child { padding-left: 12px; }
.tb-person.on { background: var(--mat); color: #fff; }
.tb-person.tb-over { outline: 2px solid var(--mat); outline-offset: 2px; transform: scale(1.06); }
.tb-tagf { flex: 0 0 auto; border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--ink-2); opacity: .55; }
.tb-tagf.on { opacity: 1; font-weight: 600; }
.tb-tagf:first-child { padding: 3px 8px; }
.tb-hint { margin: 0 0 8px; }
.tb-av { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--mat-soft); color: var(--mat); font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.tb-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.tb-col { background: var(--fill); border-radius: 12px; padding: 8px; min-width: 0; }
.tb-col > header { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 8px; font-size: 14px; }
.tb-list { display: flex; flex-direction: column; gap: 8px; min-height: 64px; border-radius: 10px; transition: background .15s; }
.tb-col.tb-over { background: var(--mat-soft); box-shadow: inset 0 0 0 2px var(--mat); }
.tb-empty { text-align: center; padding: 18px 0; margin: 0; }
.tb-card { background: var(--panel); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 0 var(--line); cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; touch-action: pan-x pan-y; }
.tb-card[data-move] { cursor: grab; }
.tb-card.late { box-shadow: inset 3px 0 0 var(--err), 0 1px 0 var(--line); }
.tb-card.unseen .tb-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mat); margin-right: 6px; vertical-align: middle; }
.tb-card.tb-dragging { opacity: .35; }
.tb-ghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; box-shadow: 0 12px 28px rgba(0,0,0,.18); opacity: .95; }
.tb-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tb-tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 1.4; }
.tg-red { background: #ffe5e3; color: #c4271c; } .tg0 { background: #e3f0ff; color: #0060d6; } .tg1 { background: #e2f6e6; color: #1d8a39; }
.tg2 { background: #fff1db; color: #a55d00; } .tg3 { background: #efe6fb; color: #7a3fc4; } .tg4 { background: #def5f7; color: #0f7c88; }
.tg5 { background: #fde6ef; color: #b5296a; } .tg6 { background: #ececf0; color: #4b4b55; }
.tb-title { font-weight: 600; line-height: 1.35; word-break: break-word; }
.tb-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--ink-2); min-width: 0; flex-wrap: wrap; }
.tb-who { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-due.late { color: var(--err); font-weight: 600; }
.tb-ico { padding: 1px 6px; border-radius: 6px; background: var(--fill); }
.tb-moves { flex-wrap: wrap; margin: 4px 0 10px; }
.tb-hist { margin-top: 10px; }
@media (max-width: 1023px) {
  .tb-cols { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -16px; padding: 0 16px 8px; scrollbar-width: none; }
  .tb-cols::-webkit-scrollbar { display: none; }
  .tb-col { flex: 0 0 84%; scroll-snap-align: start; }
}
:root[data-theme="dark"] .tb-tag { filter: brightness(.85); }
body.tb-dragmode .tb-cols { scroll-snap-type: none; }
body.tb-dragmode { -webkit-user-select: none; user-select: none; }

/* Hệ thống / Chuẩn hoá */
.sys-alert { box-shadow: inset 3px 0 0 var(--err); }
.sys-alert p { margin: 4px 0; }
.sys-ok h3 { color: var(--ok, #1d8a39); }
.norm h4 { margin: 14px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.norm h3 .pill { margin-left: 6px; vertical-align: middle; }

/* quick payment method + folded extras */
.pay-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.pay-quick button { border: 0; border-radius: 16px; padding: 7px 12px; background: var(--fill); color: var(--ink); font: inherit; font-size: 14px; }
.pay-quick button.on { background: var(--mat); color: #fff; }
details.fold { margin: 8px 0; }
details.fold > summary { cursor: pointer; color: var(--mat); font-weight: 600; padding: 6px 0; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }

/* Hôm nay */
.home-shift { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.home-shift > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-shift.on { box-shadow: inset 3px 0 0 var(--go); }
.home-shift .btn { flex: 0 0 auto; min-width: 96px; }
.home-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.home-act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 92px; padding: 12px 6px;
  border: 0; border-radius: 14px; background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: 0 1px 0 var(--line); }
.home-act .ic { width: 28px; height: 28px; color: var(--mat); }
.home-act:active { background: var(--press); transform: scale(.98); }
.home-mine { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.home-mine b { margin-left: auto; }
.home-h { display: flex; align-items: baseline; justify-content: space-between; }
.home-row { cursor: pointer; }
@media (min-width: 1024px) { .home-actions { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
