/* SINTETIKO Workspace v2 - Coral design language (tokens from the iOS app, DesignSystem/Generated/Tokens.generated.swift: .coral and .coralOscuro). */
:root {
  --bg: #FFFFFF; --surface: #FFFFFF; --surface2: #F7F7F7; --canvas: #F7F7F7;
  --line: #EBEBEB; --border: #DDDDDD; --border-strong: #717171;
  --text: #222222; --muted: #6A6A6A; --quiet: #717171; --ink: #222222; --on-ink: #FFFFFF;
  --primary: #FF385C; --primary-hover: #E61E4D; --grad: linear-gradient(to right, #E61E4D, #D70466);
  --primary-soft: #FFF1F3; --primary-line: #FFC2CE; --tonal: #FFF1F3; --tonal-strong: #FFE0E6; --on-tonal: #B4123A;
  --ok: #167A3E; --ok-bg: #E4F4EA; --warn: #9A5B00; --warn-bg: #FDF1D9; --err: #C13515; --err-bg: #FDE8E6; --info: #1D5FA8; --info-bg: #E5EFFA;
  --hover: rgba(34,34,34,.05); --pressed: rgba(34,34,34,.09);
  --shadow: 0 6px 16px rgba(0,0,0,.12); --shadow-s: 0 2px 8px rgba(0,0,0,.08); --shadow-l: 0 16px 48px rgba(0,0,0,.18);
  --scrim: rgba(0,0,0,.36);
  --r-xs: 4px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-2xl: 28px;
  --g: 24px; --top-h: 64px; --rail-w: 248px; --strip-w: 56px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --ease: cubic-bezier(.32,.72,0,1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --surface: #121212; --surface2: #1D1D1D; --canvas: #1A1A1A;
    --line: #2E2E2E; --border: #3A3A3A; --border-strong: #8A8A8A;
    --text: #F2F2F2; --muted: #A3A3A3; --quiet: #9A9A9A; --ink: #F2F2F2; --on-ink: #121212;
    --primary-hover: #FF5A75; --primary-soft: #3A1520; --primary-line: #6B2A3A; --tonal: #3A1520; --tonal-strong: #5A1F31; --on-tonal: #FF9AB0;
    --ok: #4CC47A; --ok-bg: #153322; --warn: #F0B24A; --warn-bg: #382A0F; --err: #FF7B6E; --err-bg: #3D1A17; --info: #6FB1F5; --info-bg: #14283C;
    --hover: rgba(242,242,242,.05); --pressed: rgba(242,242,242,.09);
    --shadow: 0 6px 16px rgba(0,0,0,.5); --shadow-s: 0 2px 8px rgba(0,0,0,.4); --shadow-l: 0 16px 48px rgba(0,0,0,.6); --scrim: rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121212; --surface: #121212; --surface2: #1D1D1D; --canvas: #1A1A1A;
  --line: #2E2E2E; --border: #3A3A3A; --border-strong: #8A8A8A;
  --text: #F2F2F2; --muted: #A3A3A3; --quiet: #9A9A9A; --ink: #F2F2F2; --on-ink: #121212;
  --primary-hover: #FF5A75; --primary-soft: #3A1520; --primary-line: #6B2A3A; --tonal: #3A1520; --tonal-strong: #5A1F31; --on-tonal: #FF9AB0;
  --ok: #4CC47A; --ok-bg: #153322; --warn: #F0B24A; --warn-bg: #382A0F; --err: #FF7B6E; --err-bg: #3D1A17; --info: #6FB1F5; --info-bg: #14283C;
  --hover: rgba(242,242,242,.05); --pressed: rgba(242,242,242,.09);
  --shadow: 0 6px 16px rgba(0,0,0,.5); --shadow-s: 0 2px 8px rgba(0,0,0,.4); --shadow-l: 0 16px 48px rgba(0,0,0,.6); --scrim: rgba(0,0,0,.6);
  color-scheme: dark;
}
:root[data-density="compact"] { --row-pad: 6px; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font: 400 14px/1.45 var(--font); background: var(--canvas); color: var(--text); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
.ic { flex: none; display: inline-block; vertical-align: -0.2em; }
::selection { background: var(--tonal-strong); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.row-f { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wrap-f { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.col-f { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sp { flex: 1; }
.hide { display: none !important; }

/* ===== Shell ===== */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0,1fr) var(--strip-w); grid-template-rows: var(--top-h) minmax(0,1fr); height: 100dvh; }
.shell.rail-mini { --rail-w: 76px; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 0 16px 0 12px; min-width: 0; }
.top .brand { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 6px; border-radius: var(--r-md); flex: none; }
.top .brand img { height: 14px; width: auto; }
.top .brand .wm-d { display: none; }
:root[data-theme="dark"] .top .brand .wm-l { display: none; } :root[data-theme="dark"] .top .brand .wm-d { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top .brand .wm-l { display: none; } :root:not([data-theme="light"]) .top .brand .wm-d { display: block; } }
.top .brand .bar { width: 1px; height: 18px; background: var(--border); }
.top .brand span { font-size: 17px; font-weight: 500; letter-spacing: -.2px; }
.top .search { flex: 1; max-width: 720px; margin: 0 auto 0 32px; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-s); color: var(--muted); cursor: text; min-width: 0; }
.top .search:hover { box-shadow: var(--shadow); }
.top .search .ph { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .search kbd { font: 500 11px var(--font); border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px; color: var(--muted); }
.top .acts { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.top .s-ico { display: none; }
.ibtn { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text); position: relative; flex: none; }
.ibtn:hover { background: var(--hover); }
.ibtn:active { background: var(--pressed); }
.ibtn.sm { width: 32px; height: 32px; }
.ibtn.on { background: var(--tonal); color: var(--on-tonal); }
.ibtn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; }
.ibtn .dot.paused { background: var(--muted); }
.me-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.me-btn .st { position: absolute; right: 2px; bottom: 2px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--canvas); background: var(--ok); }
.st-busy { background: var(--err) !important; } .st-away { background: var(--warn) !important; } .st-dnd { background: var(--muted) !important; }

.rail { grid-row: 2; overflow-y: auto; padding: 4px 12px 16px; margin-bottom: 64px; scrollbar-width: thin; }
.rail .grp { font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 12px 4px; text-transform: none; }
.rail a { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 12px 0 6px; border-radius: 999px; color: var(--text); font-weight: 500; }
.rail a:hover { background: var(--hover); }
.rail a.on { background: var(--tonal-strong); color: var(--on-tonal); }
.rail a .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail a .ct { font-size: 12px; font-weight: 600; }
.shell.rail-mini .rail { padding: 4px 10px 16px; }
.shell.rail-mini .rail .grp { font-size: 0; padding: 8px 0; margin: 8px 10px 0; border-top: 1px solid var(--line); }
.shell.rail-mini .rail a { justify-content: center; padding: 0; height: 48px; position: relative; }
.shell.rail-mini .rail a .nm, .shell.rail-mini .rail a .ct { display: none; }
.shell.rail-mini .rail a .bd { position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.rail a .bd { display: none; }
.shell.rail-mini .rail a .bd.y { display: block; }

.main { grid-row: 2; min-width: 0; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); margin: 0 0 12px; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.viewas { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--warn-bg); color: var(--warn); font-weight: 500; font-size: 13px; border-bottom: 1px solid var(--line); flex: none; }
.viewas .btn { margin-left: auto; }
.strip { grid-row: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; }
.strip .ibtn { width: 40px; height: 40px; }
.drawer-scrim { display: none; }

/* ===== App layout inside main ===== */
.app { display: flex; flex: 1; min-height: 0; min-width: 0; }
.anav { width: 248px; flex: none; border-right: 1px solid var(--line); overflow-y: auto; padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 2px; background: var(--surface); }
.anav > * { flex: none; }
.anav .amark { display: flex; align-items: center; gap: 10px; padding: 0 8px 12px; font-size: 16px; font-weight: 600; }
.anav .create { display: inline-flex; align-items: center; gap: 12px; height: 56px; padding: 0 24px 0 18px; border-radius: var(--r-lg); background: var(--tonal); color: var(--on-tonal); font-weight: 600; font-size: 15px; margin: 0 0 12px; align-self: flex-start; box-shadow: var(--shadow-s); }
.anav .create:hover { background: var(--tonal-strong); }
.anav .lk { display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 0 12px; border-radius: 999px; color: var(--text); font-weight: 500; font-size: 14px; width: 100%; text-align: left; }
.anav .lk:hover { background: var(--hover); }
.anav .lk.on { background: var(--tonal-strong); color: var(--on-tonal); font-weight: 600; }
.anav .lk .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.anav .lk .ct { font-size: 12px; font-weight: 600; }
.anav .lk .swc { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.anav .sec { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--muted); padding: 16px 12px 6px; }
.anav .sec .ibtn { width: 28px; height: 28px; }
.anav .foot { margin-top: auto; padding-top: 16px; }
.view { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.vhead { display: flex; align-items: center; gap: 12px; padding: 16px 24px; min-height: 72px; border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.vhead h1 { font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.6px; min-width: 0; }
.vhead .sub { color: var(--muted); font-size: 13px; }
.vhead .tt { display: flex; align-items: baseline; gap: 12px; min-width: 0; flex-wrap: wrap; }
.vhead .acts { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vhead .navbtn { display: none; }
.vbody { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px 48px; display: flex; flex-direction: column; gap: 16px; }
.vbody:not(.flush) > *, .vbody:not(.flush) .col-f > *, .modal .mb > * { flex-shrink: 0; }
.vbody.flush { padding: 0; gap: 0; }
.vbody.center > * { width: 100%; max-width: 1040px; margin-left: auto; margin-right: auto; }
.split { display: flex; flex: 1; min-height: 0; }
.split > .lp { width: 380px; flex: none; border-right: 1px solid var(--line); overflow-y: auto; }
.split > .dp { flex: 1; min-width: 0; overflow-y: auto; }

/* ===== Type ===== */
.h1 { font-size: 32px; line-height: 1.12; font-weight: 700; letter-spacing: -.6px; }
.h2 { font-size: 18px; font-weight: 600; letter-spacing: -.2px; }
.h3 { font-size: 15px; font-weight: 600; }
.lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.shd { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.shd a, .shd .lnk { font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.lnk { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lnk.p { color: var(--on-tonal); }
p.prose, .prose p { line-height: 1.6; }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; flex: none; }
.btn:hover { background: var(--surface2); }
.btn:active { background: var(--pressed); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(.96); }
.btn.ink { background: var(--ink); color: var(--on-ink); border-color: transparent; }
.btn.tonal { background: var(--tonal); color: var(--on-tonal); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--err); }
.btn.danger.fill { background: var(--err); color: #fff; border-color: transparent; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { height: 48px; padding: 0 24px; font-size: 15px; }
.btn[disabled], .btn.dis { opacity: .45; pointer-events: none; }
.btn.icon { width: 40px; padding: 0; }
.btn.sm.icon { width: 32px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-md); padding: 2px; gap: 2px; background: var(--surface); flex: none; }
.seg button { height: 32px; padding: 0 12px; border-radius: 9px; font-weight: 500; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--ink); color: var(--on-ink); }

/* ===== Chips and tabs ===== */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; flex: none; padding: 1px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13px; white-space: nowrap; flex: none; }
.chip:hover { border-color: var(--text); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip.sm { height: 28px; padding: 0 12px; font-size: 12px; }
.chip em { font-style: normal; font-size: 11px; font-weight: 600; opacity: .75; }
.chip .x { margin-right: -6px; opacity: .7; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.pad { padding: 0 24px; }
.tab { height: 48px; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; flex: none; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--ink); font-weight: 600; }
.tab .ct { font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; background: var(--primary); color: #fff; display: inline-grid; place-items: center; }
.tab .ct.n { background: var(--surface2); color: var(--muted); }
.cats { display: flex; gap: 32px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); flex: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 10px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 12px; font-weight: 500; white-space: nowrap; margin-bottom: -1px; }
.cats button.on { color: var(--text); border-bottom-color: var(--ink); font-weight: 600; }

/* ===== Pills / badges ===== */
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface2); color: var(--muted); white-space: nowrap; flex: none; }
.pill.ok { background: var(--ok-bg); color: var(--ok); } .pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.err { background: var(--err-bg); color: var(--err); } .pill.info { background: var(--info-bg); color: var(--info); } .pill.p { background: var(--tonal); color: var(--on-tonal); } .pill.ink { background: var(--ink); color: var(--on-ink); }
.pill.line { background: transparent; border: 1px solid var(--border); color: var(--text); }
.pill .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; }
.udot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
.lbl-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }

/* ===== Tiles and avatars ===== */
.tile { position: relative; display: grid; place-items: center; overflow: hidden; color: #fff; flex: none; }
.tile svg.rings { position: absolute; inset: 0; width: 100%; height: 100%; }
.tile svg.rings circle { fill: none; stroke: rgba(255,255,255,.22); stroke-width: 1.2; }
.tile .gl { position: relative; display: grid; place-items: center; }
.tile.plate .gl { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); }
.av { border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 600; flex: none; position: relative; letter-spacing: .2px; }
.av .pr { position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 8px; min-height: 8px; border-radius: 50%; border: 2px solid var(--surface); background: var(--ok); }
.av .pr.away { background: var(--warn); } .av .pr.off { background: var(--muted); } .av .pr.busy { background: var(--err); }
.avs { display: inline-flex; }
.avs .av { box-shadow: 0 0 0 2px var(--surface); }
.avs .av + .av { margin-left: -8px; }

/* ===== Cards, rows, lists ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; min-width: 0; }
.card.pad0 { padding: 0; overflow: hidden; }
.card.float { box-shadow: var(--shadow); border-color: transparent; }
.card.tint { background: var(--canvas); border-color: transparent; }
.card.hov { cursor: pointer; transition: box-shadow .15s; }
.card.hov:hover { box-shadow: var(--shadow); }
.card > .h2 + *, .card > .shd + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.gauto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.gauto.s { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-width: 0; position: relative; }
.li:last-child { border-bottom: 0; }
.li.press { cursor: pointer; }
.li.press:hover { background: var(--surface2); }
.li.on { background: var(--tonal); }
.li .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.li .tx b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .tx span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .r { flex: none; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.list.bare .li { padding: 10px 0; }
.kv { display: grid; grid-template-columns: 160px minmax(0,1fr); gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
.hr { height: 1px; background: var(--line); border: 0; flex: none; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; background: var(--surface); }
.kpi.btnlike { cursor: pointer; text-align: left; }
.kpi.btnlike:hover { box-shadow: var(--shadow-s); }
.kpi .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 24px; font-weight: 600; letter-spacing: -.4px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .d { font-size: 12px; color: var(--muted); }
.kpi .d.up { color: var(--ok); } .kpi .d.down { color: var(--err); }

/* Tables */
.tw { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: auto; background: var(--surface); }
.tw.flat { border-radius: 0; border-left: 0; border-right: 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
table.t td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.press { cursor: pointer; } table.t tr.press:hover td { background: var(--surface2); }
table.t tr.on td { background: var(--tonal); }
table.t .num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t th.sortable { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.inp, .sel, .ta { width: 100%; height: 44px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 0 14px; color: var(--text); outline: none; min-width: 0; }
.sel { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.ta { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.inp.sm, .sel.sm { height: 36px; border-radius: 10px; font-size: 13px; }
select.sel { width: auto; max-width: 100%; }
.field select.sel { width: 100%; }
.inp:focus, .sel:focus, .ta:focus, [contenteditable]:focus-visible { border-color: color-mix(in srgb, var(--primary) 60%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); outline: none; }
.chk { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.chk input { width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
.sw { position: relative; width: 44px; height: 26px; flex: none; display: inline-block; }
.sw input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; z-index: 1; }
.sw i { position: absolute; inset: 0; border-radius: 13px; background: var(--border); transition: background .15s; }
.sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.sw input:checked + i { background: var(--ink); }
.sw input:checked + i::after { transform: translateX(18px); }
.setrow { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: 0; }
.setrow .tx { flex: 1; min-width: 0; }
.setrow .tx b { display: block; font-weight: 500; }
.setrow .tx span { display: block; font-size: 13px; color: var(--muted); }
.srch { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); min-width: 0; flex: 1; max-width: 480px; }
.srch:focus-within { border-color: color-mix(in srgb, var(--primary) 60%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.srch input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); min-width: 0; height: 100%; }
.srch.sm { height: 36px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar > .sel, .toolbar > .inp { width: auto; max-width: 100%; }
.tchips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-md); min-height: 44px; align-items: center; background: var(--surface); }
.tchips .tc { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px 0 10px; border-radius: 999px; background: var(--surface2); font-size: 13px; }
.tchips .tc.bad { background: var(--err-bg); color: var(--err); }
.tchips input { flex: 1; min-width: 120px; border: 0; outline: 0; background: transparent; height: 28px; }

/* Empty */
.empty { border: 1px dashed var(--border); border-radius: var(--r-lg); padding: 40px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; color: var(--muted); }
.empty .ei { width: 56px; height: 56px; border-radius: 18px; background: var(--surface2); display: grid; place-items: center; color: var(--text); margin-bottom: 4px; }
.empty b { color: var(--text); font-size: 16px; font-weight: 600; }
.empty .btn { margin-top: 8px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-md); background: var(--surface2); font-size: 13.5px; }
.notice.warn { background: var(--warn-bg); color: var(--warn); } .notice.info { background: var(--info-bg); color: var(--info); } .notice.err { background: var(--err-bg); color: var(--err); } .notice.ok { background: var(--ok-bg); color: var(--ok); } .notice.p { background: var(--tonal); color: var(--on-tonal); }
.notice { flex-wrap: wrap; }
.notice .tx { flex: 1; min-width: 180px; } .notice b { font-weight: 600; }
.notice .btn { margin-left: auto; }
.skel { background: linear-gradient(90deg, var(--surface2), var(--line), var(--surface2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-sm); }
@keyframes sk { to { background-position: -200% 0; } }
.prog { height: 6px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.prog.p i { background: var(--primary); } .prog.ok i { background: var(--ok); } .prog.warn i { background: var(--warn); } .prog.err i { background: var(--err); }

/* ===== Layer: modal, sheet, menu, toast ===== */
#layer { position: fixed; inset: 0; pointer-events: none; z-index: 1000; }
#layer > * { pointer-events: auto; }
.scrim { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: var(--r-2xl); width: 560px; max-width: 100%; max-height: calc(100dvh - 48px); display: flex; flex-direction: column; box-shadow: var(--shadow-l); animation: pop .2s var(--ease); min-height: 0; }
.modal.wide { width: 880px; } .modal.xl { width: 1120px; } .modal.sm { width: 420px; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.modal .mh { display: flex; align-items: center; gap: 12px; padding: 20px 24px 8px; }
.modal .mh h2 { font-size: 22px; font-weight: 600; letter-spacing: -.3px; flex: 1; min-width: 0; }
.modal .grab { display: none; }
.modal .mb { padding: 12px 24px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.modal .mf { padding: 12px 24px 24px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.menu { position: fixed; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); max-height: min(70dvh, 520px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px; animation: fade .1s; z-index: 2; }
.menu .mi { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.menu .mi:hover { background: var(--surface2); }
.menu .mi.danger { color: var(--err); }
.menu .mi.on::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-left: auto; }
.menu .mi .k { margin-left: auto; font-size: 12px; color: var(--muted); }
.menu .ms { height: 1px; background: var(--line); margin: 6px 4px; }
.menu .mlbl { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 8px 12px 4px; }
.pop { position: fixed; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-l); width: 380px; max-width: calc(100vw - 16px); max-height: calc(100dvh - 88px); overflow-y: auto; animation: fade .12s; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 3; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 8px 8px 8px 18px; border-radius: var(--r-md); background: #222; color: #fff; box-shadow: var(--shadow); font-size: 14px; max-width: min(560px, calc(100vw - 32px)); animation: pop .2s var(--ease); }
:root[data-theme="dark"] .toast { background: #F2F2F2; color: #121212; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #F2F2F2; color: #121212; } }
.toast button { font-weight: 600; padding: 0 12px; height: 32px; border-radius: 8px; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.toast button:hover { background: rgba(127,127,127,.2); }
.tip { position: fixed; background: #222; color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 8px; pointer-events: none; z-index: 5; }

/* Palette (Atlas) */
.palette { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); width: 760px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 96px); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-l); display: flex; flex-direction: column; overflow: hidden; animation: pop .18s var(--ease); }
.palette .pin { display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px; height: 64px; border-bottom: 1px solid var(--line); }
.palette .pin input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; height: 100%; min-width: 0; }
.palette .pf { padding: 12px 16px 0; }
.palette .pr { overflow-y: auto; padding: 8px 8px 12px; min-height: 0; }
.palette .pg { font-size: 12px; font-weight: 600; color: var(--muted); padding: 12px 12px 6px; display: flex; justify-content: space-between; }
.palette .it { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-md); cursor: pointer; width: 100%; text-align: left; min-width: 0; }
.palette .it:hover, .palette .it.sel { background: var(--surface2); }
.palette .it .tx { flex: 1; min-width: 0; }
.palette .it .tx b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .it .tx span { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .it mark, .hl mark { background: var(--tonal-strong); color: inherit; border-radius: 3px; padding: 0 1px; }
.palette .pfoot { display: flex; gap: 16px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.answer { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; background: var(--canvas); display: flex; flex-direction: column; gap: 10px; }
.answer p { line-height: 1.6; }
.cite { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 6px; background: var(--ink); color: var(--on-ink); font-size: 10.5px; font-weight: 600; vertical-align: 2px; cursor: pointer; margin: 0 1px; }
.srcs { display: flex; flex-wrap: wrap; gap: 8px; }
.srcs .src { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px 0 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; max-width: 280px; }

/* Charts */
.chart { width: 100%; height: auto; overflow: visible; }
.chart .ax { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bars-h { display: flex; flex-direction: column; gap: 10px; }
.bars-h .bh { display: grid; grid-template-columns: 140px minmax(0,1fr) 64px; gap: 12px; align-items: center; font-size: 13px; }
.bars-h .bh .tr { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.bars-h .bh .tr i { display: block; height: 100%; border-radius: 4px; background: var(--ink); }

/* Board (kanban) */
.board { display: flex; gap: 12px; overflow-x: auto; padding: 4px 24px 24px; flex: 1; min-height: 0; align-items: flex-start; }
.bcol { width: 296px; flex: none; background: var(--canvas); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: 100%; }
.bcol .bh { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-weight: 600; }
.bcol .bh .muted { font-weight: 400; font-size: 12px; }
.bcol .bl { display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 10px; overflow-y: auto; min-height: 48px; }
.bcol.over { box-shadow: inset 0 0 0 2px var(--primary); }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; display: flex; flex-direction: column; gap: 8px; cursor: grab; touch-action: none; user-select: none; }
.bcard:hover { box-shadow: var(--shadow-s); }
.bcard b { font-weight: 600; }
.dragging { opacity: .9; box-shadow: var(--shadow-l) !important; cursor: grabbing; z-index: 50; pointer-events: none; position: fixed !important; }
.drop-ph { border: 2px dashed var(--border); border-radius: var(--r-md); background: transparent; }

/* Misc */
.thumb { border-radius: var(--r-md); overflow: hidden; flex: none; display: grid; place-items: center; color: #fff; }
.code { font-family: var(--mono); font-size: 12.5px; background: var(--surface2); border-radius: var(--r-md); padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
kbd.k { font: 500 11.5px var(--font); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--text); background: var(--surface); }
.stepper { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stepper .st { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 4px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--muted); }
.stepper .st i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface2); font-style: normal; font-size: 12px; font-weight: 600; }
.stepper .st.on { color: var(--text); } .stepper .st.on i { background: var(--ink); color: var(--on-ink); }
.stepper .st.done i { background: var(--ok); color: #fff; }
.qr { display: grid; grid-template-columns: repeat(25, 1fr); width: 200px; height: 200px; background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--line); }
.qr i { background: #111; } .qr b { background: #fff; }
.ring { position: relative; display: inline-grid; place-items: center; }
.ring .rv { position: absolute; font-weight: 600; font-size: 15px; }
.dz { border: 1.5px dashed var(--border); border-radius: var(--r-lg); padding: 24px; text-align: center; color: var(--muted); }

/* ===== Responsive ===== */
@media (max-width: 1279px) {
  .shell { --strip-w: 0px; }
  .strip { display: none; }
  .main { margin-right: 12px; }
}
@media (max-width: 1023px) {
  .shell:not(.rail-force) { --rail-w: 76px; }
  .shell:not(.rail-force) .rail { padding: 4px 10px 16px; }
  .shell:not(.rail-force) .rail .grp { font-size: 0; padding: 8px 0; margin: 8px 10px 0; border-top: 1px solid var(--line); }
  .shell:not(.rail-force) .rail a { justify-content: center; padding: 0; height: 48px; position: relative; }
  .shell:not(.rail-force) .rail a .nm, .shell:not(.rail-force) .rail a .ct { display: none; }
  .shell:not(.rail-force) .rail a .bd.y { display: block; position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
  .anav { width: 220px; }
  .split > .lp { width: 320px; }
  .top .search { margin-left: 16px; }
}
@media (max-width: 767px) {
  body { font-size: 15px; }
  .shell { grid-template-columns: minmax(0,1fr); grid-template-rows: 56px minmax(0,1fr); --top-h: 56px; }
  .top { padding: 0 8px; gap: 2px; }
  .top .brand { padding: 0 4px; gap: 8px; }
  .top .brand { min-width: 0; overflow: hidden; flex: 0 1 auto; }
  .top .brand img { height: 9px; width: auto; }
  .top .brand span { font-size: 13px; }
  .top .ibtn, .top .me-btn { width: 36px; height: 36px; }
  .top .me-btn .av { width: 30px !important; height: 30px !important; }
  .top .brand .bar { height: 14px; }
  .top .search { display: none; }
  .top .s-ico { display: inline-grid; }
  .top .acts { margin-left: auto; gap: 0; }
  .top .acts .d-only { display: none; }
  .rail { position: fixed; top: 0; bottom: 0; left: 0; width: 300px; max-width: 86vw; background: var(--surface); z-index: 900; transform: translateX(-102%); transition: transform .25s var(--ease); padding: 16px 12px 88px; box-shadow: var(--shadow-l); }
  .shell .rail .grp { font-size: 12px !important; padding: 16px 12px 6px !important; margin: 0 !important; border: 0 !important; }
  .shell .rail a { justify-content: flex-start !important; padding: 0 12px 0 6px !important; height: 44px !important; }
  .shell .rail a .nm, .shell .rail a .ct { display: block !important; }
  .shell .rail a .bd { display: none !important; }
  .shell.drawer .rail { transform: none; }
  .shell.drawer .drawer-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 899; }
  .main { grid-column: 1; margin: 0; border-radius: 0; border-width: 1px 0 0; }
  .anav { position: fixed; top: 0; bottom: 0; left: 0; width: 300px; max-width: 86vw; z-index: 900; transform: translateX(-102%); transition: transform .25s var(--ease); box-shadow: var(--shadow-l); padding-bottom: 88px; }
  .app.nav-open .anav { transform: none; }
  .app.nav-open::before { content: ""; position: fixed; inset: 0; background: var(--scrim); z-index: 899; }
  .vhead { padding: 12px 16px; min-height: 60px; gap: 8px; }
  .vhead h1 { font-size: 24px; }
  .vhead .navbtn { display: inline-grid; margin-left: -8px; }
  .vhead .tt { flex: 1 1 auto; }
  .vhead .acts { margin-left: auto; max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding: 2px; }
  .vhead .acts:empty { display: none; }
  .vhead .acts.keep { width: auto; margin-left: auto; }
  .vbody { padding: 16px 16px 96px; }
  .tabs.pad { padding: 0 16px; }
  .board { padding: 4px 16px 96px; }
  .split > .lp { width: 100%; border-right: 0; }
  .split.detail > .lp { display: none; }
  .split:not(.detail) > .dp { display: none; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0,1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .kv { grid-template-columns: minmax(0,1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .scrim { align-items: flex-end; padding: 0; }
  .modal, .modal.wide, .modal.xl, .modal.sm { width: 100%; max-height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: up .25s var(--ease); }
  @keyframes up { from { transform: translateY(40%); } }
  .modal .grab { display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--border); margin: 8px auto 0; }
  .modal .mh { padding: 12px 16px 4px; }
  .modal .mb { padding: 8px 16px 12px; }
  .modal .mf { padding: 8px 16px 72px; }
  .modal .mb:last-child { padding-bottom: 72px; }
  .modal .mf .btn { flex: 1; }
  .toasts { top: 64px; bottom: auto; }
  .palette { top: 8px; max-height: calc(100dvh - 16px); }
  .bars-h .bh { grid-template-columns: 96px minmax(0,1fr) 56px; }
  .tw table.t.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tw table.t.cards, .tw table.t.cards tbody, .tw table.t.cards tr, .tw table.t.cards td { display: block; width: 100%; }
  .tw table.t.cards tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
  .tw table.t.cards td { border: 0; padding: 4px 16px; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .tw table.t.cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; }
  .tw table.t.cards td.num { text-align: right; }
  .hide-m { display: none !important; }
}
@media (min-width: 768px) { .show-m { display: none !important; } }
@media print { .top, .rail, .strip, .anav, .vhead .acts { display: none !important; } body { overflow: visible; } .shell { display: block; height: auto; } .main { border: 0; } .vbody { overflow: visible; } }

/* Bottom-left corner is reserved for the Hub version pill (about 130 x 60 px). Mobile layouts keep controls out of it. */
@media (max-width: 767px) {
  .vbody::after, .split > .lp::after, .split > .dp::after, .ml-tmain::after { content: ""; display: block; height: 72px; flex: none; }
  .mt-bar { padding-bottom: 64px !important; }
  .dc-tabs { padding-left: 140px !important; }
  .gk-comp { bottom: 64px !important; }
  .dc-ths { padding-left: 140px !important; }
  .cl-month { padding-bottom: 64px; }
}

/* ===== Vamos: floating button on every screen (v3) ===== */
.tile.vmk svg { display: block; }
.vfab { position: fixed; right: 6px; bottom: 76px; z-index: 950; width: 44px; height: 44px; border-radius: 50%; padding: 0; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow), 0 1px 3px rgba(0, 0, 0, .12); transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.vfab:hover { transform: translateY(-1px); background: var(--surface2); }
.vfab:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
body[data-app="vamos"] .vfab, body.vp-open .vfab { display: none; }
@media (max-width: 1279px) { .vfab { right: 16px; } }
@media (max-width: 767px) { body[data-app="chat"] .vfab { display: none; } }
@media print { .vfab { display: none; } }
