/* Terviros MES – design system aligned with Terviros Health.
   Inter, ink #172033 on canvas #f8fafc, teal brand #0d9488 / #0f766e, glass surfaces with layered depth,
   gradient pill buttons. Light by default, dark on request or by system preference. */

:root {
  --canvas: #f8fafc;
  --surface: #ffffff;
  --subtle: #f1f5f9;
  --ink: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --brand: #0d9488;
  --brand-strong: #0f766e;
  --brand-soft: rgba(13, 148, 136, .12);
  --brand-ink: #ffffff;
  --accent: #2563eb;
  --success: #16a34a; --success-bg: #dcfce7;
  --warning: #d97706; --warning-bg: #fef3c7;
  --danger: #dc2626;  --danger-bg: #fee2e2;
  --info-bg: #dbeafe;
  --neutral-bg: #eef2f6;
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-line: rgba(148, 163, 184, .24);
  --depth: 0 1px 0 rgba(255,255,255,.9) inset, 0 1px 2px rgba(15,23,42,.04), 0 10px 30px -8px rgba(15,23,42,.12), 0 30px 60px -30px rgba(13,148,136,.18);
  --depth-hover: 0 1px 0 rgba(255,255,255,.95) inset, 0 2px 4px rgba(15,23,42,.05), 0 18px 40px -10px rgba(15,23,42,.16), 0 40px 80px -30px rgba(13,148,136,.25);
  --btn-gradient: linear-gradient(135deg, #14b8a6, #0f766e 55%, #0e7490);
  --btn-glow: 0 1px 0 rgba(255,255,255,.35) inset, 0 8px 20px -6px rgba(13,148,136,.55);
  --ill-1: #ccfbf1; --ill-2: #5eead4; --ill-3: #0f766e; --ill-4: #bae6fd;
  --radius: 14px;
  --radius-sm: 10px;
  --pill: 999px;
  --focus: #0d9488;
  --topbar-h: 60px;
  --modbar-h: 48px;
  --side-w: 248px;
  --side-rail: 68px;
  --row-pad: .62rem;
  /* Kept for older screens */
  --bg: var(--canvas); --text: var(--ink); --surface-2: var(--subtle);
  --good: var(--success); --good-bg: var(--success-bg); --warn: var(--warning); --warn-bg: var(--warning-bg); --bad: var(--danger); --bad-bg: var(--danger-bg);
  --shadow: var(--depth);
  color-scheme: light;
  font-family: Inter, "Inter Fallback", "Segoe UI", ui-sans-serif, system-ui, -apple-system, Roboto, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: "cv11", "ss01", "tnum" 0;
}

:root[data-theme="dark"] {
  --canvas: #0b1220; --surface: #111a2c; --subtle: #17223a; --ink: #e6edf7; --muted: #94a3b8; --line: #23324d; --line-strong: #31415f;
  --brand: #2dd4bf; --brand-strong: #14b8a6; --brand-soft: rgba(45, 212, 191, .14); --brand-ink: #042f2b;
  --success-bg: rgba(22,163,74,.18); --warning-bg: rgba(217,119,6,.2); --danger-bg: rgba(220,38,38,.2); --info-bg: rgba(37,99,235,.2); --neutral-bg: #1c2840;
  --success: #4ade80; --warning: #fbbf24; --danger: #f87171;
  --glass: rgba(17, 26, 44, .72); --glass-strong: rgba(17, 26, 44, .9); --glass-line: rgba(148, 163, 184, .16);
  --depth: 0 1px 0 rgba(255,255,255,.04) inset, 0 12px 32px -12px rgba(0,0,0,.6);
  --depth-hover: 0 1px 0 rgba(255,255,255,.06) inset, 0 18px 40px -12px rgba(0,0,0,.7);
  --btn-glow: 0 8px 20px -8px rgba(45,212,191,.45);
  --ill-1: #134e4a; --ill-2: #0f766e; --ill-3: #5eead4; --ill-4: #1e3a5f;
  color-scheme: dark;
}
:root[data-density="compact"] { font-size: 14px; --row-pad: .38rem; }

* { box-sizing: border-box; min-width: 0; }
html { scroll-padding-top: calc(var(--topbar-h) + var(--modbar-h) + 12px); }
body {
  margin: 0; min-height: 100vh; overflow-x: clip;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(20, 184, 166, .10), transparent 60%),
    radial-gradient(800px 380px at 100% 0%, rgba(14, 116, 144, .08), transparent 60%),
    var(--canvas);
  background-attachment: fixed;
}
a { color: var(--brand-strong); text-decoration: none; }
:root[data-theme="dark"] a { color: var(--brand); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1 { font-size: clamp(1.35rem, 1.1rem + .8vw, 1.75rem); line-height: 1.15; margin: 0; letter-spacing: -.02em; font-weight: 700; text-wrap: balance; }
h2 { font-size: 1.02rem; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 0; font-weight: 650; }
p { margin: .35rem 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.xsmall { font-size: .78rem; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 46ch; }
.overdue { color: var(--danger); font-weight: 600; }
.neg { color: var(--danger); }
.pos { color: var(--success); }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
.icon { flex: none; display: inline-block; vertical-align: -3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 1px solid var(--line-strong); background: var(--glass-strong); color: var(--ink);
  padding: .5rem 1rem; border-radius: var(--pill); cursor: pointer; min-height: 40px; white-space: nowrap;
  transition: background .15s, box-shadow .15s, transform .05s, border-color .15s;
}
.btn:hover { background: var(--surface); border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--btn-gradient); border: 0; color: #fff; box-shadow: var(--btn-glow); }
.btn-primary:hover { background: var(--btn-gradient); filter: brightness(1.06); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--brand-soft); border-color: transparent; }
.btn-sm { padding: .28rem .7rem; min-height: 32px; font-size: .82rem; }
.btn-lg { min-height: 54px; font-size: 1.02rem; padding: .7rem 1.2rem; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }

/* ---------- chips, badges, tags ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 1rem; }
.chip { font: inherit; font-size: .84rem; padding: .32rem .8rem; border-radius: var(--pill); border: 1px solid var(--line); background: var(--glass-strong); color: var(--muted); cursor: pointer; display: inline-flex; gap: .35rem; align-items: center; }
.chip:hover { border-color: var(--brand); color: var(--ink); }
.chip.active { background: var(--brand-soft); color: var(--brand-strong); border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); font-weight: 650; }
:root[data-theme="dark"] .chip.active { color: var(--brand); }
.chip .count { font-size: .74rem; background: var(--subtle); border-radius: var(--pill); padding: 0 .4rem; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 650; padding: .14rem .6rem; border-radius: var(--pill); background: var(--neutral-bg); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-good { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warning-bg); color: var(--warning); }
.badge-bad { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--accent); }
.tag { font-size: .72rem; font-weight: 650; margin-left: .4rem; padding: .08rem .5rem; border-radius: 6px; background: var(--brand-soft); color: var(--brand-strong); }
.tag-demo { background: var(--warning-bg); color: var(--warning); }

/* ---------- shell: top bar, module bar, sidebar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .6rem; height: var(--topbar-h); padding: 0 1rem;
  background: var(--glass-strong); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--glass-line);
}
.spacer { flex: 1; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; font-size: 1.05rem; color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--btn-gradient); color: #fff; font-weight: 800; box-shadow: var(--btn-glow); }
.brand .brand-sub { color: var(--brand-strong); font-weight: 650; }
:root[data-theme="dark"] .brand .brand-sub { color: var(--brand); }
.brand-lg { font-size: 1.5rem; }
.brand-lg .brand-mark { width: 44px; height: 44px; font-size: 1.2rem; border-radius: 12px; }
.who { color: var(--muted); font-size: .86rem; white-space: nowrap; }
.menu-btn { display: none; }
.palette-trigger { display: inline-flex; align-items: center; gap: .5rem; min-width: 260px; justify-content: flex-start; color: var(--muted); font-weight: 500; border-color: var(--line); }
.palette-trigger kbd, kbd { font: 600 .72rem/1 Inter, system-ui, sans-serif; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: .18rem .38rem; color: var(--muted); background: var(--surface); }
.palette-trigger kbd { margin-left: auto; }
.plant-select { font: inherit; font-size: .86rem; font-weight: 600; border: 1px solid var(--line); border-radius: var(--pill); padding: .38rem 2rem .38rem .8rem; background: var(--glass-strong); color: var(--ink); min-height: 38px; }
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; }

.modbar {
  position: sticky; top: var(--topbar-h); z-index: 35; height: var(--modbar-h); display: flex; align-items: center; gap: .25rem; padding: 0 .75rem;
  background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--glass-line);
  overflow-x: auto; scrollbar-width: none; transition: margin-top .2s, opacity .2s;
}
.modbar::-webkit-scrollbar { display: none; }
.modtab { display: inline-flex; align-items: center; gap: .45rem; padding: .42rem .8rem; border-radius: var(--pill); color: var(--muted); font-weight: 600; font-size: .88rem; white-space: nowrap; border: 1px solid transparent; }
.modtab:hover { color: var(--ink); background: var(--brand-soft); text-decoration: none; }
.modtab[aria-current] { color: var(--brand-strong); background: var(--surface); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); box-shadow: var(--depth); }
:root[data-theme="dark"] .modtab[aria-current] { color: var(--brand); }
body.modbar-collapsed .modbar { margin-top: calc(-1 * var(--modbar-h)); opacity: 0; pointer-events: none; }
body.modbar-collapsed { --modbar-h-live: 0px; }

.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h) - var(--modbar-h)); transition: grid-template-columns .2s ease; }
body.modbar-collapsed .layout { min-height: calc(100vh - var(--topbar-h)); }
body.side-collapsed .layout { grid-template-columns: var(--side-rail) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: calc(var(--topbar-h) + var(--modbar-h)); height: calc(100vh - var(--topbar-h) - var(--modbar-h)); overflow-y: auto; overflow-x: hidden;
  padding: .9rem .6rem 1rem; border-right: 1px solid var(--glass-line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: .2rem;
}
body.modbar-collapsed .sidebar { top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); }
.side-head { display: flex; align-items: center; gap: .5rem; padding: .2rem .4rem .7rem; }
.side-head .module-name { font-weight: 700; font-size: .95rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-group { margin-top: .35rem; }
.nav-title { width: 100%; display: flex; align-items: center; gap: .4rem; font: inherit; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .35rem .6rem; background: none; border: 0; cursor: pointer; font-weight: 650; }
.nav-title .icon { margin-left: auto; transition: transform .15s; }
.nav-group.closed .nav-title .icon { transform: rotate(-90deg); }
.nav-group.closed .nav-items { display: none; }
.nav-link { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: 10px; color: var(--ink); font-weight: 500; font-size: .92rem; white-space: nowrap; position: relative; }
.nav-link .icon { color: var(--muted); }
.nav-link:hover { background: var(--brand-soft); text-decoration: none; }
.nav-link[aria-current] { background: var(--surface); color: var(--brand-strong); font-weight: 650; box-shadow: var(--depth); }
.nav-link[aria-current] .icon { color: var(--brand); }
:root[data-theme="dark"] .nav-link[aria-current] { color: var(--brand); }
.nav-link .nav-count { margin-left: auto; font-size: .72rem; font-weight: 700; background: var(--warning-bg); color: var(--warning); border-radius: var(--pill); padding: 0 .45rem; }
.side-foot { margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--glass-line); display: grid; gap: .2rem; }
body.side-collapsed .sidebar .label, body.side-collapsed .nav-title, body.side-collapsed .side-head .module-name, body.side-collapsed .nav-count { display: none; }
body.side-collapsed .nav-link { justify-content: center; padding: .6rem; }
body.side-collapsed .nav-group.closed .nav-items { display: block; }
body.side-collapsed .side-head { justify-content: center; }
body.side-collapsed .nav-link:hover::after {
  content: attr(data-label); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); background: var(--ink); color: var(--canvas);
  padding: .3rem .6rem; border-radius: 8px; font-size: .8rem; white-space: nowrap; z-index: 60; pointer-events: none;
}
body.side-collapsed .sidebar { overflow: visible; }

.content { padding: 1.35rem clamp(1rem, 2.6vw, 2.25rem) 3rem; max-width: 1480px; width: 100%; outline: none; }
.crumbs { display: flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--muted); margin-bottom: .4rem; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs .icon { opacity: .6; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.page-head .sub { color: var(--muted); font-size: .92rem; margin-top: .25rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.toolbar .chips { margin: 0; }
.search, .input-pill { font: inherit; padding: .55rem 1rem; border: 1px solid var(--line); border-radius: var(--pill); min-width: 260px; background: var(--glass-strong); color: var(--ink); min-height: 40px; }
.search:focus, .input-pill:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.loading { padding: 3rem; text-align: center; color: var(--muted); }
.loading::before { content: ""; display: block; width: 28px; height: 28px; margin: 0 auto .75rem; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cards, KPIs ---------- */
.card { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); box-shadow: var(--depth); padding: 1.05rem 1.15rem; margin-bottom: 1rem; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: .5rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--depth); position: relative; overflow: hidden; }
.stat-label { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.stat-value { font-size: 1.5rem; font-weight: 700; margin: .15rem 0 .05rem; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat-sub { font-size: .8rem; color: var(--muted); }
.stat.tone-good .stat-value { color: var(--success); }
.stat.tone-warn .stat-value { color: var(--warning); }
.stat.tone-bad .stat-value { color: var(--danger); }
.stat.clickable { cursor: pointer; transition: box-shadow .15s, transform .15s; }
.stat.clickable:hover { box-shadow: var(--depth-hover); transform: translateY(-1px); }
.stats-tight .stat { box-shadow: none; }
.big-number { font-size: 2rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.meter { height: 8px; border-radius: var(--pill); background: var(--subtle); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: var(--pill); background: var(--btn-gradient); }
.meter.warn > span { background: var(--warning); }
.meter.bad > span { background: var(--danger); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--glass-line); border-radius: var(--radius); background: var(--glass-strong); box-shadow: var(--depth); }
.card .table-wrap { border: 0; border-radius: 0; margin: 0 -1.15rem; box-shadow: none; background: transparent; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { position: sticky; top: 0; text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: .62rem .9rem; border-bottom: 1px solid var(--line); background: var(--subtle); white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th .sort { margin-left: .25rem; opacity: .7; }
td { padding: var(--row-pad) .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--subtle) 40%, transparent); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--brand-soft); }
tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warning); }
@media (min-width: 901px) { td:first-child { white-space: nowrap; } }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .cell > * + * { margin-left: .35rem; }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .55rem .9rem; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); flex-wrap: wrap; }
.empty { padding: 2rem 1.5rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--glass); display: grid; justify-items: center; gap: .5rem; }
.card .empty { border: 0; padding: 1.25rem; background: transparent; }
.notice { padding: .8rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; display: flex; gap: .6rem; align-items: flex-start; border: 1px solid transparent; }
.notice-warn { background: var(--warning-bg); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 25%, transparent); }
.notice-bad { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.notice-info { background: var(--info-bg); color: var(--accent); }
.notice-good { background: var(--success-bg); color: var(--success); }
.pager { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .75rem; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tab { font: inherit; font-weight: 600; font-size: .9rem; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: .6rem .9rem; cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--brand-strong); border-bottom-color: var(--brand); }
:root[data-theme="dark"] .tab[aria-selected="true"] { color: var(--brand); }

/* ---------- charts ---------- */
.bars { display: grid; gap: .65rem; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr auto; gap: .75rem; align-items: center; }
.bar-label { font-size: .88rem; }
.bar-track { height: 12px; background: var(--subtle); border-radius: var(--pill); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--btn-gradient); border-radius: var(--pill); min-width: 2px; }
.bar-fill.warn { background: var(--warning); }
.bar-fill.bad { background: var(--danger); }
.bar-value { font-size: .84rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.donut { display: flex; align-items: center; gap: 1rem; }
.legend { display: grid; gap: .3rem; font-size: .85rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .4rem; vertical-align: 0; }

/* ---------- home ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.hero h1 span { color: var(--brand-strong); }
:root[data-theme="dark"] .hero h1 span { color: var(--brand); }
.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.tile { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; align-items: center; padding: .9rem 1rem; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--depth); color: var(--ink); transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: var(--depth-hover); transform: translateY(-2px); text-decoration: none; }
.tile .illustration { grid-row: span 2; width: 64px; height: 50px; }
.tile strong { font-size: .95rem; }
.tile .muted { font-size: .8rem; }
.feed { display: grid; gap: .5rem; }
.feed-item { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; align-items: center; padding: .55rem .65rem; border-radius: 10px; }
.feed-item:hover { background: var(--brand-soft); }
.feed-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); }
.feed-icon.bad { background: var(--danger-bg); color: var(--danger); }
.feed-icon.warn { background: var(--warning-bg); color: var(--warning); }

/* ---------- pipeline board ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: .8rem; overflow-x: auto; padding-bottom: .5rem; }
.lane { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); padding: .6rem; min-height: 200px; }
.lane-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .2rem .3rem .6rem; }
.lane-won .lane-head strong { color: var(--success); }
.lane-lost .lane-head strong { color: var(--danger); }
.opp { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .75rem; margin-bottom: .55rem; box-shadow: var(--depth); display: grid; gap: .25rem; }
.opp-name { font-weight: 650; }
.opp-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: .86rem; font-variant-numeric: tabular-nums; }
.opp-actions { display: flex; gap: .3rem; margin-top: .25rem; }

/* ---------- dialogs, drawers, forms ---------- */
.dialog { border: 1px solid var(--glass-line); border-radius: 20px; padding: 0; width: min(680px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .45); }
.dialog.wide { width: min(980px, calc(100vw - 2rem)); }
.dialog::backdrop { background: rgba(15, 23, 42, .4); backdrop-filter: blur(3px); }
.dialog-form { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.dialog-form header { padding: 1.15rem 1.35rem .4rem; }
.dialog-form > .muted { padding: 0 1.35rem; margin: 0 0 .5rem; }
.dialog-body { padding: .5rem 1.35rem; overflow-y: auto; display: grid; gap: .9rem; }
.dialog-form footer { display: flex; justify-content: flex-end; gap: .5rem; padding: 1rem 1.35rem; border-top: 1px solid var(--line); }
.field { display: grid; gap: .32rem; }
.field label, .field-label { font-weight: 600; font-size: .86rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.field-check { grid-template-columns: auto 1fr; align-items: center; }
.field-check label { order: 2; font-weight: 500; }
.req { color: var(--danger); }
.hint { color: var(--muted); font-size: .8rem; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: .55rem .75rem; width: 100%; min-height: 44px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
textarea { resize: vertical; }
.form-error { color: var(--danger); background: var(--danger-bg); padding: .6rem .8rem; border-radius: 10px; margin: .25rem 1.35rem 0; }
.login .form-error, .card .form-error { margin: 0; }
.picker { display: grid; grid-template-columns: 1fr 1.3fr; gap: .4rem; }
.lines { display: grid; gap: .6rem; margin: .4rem 0 .6rem; }
.line { border: 1px solid var(--line); border-radius: 14px; padding: .7rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; background: var(--subtle); }
.line-main { grid-column: 1 / -1; }
.line-field { display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); font-weight: 600; }
.line-actions { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
.atp { grid-column: 1 / -1; }
.stack { display: grid; gap: .85rem; }
.picker-inline { min-width: min(520px, 100%); }
.picker-inline .picker { grid-template-columns: 1fr 1.4fr; }
code.copy { user-select: all; background: var(--subtle); padding: .15rem .45rem; border-radius: 6px; overflow-wrap: anywhere; }
.big-code { font-size: 1.4rem; letter-spacing: .12em; font-weight: 700; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.totp-qr { display: grid; justify-items: center; gap: .55rem; }
.totp-qr svg { width: min(220px, 100%); height: auto; border-radius: 12px; }
.totp-qr a { text-align: center; }
.totp-qr + p { margin: .2rem 0 0; }

/* ---------- command palette ---------- */
.palette { width: min(640px, calc(100vw - 2rem)); padding: 0; border-radius: 18px; border: 1px solid var(--glass-line); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .5); margin-top: 12vh; }
.palette::backdrop { background: rgba(15, 23, 42, .35); backdrop-filter: blur(3px); }
.palette-input { display: flex; align-items: center; gap: .6rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); }
.palette-input input { border: 0; box-shadow: none; padding: 0; min-height: 32px; font-size: 1.05rem; background: transparent; }
.palette-input input:focus { box-shadow: none; }
.palette-list { max-height: 52vh; overflow-y: auto; padding: .4rem; }
.palette-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .55rem .7rem .25rem; font-weight: 650; }
.palette-item { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .6rem .7rem; border-radius: 10px; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.palette-item[aria-selected="true"], .palette-item:hover { background: var(--brand-soft); }
.palette-item .muted { margin-left: auto; font-size: .8rem; }
.palette-foot { display: flex; gap: 1rem; padding: .55rem 1rem; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); }

/* ---------- popover menu ---------- */
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--depth-hover); padding: .4rem; z-index: 70; display: grid; gap: .1rem; }
.menu-wrap { position: relative; }
.menu-item { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: 9px; border: 0; background: none; font: inherit; color: var(--ink); cursor: pointer; text-align: left; width: 100%; }
.menu-item:hover { background: var(--brand-soft); text-decoration: none; }
.menu-sep { height: 1px; background: var(--line); margin: .3rem 0; }
.menu-label { font-size: .72rem; color: var(--muted); padding: .35rem .7rem .15rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); align-items: center; gap: 2rem; padding: clamp(1rem, 4vw, 3rem); max-width: 1180px; margin: 0 auto; }
.login-hero h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); line-height: 1.05; }
.login-hero h1 span { color: var(--brand-strong); }
.login-hero .eyebrow { display: inline-flex; gap: .4rem; align-items: center; font-size: .82rem; font-weight: 600; color: var(--brand-strong); background: var(--brand-soft); border-radius: var(--pill); padding: .3rem .8rem; margin-bottom: 1rem; }
.login-hero ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .55rem; margin-top: 1.2rem; }
.login-hero li { display: flex; align-items: center; gap: .55rem; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 12px; padding: .6rem .75rem; font-size: .9rem; }
.login-hero li .icon { color: var(--brand); }
.login-card { width: 100%; max-width: 440px; justify-self: center; background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: 22px; box-shadow: var(--depth); padding: 1.75rem; display: grid; gap: .9rem; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.login-single { grid-template-columns: minmax(0, 1fr); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 100; }
.toast { background: var(--ink); color: var(--canvas); padding: .75rem 1rem; border-radius: 14px; box-shadow: var(--depth-hover); max-width: 440px; transition: opacity .3s, transform .3s; font-size: .92rem; }
.toast-success { background: var(--success); color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast.leaving { opacity: 0; transform: translateY(6px); }

/* ---------- floor terminal (kiosk) ---------- */
.floor-mode { font-size: 17px; }
.floor-root { min-height: 100vh; display: flex; flex-direction: column; }
.floor-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .65rem 1rem; background: var(--glass-strong); backdrop-filter: blur(12px); border-bottom: 1px solid var(--glass-line); }
.floor-id strong { font-size: 1.05rem; }
.pill { font: inherit; font-size: .84rem; font-weight: 650; padding: .28rem .75rem; border-radius: var(--pill); border: 0; background: var(--neutral-bg); color: var(--muted); }
.pill-good { background: var(--success-bg); color: var(--success); }
.pill-warn { background: var(--warning-bg); color: var(--warning); }
.pill-bad { background: var(--danger-bg); color: var(--danger); cursor: pointer; }
.floor-grid { flex: 1; display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 1rem; padding: 1rem; }
.floor-left { display: flex; flex-direction: column; gap: .75rem; min-height: 0; }
.scan { font-size: 1.15rem; min-height: 56px; border: 2px solid var(--brand); border-radius: 14px; }
.order-list { display: grid; gap: .5rem; overflow-y: auto; max-height: calc(100vh - 280px); align-content: start; }
.order-card { text-align: left; font: inherit; color: var(--ink); background: var(--glass-strong); border: 1px solid var(--line); border-radius: 14px; padding: .75rem .85rem; cursor: pointer; display: grid; gap: .2rem; min-height: 64px; }
.order-card.selected { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.order-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.floor-main { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--depth); }
.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.order-qty { text-align: right; }
.big-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; margin-bottom: 1.25rem; }
h2.sub { margin: 1rem 0 .5rem; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.ops { display: grid; gap: .6rem; }
.op { border: 1px solid var(--line); border-radius: 14px; padding: .75rem .85rem; display: grid; gap: .35rem; background: var(--subtle); }
.op-running { border-color: var(--brand); }
.op-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.op-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.op-actions .btn { min-height: 48px; }
.big-empty { padding: 4rem 1rem; font-size: 1.1rem; }
.floor-login { min-height: auto; padding-top: 2rem; grid-template-columns: minmax(0, 1fr); }

/* ---------- trace tree ---------- */
.tree { display: grid; gap: .35rem; }
.tree-node { display: flex; align-items: center; gap: .55rem; padding: .45rem .6rem; border-radius: 10px; background: var(--subtle); }
.tree-node[data-depth="1"] { margin-left: 1.5rem; }
.tree-node[data-depth="2"] { margin-left: 3rem; }
.tree-node[data-depth="3"] { margin-left: 4.5rem; }
.tree-node[data-depth="4"] { margin-left: 6rem; }

/* ---------- small screens ---------- */
@media (max-width: 1100px) { .palette-trigger { min-width: 0; } .palette-trigger .label { display: none; } }
@media (max-width: 900px) {
  :root { --modbar-h: 46px; }
  .menu-btn { display: inline-flex; }
  .who, .plant-select-wrap .label { display: none; }
  .layout, body.side-collapsed .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: calc(var(--topbar-h) + var(--modbar-h)); bottom: 0; width: 280px; transform: translateX(-105%); transition: transform .2s; z-index: 45; height: auto; box-shadow: var(--depth-hover); background: var(--surface); }
  .nav-open .sidebar { transform: none; }
  body.side-collapsed .sidebar .label, body.side-collapsed .nav-title, body.side-collapsed .side-head .module-name { display: initial; }
  .side-collapse-btn { display: none; }
  .search { min-width: 0; width: 100%; }
  .picker, .line { grid-template-columns: 1fr; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-hero ul { display: none; }
  table thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border-bottom: 1px solid var(--line); padding: .4rem 0; }
  td { border: 0; padding: .25rem .9rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; text-align: left; flex: none; }
  td > .cell { min-width: 0; overflow-wrap: anywhere; }
  td.row-actions { justify-content: flex-end; }
  td.row-actions::before { content: none; }
  .floor-grid { grid-template-columns: minmax(0, 1fr); }
  .order-list { max-height: 40vh; }
  .bar-row { grid-template-columns: 90px 1fr; }
  .bar-value { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .topbar, .modbar, .sidebar, .actions, .toasts, .chips, .toolbar { display: none !important; }
  .layout { display: block; } body { background: #fff; } .card, .table-wrap, .stat { box-shadow: none; backdrop-filter: none; }
}

/* ---------- additions: operations screens ---------- */
.warn-text { color: var(--warning); font-weight: 600; }
.inline-field { display: inline-flex; align-items: center; gap: .45rem; font-size: .88rem; color: var(--muted); font-weight: 600; }
.inline-field input, .inline-field select { width: auto; }
.input-sm { width: 7.5rem; min-height: 34px; padding: .3rem .5rem; text-align: right; }
.oee { display: grid; grid-template-columns: minmax(60px, 1fr) auto; align-items: center; gap: .5rem; min-width: 130px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.checklist li { display: flex; align-items: center; gap: .45rem; font-size: .9rem; }
.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.machine-card { display: grid; gap: .3rem; padding: .85rem .95rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); }
.machine-card.status-running { border-left-color: var(--success); }
.machine-card.status-available { border-left-color: var(--brand); }
.machine-card.status-down { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger-bg) 45%, var(--surface)); }
.machine-card.status-maintenance { border-left-color: var(--warning); }
.machine-card.status-retired { opacity: .6; }
.board.wip-board { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.board-col { background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius); padding: .6rem; min-height: 160px; }
.board-col > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.board-card { display: grid; gap: .3rem; padding: .7rem .8rem; margin-bottom: .55rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.board-card:hover { border-color: var(--brand); }
.board-card.late { border-left: 4px solid var(--danger); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .7rem; max-height: 46vh; overflow: auto; }
.perm-grid fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .7rem; margin: 0; display: grid; gap: .25rem; }
.perm-grid legend { font-weight: 700; font-size: .8rem; padding: 0 .3rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: .4rem; font-size: .84rem; font-weight: 500; }
.check input { width: auto; }
.secret { display: block; padding: .7rem .8rem; margin: .4rem 0; border-radius: var(--radius-sm); background: var(--subtle); border: 1px dashed var(--line-strong); word-break: break-all; user-select: all; }
.label-card { display: grid; gap: .25rem; padding: 1rem; margin: .8rem 0; border: 2px solid var(--ink); border-radius: 6px; background: #fff; color: #000; max-width: 340px; }
.label-card code { font-size: .78rem; word-break: break-all; }
.tree-node[data-depth="5"] { margin-left: 7.5rem; } .tree-node[data-depth="6"] { margin-left: 9rem; }
.tree-node > span:nth-child(2) { flex: 1; min-width: 0; }
a.notice { text-decoration: none; }

/* ---------- assistant ---------- */
.chat-fab { position: fixed; right: 1.15rem; bottom: 1.15rem; z-index: 60; width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; background: var(--btn-gradient); box-shadow: var(--btn-glow), 0 10px 30px -8px rgba(15,23,42,.35); display: grid; place-items: center; transition: transform .15s ease; }
.chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.chat-fab:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
body.chat-open .chat-fab, body.floor-mode .chat-fab { display: none; }
.chat { position: fixed; right: 1.15rem; bottom: 1.15rem; z-index: 61; width: min(410px, calc(100vw - 1.5rem)); height: min(620px, calc(100vh - 5.5rem)); display: flex; flex-direction: column; border-radius: 18px; background: var(--glass-strong); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); border: 1px solid var(--glass-line); box-shadow: var(--depth-hover); overflow: hidden; }
.chat[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: .6rem; padding: .7rem .8rem; border-bottom: 1px solid var(--line); }
.chat-head > div { flex: 1; min-width: 0; line-height: 1.25; }
.chat-head .brand-mark { background: var(--btn-gradient); color: #fff; }
.chat-log { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; }
.chat-msg { max-width: 92%; display: grid; gap: .5rem; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.user .chat-text { background: var(--btn-gradient); color: #fff; border-radius: 16px 16px 4px 16px; }
.chat-msg.bot .chat-text { background: var(--subtle); border-radius: 16px 16px 16px 4px; }
.chat-text { padding: .6rem .8rem; font-size: .9rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-rows { display: grid; gap: .3rem; }
.chat-row { display: flex; justify-content: space-between; gap: .6rem; padding: .45rem .65rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: inherit; text-decoration: none; font-size: .85rem; }
.chat-row:hover { border-color: var(--brand); }
.chat-row > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-links { display: flex; flex-wrap: wrap; gap: .35rem; }
.chat-msg .chips { margin: 0; }
.chat-form { display: flex; gap: .5rem; padding: .7rem .8rem .3rem; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; border-radius: var(--pill); }
.chat-note { margin: 0; padding: 0 .9rem .6rem; text-align: center; }
@media (max-width: 640px) { .chat { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; } }
@media print { .chat, .chat-fab { display: none !important; } }

.op-dots { display: flex; gap: 4px; margin-top: 2px; }
.op-dot { width: 18px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.op-dot.completed { background: var(--success); } .op-dot.running { background: var(--brand); } .op-dot.paused { background: var(--warning); } .op-dot.ready { background: var(--accent); }

/* ---------- small screens: top bar and module bar ---------- */
.modbar { flex-wrap: nowrap; overflow-x: auto; }
.modtab { flex: none; white-space: nowrap; }
@media (max-width: 900px) {
  .topbar { gap: .35rem; padding-inline: .6rem; }
  .topbar .brand .label, .topbar .tag-demo, .palette-trigger kbd, .palette-trigger .label { display: none; }
  .palette-trigger { min-width: 0; width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
  .plant-select-wrap { min-width: 0; flex: 0 1 8.5rem; }
  .plant-select { width: 100%; max-width: 8.5rem; text-overflow: ellipsis; }
  .topbar .btn-icon { width: 38px; height: 38px; flex: none; }
  .topbar .menu-wrap > .btn { padding: 0; }
  .topbar .menu-wrap > .btn > svg { display: none; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .actions { justify-content: flex-start; flex-wrap: wrap; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tree-node[data-depth] { margin-left: 0; }
  .chat-fab { width: 48px; height: 48px; right: .8rem; bottom: .8rem; }
}
@media (max-width: 480px) { .stats { grid-template-columns: minmax(0, 1fr); } .topbar > .btn-icon[title*="module bar"] { display: none; } }
