/* G-amini ERP web client
   Layout concept: a branded top bar, a quiet control panel, and dense but airy work
   surfaces; status is carried by shape (pills, stripes, ribbons) as well as colour. */
:root {
  --brand: #2b7ec0; --brand-2: #559ed5; --brand-tint: #e4f0fa; --brand-ink: #0f3557;
  --nav: #1f6aa5; --nav-2: #2b7ec0; --nav-text: #ffffff;
  --bg: #f3f6fa; --surface: #ffffff; --surface-2: #eef3f8; --line: #dbe4ed; --line-2: #e8eef4;
  --text: #13283c; --muted: #5a7086; --faint: #8a9cad;
  --ok: #1d8a57; --ok-bg: #e2f4ea; --warn: #a3650c; --warn-bg: #fdf1dc; --bad: #c0392b; --bad-bg: #fbe6e3; --info-bg: #e4f0fa;
  --shadow: 0 1px 2px rgba(19,40,60,.06), 0 6px 18px -10px rgba(19,40,60,.25);
  --shadow-lg: 0 20px 50px -20px rgba(8,25,42,.45);
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 10px; --r-l: 16px;
  --paper: #ffffff; --paper-text: #1b2a38;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #5ea6dc; --brand-2: #8cc0e8; --brand-tint: #16314b; --brand-ink: #d5e7f6;
    --nav: #0f2b44; --nav-2: #173d5f; --nav-text: #e6f0f9;
    --bg: #0b1622; --surface: #112131; --surface-2: #16293c; --line: #243b51; --line-2: #1c3045;
    --text: #e3ecf5; --muted: #9ab0c4; --faint: #6f879d;
    --ok: #4cc48b; --ok-bg: #133628; --warn: #e6aa4f; --warn-bg: #3a2a10; --bad: #f07f76; --bad-bg: #3d1a18; --info-bg: #16314b;
    --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 22px -12px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #5ea6dc; --brand-2: #8cc0e8; --brand-tint: #16314b; --brand-ink: #d5e7f6;
  --nav: #0f2b44; --nav-2: #173d5f; --nav-text: #e6f0f9;
  --bg: #0b1622; --surface: #112131; --surface-2: #16293c; --line: #243b51; --line-2: #1c3045;
  --text: #e3ecf5; --muted: #9ab0c4; --faint: #6f879d;
  --ok: #4cc48b; --ok-bg: #133628; --warn: #e6aa4f; --warn-bg: #3a2a10; --bad: #f07f76; --bad-bg: #3d1a18; --info-bg: #16314b;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 22px -12px rgba(0,0,0,.7);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body.erp { margin: 0; background: var(--bg); color: var(--text); font: 400 14.5px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
body.erp::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--nav); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); letter-spacing: -.01em; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
.mono { font-family: var(--f-mono); font-size: .9em; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }
.svgi { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.svgi .f { fill: var(--brand-2); opacity: .32; stroke: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Shell */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; background: var(--nav); color: var(--nav-text); display: flex; align-items: center; gap: .35rem; height: 52px; padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
.tb-btn { height: 38px; min-width: 38px; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: 0 .6rem; border: 0; border-radius: 8px; background: transparent; color: var(--nav-text); cursor: pointer; white-space: nowrap; font-weight: 500; position: relative; }
.tb-btn:hover, .tb-btn[aria-expanded="true"] { background: rgba(255,255,255,.14); }
.tb-btn .svgi .f { fill: #fff; opacity: .25; }
.tb-app { font: 650 1.02rem/1 var(--f-display); letter-spacing: -.01em; padding-right: .4rem; white-space: nowrap; }
.tb-menus { display: flex; align-items: center; gap: .1rem; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; }
.tb-menus::-webkit-scrollbar { display: none; }
.tb-menus .tb-btn { font-size: .92rem; opacity: .9; }
.tb-menus .tb-btn.on { background: rgba(255,255,255,.18); opacity: 1; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: .15rem; flex: none; }
.badge-dot { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #f4b740; color: #2a1a00; font: 700 .68rem/17px var(--f-body); text-align: center; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font: 700 .76rem/1 var(--f-body); color: #fff; flex: none; text-transform: uppercase; letter-spacing: .02em; }
.avatar.sm { width: 24px; height: 24px; font-size: .64rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.co-name { font-size: .82rem; opacity: .85; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.menu-mobile { display: none; }
@media (max-width: 860px) {
  .tb-menus { display: none; }
  .menu-mobile { display: inline-flex; }
  .co-name { display: none; }
  .tb-app { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 38px; }
}

.dropdown { position: fixed; z-index: 80; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: .35rem; min-width: 220px; max-width: calc(100vw - 20px); max-height: 70vh; overflow-y: auto; }
.dropdown .dd-item { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 0; background: none; border-radius: 8px; text-align: left; cursor: pointer; color: var(--text); text-decoration: none; font-size: .93rem; }
.dropdown .dd-item:hover, .dropdown .dd-item.on { background: var(--surface-2); }
.dropdown .dd-item small { color: var(--muted); margin-left: auto; font-size: .78rem; }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
.dropdown .dd-head { padding: .5rem .7rem .3rem; font: 700 .7rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }

main#view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 0 3rem; max-width: 1600px; margin: 0 auto; }

/* Control panel */
.cp { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .6rem 1rem; align-items: center; padding-block: .9rem; }
.cp-left { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: .35rem; font: 600 1.08rem/1.2 var(--f-display); min-width: 0; flex-wrap: wrap; }
.crumbs a { color: var(--brand); text-decoration: none; font-weight: 500; cursor: pointer; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
.cp-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.searchbox { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; min-height: 38px; padding: .2rem .45rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-width: min(380px, 100%); }
.searchbox:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.searchbox input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 90px; padding: .3rem .2rem; }
.facet { display: inline-flex; align-items: center; gap: .3rem; background: var(--brand-tint); color: var(--brand-ink); border-radius: 6px; padding: .12rem .2rem .12rem .5rem; font-size: .82rem; font-weight: 600; }
.facet button { border: 0; background: none; cursor: pointer; padding: 0 .15rem; color: inherit; display: inline-grid; }
.facet .svgi { width: 14px; height: 14px; }
.viewsw { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.viewsw button { border: 0; background: none; height: 36px; width: 38px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.viewsw button + button { border-left: 1px solid var(--line); }
.viewsw button[aria-pressed="true"] { background: var(--brand-tint); color: var(--brand); }
@media (max-width: 860px) { .cp { grid-template-columns: 1fr; } .cp-right { justify-content: flex-start; } .searchbox { flex: 1 1 100%; min-width: 0; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 36px; padding: .4rem .9rem; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #226aa4; border-color: #226aa4; color: #fff; }
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn-primary:hover { color: #08192a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary, :root:not([data-theme="light"]) .btn-primary:hover { color: #08192a; } }
:root[data-theme="dark"] .btn-primary:hover { background: var(--brand-2); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); color: var(--bad); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { filter: brightness(1.05); color: #fff; border-color: var(--ok); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 30px; padding: .25rem .6rem; font-size: .84rem; }
.btn-lg { min-height: 48px; padding: .6rem 1.2rem; font-size: 1rem; }
.icon-only { width: 36px; padding: 0; }

/* Pills / status */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .14rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); letter-spacing: .01em; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--brand); }
.tag { display: inline-block; padding: .1rem .45rem; border-radius: 5px; font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--muted); margin: 0 .2rem .2rem 0; }
.stars { display: inline-flex; gap: 1px; color: #e0a526; }
.stars .svgi { width: 14px; height: 14px; }
.stars .off { color: var(--line); }
.stars > span:not(.off) .svgi, .stars button:not(.off) .svgi { fill: currentColor; }
.stars button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; display: inline-grid; }

/* List view */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.list th { text-align: left; font: 600 .74rem/1.2 var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .7rem .75rem; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; cursor: pointer; user-select: none; position: sticky; top: 0; }
table.list th.num { text-align: right; }
table.list th .svgi { width: 12px; height: 12px; vertical-align: -1px; }
table.list td { padding: .62rem .75rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: color-mix(in srgb, var(--brand-tint) 55%, transparent); }
table.list tr.sel td { background: var(--brand-tint); }
table.list td.cb, table.list th.cb { width: 34px; padding-right: 0; }
table.list input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }
table.list tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
table.list tr.grp td { background: var(--surface-2); font-weight: 650; cursor: pointer; }
.list-empty { padding: 3rem 1rem; text-align: center; color: var(--muted); display: grid; gap: .6rem; justify-items: center; }
.list-empty .svgi { width: 46px; height: 46px; color: var(--brand); stroke-width: 1.3; }
.list-empty b { color: var(--text); font-size: 1.05rem; font-family: var(--f-display); }
.massbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .55rem .75rem; border-radius: 10px; background: var(--brand-tint); margin-bottom: .6rem; font-size: .9rem; }
.mlist { display: none; }
@media (max-width: 720px) {
  .tbl-wrap.resp table.list { display: none; }
  .tbl-wrap.resp .mlist { display: grid; }
  .mlist .mrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .8rem; padding: .8rem .9rem; border-bottom: 1px solid var(--line-2); cursor: pointer; }
  .mlist .mrow:last-child { border-bottom: 0; }
  .mlist .mrow b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mlist .mrow .sub { color: var(--muted); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: .9rem; overflow-x: auto; padding-bottom: 1rem; align-items: start; scroll-snap-type: x proximity; }
.kcol { background: var(--surface-2); border-radius: var(--r-l); padding: .6rem; min-height: 160px; scroll-snap-align: start; transition: background .12s; }
.kcol.over { background: var(--brand-tint); outline: 2px dashed var(--brand-2); }
.kcol-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .2rem .3rem .5rem; }
.kcol-head b { font: 650 .95rem/1.2 var(--f-display); }
.kcol-head small { color: var(--muted); font-size: .8rem; }
.kbar { height: 5px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 0 .3rem .6rem; display: flex; }
.kbar i { display: block; height: 100%; }
.kcards { display: grid; gap: .5rem; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .8rem; cursor: grab; display: grid; gap: .35rem; position: relative; box-shadow: 0 1px 0 var(--line-2); }
.kcard:hover { border-color: var(--brand-2); }
.kcard.dragging { opacity: .5; }
.kcard .kt { font-weight: 650; line-height: 1.3; padding-right: 1.2rem; }
.kcard .ks { color: var(--muted); font-size: .84rem; }
.kcard .kf { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .84rem; }
.kcard .kf .num { font-weight: 650; }
.kcard .stripe { position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; }
.kcard .act { position: absolute; right: .55rem; top: .6rem; width: 9px; height: 9px; border-radius: 50%; }
.kquick { display: flex; gap: .4rem; margin-bottom: .5rem; }
.kquick input { flex: 1; min-width: 0; }

/* Form view */
.form-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
@media (max-width: 1180px) { .form-wrap { grid-template-columns: 1fr; } }
.form-bar { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.form-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.statusbar { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.statusbar span { padding: .35rem .75rem .35rem 1rem; font-size: .8rem; font-weight: 600; color: var(--muted); background: var(--surface); position: relative; white-space: nowrap; }
.statusbar span + span { border-left: 1px solid var(--line); }
.statusbar span.on { background: var(--brand); color: #fff; }
:root[data-theme="dark"] .statusbar span.on { color: #08192a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .statusbar span.on { color: #08192a; } }
@media (max-width: 720px) { .statusbar span:not(.on) { display: none; } }
.sheet { padding: 1.2rem 1.4rem 1.6rem; position: relative; }
.sheet-title { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
.sheet-title h2 { font-size: 1.6rem; }
.sheet-title .eyebrow { font: 600 .74rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .35rem; }
.smart { display: flex; gap: .4rem; flex-wrap: wrap; }
.smart button { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: .35rem .7rem; cursor: pointer; text-align: left; color: var(--text); }
.smart button:hover { border-color: var(--brand); }
.smart button b { display: block; font-size: .95rem; line-height: 1.1; }
.smart button small { color: var(--muted); font-size: .74rem; }
.smart .svgi { color: var(--brand); width: 20px; height: 20px; }
.ribbon { position: absolute; top: 14px; right: -6px; padding: .3rem 1rem; font: 800 .74rem/1 var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: #fff; background: var(--ok); border-radius: 4px 0 0 4px; box-shadow: var(--shadow); }
.ribbon.bad { background: var(--bad); }
.ribbon.warn { background: var(--warn); }
.fgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .1rem 2rem; }
@media (max-width: 720px) { .fgrid { grid-template-columns: 1fr; } .sheet { padding: 1rem; } }
.fsec { display: grid; gap: .1rem; align-content: start; }
.fsec h4 { font: 700 .72rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: .9rem 0 .4rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line-2); }
.frow { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: .7rem; align-items: center; min-height: 38px; }
.frow > label { font-weight: 600; font-size: .86rem; color: var(--muted); }
.frow.req > label::after { content: " *"; color: var(--bad); }
.frow .ro { padding: .35rem 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .frow { grid-template-columns: 1fr; gap: .15rem; padding-block: .25rem; } }
.inp { width: 100%; min-height: 36px; padding: .35rem .6rem; border: 1px solid transparent; border-bottom-color: var(--line); border-radius: 7px; background: transparent; color: var(--text); transition: border-color .12s, background .12s; }
.inp:hover { border-color: var(--line); }
.inp:focus { outline: 0; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
.inp.invalid { border-color: var(--bad); background: var(--bad-bg); }
.inp.boxed { border-color: var(--line); background: var(--surface); }
textarea.inp { min-height: 80px; resize: vertical; }
select.inp { cursor: pointer; }
.field-err { color: var(--bad); font-size: .78rem; grid-column: 2; }
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin: 1.3rem 0 .8rem; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: .55rem .9rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }

/* Lines editor */
.lines { overflow-x: auto; }
.lines table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: .9rem; }
.lines th { text-align: left; font: 600 .72rem/1.2 var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: .5rem; border-bottom: 1px solid var(--line); }
.lines th.num { text-align: right; }
.lines td { padding: .25rem .35rem; border-bottom: 1px solid var(--line-2); }
.lines td .inp { min-height: 32px; }
.lines td .inp.num { text-align: right; }
.lines .add-line { padding: .5rem; }
.lines .add-line button { border: 0; background: none; color: var(--brand); font-weight: 600; cursor: pointer; padding: .2rem 0; }
.totals { display: grid; justify-content: end; gap: .25rem; margin-top: .9rem; font-variant-numeric: tabular-nums; }
.totals div { display: grid; grid-template-columns: 170px 150px; gap: 1rem; text-align: right; }
.totals div span { color: var(--muted); }
.totals .grand { border-top: 1px solid var(--line); padding-top: .4rem; margin-top: .2rem; font: 700 1.15rem/1.2 var(--f-display); }
.totals .grand span { color: var(--text); }
@media (max-width: 480px) { .totals div { grid-template-columns: 1fr auto; } .totals { justify-content: stretch; } }

/* Chatter */
.chatter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: .9rem; display: grid; gap: .7rem; position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 80px); overflow-y: auto; }
@media (max-width: 1180px) { .chatter { position: static; max-height: none; } }
.chat-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.chat-box { display: grid; gap: .4rem; }
.chat-box textarea { min-height: 64px; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem; background: var(--bg); resize: vertical; width: 100%; }
.msg { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: .6rem; font-size: .88rem; }
.msg .mh { display: flex; gap: .4rem; align-items: baseline; flex-wrap: wrap; }
.msg .mh b { font-size: .88rem; }
.msg .mh small { color: var(--faint); font-size: .76rem; }
.msg .mb { margin-top: .15rem; overflow-wrap: anywhere; }
.msg.note .mb { background: var(--warn-bg); border-radius: 8px; padding: .35rem .55rem; }
.msg.track .mb { color: var(--muted); }
.msg .mb .arrow { color: var(--faint); margin: 0 .25rem; }
.activity { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: .55rem; align-items: center; padding: .5rem .6rem; border-radius: 10px; background: var(--surface-2); font-size: .86rem; }
.activity i { width: 10px; height: 10px; border-radius: 50%; }
.due-ok { background: var(--ok); } .due-today { background: var(--warn); } .due-late { background: var(--bad); }
.day-sep { text-align: center; font-size: .74rem; color: var(--faint); display: flex; align-items: center; gap: .6rem; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Home / launcher */
.home { padding-block: 1.6rem; display: grid; gap: 1.6rem; }
.home-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; }
.home-head h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.launch { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 1.1rem .6rem; }
.launch a { display: flex; flex-direction: column; align-items: center; gap: .45rem; text-decoration: none; color: var(--text); font-size: .84rem; font-weight: 500; text-align: center; padding: .3rem; border-radius: 12px; cursor: pointer; line-height: 1.25; }
.launch .tile { width: 77px; height: 77px; border-radius: 22px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--brand); transition: transform .15s, box-shadow .15s; box-shadow: 0 1px 0 var(--line), 0 6px 14px -10px rgba(17,38,58,.35); position: relative; }
.launch .tile::after { content: ""; position: absolute; right: 7px; top: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand-2); }
.launch .tile .svgi { width: 38px; height: 38px; stroke-width: 1.5; }
.launch .tile.tile-img { background: none; border: 0; box-shadow: none; }
.launch .tile.tile-img::after { display: none; }
.launch .tile .appimg { width: 100%; height: 100%; display: block; }
.launch a:hover .tile.tile-img { box-shadow: none; filter: drop-shadow(0 10px 10px rgba(43,126,192,.28)); }
@media (max-width: 520px) { .launch { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } .launch .tile { width: 70px; height: 70px; border-radius: 20px; } }
.launch a:hover .tile { transform: translateY(-3px); box-shadow: 0 14px 22px -12px rgba(43,126,192,.55); }
.launch a.locked { opacity: .55; }
.launch-fam { font: 700 .72rem/1 var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); grid-column: 1 / -1; margin-top: .6rem; }
.onboard { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; }
.onboard ol { list-style: none; margin: .8rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.onboard li button { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: var(--surface); padding: .35rem .7rem; border-radius: 999px; cursor: pointer; font-size: .85rem; }
.onboard li.done button { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.progress { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .4s; }

/* Dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: .9rem 1rem; display: grid; gap: .3rem; cursor: default; }
.kpi[data-go] { cursor: pointer; }
.kpi[data-go]:hover { border-color: var(--brand); }
.kpi small { color: var(--muted); font-size: .8rem; font-weight: 600; }
.kpi b { font: 700 1.5rem/1.1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .delta { font-size: .8rem; font-weight: 600; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .9rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 1rem 1.1rem; min-width: 0; }
.panel h3 { font-size: 1rem; margin-bottom: .7rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.panel h3 small { font: 500 .8rem/1 var(--f-body); color: var(--muted); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
@media (max-width: 1000px) { .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; } }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--f-body); }
.chart .grid line { stroke: var(--line-2); }
.chart .axis { stroke: var(--line); }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .4rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .8rem; font-size: .86rem; align-items: center; }
.hbar .track { grid-column: 1 / -1; height: 7px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin-bottom: .45rem; }
.hbar .track i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.alerts { display: grid; gap: .45rem; }
.alert { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: .7rem; align-items: center; padding: .55rem .7rem .55rem 0; border-radius: 10px; background: var(--surface-2); font-size: .88rem; cursor: pointer; }
.alert::before { content: ""; align-self: stretch; border-radius: 0 3px 3px 0; background: var(--brand); }
.alert.bad::before { background: var(--bad); } .alert.warn::before { background: var(--warn); } .alert.ok::before { background: var(--ok); }
.role-tabs { display: flex; gap: .35rem; flex-wrap: wrap; }

/* Modal */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(6,18,30,.55); display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 24px); background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { width: min(980px, 100%); }
.modal-h { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.modal-h h3 { font-size: 1.15rem; }
.modal-b { padding: 1rem 1.1rem; overflow-y: auto; display: grid; gap: .8rem; }
.modal-f { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.1rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.toast-stack { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 120; display: grid; gap: .5rem; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: .9rem; display: flex; gap: .6rem; align-items: center; animation: tin .2s ease-out; }
.toast.bad { background: var(--bad); color: #fff; }
.toast .svgi { flex: none; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* Command palette */
.palette { position: fixed; inset: 0; z-index: 95; background: rgba(6,18,30,.45); display: grid; align-items: start; justify-items: center; padding: 12vh max(12px, env(safe-area-inset-right, 0px)) 12px max(12px, env(safe-area-inset-left, 0px)); }
.palette-box { width: min(620px, 100%); background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-box input { width: 100%; border: 0; outline: 0; padding: 1rem 1.1rem; font-size: 1.05rem; background: transparent; border-bottom: 1px solid var(--line); }
.palette-res { max-height: 50vh; overflow-y: auto; padding: .35rem; }
.palette-res .dd-item { display: flex; gap: .6rem; align-items: center; padding: .55rem .7rem; border-radius: 8px; cursor: pointer; }
.palette-res .dd-item.on { background: var(--brand-tint); }
.palette-res .dd-item small { margin-left: auto; color: var(--muted); }
.palette-foot { padding: .5rem 1rem; font-size: .76rem; color: var(--faint); border-top: 1px solid var(--line); display: flex; gap: 1rem; }
kbd { font: 600 .74rem/1 var(--f-mono); padding: .15rem .35rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); }

/* Document (PDF) preview */
.paper-wrap { background: var(--surface-2); padding: 1rem; border-radius: 12px; overflow-x: auto; min-height: min-content; }
.paper { background: var(--paper); color: var(--paper-text); width: 794px; max-width: 100%; margin: 0 auto; min-height: 1000px; padding: 48px 52px 0; box-shadow: 0 2px 16px rgba(0,0,0,.18); font: 400 12.5px/1.5 var(--doc-font, "Figtree"), system-ui, sans-serif; position: relative; display: flex; flex-direction: column; color-scheme: light; }
.paper .doc-head { display: flex; justify-content: space-between; gap: 1.5rem; align-items: flex-start; }
.paper .doc-logo { max-height: 56px; max-width: 200px; }
.paper .doc-co { text-align: right; font-size: 11.5px; color: #4a5b6b; }
.paper .doc-co b { color: #1b2a38; font-size: 13px; }
.paper h1.doc-title { font: 700 22px/1.2 var(--doc-font, "Bricolage Grotesque"), sans-serif; margin: 28px 0 4px; color: var(--doc-accent, #2b7ec0); letter-spacing: -.01em; }
.paper .doc-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0; font-size: 11.5px; }
.paper .doc-meta div span { display: block; color: #6b7c8c; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.paper .doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 18px; font-size: 12px; }
.paper .doc-parties span { display: block; color: #6b7c8c; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 2px; }
.paper table.doc-lines { width: 100%; border-collapse: collapse; margin-top: 20px; font-size: 12px; }
.paper table.doc-lines th { text-align: left; padding: 7px 8px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--doc-accent, #2b7ec0); color: #34495c; }
.paper table.doc-lines td { padding: 7px 8px; border-bottom: 1px solid #e3e9ef; }
.paper table.doc-lines .num { text-align: right; }
.paper.style-boxed table.doc-lines th { background: var(--doc-accent, #2b7ec0); color: #fff; border: 0; }
.paper.style-boxed table.doc-lines td { border: 1px solid #dfe6ed; }
.paper.style-striped table.doc-lines tbody tr:nth-child(odd) td { background: #f2f6fa; }
.paper.style-bold h1.doc-title { font-size: 30px; text-transform: uppercase; letter-spacing: .02em; }
.paper.style-bold .doc-band { height: 10px; background: var(--doc-accent, #2b7ec0); margin: -48px -52px 30px; }
.paper.style-minimal table.doc-lines th { border-bottom: 1px solid #bcc8d3; color: #6b7c8c; }
.paper.style-minimal h1.doc-title { color: #1b2a38; font-weight: 600; }
.paper .doc-totals { margin-left: auto; width: 280px; margin-top: 14px; font-size: 12.5px; }
.paper .doc-totals div { display: flex; justify-content: space-between; padding: 4px 8px; }
.paper .doc-totals .g { font-weight: 700; font-size: 14px; border-top: 2px solid var(--doc-accent, #2b7ec0); margin-top: 4px; padding-top: 7px; }
.paper .doc-pay { margin-top: 22px; display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 16px; padding: 12px 14px; border: 1px solid #dfe6ed; border-radius: 8px; font-size: 11.5px; }
.paper .doc-pay b { font-size: 12px; }
.paper .qr { width: 96px; height: 96px; }
.paper .doc-notes { margin-top: 16px; font-size: 11px; color: #4a5b6b; }
.paper .doc-spacer { flex: 1; min-height: 30px; }
.paper .doc-foot { border-top: 1px solid #dfe6ed; padding: 10px 0 8px; font-size: 10px; color: #6b7c8c; text-align: center; }
.paper .doc-mark { padding: 4px 0 14px; font: 600 9.5px/1.2 "Figtree", sans-serif; color: #3b4f62; text-align: right; display: flex; justify-content: flex-end; align-items: center; gap: 5px; }
.paper .doc-mark img { height: 12px; width: auto; }
.paper .watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; overflow: hidden; }
.paper .watermark span { transform: rotate(-30deg); font: 800 110px/1 "Figtree", sans-serif; color: rgba(43,126,192,.08); letter-spacing: .08em; }
.paper .watermark.bad span { color: rgba(192,57,43,.1); }
.paper .watermark.ok span { color: rgba(29,138,87,.1); }
.paper .etims { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: center; margin-top: 14px; font-size: 10.5px; color: #4a5b6b; padding: 8px 10px; background: #f3f7fa; border-radius: 6px; }
.paper .etims .qr { width: 70px; height: 70px; }
.receipt { width: 302px; margin: 0 auto; background: #fff; color: #111; font: 400 12px/1.45 var(--f-mono); padding: 16px 14px; box-shadow: 0 2px 16px rgba(0,0,0,.18); color-scheme: light; }
.receipt .c { text-align: center; }
.receipt hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
.receipt .r { display: flex; justify-content: space-between; gap: 8px; }
.receipt .last { text-align: center; font-weight: 700; font-size: 11px; margin-top: 10px; }
@media (max-width: 860px) { .paper { padding: 28px 22px 0; min-height: 0; } .paper .doc-meta { grid-template-columns: 1fr 1fr; } .paper .doc-parties { grid-template-columns: 1fr; } .paper .doc-totals { width: 100%; } .paper.style-bold .doc-band { margin: -28px -22px 20px; } }

/* POS */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 0; height: calc(100dvh - 52px - env(safe-area-inset-top, 0px)); margin: 0 calc(-1 * max(16px, env(safe-area-inset-right, 0px))) -3rem calc(-1 * max(16px, env(safe-area-inset-left, 0px))); }
.pos-left { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.pos-bar { display: flex; gap: .5rem; padding: .7rem 1rem; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--surface); }
.pos-cats { display: flex; gap: .35rem; overflow-x: auto; flex: 1; min-width: 0; scrollbar-width: thin; }
.pos-grid { flex: 1; overflow-y: auto; padding: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; align-content: start; }
.pos-prod { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .8rem; text-align: left; cursor: pointer; display: grid; gap: .3rem; min-height: 110px; position: relative; }
.pos-prod:hover { border-color: var(--brand); }
.pos-prod:active { transform: scale(.98); }
.pos-prod .pi { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-tint); display: grid; place-items: center; color: var(--brand); font: 700 1rem/1 var(--f-display); }
.pos-prod b { font-size: .9rem; line-height: 1.25; }
.pos-prod .pp { font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.pos-prod .ps { position: absolute; right: .6rem; top: .6rem; font-size: .72rem; color: var(--muted); }
.pos-right { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.pos-cart { flex: 1; overflow-y: auto; padding: .4rem .6rem; }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .8rem; padding: .55rem .5rem; border-radius: 10px; cursor: pointer; }
.pos-line.on { background: var(--brand-tint); }
.pos-line small { color: var(--muted); }
.pos-total { padding: .8rem 1rem; border-top: 1px solid var(--line); display: grid; gap: .2rem; font-variant-numeric: tabular-nums; }
.pos-total .g { font: 700 1.6rem/1.1 var(--f-display); display: flex; justify-content: space-between; }
.pos-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.pos-pad button { border: 0; background: var(--surface); min-height: 52px; font-size: 1.05rem; font-weight: 600; cursor: pointer; }
.pos-pad button:hover { background: var(--surface-2); }
.pos-pad button.on { background: var(--brand-tint); color: var(--brand); }
.pos-pad button.pay { background: var(--brand); color: #fff; grid-row: span 2; font-size: 1.1rem; }
:root[data-theme="dark"] .pos-pad button.pay { color: #08192a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pos-pad button.pay { color: #08192a; } }
.pos-cart-toggle { display: none; }
@media (max-width: 860px) {
  .pos { grid-template-columns: 1fr; height: auto; min-height: calc(100dvh - 52px); }
  .pos-right { position: fixed; inset: auto 0 0 0; z-index: 30; max-height: 78dvh; border-top: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: translateY(calc(100% - 64px - env(safe-area-inset-bottom, 0px))); transition: transform .25s; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .pos-right.open { transform: none; }
  .pos-cart-toggle { display: flex; justify-content: space-between; align-items: center; min-height: 64px; padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); border: 0; background: var(--brand); color: #fff; font-weight: 700; font-size: 1.05rem; cursor: pointer; width: 100%; }
  .pos-grid { padding-bottom: 90px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; }
.pay-methods button { display: grid; justify-items: center; gap: .35rem; padding: .9rem .5rem; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font-weight: 600; }
.pay-methods button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-ink); }
.pay-methods .svgi { width: 26px; height: 26px; color: var(--brand); }

/* Bank reconciliation */
.recon { display: grid; gap: .6rem; }
.recon-line { display: grid; grid-template-columns: 110px minmax(0, 1.4fr) 130px minmax(0, 1.6fr) auto; gap: .8rem; align-items: center; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: .9rem; }
.recon-line.done { opacity: .6; }
.recon-line .why { font-size: .78rem; color: var(--muted); }
.conf { display: inline-block; width: 52px; height: 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; vertical-align: middle; margin-right: .35rem; }
.conf i { display: block; height: 100%; background: var(--ok); }
@media (max-width: 900px) { .recon-line { grid-template-columns: 1fr 1fr; } .recon-line > :nth-child(4), .recon-line > :nth-child(5) { grid-column: 1 / -1; } }

/* Reports */
.report { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow-x: auto; }
.report table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 520px; }
.report td, .report th { padding: .5rem .9rem; border-bottom: 1px solid var(--line-2); }
.report th { text-align: left; font: 600 .74rem/1.2 var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
.report tr.h td { font-weight: 700; background: var(--surface-2); }
.report tr.t td { font-weight: 700; border-top: 2px solid var(--line); }
.report tr.i td:first-child { padding-left: 2rem; }
.report tr[data-acc] { cursor: pointer; }
.report tr[data-acc]:hover td { background: var(--brand-tint); }

/* Discuss */
.discuss { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; height: calc(100dvh - 150px); min-height: 420px; margin-top: 1rem; }
.discuss aside { border-right: 1px solid var(--line); padding: .7rem; overflow-y: auto; display: grid; gap: .15rem; align-content: start; }
.discuss aside button { text-align: left; border: 0; background: none; padding: .45rem .6rem; border-radius: 8px; cursor: pointer; display: flex; gap: .5rem; align-items: center; }
.discuss aside button.on { background: var(--brand-tint); color: var(--brand-ink); font-weight: 600; }
.discuss .thread { display: flex; flex-direction: column; min-width: 0; }
.discuss .msgs { flex: 1; overflow-y: auto; padding: 1rem; display: grid; gap: .9rem; align-content: start; }
.discuss form { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); }
.discuss form input { flex: 1; min-width: 0; }
@media (max-width: 720px) { .discuss { grid-template-columns: 1fr; height: auto; } .discuss aside { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); } .discuss .msgs { max-height: 55vh; } }

/* Settings */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1rem; padding-top: 1rem; align-items: start; }
.settings nav { display: grid; gap: .15rem; position: sticky; top: 70px; }
.settings nav button { text-align: left; border: 0; background: none; padding: .55rem .75rem; border-radius: 9px; cursor: pointer; display: flex; gap: .55rem; align-items: center; color: var(--text); }
.settings nav button.on { background: var(--surface); box-shadow: var(--shadow); color: var(--brand); font-weight: 600; }
@media (max-width: 860px) { .settings { grid-template-columns: 1fr; } .settings nav { position: static; display: flex; overflow-x: auto; } .settings nav button { white-space: nowrap; } }
.set-block { display: grid; gap: .9rem; padding: 1.1rem 1.2rem; }
.set-block + .set-block { border-top: 1px solid var(--line); }
.set-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 1rem; align-items: start; }
.set-row > div:first-child b { display: block; }
.set-row > div:first-child small { color: var(--muted); }
@media (max-width: 720px) { .set-row { grid-template-columns: 1fr; gap: .4rem; } }
.layout-designer { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .layout-designer { grid-template-columns: 1fr; } }
.style-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.style-pick button { border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); padding: .45rem .2rem; font-size: .78rem; cursor: pointer; display: grid; gap: .3rem; justify-items: center; }
.style-pick button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-tint); }
.style-pick i { width: 34px; height: 42px; border: 1px solid var(--line); border-radius: 3px; background: linear-gradient(var(--brand) 0 0) 4px 10px / 26px 3px no-repeat, linear-gradient(var(--line) 0 0) 4px 18px / 26px 2px no-repeat, linear-gradient(var(--line) 0 0) 4px 24px / 26px 2px no-repeat, linear-gradient(var(--line) 0 0) 4px 30px / 18px 2px no-repeat, var(--paper); }
.swatches { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--brand); }
.locked-mark { display: flex; gap: .6rem; align-items: center; padding: .6rem .8rem; border-radius: 10px; background: var(--surface-2); font-size: .86rem; }
.locked-mark .svgi { color: var(--muted); }
.plan-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border-radius: 14px; background: var(--brand-tint); }
.plan-card b { font: 700 1.3rem/1.1 var(--f-display); }

/* Copilot */
.qa { display: grid; gap: 1rem; max-width: 880px; margin: 1rem auto 0; }
.qa-ask { display: flex; gap: .5rem; }
.qa-ask input { flex: 1; min-width: 0; min-height: 46px; border: 1px solid var(--line); border-radius: 12px; padding: .5rem .9rem; background: var(--surface); font-size: 1rem; }
.qa-sugs { display: flex; flex-wrap: wrap; gap: .4rem; }
.qa-sugs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .4rem .8rem; cursor: pointer; font-size: .86rem; }
.qa-sugs button:hover { border-color: var(--brand); color: var(--brand); }
.qa-ans { display: grid; gap: .6rem; }
.qa-ans .q { justify-self: end; background: var(--brand); color: #fff; padding: .5rem .9rem; border-radius: 14px 14px 4px 14px; max-width: 80%; }
:root[data-theme="dark"] .qa-ans .q { color: #08192a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .qa-ans .q { color: #08192a; } }
.qa-ans .a { background: var(--surface); border: 1px solid var(--line); padding: .8rem 1rem; border-radius: 14px 14px 14px 4px; display: grid; gap: .5rem; max-width: 100%; overflow-x: auto; }
.qa-ans .a .src { font-size: .78rem; color: var(--muted); }

/* Misc */
.empty-state { padding: 3rem 1rem; text-align: center; display: grid; gap: .6rem; justify-items: center; color: var(--muted); }
.empty-state .svgi { width: 54px; height: 54px; color: var(--brand); stroke-width: 1.2; }
.empty-state h3 { color: var(--text); }
.banner { display: flex; gap: .8rem; align-items: center; padding: .7rem 1rem; border-radius: 12px; background: var(--warn-bg); color: var(--text); font-size: .9rem; margin-top: .9rem; flex-wrap: wrap; }
.banner.info { background: var(--info-bg); }
.banner.bad { background: var(--bad-bg); }
.banner .svgi { color: var(--warn); }
.banner.info .svgi { color: var(--brand); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
.ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; margin-top: .4rem; }
.op-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 1rem 1.1rem; display: grid; gap: .7rem; }
.op-card h3 { font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.op-card h3 .svgi { color: var(--brand); width: 22px; height: 22px; }
.op-card .op-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.op-card .op-stats { display: grid; gap: .2rem; font-size: .86rem; }
.op-card .op-stats a { cursor: pointer; text-decoration: none; }
.op-card .op-stats a:hover { text-decoration: underline; }
.sparkline { width: 100%; height: 44px; display: block; }
.att-kiosk { display: grid; justify-items: center; gap: 1rem; padding: 2.5rem 1rem; text-align: center; }
.att-kiosk .clock { font: 700 3rem/1 var(--f-display); font-variant-numeric: tabular-nums; }
.check-btn { width: 150px; height: 150px; border-radius: 50%; border: 0; font: 700 1.1rem/1.2 var(--f-display); cursor: pointer; color: #fff; background: var(--ok); box-shadow: 0 10px 30px -10px var(--ok); }
.check-btn.out { background: var(--bad); box-shadow: 0 10px 30px -10px var(--bad); }
.foot-mark { text-align: center; padding: 1.5rem 0 0; color: var(--faint); font-size: .78rem; }
.foot-mark a { color: var(--muted); }
.sw-li { list-style: none; padding: 0; margin: 0; display: grid; gap: .3rem; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .3rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* Print: only the document being printed */
#print-root { display: none; }
@media print {
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  body.printing .paper, body.printing .receipt { box-shadow: none; width: auto; margin: 0; }
  @page { margin: 12mm; }
}
.settings > * { min-width: 0; }

/* Copilot with AI assistants */
.ai-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1rem; align-items: start; }
.ai-tasks { display: grid; gap: .3rem; position: sticky; top: calc(64px + env(safe-area-inset-top, 0px)); }
.ai-tasks button { display: flex; gap: .6rem; align-items: flex-start; text-align: left; border: 1px solid transparent; background: none; padding: .55rem .65rem; border-radius: 10px; cursor: pointer; color: var(--text); }
.ai-tasks button .svgi { color: var(--brand); margin-top: .15rem; }
.ai-tasks button b { display: block; font-size: .9rem; }
.ai-tasks button small { display: block; color: var(--muted); font-size: .78rem; line-height: 1.35; }
.ai-tasks button:hover { background: var(--surface); border-color: var(--line); }
.ai-tasks button.on { background: var(--surface); border-color: var(--brand); box-shadow: var(--shadow); }
.ai-ask { display: grid; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: .8rem; }
.ai-ask textarea { min-height: 52px; resize: vertical; flex: 1; }
.ai-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.qa-ans[data-ans] { max-height: calc(100dvh - 330px); min-height: 220px; overflow-y: auto; padding-right: .2rem; }
@media (max-width: 900px) { .ai-wrap { grid-template-columns: 1fr; } .ai-tasks { position: static; display: flex; overflow-x: auto; gap: .4rem; padding-bottom: .3rem; } .ai-tasks button { flex: 0 0 auto; max-width: 220px; border-color: var(--line); background: var(--surface); } .ai-tasks button small { display: none; } .qa-ans[data-ans] { max-height: none; } }
.login-card { max-width: 440px; margin: 3rem auto; }

/* live mode: save status and notices */
.sync-chip { position: fixed; right: max(14px, env(safe-area-inset-right, 0px)); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 90; font: 600 .8rem/1 var(--f-body); padding: .5rem .75rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); box-shadow: 0 6px 18px -10px rgba(17,38,58,.45); }
.sync-chip.busy::before { content: ""; display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--brand-2); margin-right: .45rem; animation: syncp 1s infinite alternate; }
.sync-chip.ok { color: var(--ok); }
.sync-chip.bad { color: #fff; background: var(--bad); border-color: var(--bad); }
@keyframes syncp { from { opacity: .3; } to { opacity: 1; } }
.rt-ind { display: inline-flex; align-items: center; gap: .35rem; font: 600 .72rem/1 var(--f-body); letter-spacing: .02em; color: var(--muted); padding: .3rem .55rem; border-radius: 999px; border: 1px solid var(--line); margin-right: .25rem; white-space: nowrap; }
.rt-ind i { width: .5rem; height: .5rem; border-radius: 50%; background: #b9c4cf; }
.rt-ind.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.rt-ind.on i { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); animation: rtp 2.4s infinite; }
@keyframes rtp { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 70% { box-shadow: 0 0 0 .45rem transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
#topbar .rt-ind { color: rgba(255,255,255,.78); border-color: rgba(255,255,255,.32); }
#topbar .rt-ind.on { color: #fff; border-color: rgba(255,255,255,.5); }
#topbar .rt-ind i { background: rgba(255,255,255,.55); }
#topbar .rt-ind.on i { background: #6ee7a8; }
@media (max-width: 560px) { .rt-ind { font-size: 0; padding: .35rem; gap: 0; } }
@media (prefers-reduced-motion: reduce) { .rt-ind.on i { animation: none; } }
.live-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 80; width: min(860px, calc(100% - 24px)); display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; justify-content: space-between; background: #10283f; color: #fff; border-radius: 16px; padding: .7rem .7rem .7rem 1rem; box-shadow: 0 14px 36px -14px rgba(8,22,36,.6); font-size: .9rem; }
.live-bar.warn { background: #7a4b07; }
.live-bar .btn-row { display: flex; gap: .4rem; margin-left: auto; }
.live-bar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.live-bar .icon-btn { color: #fff; background: transparent; border: 0; }
@media (max-width: 560px) { .live-bar { font-size: .84rem; } .live-bar .btn-row { margin-left: 0; } }
