/* hncltt-invoices — Britain Technologies */
:root {
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: color-mix(in srgb, var(--brand) 10%, white);
  --bg: #f3f5f6;
  --panel: #ffffff;
  --ink: #172024;
  --ink-2: #4a565c;
  --muted: #7b878d;
  --line: #e2e7ea;
  --line-2: #eef1f3;
  --danger: #c2281f;
  --warn: #b45309;
  --ok: #15803d;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 28, .05), 0 4px 16px rgba(16, 24, 28, .05);
  --shadow-lg: 0 10px 40px rgba(16, 24, 28, .18);
  --sidebar: 248px;
  --topbar: 56px;
  --tabbar: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font);
  overscroll-behavior-y: contain; -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
svg:not([width]) { width: 20px; height: 20px; flex: none; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 14px; min-width: 0; }
.stack > * { min-width: 0; }
.stack-sm { display: grid; gap: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ shell */
#app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: #10181b; color: #c9d3d7; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; }
.brand img { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; background: #fff; }
.brand .mark { width: 36px; height: 36px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px; }
.brand b { display: block; font-size: 15px; }
.brand small { color: #84949b; font-size: 12px; }
.nav { display: grid; gap: 2px; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #c9d3d7;
  font-weight: 550; font-size: 14.5px; border: 0; background: none; cursor: pointer; text-align: left; width: 100%;
}
.nav a:hover, .nav button:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: color-mix(in srgb, var(--brand) 85%, black); color: #fff; }
.nav svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #66767d; padding: 16px 12px 6px; }
.sidebar .spacer { flex: 1; }
.sidebar .me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; color: #c9d3d7; }
.sidebar .me:hover { background: rgba(255,255,255,.06); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1480px; margin: 0 auto; padding: 24px 28px; flex: 1; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px 12px 22px; }

.topbar { display: none; }
.tabbar { display: none; }

.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { flex: 1; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { border-color: #cfd6da; background: #fafbfb; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: color-mix(in srgb, var(--brand) 88%, black); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn.icon { padding: 0; width: 40px; }
.btn.sm.icon { width: 32px; }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn.wa:hover { background: #198f48; }
.btn.block { width: 100%; }

.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #d5dce0; border-radius: var(--radius-sm);
  background: #fff; outline: none; transition: border-color .12s, box-shadow .12s; font-size: 15px;
}
textarea.input { min-height: 84px; resize: vertical; line-height: 1.4; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.money { text-align: right; }
.input[readonly] { background: var(--line-2); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237b878d' stroke-width='1.6' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span-2 { grid-column: span 2; }

.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 38px; }

.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ------------------------------------------------------------------ cards & tables */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { flex: 1; }
.card-body { padding: 18px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 4px 0 10px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 750; margin-top: 4px; letter-spacing: -.02em; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.alert .value { color: var(--danger); }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfcfc; position: sticky; top: 0; z-index: 1; }
table.list td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr.click { cursor: pointer; }
table.list tbody tr.click:hover td { background: #f7fafa; }
table.list tbody tr.sel td { background: var(--brand-soft); }
table.list .num { text-align: right; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 13px; color: var(--muted); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.draft { background: #eef0f2; color: #5b666c; }
.pill.sent { background: #e0f2fe; color: #075985; }
.pill.partial { background: #fef3c7; color: #92400e; }
.pill.overdue { background: #fee2e2; color: #991b1b; }
.pill.paid { background: #dcfce7; color: #166534; }
.pill.void { background: #e5e7eb; color: #4b5563; text-decoration: line-through; }
.pill.admin { background: #ede9fe; color: #5b21b6; }
.pill.staff { background: #e0f2fe; color: #075985; }
.pill.viewer { background: #f1f5f9; color: #475569; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .45; margin-bottom: 8px; }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* split (master/detail) */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.split.has-detail { grid-template-columns: minmax(360px, 440px) minmax(0, 1fr); }
.split .list-pane { min-width: 0; }
.split .detail-pane { min-width: 0; position: sticky; top: 18px; }
.split.has-detail table.list .hide-split { display: none; }

/* invoice detail */
.inv-head { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.inv-amount { font-size: 30px; font-weight: 780; letter-spacing: -.02em; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.preview-frame { width: 100%; height: 980px; border: 0; border-radius: var(--radius); background: #fff; display: block; }
.timeline { display: grid; gap: 8px; font-size: 13.5px; }
.timeline div { display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.timeline svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.timeline b { color: var(--ink); font-weight: 600; }

/* invoice editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.editor aside { position: sticky; top: 18px; display: grid; gap: 14px; }
.lines-table { width: 100%; border-collapse: collapse; }
.lines-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; padding: 8px 6px; font-weight: 650; }
.lines-table td { padding: 6px; vertical-align: top; border-top: 1px solid var(--line-2); }
.lines-table .c-qty { width: 90px; } .lines-table .c-rate { width: 130px; } .lines-table .c-amt { width: 120px; text-align: right; } .lines-table .c-tax { width: 50px; text-align: center; } .lines-table .c-x { width: 44px; }
.lines-table .amt { padding-top: 10px; font-weight: 600; text-align: right; }
.lines-table textarea.input { min-height: 42px; height: 42px; }
.line-card { display: none; }
.totals { display: grid; gap: 8px; font-size: 14.5px; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; }
.totals .grand { font-size: 19px; font-weight: 780; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }

.picker { position: relative; }
.picker-menu { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 300px; overflow: auto; padding: 4px; }
.picker-menu button { display: flex; width: 100%; gap: 10px; justify-content: space-between; align-items: center; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.picker-menu button:hover, .picker-menu button.hl { background: var(--brand-soft); }
.picker-menu .new { color: var(--brand); font-weight: 600; }

/* items */
.price-btn { border: 1px dashed transparent; background: none; padding: 4px 8px; border-radius: 8px; font-weight: 650; cursor: pointer; font-variant-numeric: tabular-nums; }
.price-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.price-edit { display: inline-flex; gap: 6px; align-items: center; }
.price-edit .input { width: 120px; min-height: 36px; padding: 6px 10px; text-align: right; }
.bulkbar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; margin-top: 12px; background: #10181b; color: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); }
.bulkbar .btn { min-height: 36px; }

/* ------------------------------------------------------------------ chart */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .bar i { display: block; width: 100%; max-width: 46px; background: color-mix(in srgb, var(--brand) 75%, white); border-radius: 6px 6px 3px 3px; min-height: 3px; }
.bars .bar.now i { background: var(--brand); }
.bars .bar span { font-size: 11.5px; color: var(--muted); }
.bars .bar b { font-size: 11.5px; font-weight: 600; color: var(--ink-2); }

/* ------------------------------------------------------------------ modal / toast */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(12, 18, 20, .45); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease; }
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line-2); position: sticky; bottom: 0; background: #fff; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

.toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast { background: #10181b; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14.5px; animation: pop .18s ease; pointer-events: auto; }
.toast.error { background: var(--danger); }

/* pull to refresh */
.ptr { position: fixed; top: calc(var(--safe-t) + 8px); left: 50%; z-index: 90; width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-lg); display: grid; place-items: center; transform: translateY(-80px); transition: transform .2s; pointer-events: none; }
.ptr svg { width: 22px; height: 22px; color: var(--brand); }
.ptr.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 22px; height: 22px; border: 2.5px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }

/* ------------------------------------------------------------------ auth */
.auth { min-height: 100vh; display: grid; grid-template-rows: 1fr auto; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent), #0f171a; color: #e7eef0; }
.auth-box { width: min(400px, 100%); margin: auto; padding: 32px 22px; text-align: center; }
.auth-box .logo { width: 68px; height: 68px; margin: 0 auto 14px; border-radius: 18px; background: #fff; display: grid; place-items: center; overflow: hidden; }
.auth-box .logo img { max-width: 80%; max-height: 80%; }
.auth-box .logo .mark { width: 100%; height: 100%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 24px; }
.auth-box h1 { font-size: 22px; color: #fff; }
.auth-box p { color: #9fb0b6; margin: 6px 0 0; }
.auth .footer { color: #6f8188; }
.auth .input { background: #18242a; border-color: #2a3a41; color: #fff; }
.auth .input:focus { border-color: var(--brand); }
.auth .field > span { color: #b9c7cc; }
.auth .link { background: none; border: 0; color: #9fd9d2; cursor: pointer; font-weight: 600; padding: 8px; }
.auth .err { color: #ffb4ad; min-height: 22px; margin-top: 10px; font-size: 14px; }
.dots { display: flex; gap: 14px; justify-content: center; margin: 26px 0 8px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #5a6e76; transition: background .1s, border-color .1s, transform .1s; }
.dots i.on { background: #fff; border-color: #fff; transform: scale(1.05); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pad { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 22px; justify-content: center; margin-top: 18px; }
.pad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: rgba(255,255,255,.08); color: #fff; font-size: 28px; font-weight: 400; cursor: pointer; display: grid; place-items: center; transition: background .1s; }
.pad button:active { background: rgba(255,255,255,.22); }
.pad button.fn { background: transparent; font-size: 14px; }
.pad button svg { width: 28px; height: 28px; }
.auth form .btn { margin-top: 6px; }
.auth-form { display: grid; gap: 12px; text-align: left; margin-top: 22px; }

/* ------------------------------------------------------------------ import */
.dropzone { border: 2px dashed #cbd5da; border-radius: var(--radius); padding: 30px 20px; text-align: center; cursor: pointer; background: #fbfcfc; transition: border-color .12s, background .12s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone svg { width: 34px; height: 34px; color: var(--brand); }
.import-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .import-grid { grid-template-columns: minmax(0, 1fr); } }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.table-scroll { overflow: auto; max-height: 380px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.table-scroll table.list td, .table-scroll table.list th { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
.steps { margin: 0; padding-left: 20px; color: var(--ink-2); font-size: 14px; display: grid; gap: 4px; }
.progress { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }

/* ================================================================== responsive */
@media (max-width: 1280px) {
  .split.has-detail { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); }
  .editor { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1100px) {
  .split.has-detail { grid-template-columns: minmax(0, 1fr); }
  .split.has-detail .list-pane { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 40; align-items: center; gap: 8px;
    height: calc(var(--topbar) + var(--safe-t)); padding: var(--safe-t) 8px 0 14px; background: rgba(255,255,255,.92);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-bottom: 1px solid var(--line);
  }
  .topbar .title { flex: 1; font-weight: 700; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .btn.icon { border: 0; background: transparent; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(255,255,255,.95);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .tabbar a svg { width: 23px; height: 23px; }
  .tabbar a.active { color: var(--brand); }
  .tabbar a.fab span { display: none; }
  .tabbar a.fab div { width: 50px; height: 50px; border-radius: 16px; background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 40%, transparent); margin-top: -14px; }
  .main { padding-bottom: calc(var(--tabbar) + var(--safe-b)); }
  .content { padding: 14px 14px 8px; }
  .page-head h1 { font-size: 20px; }
  .page-head.desktop-only, .desktop-only { display: none !important; }

  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi .value { font-size: 19px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .editor { grid-template-columns: 1fr; }
  .editor aside { position: static; }
  .split.has-detail .detail-pane { position: static; }

  /* tables become cards */
  table.list.responsive thead { display: none; }
  table.list.responsive, table.list.responsive tbody { display: block; }
  table.list.responsive tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  table.list.responsive td { display: block; padding: 0; border: 0; }
  table.list.responsive td.m-hide { display: none; }
  table.list.responsive td.m-right { text-align: right; grid-column: 2; }
  table.list.responsive td.m-full { grid-column: 1 / -1; }
  table.list.responsive td.m-r1 { grid-row: 1; }
  table.list.responsive td.m-r2 { grid-row: 2; }

  .lines-table { display: none; }
  .line-card { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fcfdfd; }
  .line-card .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: end; }
  .share-grid { grid-template-columns: 1fr 1fr; }
  .preview-frame { height: 760px; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; align-self: end; animation: up .22s ease; }
  .overlay { padding: 0; place-items: end center; }
  .modal-foot { padding-bottom: calc(14px + var(--safe-b)); }
  .toasts { bottom: calc(var(--tabbar) + var(--safe-b) + 12px); }
  .bulkbar { bottom: calc(var(--tabbar) + var(--safe-b) + 10px); }
  .pad { grid-template-columns: repeat(3, 72px); gap: 12px 24px; }
  .pad button { width: 72px; height: 72px; }
}
@media (min-width: 901px) { .mobile-only { display: none !important; } }
@media print { .sidebar, .topbar, .tabbar, .footer { display: none; } }
