/* =====================================================================
   Chaveevan Fleet — Design System
   โทนเขียวเข้ม ชุดสีเดียวกับระบบ Payroll (primary #027a6c)
   ===================================================================== */
:root {
  --bg: #f3f7f5;
  --surface: #ffffff;
  --surface-2: #f8fbfa;
  --surface-3: #eef4f1;
  --border: #e0e9e6;
  --border-2: #cddbd6;
  --line: #edf3f0;
  --text: #13282a;
  --text-2: #2e4446;
  --muted: #5d706c;
  --faint: #91a29e;

  --primary: #027a6c;
  --primary-600: #026b5f;
  --primary-700: #015d5f;
  --primary-50: #eef8f5;
  --primary-100: #d9f1e9;
  --primary-200: #a9dfcf;
  --lime: #41c889;
  --deep: #033f41;

  --grad: radial-gradient(120% 140% at 0% 0%, rgba(65, 200, 137, .45) 0%, rgba(65, 200, 137, 0) 45%), linear-gradient(135deg, #08a488 0%, #027a6c 50%, #015d5f 100%);
  --grad-hover: radial-gradient(120% 140% at 0% 0%, rgba(65, 200, 137, .38) 0%, rgba(65, 200, 137, 0) 45%), linear-gradient(135deg, #07957c 0%, #026b5f 50%, #014c4e 100%);
  --grad-hdr: linear-gradient(100deg, #023f41 0%, #035854 30%, #027a6c 68%, #0a9a80 100%);
  --grad-soft: linear-gradient(135deg, #effaf6 0%, #e1f3ec 100%);
  --grad-shadow: 0 6px 16px -6px rgba(2, 122, 108, .5);

  --green: #0e8f5b; --green-bg: #eafaf2; --green-bd: #bfe9d4;
  --amber: #b45f06; --amber-bg: #fff6e5; --amber-bd: #f8dca6;
  --red: #e11d48;   --red-bg: #fff1f3;   --red-bd: #fbc7d1;
  --blue: #2f5bea;  --blue-bg: #eaf0ff;  --blue-bd: #c7d5fb;
  --violet: #7c4ddb; --violet-bg: #f3eefe; --violet-bd: #ddd0fb;
  --sky: #0284c7;   --sky-bg: #e7f6fd;   --sky-bd: #bfe6f8;
  --gray: #5d706c;  --gray-bg: #f1f4f3;  --gray-bd: #dde5e2;
  --teal: #0f9b8c;  --teal-bg: #e4f8f5;  --teal-bd: #b9ece5;
  --orange: #ea580c; --orange-bg: #fff1e6; --orange-bd: #fed4b3;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, .04);
  --shadow-md: 0 8px 24px rgba(17, 24, 39, .08);
  --shadow-lg: 0 24px 60px -12px rgba(3, 40, 38, .28);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --hdr-h: 58px;
  --side-w: 248px;
  --font: 'IBM Plex Sans Thai', 'Sarabun', 'Segoe UI', Tahoma, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b1514;
  --surface: #111d1c;
  --surface-2: #142321;
  --surface-3: #1a2c2a;
  --border: #223734;
  --border-2: #2d4743;
  --line: #1c2f2c;
  --text: #e3efec;
  --text-2: #c3d4d0;
  --muted: #8ea6a1;
  --faint: #5f7773;
  --primary: #17b89f;
  --primary-600: #13a38d;
  --primary-700: #3fd1b5;
  --primary-50: #10302b;
  --primary-100: #14403a;
  --primary-200: #1d5a51;
  --grad-soft: linear-gradient(135deg, #10302b 0%, #123631 100%);
  --green: #3dd598; --green-bg: #0f2d22; --green-bd: #1b4a37;
  --amber: #f5b14c; --amber-bg: #2e2412; --amber-bd: #4d3a17;
  --red: #fb7191;   --red-bg: #33141c;   --red-bd: #5a2030;
  --blue: #7b9bff;  --blue-bg: #151f3d;  --blue-bd: #263766;
  --violet: #b394ff; --violet-bg: #231a3d; --violet-bd: #3a2c63;
  --sky: #4cc3f5;   --sky-bg: #10293a;   --sky-bd: #1b4560;
  --gray: #a3b6b2;  --gray-bg: #1a2826;  --gray-bd: #2b3d3a;
  --teal: #3fd1c0;  --teal-bg: #0f2d2a;  --teal-bd: #1b4a45;
  --orange: #fb923c; --orange-bg: #2f1d10; --orange-bd: #52321a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { color: var(--primary-700); text-decoration: none; }
a:hover { color: var(--primary-600); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: var(--primary-100); }
[x-cloak] { display: none !important; }
.ic { flex-shrink: 0; width: 18px; height: 18px; stroke-width: 2; vertical-align: -4px; }
.ic-sm { width: 15px; height: 15px; vertical-align: -3px; }
.ic-lg { width: 22px; height: 22px; }
.ic-xl { width: 28px; height: 28px; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.bold { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-blue { color: var(--blue); }
.hide { display: none !important; }

/* ============================== Header ============================== */
.hdr {
  position: fixed; inset: 0 0 auto 0; height: var(--hdr-h); z-index: 60;
  display: flex; align-items: center; gap: 12px; padding: 0 16px 0 12px;
  background: var(--grad-hdr); color: #fff;
  box-shadow: 0 6px 20px -12px rgba(1, 50, 48, .75);
}
.hdr::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(1200px 120px at 22% -40px, rgba(65, 200, 137, .30), transparent 60%); }
.hdr > * { position: relative; z-index: 1; }
.hdr-btn { background: none; border: 0; color: #fff; width: 38px; height: 38px; border-radius: 10px; cursor: pointer; display: inline-grid; place-items: center; position: relative; transition: background .15s; }
.hdr-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.hdr-burger { display: none; }
.hdr-brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: calc(var(--side-w) - 28px); }
.hdr-brand:hover { color: #fff; }
.hdr-logo { width: 34px; height: 34px; border-radius: 10px; background: #fff; color: var(--primary); display: grid; place-items: center; box-shadow: 0 6px 14px -6px rgba(0, 40, 36, .45); }
.hdr-logo .ic { width: 20px; height: 20px; color: #027a6c; }
.hdr-name { font-weight: 600; font-size: 15.5px; letter-spacing: .2px; line-height: 1.2; }
.hdr-sub { font-size: 11px; color: rgba(255, 255, 255, .78); font-weight: 400; }
.hdr-spacer { flex: 1; }
.hdr-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; min-width: 300px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22); border-radius: 10px; color: rgba(255, 255, 255, .85); cursor: pointer; font-size: 13px; transition: background .15s; }
.hdr-search:hover { background: rgba(255, 255, 255, .22); }
.hdr-search kbd { margin-left: auto; font-family: var(--font); font-size: 11px; background: rgba(255, 255, 255, .18); border-radius: 5px; padding: 1px 6px; }
.hdr-dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #ff4d6d; color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #035854; }
.hdr-user { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: 12px; cursor: pointer; background: none; border: 0; color: #fff; }
.hdr-user:hover { background: rgba(255, 255, 255, .14); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; background: linear-gradient(135deg, #41c889, #0a9a80); color: #fff; font-size: 14px; flex-shrink: 0; }
.avatar-sm { width: 26px; height: 26px; font-size: 12px; }
.hdr-user-name { font-size: 13px; line-height: 1.2; text-align: left; }
.hdr-user-role { font-size: 11px; color: rgba(255, 255, 255, .75); }

/* ============================== Sidebar ============================== */
.side { position: fixed; top: var(--hdr-h); left: 0; bottom: 0; width: var(--side-w); background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; z-index: 50; padding: 12px 10px 24px; transition: transform .25s ease, width .2s ease; }
.side::-webkit-scrollbar { width: 6px; } .side::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
.side-group { margin-top: 14px; }
.side-group:first-child { margin-top: 0; }
.side-label { font-size: 11px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .6px; padding: 0 10px 6px; }
.side-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-size: 13.5px; position: relative; transition: background .12s, color .12s; }
.side-link .ic { color: var(--muted); width: 18px; height: 18px; }
.side-link:hover { background: var(--surface-3); color: var(--text); }
.side-link.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.side-link.active .ic { color: var(--primary); }
.side-link.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.side-count { margin-left: auto; font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: var(--amber-bg); color: var(--amber); }
.side-count.red { background: var(--red-bg); color: var(--red); }
.side-foot { margin: 18px 6px 0; padding: 12px; border-radius: 12px; background: var(--grad-soft); font-size: 12px; color: var(--muted); }
.side-backdrop { display: none; }

.main { margin-left: var(--side-w); padding: calc(var(--hdr-h) + 22px) 26px 40px; min-height: 100vh; }
.container { max-width: 1440px; margin: 0 auto; }

/* ============================== Page header ============================== */
.page-hd { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 600; letter-spacing: -.2px; display: flex; align-items: center; gap: 10px; }
.page-title .ic { color: var(--primary); width: 22px; height: 22px; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--faint); margin-bottom: 4px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================== Buttons ============================== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: all .15s; text-decoration: none; }
.btn:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-2); }
.btn:active { transform: translateY(1px); }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: var(--grad-shadow); }
.btn-primary:hover { background: var(--grad-hover); color: #fff; border-color: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #be123c; color: #fff; border-color: #be123c; }
.btn-soft { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary-700); }
.btn-soft:hover { background: var(--primary-100); color: var(--primary-700); }
.btn-soft-red { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.btn-soft-red:hover { background: var(--red-bd); color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-xs .ic { width: 14px; height: 14px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }

/* ============================== Cards ============================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-hd { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-title { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.card-title .ic { color: var(--primary); }
.card-hd .card-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-bd { padding: 18px; }
.card-bd.tight { padding: 0; }
.card-ft { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card + .card { margin-top: 16px; }
.card-hover { transition: box-shadow .2s, transform .2s, border-color .2s; }
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary-200); }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-all { grid-column: 1 / -1; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 26px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.ml-auto { margin-left: auto; }
.gap-sm { gap: 6px; }

/* ============================== Stat tiles ============================== */
.stat { position: relative; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; gap: 14px; align-items: flex-start; overflow: hidden; transition: box-shadow .2s, transform .2s; color: inherit; }
a.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: inherit; }
.stat-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-ic .ic { width: 22px; height: 22px; }
.stat-label { color: var(--muted); font-size: 12.5px; }
.stat-value { font-size: 25px; font-weight: 600; line-height: 1.15; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 3px; }
.stat-foot { font-size: 12px; color: var(--muted); margin-top: 3px; }
.stat.hero { background: var(--grad); border: 0; color: #fff; box-shadow: var(--grad-shadow); }
.stat.hero .stat-label, .stat.hero .stat-foot { color: rgba(255, 255, 255, .82); }
.stat.hero .stat-ic { background: rgba(255, 255, 255, .18); color: #fff; }

/* สีพื้นหลังอ่อน + สีตัวอักษร ใช้ร่วมกับ badge/icon */
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-blue { background: var(--blue-bg); color: var(--blue); }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-sky { background: var(--sky-bg); color: var(--sky); }
.tone-gray { background: var(--gray-bg); color: var(--gray); }
.tone-teal { background: var(--teal-bg); color: var(--teal); }
.tone-orange { background: var(--orange-bg); color: var(--orange); }
.tone-primary { background: var(--primary-50); color: var(--primary); }

/* ============================== Badges ============================== */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; line-height: 1; }
.badge .ic { width: 13px; height: 13px; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.no-dot::before { display: none; }
.badge-green { background: var(--green-bg); color: var(--green); border-color: var(--green-bd); }
.badge-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-bd); }
.badge-red { background: var(--red-bg); color: var(--red); border-color: var(--red-bd); }
.badge-blue { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-bd); }
.badge-violet { background: var(--violet-bg); color: var(--violet); border-color: var(--violet-bd); }
.badge-gray { background: var(--gray-bg); color: var(--gray); border-color: var(--gray-bd); }
.badge-sky { background: var(--sky-bg); color: var(--sky); border-color: var(--sky-bd); }
.badge-teal { background: var(--teal-bg); color: var(--teal); border-color: var(--teal-bd); }
.badge-orange { background: var(--orange-bg); color: var(--orange); border-color: var(--orange-bd); }
.badge-primary { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-100); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 7px; background: var(--surface-3); color: var(--text-2); font-size: 12px; border: 1px solid var(--border); }
.flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--red); background: var(--red-bg); border-radius: 6px; padding: 1px 7px; }
.flag .ic { width: 12px; height: 12px; }

/* ============================== Tables ============================== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { padding: 11px 14px; font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--border); }
.table .num, .table td.right, .table th.right { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table-sm td, .table-sm th { padding: 7px 10px; }
.table tr.is-cancelled td { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--border-2); }
.table tr.is-flagged td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.cell-main { font-weight: 500; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); }

/* ============================== Forms ============================== */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.label .req { color: var(--red); margin-left: 2px; }
.hint { font-size: 11.5px; color: var(--faint); }
.err { font-size: 12px; color: var(--red); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 84px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235d706c' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--red); }
.input[readonly], .input.readonly { background: var(--surface-3); color: var(--text-2); }
.input-sm, .select-sm { height: 34px; font-size: 13px; border-radius: 8px; }
.input-lg { height: 50px; font-size: 18px; font-weight: 600; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-2); border-left: 0; border-radius: 0 10px 10px 0; background: var(--surface-3); color: var(--muted); font-size: 13px; white-space: nowrap; }
.input-icon { position: relative; }
.input-icon .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 36px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.switch { position: relative; width: 40px; height: 23px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--border-2); transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(17px); }
.section-title { font-size: 13px; font-weight: 600; color: var(--primary-700); display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; grid-column: 1 / -1; }
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.section-title .ic { width: 16px; height: 16px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label, .seg a, .seg button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--muted); cursor: pointer; border: 0; background: none; }
.seg input { display: none; }
.seg input:checked + span, .seg .active { background: var(--surface); color: var(--primary-700); box-shadow: var(--shadow-sm); font-weight: 600; }
.seg label > span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px; margin: -6px -12px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice .choice-body { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 10px; border: 1.5px solid var(--border); border-radius: 12px; text-align: center; font-size: 13px; transition: all .15s; background: var(--surface); }
.choice .choice-body .ic { width: 24px; height: 24px; color: var(--muted); }
.choice input:checked + .choice-body { border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); font-weight: 600; box-shadow: 0 0 0 3px var(--primary-100); }
.choice input:checked + .choice-body .ic { color: var(--primary); }
.calc-box { background: var(--grad-soft); border: 1px dashed var(--primary-200); border-radius: 12px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.calc-box .calc-value { font-size: 22px; font-weight: 700; color: var(--primary-700); font-variant-numeric: tabular-nums; }

/* Filter bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.filters .field { min-width: 150px; flex: 1 1 150px; max-width: 240px; }
.filters .field.grow { max-width: none; flex: 2 1 220px; }
.filters .label { font-size: 11.5px; color: var(--muted); }
.filters .input, .filters .select { height: 36px; font-size: 13px; }
.filters .btn { height: 36px; }

/* tom-select ปรับธีม */
.ts-wrapper.single .ts-control, .ts-wrapper.multi .ts-control { min-height: 40px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface) !important; color: var(--text); padding: 8px 12px; box-shadow: none; font-size: 14px; }
.ts-wrapper.focus .ts-control { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.ts-dropdown { border-radius: 10px; border: 1px solid var(--border-2); box-shadow: var(--shadow-md); background: var(--surface); color: var(--text); margin-top: 4px; z-index: 300; }
.ts-dropdown .active { background: var(--primary-50); color: var(--primary-700); }
.ts-dropdown .option, .ts-dropdown .no-results, .ts-dropdown .optgroup-header { padding: 8px 12px; }
.ts-dropdown .optgroup-header { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; }
.ts-control input { color: var(--text) !important; }
.ts-wrapper.multi .ts-control > div { background: var(--primary-50); color: var(--primary-700); border-radius: 6px; }
.filters .ts-wrapper.single .ts-control { min-height: 36px; padding: 6px 10px; font-size: 13px; }

/* ============================== Alerts / flash ============================== */
.alert { display: flex; gap: 12px; padding: 12px 16px; border-radius: 12px; border: 1px solid; font-size: 13.5px; align-items: flex-start; }
.alert .ic { margin-top: 1px; }
.alert-green { background: var(--green-bg); border-color: var(--green-bd); color: var(--green); }
.alert-amber { background: var(--amber-bg); border-color: var(--amber-bd); color: var(--amber); }
.alert-red { background: var(--red-bg); border-color: var(--red-bd); color: var(--red); }
.alert-blue { background: var(--blue-bg); border-color: var(--blue-bd); color: var(--blue); }
.alert b { font-weight: 600; }
.alert ul { margin: 4px 0 0 18px; }

/* Toast */
.toasts { position: fixed; top: calc(var(--hdr-h) + 14px); right: 18px; z-index: 400; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; min-width: 300px; max-width: 420px; padding: 13px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); animation: toastIn .35s cubic-bezier(.2, .9, .3, 1.2); font-size: 13.5px; }
.toast .toast-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.toast-title { font-weight: 600; }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ============================== Modal ============================== */
.modal-bg { position: fixed; inset: 0; background: rgba(3, 25, 24, .45); backdrop-filter: blur(3px); z-index: 200; display: grid; place-items: center; padding: 16px; animation: fadeIn .15s; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: popIn .22s cubic-bezier(.2, .9, .3, 1.15); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1000px; }
.modal-hd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-title { font-weight: 600; font-size: 16px; }
.modal-bd { padding: 20px; overflow-y: auto; }
.modal-ft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.modal-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 12px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* Dropdown */
.dd { position: relative; }
.dd-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 100; color: var(--text); animation: popIn .15s; }
.dd-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; cursor: pointer; width: 100%; background: none; border: 0; text-align: left; }
.dd-item:hover { background: var(--surface-3); color: var(--text); }
.dd-item .ic { color: var(--muted); }
.dd-sep { height: 1px; background: var(--line); margin: 5px 0; }
.dd-head { padding: 8px 10px; font-size: 12px; color: var(--muted); }

