/* =====================================================================
   IoT Energy Dashboard — shared theme
   Tokens + reusable components. Page layout (positions) lives in each
   page; everything visual lives here. See DESIGN.md for usage.
   ===================================================================== */

:root {
  /* surface & ink */
  --bg: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: rgba(15, 23, 42, 0.08);
  --hover: rgba(15, 23, 42, 0.035);
  --well: rgba(15, 23, 42, 0.03);
  --card: rgba(255, 255, 255, 0.86);

  /* brand & status */
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --accent-line: rgba(37, 99, 235, 0.35);
  --ok: #10b981;
  --ok-ring: rgba(16, 185, 129, 0.15);
  --warn: #f59e0b;
  --warn-soft: #fef3c7;
  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --off: #cbd5e1;

  /* shape & depth */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 28px rgba(15, 23, 42, .08);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .10);

  /* type */
  --font: "Inter", "IBM Plex Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: 24px;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Surfaces ---------- */
.glass { background: var(--card); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }

/* ---------- Typography ---------- */
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; gap: 8px; }
.eyebrow::before { content: ""; width: 18px; height: 2px; background: var(--accent); border-radius: 2px; }
.title { margin: 8px 0 4px; font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.title span { color: var(--faint); font-weight: 500; }
.section-label { margin: 4px 8px 6px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }

/* ---------- Segmented control & icon buttons ---------- */
.seg { display: flex; background: rgba(15, 23, 42, .04); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button, .icon-btn { border: 0; background: transparent; padding: 7px 13px; border-radius: var(--radius-xs); font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; white-space: nowrap; }
.seg button:hover, .icon-btn:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.icon-btn { padding: 7px 10px; display: inline-flex; align-items: center; gap: 6px; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }
.divider { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }

/* ---------- Buttons ---------- */
.btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 7px 12px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); transition: border-color .15s, color .15s; }
.btn:hover { border-color: var(--accent-line); color: var(--accent); }
.btn-primary { border: 0; border-radius: var(--radius-sm); padding: 9px 14px; font-weight: 600; font-size: 13px; cursor: pointer; background: var(--accent); color: #fff; }
.btn-danger { border-color: rgba(239, 68, 68, .3); color: var(--danger); }

/* ---------- Popover (anchored under a toolbar button) ---------- */
.popover { position: absolute; top: calc(100% + 8px); right: 0; padding: 8px; width: 262px; display: none; }
.popover.open { display: block; animation: pop .18s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

/* ---------- Toggle row (label + switch) ---------- */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border-radius: var(--radius-xs); cursor: pointer; font-size: 13px; color: var(--ink-2); user-select: none; }
.toggle:hover { background: var(--hover); }
.toggle .sw { width: 30px; height: 18px; border-radius: 99px; background: var(--off); position: relative; transition: background .2s; flex: none; }
.toggle .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .2s; }
.toggle.on .sw { background: var(--accent); }
.toggle.on .sw::after { transform: translateX(12px); }
.toggle .lbl { display: flex; align-items: center; gap: 8px; }
.chip { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.slider-row { padding: 2px 8px 8px 26px; display: none; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.slider-row.show { display: flex; }
input[type=range] { flex: 1; accent-color: var(--accent); }

/* ---------- Mini switch (inline in list rows) ---------- */
.mini-sw { width: 28px; height: 16px; border-radius: 99px; background: var(--accent); position: relative; border: 0; cursor: pointer; padding: 0; flex: none; }
.mini-sw::after { content: ""; position: absolute; top: 2px; left: 14px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .2s; }
.off .mini-sw { background: var(--off); }
.off .mini-sw::after { left: 2px; }

/* ---------- Status dot ---------- */
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-ring); flex: none; }
.off .dot { background: var(--off); box-shadow: none; }
.fault .dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, .18); }

/* ---------- Card header ---------- */
.card-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 8px 10px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.card-head small { color: var(--muted); font-size: 12px; }
.chev { display: none; width: 7px; height: 7px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint); transform: rotate(-135deg) translate(-2px, -2px); transition: transform .2s; }
.collapsed .chev { transform: rotate(45deg); }

