:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --border: #e3e8ec;
  --text: #17212b;
  --muted: #5f6b76;
  --primary: #0f766e;
  --primary-600: #0d655e;
  --primary-soft: #e0f2ef;
  --danger: #c2372b;
  --danger-soft: #fdecea;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --info: #2563eb;
  --info-soft: #e5edff;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --violet: #7c3aed;
  --violet-soft: #efe7ff;
  --gray-soft: #eef1f4;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 12px;
  --sidebar: 236px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #182028;
    --surface-2: #1d2630;
    --border: #2a3542;
    --text: #e6ebf0;
    --muted: #9aa7b3;
    --primary: #2bb3a3;
    --primary-600: #37c4b3;
    --primary-soft: #133b37;
    --danger: #f06a5f;
    --danger-soft: #3a1d1b;
    --warn: #f0a44b;
    --warn-soft: #3a2a14;
    --info: #6d9bff;
    --info-soft: #1a2744;
    --ok: #4ade80;
    --ok-soft: #14301f;
    --violet: #b394ff;
    --violet-soft: #2a2145;
    --gray-soft: #232d38;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'IBM Plex Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
svg[aria-hidden] { width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -0.15em; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.auth-card .brand img { width: 64px; height: 64px; }
.brand b { display: block; font-size: 16px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: var(--muted); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav .sep { margin: 10px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.userbox { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.userbox .who { flex: 1; min-width: 0; }
.userbox .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.scrim { display: none; }

@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .topbar { display: flex; }
  .content { padding: 16px 16px 40px; }
  h1 { font-size: 20px; }
}

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }

.kpi { padding: 16px 18px; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi .bar { height: 6px; background: var(--gray-soft); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.kpi .bar i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.kpi.accent-warn .value { color: var(--warn); }
.kpi.accent-danger .value { color: var(--danger); }
.kpi.accent-info .value { color: var(--info); }
.kpi.accent-ok .value { color: var(--ok); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 500;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13.5px; }
.btn.icon { width: 38px; padding: 0; }
.btn.block { width: 100%; }

.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 76px; padding: 9px 12px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.search { position: relative; min-width: 220px; flex: 1; max-width: 360px; }
.search svg { position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 36px; }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
label.field .req { color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid h3 { grid-column: 1 / -1; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--text); }
.form-grid h3:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
@media (max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted); display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip .count { font-size: 12px; opacity: .75; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12.5px;
  font-weight: 600; white-space: nowrap; background: var(--gray-soft); color: var(--muted);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-violet { background: var(--violet-soft); color: var(--violet); }
.b-primary { background: var(--primary-soft); color: var(--primary); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

@media (max-width: 760px) {
  table.table.responsive thead { display: none; }
  table.table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 10px 14px; border-bottom: 1px solid var(--border); }
  .table.responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex-shrink: 0; }
  .table.responsive td.num { text-align: right; }
}

.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Summary table ---------- */
.summary td:first-child { color: var(--muted); }
.summary td.num { font-weight: 600; }
.summary tr.hl td { background: var(--primary-soft); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.room-pill {
  min-width: 56px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 13.5px;
  background: var(--gray-soft); padding: 0 6px;
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .grow b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-scroll { max-height: 380px; overflow-y: auto; }

/* ---------- Room map ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.floor { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.floor:last-child { border-bottom: 0; }
.floor-label { font-weight: 600; color: var(--muted); font-size: 13.5px; padding-top: 8px; }
.floor-label small { display: block; font-weight: 400; font-size: 11.5px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tile {
  border-radius: 10px; padding: 8px 9px; min-height: 64px; cursor: pointer; border: 1px solid transparent; text-align: left;
  display: flex; flex-direction: column; gap: 2px; position: relative; transition: transform .08s, box-shadow .08s;
}
.tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.tile b { font-size: 14px; }
.tile span { font-size: 11.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .9; }
.tile .flag { position: absolute; top: 6px; right: 7px; font-size: 11px; font-weight: 700; }
.tile.dim { opacity: .25; }
@media (max-width: 600px) {
  .floor { grid-template-columns: 1fr; gap: 6px; padding: 12px 14px; }
  .floor-label { padding-top: 0; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
}

.s-vacant-ready   { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.s-vacant-cleaning{ background: var(--surface); color: var(--ok); border: 1px dashed color-mix(in srgb, var(--ok) 55%, transparent); }
.s-vacant-repair  { background: var(--danger-soft); color: var(--danger); }
.s-vacant-sample  { background: var(--gray-soft); color: var(--muted); }
.s-occupied       { background: var(--primary-soft); color: var(--primary); }
.s-stay           { background: var(--info-soft); color: var(--info); }
.s-notice         { background: var(--warn-soft); color: var(--warn); }
.s-notice_booked  { background: var(--violet-soft); color: var(--violet); }
.s-reserved       { background: var(--violet-soft); color: var(--violet); border: 1px dashed var(--violet); }
.s-duplicate      { background: var(--danger); color: #fff; }

/* ---------- Drawer / Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10, 16, 24, .45); z-index: 60; display: flex; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  margin-left: auto; width: min(560px, 100%); height: 100%; background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .2s ease;
}
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }
.modal {
  margin: auto; width: min(720px, calc(100% - 24px)); max-height: calc(100vh - 32px); background: var(--surface);
  border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: pop .15s ease;
}
.modal.narrow { width: min(440px, calc(100% - 24px)); }
@keyframes pop { from { transform: scale(.97); opacity: .5; } }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-head h2 { flex: 1; }
.panel-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.panel-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.section { margin-bottom: 20px; }
.section > h3 { margin-bottom: 10px; }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 500px) { dl.kv { grid-template-columns: 120px 1fr; } }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.callout { border-radius: 10px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.callout.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.callout.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.secret {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 17px; letter-spacing: .03em; padding: 12px;
  background: var(--surface-2); border: 1px dashed var(--border); border-radius: 9px; text-align: center; user-select: all;
}

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100% - 36px); }
.toast { background: var(--text); color: var(--surface); padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .15s ease; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 500px at 10% -10%, var(--primary-soft), transparent 60%), var(--bg); }
.auth-card { width: min(400px, 100%); padding: 30px 28px; }
.auth-card .brand { padding: 0 0 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.error-box { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 9px; font-size: 14px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; height: 32px; width: 36px; border: 0; background: transparent; cursor: pointer; color: var(--muted); border-radius: 7px; }

/* ---------- Trend chart ---------- */
.trend { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 150px; padding: 8px 4px 0; }
.trend .col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.trend .bars { display: flex; gap: 2px; align-items: flex-end; height: 120px; }
.trend .bars i { width: 9px; border-radius: 3px 3px 0 0; min-height: 2px; display: block; }
.trend .in { background: var(--primary); }
.trend .out { background: var(--warn); }
.trend small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.legend i.lg-in { background: var(--primary); }
.legend i.lg-out { background: var(--warn); }
.callout.click, [data-booking].callout { cursor: pointer; }
.callout.click:hover { border-color: var(--primary); }
.card-head select.input { width: auto; min-width: 140px; }
@media (max-width: 600px) {
  .card-head select.input { flex: 1 1 140px; }
  .search { max-width: none; min-width: 0; flex-basis: 100%; }
}

/* ---------- Export ---------- */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.choice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s;
}
.choice:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.choice.on { border-color: var(--primary); background: var(--primary-soft); }
.choice input { width: 17px; height: 17px; margin-top: 3px; accent-color: var(--primary); flex-shrink: 0; }
.choice span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.choice small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.choice em { font-style: normal; align-self: flex-start; margin-top: 2px; height: 20px; font-size: 11.5px; }
div.field { display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; font-weight: 500; }
.grow { flex: 1; min-width: 0; }

/* ---------- Chart tokens (validated: dataviz validate_palette) ---------- */
:root { --viz-1: #0d9488; --viz-2: #d97706; --viz-track: #eef1f4; }
@media (prefers-color-scheme: dark) { :root { --viz-1: #0d9488; --viz-2: #c2700a; --viz-track: #232d38; } }
.trend .in, .legend i.lg-in, .viz-1 { background: var(--viz-1); }
.trend .out, .legend i.lg-out, .viz-2 { background: var(--viz-2); }

.hbar { display: flex; flex-direction: column; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; font-size: 13.5px; }
.hbar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.hbar-row .track { height: 14px; background: var(--viz-track); border-radius: 4px; overflow: hidden; }
.hbar-row .track i { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar-row .val { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 44px; text-align: right; }
.vbars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; align-items: end; height: 190px; padding-top: 14px; }
.vbars .col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; }
.vbars .bars { display: flex; gap: 2px; align-items: flex-end; height: 150px; width: 100%; justify-content: center; }
.vbars .bars i { flex: 0 1 14px; border-radius: 4px 4px 0 0; min-height: 2px; display: block; position: relative; }
.vbars .bars i:hover { filter: brightness(1.12); }
.vbars small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vbars .top { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-note { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* ---------- AI panel ---------- */
.ai-card { border: 1px solid color-mix(in srgb, var(--violet) 35%, var(--border)); background: linear-gradient(180deg, var(--violet-soft), var(--surface) 140px); }
.ai-headline { font-size: 18px; font-weight: 700; margin: 4px 0 8px; }
.ai-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ai-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ai-item b { display: block; margin-bottom: 4px; }
.ai-item p { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- Meters ---------- */
.meter-input { width: 110px; height: 34px; padding: 0 8px; text-align: right; }
.table td.tight { padding-top: 6px; padding-bottom: 6px; }
.money { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.totals { margin-top: 14px; margin-left: auto; width: min(320px, 100%); display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 14px; }
.totals .grand { font-weight: 700; font-size: 16px; border-top: 1px solid var(--border); padding-top: 6px; }
.items-edit td { padding: 6px 8px; }
.items-edit .input { height: 34px; }

/* ---------- Print ---------- */
#print-area { display: none; }
@media print {
  body { background: #fff; color: #000; }
  #app, #toasts, .overlay { display: none !important; }
  #print-area { display: block; }
  @page { size: A4; margin: 14mm; }
}
.doc { font-size: 13px; color: #000; }
.doc h1 { font-size: 20px; margin: 0; }
.doc .doc-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 12px; }
.doc .doc-head img { width: 64px; height: 64px; }
.doc table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.doc th, .doc td { border: 1px solid #999; padding: 6px 8px; text-align: left; }
.doc td.num, .doc th.num { text-align: right; }
.doc .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; text-align: center; }
.doc .sign div { border-top: 1px dotted #000; padding-top: 6px; }
.doc .copy + .copy { page-break-before: always; }
.page-head .row { flex-wrap: nowrap; }
.page-head input[type=month].input { width: 170px; }