/* Notification panel */
.notif-panel { width: 380px; max-height: 70vh; overflow-y: auto; padding: 0; }
.notif-hd { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; gap: 8px; position: sticky; top: 0; background: var(--surface); }
.notif-item { display: flex; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.notif-item:hover { background: var(--surface-2); color: var(--text); }
.notif-item .notif-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.notif-item .notif-ic .ic { width: 17px; height: 17px; }
.notif-title { font-size: 13px; font-weight: 500; }
.notif-sub { font-size: 12px; color: var(--muted); }

/* Command palette */
.cmdk { position: fixed; inset: 0; z-index: 500; background: rgba(3, 25, 24, .5); backdrop-filter: blur(4px); display: flex; justify-content: center; padding-top: 12vh; animation: fadeIn .12s; }
.cmdk-box { width: 100%; max-width: 620px; margin: 0 16px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; align-self: flex-start; animation: popIn .18s; }
.cmdk-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.cmdk-input input { flex: 1; height: 54px; border: 0; outline: 0; background: none; font-size: 16px; }
.cmdk-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 11.5px; color: var(--faint); font-weight: 600; padding: 10px 10px 4px; text-transform: uppercase; letter-spacing: .5px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; color: var(--text); cursor: pointer; }
.cmdk-item.active, .cmdk-item:hover { background: var(--primary-50); color: var(--primary-700); }
.cmdk-item .cmdk-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex-shrink: 0; }
.cmdk-item.active .cmdk-ic { background: var(--primary-100); color: var(--primary); }
.cmdk-foot { padding: 9px 14px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); display: flex; gap: 14px; }
.cmdk-foot kbd, kbd { font-family: var(--font); font-size: 11px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; }