/* ---------- Card (glass panel in a rail) ---------- */
.card { padding: 10px 8px 8px; }
.note { margin: 0 8px 10px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }

/* ---------- Badge & live dot ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 500; color: var(--muted); background: var(--well); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
.badge.accent { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.badge.warn { color: #b45309; background: var(--warn-soft); border-color: transparent; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); animation: live 2s ease-out infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* ---------- Big stat (value + caption) ---------- */
.stat-big { padding: 0 8px 10px; }
.stat-big > span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }
.stat-big > span b { color: var(--ink-2); font-weight: 600; }
.stat-big.tight { padding: 0; }
.stat-big.tight .bigval { font-size: 30px; }

/* ---------- Sparkline (24 h area chart, inline SVG) ---------- */
.spark { padding: 0 8px 10px; }
.spark svg { display: block; width: 100%; height: 72px; overflow: visible; }
.spark .area { fill: var(--accent); opacity: .10; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.spark .grid { stroke: var(--line); stroke-width: 1; }
.spark .now { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.spark .axis { font-size: 9.5px; fill: var(--faint); font-family: var(--font); }

/* ---------- Unit dots (one dot per device, clickable) ---------- */
.unit-dots { display: grid; grid-template-columns: repeat(6, 14px); gap: 6px; }
.unit-dots button { width: 14px; height: 14px; border-radius: 4px; border: 0; padding: 0; cursor: pointer; background: var(--accent); transition: transform .15s, background .2s; }
.unit-dots button:hover { transform: scale(1.2); }
.unit-dots button.off { background: var(--off); }
.unit-dots button.fault { background: var(--danger); }
.unit-dots button.sel { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 6px 10px; }
.kpi { background: var(--well); border-radius: var(--radius-sm); padding: 9px 11px; }
.kpi b { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 11.5px; color: var(--muted); }
.kpi.accent b { color: var(--accent); }
.kpis.three { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kpis.three .kpi { padding: 8px 9px; }
.kpis.three .kpi b { font-size: 16px; }
.kpis.three .kpi span { font-size: 11px; }

/* ---------- List rows ---------- */
.list { overflow-y: auto; flex: 1; padding: 0 2px; scrollbar-width: thin; }
.row { display: grid; grid-template-columns: 10px 1fr auto auto; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; }
.row:hover { background: var(--hover); }
.row.sel { background: var(--accent-soft); }
.row .name { font-size: 13px; font-weight: 600; }
.row .sub { font-size: 11.5px; color: var(--muted); display: block; font-weight: 400; margin-top: 1px; }
.row .val { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.off .val { color: var(--faint); }

/* ---------- Detail card (selected item) ---------- */
.detail { margin: 0 6px 10px; padding: 14px; border-radius: 12px; background: linear-gradient(160deg, #eff6ff, #ffffff 70%); border: 1px solid rgba(37, 99, 235, .15); display: none; }
.detail.show { display: block; }
.detail .top { display: flex; justify-content: space-between; align-items: flex-start; }
.detail h4 { margin: 0; font-size: 16px; }
.detail .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.detail .close { border: 0; background: transparent; cursor: pointer; color: var(--faint); font-size: 18px; line-height: 1; padding: 2px 4px; }
.detail .btn-primary { margin-top: 12px; width: 100%; }
.detail.isoff .btn-primary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.detail.isoff .bigval { color: var(--faint); }

/* ---------- Big value + stepper ---------- */
.setpoint { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.bigval { font-size: 40px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.bigval small { font-size: 18px; color: var(--muted); font-weight: 500; }
.stepper { display: flex; gap: 6px; }
.stepper button { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #fff; font-size: 18px; cursor: pointer; color: var(--ink-2); }
.stepper button:hover { color: var(--accent); border-color: var(--accent-line); }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.meta div { font-size: 11px; color: var(--muted); }
.meta b { display: block; font-size: 12.5px; color: var(--ink); font-weight: 600; margin-top: 2px; }

/* ---------- Hint pill, splash, veil ---------- */
.hint { font-size: 12px; color: var(--muted); padding: 8px 14px; border-radius: 99px; pointer-events: none; transition: opacity .6s; white-space: nowrap; }
.splash { position: fixed; inset: 0; background: #fff; display: grid; place-items: center; z-index: 50; transition: opacity .8s ease; }
.splash.hide { opacity: 0; pointer-events: none; }
.splash .ld { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; }
.splash .ld i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.veil { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .18s; }
.veil.on { opacity: 1; }

/* ---------- 3D scene tags (CSS2D labels) ---------- */
.ac-tag { pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 4px 9px 4px 7px; border-radius: 99px; background: rgba(255, 255, 255, .94); border: 1px solid rgba(37, 99, 235, .22); box-shadow: var(--shadow-sm); font-size: 11.5px; font-weight: 600; color: var(--ink); white-space: nowrap; transition: border-color .2s, background .2s; }
.ac-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.ac-tag span { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.ac-tag:hover, .ac-tag.sel { border-color: var(--accent); background: #fff; }
.ac-tag.sel { background: var(--accent); color: #fff; }
.ac-tag.sel span { color: rgba(255, 255, 255, .8); }
.ac-tag.sel i { background: #fff; box-shadow: none; }
.ac-tag.off { border-color: var(--line); color: var(--muted); }
.ac-tag.off i { background: var(--off); box-shadow: none; }
.ac-tag.fault { background: var(--danger); border-color: var(--danger); color: #fff; animation: tag-alarm 1.2s ease-in-out infinite; }
.ac-tag.fault span { color: rgba(255, 255, 255, .9); }
.ac-tag.fault i { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
@keyframes tag-alarm { 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, .22), var(--shadow-sm); } }
.sv-tag { font-size: 10px; font-weight: 600; color: #475569; background: rgba(255, 255, 255, .9); border: 1px solid rgba(15, 23, 42, .12); border-radius: 5px; padding: 1px 5px; letter-spacing: .03em; }
.hide-tags .ac-tag, .hide-tags .sv-tag { display: none; }
.hide-sv .sv-tag { display: none; }

.fatal { position: fixed; inset: 0; display: none; place-items: center; text-align: center; color: var(--muted); font-size: 14px; padding: 24px; }

/* ---------- Alerts (active faults) ----------
   .alert-card  floating red-tinted glass card, one per unacknowledged fault
   .alert-item  the same content inline inside another card (e.g. .detail)
   .alert-mini  compact summary card listing overflow / acknowledged faults */
.alert { border-color: rgba(239, 68, 68, .35); background: linear-gradient(160deg, rgba(254, 226, 226, .94), rgba(255, 255, 255, .92) 70%); }
.alert-card { padding: 12px 12px 10px; }
.alert-item { padding: 10px; margin: 0 2px 6px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, .75); border: 1px solid rgba(239, 68, 68, .18); }
:is(.alert-item, .alert-card) .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
:is(.alert-item, .alert-card) .what { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.alert-card .what { font-size: 14px; }
:is(.alert-item, .alert-card) .what small { color: var(--muted); font-weight: 500; font-size: 12px; }
:is(.alert-item, .alert-card) .where { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
:is(.alert-item, .alert-card) .advice { font-size: 11.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
:is(.alert-item, .alert-card) .acts { display: flex; gap: 6px; margin-top: 8px; }
:is(.alert-item, .alert-card) .acts .btn { padding: 5px 10px; font-size: 12px; }
.alert-card .acts .btn:first-child { background: var(--danger); border-color: var(--danger); color: #fff; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; animation: pulse-red 1.4s ease-out infinite; }
@keyframes pulse-red { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); } 80%, 100% { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); } }
.alert-mini { padding: 8px 6px 6px; }
.alert-mini .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 6px 6px; font-size: 12.5px; font-weight: 600; }
.alert-mini .head .btn { padding: 4px 9px; font-size: 11.5px; }
.alert-mini .rows { max-height: 152px; overflow-y: auto; scrollbar-width: thin; }
.alert-mini .mrow { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 8px; padding: 6px; border-radius: var(--radius-xs); cursor: pointer; font-size: 12px; }
.alert-mini .mrow:hover { background: var(--hover); }
.alert-mini .mrow .dot { width: 7px; height: 7px; box-shadow: none; }
.alert-mini .mrow.ack .dot { background: var(--warn); }
.alert-mini .mrow.active .dot { background: var(--danger); }
.alert-mini .mrow small { color: var(--muted); }
.enter { animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ---------- Form fields & chips ---------- */
.field { font: inherit; font-size: 12.5px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-xs); padding: 6px 9px; outline: none; transition: border-color .15s, box-shadow .15s; }
.field:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
select.field { padding-right: 26px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%), linear-gradient(135deg, var(--faint) 50%, transparent 50%); background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 11px; font-size: 12px; cursor: pointer; color: var(--ink-2); transition: all .15s; }
.chips button:hover { border-color: var(--accent-line); }
.chips button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Drawer (slides up from the bottom edge) ---------- */
.drawer { display: flex; flex-direction: column; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(24px) scale(.98); transform-origin: bottom left; transition: opacity .22s ease, transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s .3s; }
.drawer.open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition: opacity .22s ease, transform .3s cubic-bezier(.2, .8, .2, 1); }
.drawer-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 6px 10px; }
.drawer-bar .spacer { flex: 1; }

/* ---------- Data table ---------- */
.table-wrap { overflow: auto; flex: 1; border-top: 1px solid var(--line); scrollbar-width: thin; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.table th { position: sticky; top: 0; z-index: 1; background: rgba(248, 250, 252, .97); text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: .02em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.table tbody tr { cursor: pointer; transition: background .12s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr.active td { background: rgba(254, 226, 226, .45); }
.table td.strong { color: var(--ink); font-weight: 600; }
.table .empty { text-align: center; color: var(--faint); padding: 28px; cursor: default; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 78px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 40; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .3s cubic-bezier(.2, .8, .2, 1); cursor: pointer; }
.toast.danger { background: var(--danger); }
.toast .t-sub { opacity: .8; font-size: 12px; }
.toast.out { animation: toast-out .25s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Carbon: tree equivalence row ---------- */
.trees { display: flex; gap: 4px; padding: 2px 8px 4px; }
.trees .tree { position: relative; width: 22px; height: 26px; flex: none; }
.trees .tree > span { position: absolute; inset: 0; }
.trees .tree svg { display: block; width: 22px; height: 26px; }
.trees .tree .bg { color: rgba(15, 23, 42, .1); }
.trees .tree .fg { color: var(--ok); clip-path: inset(var(--empty, 100%) 0 0 0); transition: clip-path .8s cubic-bezier(.2, .8, .2, 1); }
.trees-note { margin: 0 8px 10px; font-size: 11.5px; color: var(--muted); }
.trees-note b { color: var(--ink-2); }

/* ---------- Meter: actual vs baseline bars ---------- */
.meter { display: grid; gap: 6px; padding: 0 8px 8px; }
.meter-row { display: grid; grid-template-columns: 74px 1fr 64px; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.meter-row b { text-align: right; color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-row .bar { height: 8px; border-radius: 99px; background: var(--well); overflow: hidden; }
.meter-row .bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--ok); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.meter-row.base .bar i { background: var(--off); }
.saving { margin: 2px 6px 4px; padding: 9px 11px; border-radius: var(--radius-sm); background: rgba(16, 185, 129, .08); color: #047857; font-size: 12.5px; line-height: 1.45; }
.saving b { font-weight: 600; }
.saving.neg { background: var(--warn-soft); color: #b45309; }

/* ---------- AI dock (น้องฉ่ำ) ----------
   .dock-bar   glass pill: avatar circle · name/status · mic button
   .mic-btn    round primary action (.live = in a session → red stop)
   .levels     tiny live audio meter (set --l 0..1 on each <i>)
   .bubble     speech bubble for the assistant's words (.err for problems)
   .said       muted line with what the user said */
.dock-bar { position: relative; display: flex; align-items: center; gap: 10px; height: 56px; padding: 6px 6px 6px 58px; border-radius: 99px; }
.dock-text { min-width: 0; flex: 1; line-height: 1.25; }
.dock-text b { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; }
.dock-text span { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mic-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; cursor: pointer; display: grid; place-items: center; color: #fff; background: var(--accent); box-shadow: 0 6px 16px rgba(37, 99, 235, .32); transition: background .2s, box-shadow .2s, transform .15s; }
.mic-btn:hover { transform: scale(1.05); }
.mic-btn:active { transform: scale(.95); }
.mic-btn svg { width: 19px; height: 19px; }
.mic-btn.live { background: var(--danger); box-shadow: 0 6px 16px rgba(239, 68, 68, .32); }
.mic-btn .ring { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: spin .8s linear infinite; }
.levels { display: inline-flex; align-items: center; gap: 2px; height: 12px; }
.levels i { width: 3px; border-radius: 2px; background: var(--accent); height: calc(3px + var(--l, 0) * 9px); transition: height .08s; }
.bubble { padding: 11px 14px; border-radius: 16px 16px 16px 5px; font-size: 13.5px; line-height: 1.55; color: var(--ink); }
.bubble .who { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--accent); margin-bottom: 3px; }
.bubble.err .who { color: var(--danger); }
.bubble .tool { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.bubble .tool::before { content: ""; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.said { margin-top: 6px; font-size: 12px; color: var(--muted); padding-left: 2px; }
.said b { color: var(--ink-2); font-weight: 600; }

/* ---------- Call buttons (technician hotline) ---------- */
.btn-call { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; background: var(--ok) !important; border-color: var(--ok) !important; color: #fff !important; }
.btn-call svg { width: 13px; height: 13px; }
.call-card { display: flex; align-items: center; gap: 10px; margin-top: 9px; padding: 9px 11px; border-radius: 12px; text-decoration: none; color: #fff; background: var(--ok); box-shadow: 0 6px 16px rgba(16, 185, 129, .3); transition: transform .15s; }
.call-card:hover { transform: translateY(-1px); }
.call-card .ic { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .2); display: grid; place-items: center; flex: none; }
.call-card .ic svg { width: 16px; height: 16px; }
.call-card b { display: block; font-size: 13px; }
.call-card small { display: block; font-size: 11.5px; opacity: .9; }
.call-card .left { margin-left: auto; flex: none; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: rgba(255, 255, 255, .22); font-variant-numeric: tabular-nums; }

/* ---------- Page (workspace content) ----------
   .page-head    eyebrow + h2 + intro on the left, status/actions on the right
   .soon-grid    grid of .soon feature cards (placeholder / roadmap previews) */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h2 { margin: 8px 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.page-head p { margin: 0; max-width: 620px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.soon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.soon-grid.one { grid-template-columns: 1fr; align-content: start; }
.soon { padding: 16px; border-radius: var(--radius); background: rgba(255, 255, 255, .7); border: 1px solid var(--line); }
.soon h3 { margin: 12px 0 4px; font-size: 14px; font-weight: 600; }
.soon p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.soon-ic { width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.soon-ic svg { width: 18px; height: 18px; }

/* ---------- Report preview (mini A4 sheet) ---------- */
.report-preview { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 20px; align-items: start; }
.sheet { aspect-ratio: 1 / 1.414; background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); }
.sheet-top { display: flex; justify-content: space-between; gap: 8px; font-size: 9.5px; color: var(--muted); border-bottom: 2px solid var(--accent); padding-bottom: 8px; }
.sheet-top b { color: var(--ink); font-size: 10px; }
.sheet-title { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.sheet-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.sheet-kpis i { height: 34px; border-radius: 5px; background: var(--well); border: 1px solid var(--line); }
.sheet-chart { flex: 1; border-radius: 6px; background: linear-gradient(180deg, rgba(37, 99, 235, .10), rgba(37, 99, 235, .02)), repeating-linear-gradient(90deg, transparent 0 18px, var(--line) 18px 19px); }
.sheet-lines { display: grid; gap: 6px; }
.sheet-lines i { height: 6px; border-radius: 3px; background: var(--well); }
@media (max-width: 820px) {
  .page-head { flex-direction: column; gap: 10px; }
  .page-head h2 { font-size: 20px; }
  .report-preview { grid-template-columns: 1fr; }
  .sheet { max-width: 260px; }
}