/* ============================== Tabs ============================== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 11px 15px; color: var(--muted); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; background: none; border-top: 0; border-left: 0; border-right: 0; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-700); border-bottom-color: var(--primary); }
.tab .tab-count { font-size: 11px; background: var(--surface-3); color: var(--muted); border-radius: 9px; padding: 0 7px; }
.tab.active .tab-count { background: var(--primary-100); color: var(--primary-700); }

/* ============================== Thai license plate ============================== */
.plate { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; background: #fff; color: #111; border: 2px solid #1d1d1d; border-radius: 7px; padding: 3px 12px 2px; line-height: 1.1; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px #999, 0 2px 6px rgba(0, 0, 0, .12); min-width: 112px; font-family: 'Sarabun', var(--font); }
.plate-no { font-weight: 700; font-size: 19px; letter-spacing: .5px; }
.plate-prov { font-size: 10.5px; font-weight: 500; }
.plate-sm { min-width: 88px; padding: 2px 8px 1px; border-width: 1.5px; border-radius: 5px; }
.plate-sm .plate-no { font-size: 14px; }
.plate-sm .plate-prov { font-size: 8.5px; }
.plate-lg { min-width: 180px; padding: 6px 18px 4px; border-width: 3px; border-radius: 10px; }
.plate-lg .plate-no { font-size: 32px; }
.plate-lg .plate-prov { font-size: 15px; }

/* ============================== Countdown ring ============================== */
.ring { position: relative; width: 84px; height: 84px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .ring-track { stroke: var(--surface-3); }
.ring .ring-bar { transition: stroke-dashoffset 1s ease; stroke-linecap: round; }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.05; }
.ring-num { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-unit { font-size: 10.5px; color: var(--muted); }
.ring-green .ring-bar { stroke: var(--green); } .ring-green .ring-num { color: var(--green); }
.ring-amber .ring-bar { stroke: #f59e0b; } .ring-amber .ring-num { color: var(--amber); }
.ring-red .ring-bar { stroke: var(--red); } .ring-red .ring-num { color: var(--red); }
.ring-gray .ring-bar { stroke: var(--border-2); } .ring-gray .ring-num { color: var(--faint); }

.doc-card { display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); position: relative; overflow: hidden; }
.doc-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.doc-card.st-ok::before { background: var(--green); } .doc-card.st-warning::before { background: #f59e0b; }
.doc-card.st-expired::before { background: var(--red); } .doc-card.st-missing::before { background: var(--border-2); }
.doc-card-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 7px; }

/* ============================== Vehicle hero ============================== */
.v-hero { display: grid; grid-template-columns: 300px 1fr; gap: 0; overflow: hidden; }
.v-photo { background: var(--grad-soft); min-height: 220px; display: grid; place-items: center; position: relative; border-right: 1px solid var(--line); }
.v-photo img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.v-photo .ic { width: 80px; height: 80px; color: var(--primary-200); stroke-width: 1.2; }
.v-info { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.v-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.v-meta-item .k { font-size: 11.5px; color: var(--muted); }
.v-meta-item .v { font-weight: 600; font-size: 14.5px; }
.v-card { display: flex; flex-direction: column; overflow: hidden; color: inherit; }
.v-card:hover { color: inherit; }
.v-card-photo { height: 140px; background: var(--grad-soft); display: grid; place-items: center; position: relative; overflow: hidden; }
.v-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.v-card-photo .ic { width: 54px; height: 54px; color: var(--primary-200); stroke-width: 1.3; }
.v-card-photo .badge { position: absolute; top: 10px; left: 10px; }
.v-card-photo .plate { position: absolute; bottom: 10px; right: 10px; }
.v-card-bd { padding: 12px 14px; flex: 1; }
.v-card-docs { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.doc-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 2px 8px; border-radius: 6px; }

/* ============================== Timeline ============================== */
.timeline { position: relative; padding-left: 8px; }
.tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.tl-item::before { content: ''; position: absolute; left: 17px; top: 38px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; position: relative; z-index: 1; }
.tl-ic .ic { width: 17px; height: 17px; }
.tl-body { flex: 1; min-width: 0; padding-top: 2px; }
.tl-title { font-weight: 500; }
.tl-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.tl-date { font-size: 12px; color: var(--faint); white-space: nowrap; }

/* ============================== Kanban ============================== */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.kb-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 300px; }
.kb-col.drag-over { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.kb-hd { padding: 12px 14px; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; border-bottom: 1px solid var(--line); }
.kb-hd .count { margin-left: auto; font-size: 12px; background: var(--surface); border-radius: 9px; padding: 0 8px; color: var(--muted); border: 1px solid var(--border); }
.kb-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.kb-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; box-shadow: var(--shadow-sm); cursor: grab; transition: box-shadow .15s, transform .15s; color: inherit; display: block; }
.kb-card:hover { box-shadow: var(--shadow-md); color: inherit; }
.kb-card.dragging { opacity: .5; transform: rotate(2deg); }

/* ============================== Empty / skeleton ============================== */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-ic { width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 22px; background: var(--grad-soft); display: grid; place-items: center; color: var(--primary); }
.empty-ic .ic { width: 32px; height: 32px; stroke-width: 1.6; }
.empty-title { font-weight: 600; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--line) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Progress / tank gauge */
.progress { height: 8px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 6px; background: var(--grad); transition: width .8s ease; }
.progress.warn > span { background: linear-gradient(90deg, #f59e0b, #f97316); }
.progress.danger > span { background: linear-gradient(90deg, #f43f5e, #e11d48); }
.tank-gauge { width: 64px; height: 92px; border-radius: 12px 12px 10px 10px; border: 2px solid var(--border-2); position: relative; overflow: hidden; background: var(--surface-2); flex-shrink: 0; }
.tank-gauge .fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #3cc79a, #027a6c); transition: height 1s ease; }
.tank-gauge .fill::before { content: ''; position: absolute; top: -5px; left: -10%; width: 120%; height: 10px; background: radial-gradient(ellipse at center, rgba(255, 255, 255, .45), transparent 70%); }
.tank-gauge.low .fill { background: linear-gradient(180deg, #fb7185, #e11d48); }
.tank-gauge.mid .fill { background: linear-gradient(180deg, #fbbf24, #f59e0b); }
.tank-gauge .min-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--red); opacity: .7; }
.tank-gauge .pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--text); text-shadow: 0 1px 2px rgba(255, 255, 255, .7); }

/* Key-value list */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); font-weight: 500; min-width: 0; word-break: break-word; }

/* Attachments */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.file-tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); color: var(--text-2); display: flex; flex-direction: column; font-size: 11.5px; position: relative; }
.file-tile:hover { border-color: var(--primary-200); color: var(--text); }
.file-thumb { height: 82px; display: grid; place-items: center; background: var(--surface-3); overflow: hidden; }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb .ic { width: 30px; height: 30px; color: var(--muted); }
.file-name { padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropzone { border: 2px dashed var(--border-2); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s; background: var(--surface-2); display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-50); color: var(--primary-700); }
.dropzone input { display: none; }
.preview-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.preview-list .pv { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-3); display: grid; place-items: center; font-size: 10px; color: var(--muted); text-align: center; }
.preview-list .pv img { width: 100%; height: 100%; object-fit: cover; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pager-links { display: flex; gap: 4px; }
.pager-links a, .pager-links span { min-width: 34px; height: 34px; padding: 0 9px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--border); color: var(--text-2); background: var(--surface); font-size: 13px; }
.pager-links a:hover { border-color: var(--primary-200); color: var(--primary-700); }
.pager-links .active { background: var(--grad); color: #fff; border-color: transparent; }
.pager-links .disabled { opacity: .45; }

/* Steps (flow indicator) */
.steps { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--faint); }
.step-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-2); display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface); }
.step-dot .ic { width: 14px; height: 14px; }
.step.done { color: var(--green); } .step.done .step-dot { border-color: var(--green); background: var(--green); color: #fff; }
.step.current { color: var(--primary-700); font-weight: 600; } .step.current .step-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 4px var(--primary-100); }
.step.cancel { color: var(--red); } .step.cancel .step-dot { border-color: var(--red); background: var(--red); color: #fff; }
.step-line { flex: 1; min-width: 24px; height: 2px; background: var(--border); margin: 0 8px; }
.step-line.done { background: var(--green); }

/* Quick action grid (mobile home / QR page) */
.qa-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.qa { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 22px 12px; border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14.5px; text-align: center; box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s; cursor: pointer; }
.qa:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text); }
.qa .qa-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; }
.qa .qa-ic .ic { width: 26px; height: 26px; }

/* Bottom nav (mobile) */
.bnav { display: none; }

/* Auth / public pages */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--grad-hdr); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::before { content: ''; position: absolute; width: 600px; height: 600px; border-radius: 50%; background: radial-gradient(circle, rgba(65, 200, 137, .35), transparent 65%); top: -200px; right: -200px; }
.auth-art::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(255, 255, 255, .05); bottom: -160px; left: -120px; }
.auth-art > * { position: relative; z-index: 1; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-box { width: 100%; max-width: 380px; }
.feature-list { display: grid; gap: 14px; margin-top: 30px; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature .f-ic { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; flex-shrink: 0; }
.public-shell { min-height: 100vh; background: var(--bg); }
.public-hd { background: var(--grad-hdr); color: #fff; padding: 22px 18px 70px; position: relative; overflow: hidden; }
.public-hd::after { content: ''; position: absolute; inset: 0; background: radial-gradient(800px 200px at 10% -60px, rgba(65, 200, 137, .35), transparent 60%); pointer-events: none; }
.public-hd > * { position: relative; z-index: 1; }
.public-body { max-width: 760px; margin: -50px auto 0; padding: 0 14px 40px; position: relative; z-index: 2; }

/* Charts */
.chart { min-height: 260px; }
.chart-sm { min-height: 180px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* FullCalendar theme */
.fc { --fc-border-color: var(--border); --fc-today-bg-color: var(--primary-50); --fc-page-bg-color: var(--surface); --fc-neutral-bg-color: var(--surface-2); --fc-button-bg-color: var(--surface); --fc-button-border-color: var(--border-2); --fc-button-text-color: var(--text-2); --fc-button-hover-bg-color: var(--surface-3); --fc-button-hover-border-color: var(--border-2); --fc-button-active-bg-color: var(--primary); --fc-button-active-border-color: var(--primary); --fc-event-border-color: transparent; font-size: 13px; }
.fc .fc-button { border-radius: 9px; font-weight: 500; padding: 6px 12px; text-transform: none; box-shadow: none !important; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: #fff; }
.fc .fc-toolbar-title { font-size: 18px; font-weight: 600; }
.fc .fc-daygrid-event { border-radius: 6px; padding: 1px 5px; font-size: 12px; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--text-2); }

/* ============================== Print ============================== */
@media print {
  .hdr, .side, .bnav, .page-actions, .no-print, .toasts { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; }
}

/* ============================== Responsive ============================== */
@media (max-width: 1200px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .v-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hdr-search { min-width: 220px; }
}
@media (max-width: 1024px) {
  .hdr-burger { display: inline-grid; }
  .hdr-brand { min-width: 0; }
  .side { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.side-open .side { transform: none; }
  body.side-open .side-backdrop { display: block; position: fixed; inset: var(--hdr-h) 0 0 0; background: rgba(3, 25, 24, .4); z-index: 45; }
  .main { margin-left: 0; padding: calc(var(--hdr-h) + 18px) 18px 40px; }
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-template-columns: repeat(4, 270px); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 760px) {
  :root { --hdr-h: 56px; }
  body { font-size: 14.5px; }
  .hdr { padding: 0 8px; gap: 4px; }
  .hdr-search { display: none; }
  .hdr-sub, .hdr-user-name, .hdr-user-role { display: none; }
  .main { padding: calc(var(--hdr-h) + 14px) 14px calc(84px + env(safe-area-inset-bottom)); }
  .page-hd { align-items: flex-start; }
  .page-title { font-size: 18.5px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .g-2, .g-3, .g-4 { grid-template-columns: minmax(0, 1fr); }
  .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid-m2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .span-2, .span-3 { grid-column: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid > [class*="col-"] { grid-column: 1 / -1; }
  .card-bd { padding: 14px; }
  .card-hd { padding: 12px 14px; }
  .filters { padding: 12px 14px; }
  .filters .field { max-width: none; flex: 1 1 calc(50% - 10px); min-width: 0; }
  .kv { grid-template-columns: 120px 1fr; }
  .v-hero { grid-template-columns: minmax(0, 1fr); }
  .v-photo { min-height: 180px; border-right: 0; border-bottom: 1px solid var(--line); }
  .v-info { padding: 16px; }
  .stat { padding: 13px 14px; gap: 10px; }
  .stat-ic { width: 38px; height: 38px; }
  .stat-value { font-size: 21px; }
  .toasts { left: 12px; right: 12px; top: calc(var(--hdr-h) + 8px); }
  .toast { min-width: 0; max-width: none; }
  .modal-bg { align-items: flex-end; padding: 0; }
  .modal { border-radius: 20px 20px 0 0; max-height: 92vh; animation: sheetUp .25s ease; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
  .notif-panel { position: fixed; left: 8px; right: 8px; top: calc(var(--hdr-h) + 6px); width: auto; }

  /* ตาราง → การ์ด บนมือถือ */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border-bottom: 1px solid var(--line); padding: 12px 14px; position: relative; }
  .table-cards tbody tr:hover { background: transparent; }
  .table-cards td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex-shrink: 0; }
  .table-cards td[data-label=""]::before, .table-cards td:not([data-label])::before { display: none; }
  .table-cards td.card-main { display: block; text-align: left; padding-bottom: 6px; font-size: 15px; }
  .table-cards td.card-main::before { display: none; }
  .table-cards td.actions { justify-content: flex-end; padding-top: 8px; width: 100%; }
  .table-cards tfoot { display: block; }
  .table-cards tfoot tr { display: flex; flex-wrap: wrap; gap: 8px; }
  .table-cards tfoot td { display: inline; width: auto; }

  .bnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px -12px rgba(3, 40, 38, .18); }
  .bnav a, .bnav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); padding: 4px 0; background: none; border: 0; }
  .bnav a.active { color: var(--primary); font-weight: 600; }
  .bnav .ic { width: 22px; height: 22px; }
  .bnav .bnav-fab { width: 50px; height: 50px; margin-top: -24px; border-radius: 16px; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: var(--grad-shadow); border: 3px solid var(--surface); }
  .bnav .bnav-fab .ic { width: 24px; height: 24px; }
}
@media (min-width: 761px) { .only-mobile { display: none !important; } }
@media (max-width: 760px) { .only-desktop { display: none !important; } }

/* Spinner */
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================== Company tabs (เลือกดูทีละบริษัท) ============================== */
.co-tabs { display: flex; align-items: center; gap: 6px; margin: -4px 0 18px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-sm); overflow-x: auto; scrollbar-width: none; position: sticky; top: calc(var(--hdr-h) + 8px); z-index: 40; }
.co-tabs::-webkit-scrollbar { display: none; }
.co-tabs-label { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 6px; font-size: 12px; color: var(--faint); font-weight: 600; white-space: nowrap; border-right: 1px solid var(--line); margin-right: 2px; }
.co-tab { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 10px; border: 0; background: none; color: var(--muted); font-weight: 500; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.co-tab:hover { background: var(--surface-3); color: var(--text); }
.co-tab.active { background: var(--grad); color: #fff; box-shadow: var(--grad-shadow); }
.co-tab.active .co-dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85); }
.co-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
@media (max-width: 760px) {
  .co-tabs { margin: -2px -14px 14px; border-radius: 0; border-left: 0; border-right: 0; top: var(--hdr-h); padding: 6px 10px; }
  .co-tab { height: 32px; padding: 0 12px; font-size: 13px; }
}
.plate.plate-none { border-style: dashed; border-color: var(--border-2); box-shadow: none; background: var(--surface-2); color: var(--text-2); }
.plate.plate-none .plate-prov { color: var(--faint); }
/* กันลูกของ grid ขยายเกินคอลัมน์ (เช่น แถบแท็บ/ตารางกว้าง) */
.grid > * { min-width: 0; }

/* โลโก้ (FLEET Chaveevangroup) — พื้นเขียวเข้ม ตัดขอบบางให้แยกจากพื้นหลังสีเขียวของแถบบน */
.brand-logo { display: block; flex-shrink: 0; object-fit: cover; border-radius: 10px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35), 0 6px 14px -6px rgba(0, 40, 36, .55); }
.hdr-brand-logo { width: 38px; height: 38px; }
/* หน้าเข้าสู่ระบบ: แสดงโลโก้ฝั่งฟอร์มเมื่อแผงซ้ายถูกซ่อน (≤1024px) */
.auth-mobile-brand { display: none; }
@media (max-width: 1024px) { .auth-mobile-brand { display: flex; } }
