/* ======================================================================
   FLOWTRA - app styles
   Company theme comes in as --brand / --accent / --g1..g3 (set per company).
   Default (JB Agarbatti): black, white, gradient gold.
   ====================================================================== */
:root {
  --brand: #0D0D0D; --accent: #C9A04A; --g1: #B8862B; --g2: #E6C36A; --g3: #C9A04A; --paper-light: #FAF8F3;
  --gold: linear-gradient(135deg, var(--g1) 0%, var(--g2) 48%, var(--g3) 100%);
  --paper: var(--paper-light); --card: #FFFFFF; --card-2: #F6F4EE; --line: #E7E3D8; --line-2: #F0EDE5;
  --text: #17150F; --muted: #6B665A; --field: #FFFFFF; --field-line: #CFC9BA;
  --ok: #2F7A4B; --ok-bg: #E6F2EA; --warn: #9A5B00; --warn-bg: #FBF0DA; --bad: #B03A2E; --bad-bg: #F9E7E4;
  --info: #2B5C8A; --info-bg: #E6EEF6; --mute-bg: #EEECE6;
  --side-bg: var(--brand); --side-text: rgba(255,255,255,.72); --side-hover: rgba(255,255,255,.07);
  --shadow: 0 1px 2px rgba(23,21,15,.05), 0 8px 24px rgba(23,21,15,.06);
  --r: 14px; --r-sm: 10px; --side: 256px;
  --f-body: "Plus Jakarta Sans", "Noto Sans Gujarati", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-display: "Fraunces", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  html[data-mode="auto"] { --paper: #0E0D0B; --card: #17160F; --card-2: #1D1B14; --line: #2B2920; --line-2: #222018; --text: #F1EEE6; --muted: #A39D8E;
    --field: #121109; --field-line: #3D3A2E; --ok-bg: #12291B; --warn-bg: #2E2410; --bad-bg: #331815; --info-bg: #13243A; --mute-bg: #24221B;
    --ok: #7BCB97; --warn: #E8B259; --bad: #F08F84; --info: #8EB8E6; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark; }
}
html[data-mode="dark"] { --paper: #0E0D0B; --card: #17160F; --card-2: #1D1B14; --line: #2B2920; --line-2: #222018; --text: #F1EEE6; --muted: #A39D8E;
  --field: #121109; --field-line: #3D3A2E; --ok-bg: #12291B; --warn-bg: #2E2410; --bad-bg: #331815; --info-bg: #13243A; --mute-bg: #24221B;
  --ok: #7BCB97; --warn: #E8B259; --bad: #F08F84; --info: #8EB8E6; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--f-body); color: var(--text); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font: 600 clamp(24px, 3vw, 30px)/1.15 var(--f-display); letter-spacing: -.01em; }
h2 { font: 600 21px/1.2 var(--f-display); }
h3 { font-size: 16px; font-weight: 700; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 1em; }
p { margin: 0 0 .8em; }
small, .small { font-size: 13px; }
.tiny { font-size: 12px; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hide, [hidden] { display: none !important; }
.ic { flex: none; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
code { font-size: 13px; background: var(--card-2); padding: 2px 6px; border-radius: 6px; }

/* ---------- shell ---------- */
.side { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--side-bg); color: #fff; display: flex; flex-direction: column; z-index: 40; overflow-y: auto; scrollbar-width: thin; }
.side::after { content: ""; position: absolute; top: 0; right: 0; width: 2px; height: 100%; background: var(--gold); opacity: .55; }
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; text-decoration: none; }
.brand img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; background: #fff; padding: 3px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--gold); color: #17150F; display: grid; place-items: center; font: 700 16px var(--f-display); }
.brand-name { display: flex; flex-direction: column; font-weight: 700; font-size: 15px; line-height: 1.2; }
.brand-name small { font-weight: 500; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; background: var(--gold); -webkit-background-clip: text; background-clip: text; color: transparent; margin-top: 2px; }
.nav { padding: 4px 10px 24px; display: flex; flex-direction: column; gap: 1px; }
.nav-group { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.38); padding: 16px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--side-text); font-size: 14px; font-weight: 500; position: relative; }
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.on { color: #fff; background: rgba(255,255,255,.08); }
.nav a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav a.on .ic { color: var(--g2); }
.main { margin-left: var(--side); min-height: 100vh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; color: var(--muted); }
.search input { border: 0; background: none; outline: 0; padding: 10px 0; width: 100%; font: inherit; color: var(--text); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: none; color: var(--text); cursor: pointer; text-decoration: none; }
.icon-btn:hover { background: var(--card-2); }
.bell b { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.me { position: relative; }
.me summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.me summary::-webkit-details-marker { display: none; }
.me summary:hover { background: var(--card-2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #17150F; display: grid; place-items: center; font-weight: 700; }
.me-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 250px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.me-menu a { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.me-menu a:hover { background: var(--card-2); }
.me-head { padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: flex; flex-direction: column; }
.me-head small { color: var(--muted); }
.page { padding: 26px 28px 60px; width: 100%; max-width: 1280px; }
.page.wide { max-width: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 6px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 6px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--text); }
.banner { padding: 9px 28px; font-size: 14px; border-bottom: 1px solid var(--line); }
.banner.info { background: var(--info-bg); color: var(--info); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner a { font-weight: 600; margin-left: 6px; }
.scrim { display: none; }
.tabbar { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 11px; border: 1px solid transparent; background: var(--brand); color: #fff; font: 600 14px var(--f-body); text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .06s, box-shadow .15s, background .15s; min-height: 42px; }
.btn:hover { box-shadow: 0 4px 14px rgba(0,0,0,.14); }
.btn:active { transform: translateY(1px); }
.btn.gold { background: var(--gold); color: #17150F; border-color: color-mix(in srgb, var(--g1) 60%, transparent); }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--field-line); box-shadow: none; background: var(--card-2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.sm { padding: 6px 11px; font-size: 13px; min-height: 34px; border-radius: 9px; }
.btn.lg { padding: 13px 20px; font-size: 15px; min-height: 50px; }
.btn.block { width: 100%; }
.btn.wa { color: #128C4A; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ---------- cards, kpis ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card > h3:first-child, .card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card.flush > .card-h { padding: 16px 18px 0; }
.card.gold-top { border-top: 0; position: relative; }
.card.gold-top::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--gold); border-radius: var(--r) var(--r) 0 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; position: relative; overflow: hidden; box-shadow: var(--shadow); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--gold); opacity: .9; }
.kpi.bad::before { background: var(--bad); } .kpi.warn::before { background: var(--warn); } .kpi.ok::before { background: var(--ok); }
a.kpi:hover { border-color: var(--accent); }
.kpi-l { font-size: 12.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-v { font: 600 26px/1.15 var(--f-display); font-variant-numeric: tabular-nums; }
.kpi-s { font-size: 13px; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.cols-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }

/* ---------- lists, tables ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 11px 14px; background: var(--card-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr[data-href] { cursor: pointer; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tbl td a { text-decoration: none; }
.tbl td a:hover { text-decoration: underline; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--line); padding: 11px 14px; }
.tbl .alert-row td { background: var(--bad-bg); }
.tbl input, .tbl select { width: 100%; min-width: 70px; }
.list .li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line-2); text-decoration: none; }
.list .li:last-child { border-bottom: 0; }
.list .li:hover { background: var(--card-2); }
.li-main { display: flex; flex-direction: column; min-width: 0; }
.li-main small { color: var(--muted); }
.li.unread { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.bad { background: var(--bad); } .dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.mute { background: var(--mute-bg); color: var(--muted); }
.badge.gold { background: var(--gold); color: #17150F; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; color: var(--muted); font-size: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--text); border-image: var(--gold) 1; border-bottom: 2px solid; }
.tabs a .badge { margin-left: 6px; }
.progress { height: 9px; background: var(--card-2); border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; background: var(--gold); border-radius: 9px; }
.progress.bad > i { background: var(--bad); } .progress.ok > i { background: var(--ok); }
.bar-row { display: grid; grid-template-columns: 160px 1fr 110px; gap: 12px; align-items: center; padding: 6px 0; font-size: 14px; }
.stat-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.stat-line:last-child { border-bottom: 0; }

/* ---------- forms ---------- */
.form .grid, .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.span2 { grid-column: 1 / -1; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; }
.fld > span { color: var(--text); }
.fld .req { color: var(--bad); font-style: normal; }
.fld .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
.fld.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; padding-top: 10px; flex-wrap: wrap; }
.fld.check .hint { width: 100%; }
input, select, textarea { font: 15px var(--f-body); color: var(--text); background: var(--field); border: 1px solid var(--field-line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
textarea { resize: vertical; min-height: 80px; }
input[type=checkbox], input[type=radio] { width: 19px; height: 19px; min-height: 0; accent-color: var(--accent); flex: none; }
input[type=color] { padding: 3px; height: 44px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[disabled], select[disabled], textarea[disabled] { background: var(--card-2); color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.share-bar { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 14px; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 6px 0; font-weight: 500; }
.pw { position: relative; }
.pw-t { position: absolute; right: 6px; top: 6px; bottom: 6px; border: 0; background: var(--card-2); border-radius: 8px; padding: 0 10px; cursor: pointer; font: 600 12px var(--f-body); color: var(--muted); }
.danger-zone { margin-top: 10px; display: flex; justify-content: flex-end; }
.lines td { padding: 6px 8px; }
.lines .rm { border: 0; background: none; color: var(--bad); cursor: pointer; font-size: 20px; padding: 4px 8px; }
.totals { margin-left: auto; width: min(360px, 100%); }
.totals .stat-line b { font-variant-numeric: tabular-nums; }
.totals .grand { font: 600 20px var(--f-display); border-top: 2px solid var(--text); border-bottom: 0; padding-top: 10px; }
.matrix th, .matrix td { text-align: center; padding: 8px 6px; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }

/* ---------- messages ---------- */
.flash { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 14px; font-size: 14px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.flash.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.help-box { display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-sm); padding: 14px 16px; margin-bottom: 18px; font-size: 14px; }
.help-box .x { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--muted); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-ic { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--card); border: 1px solid var(--line); color: var(--accent); }
.empty h2, .empty h3 { color: var(--text); }
.callout { padding: 14px 16px; border-radius: var(--r-sm); background: var(--card-2); border: 1px dashed var(--field-line); font-size: 14px; margin-bottom: 14px; }
.ai-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--gold); color: #17150F; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow-y: auto; padding: 4px; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); font-size: 14px; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.bubble small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.thumb { max-width: 100%; max-height: 340px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; background: var(--gold); color: #17150F; font-weight: 700; display: grid; place-items: center; font-size: 13px; }

/* ---------- tour ---------- */
.tour { position: fixed; inset: 0; z-index: 100; background: rgba(10,9,6,.55); display: grid; place-items: center; padding: 20px; }
.tour-card { background: var(--card); border-radius: 18px; max-width: 460px; width: 100%; padding: 26px; box-shadow: 0 30px 80px rgba(0,0,0,.35); position: relative; overflow: hidden; }
.tour-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--gold); }
.tour-dots { display: flex; gap: 6px; margin: 14px 0; } .tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); } .tour-dots i.on { background: var(--accent); }

/* ---------- auth ---------- */
body.auth { background: #F5F8FC; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: radial-gradient(1200px 600px at 10% 0%, #1F5FBF55, transparent 60%), #0E1B2C; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.auth-logo { display: flex; align-items: center; gap: 12px; font: 600 26px var(--f-display); margin-bottom: 30px; }
.auth-art h2 { font: 600 clamp(28px, 3.4vw, 42px)/1.12 var(--f-display); max-width: 15ch; }
.auth-art ul { padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; color: rgba(255,255,255,.8); }
.auth-art li::before { content: "—"; color: #5FA3F5; margin-right: 10px; }
.auth-foot { margin-top: auto; color: rgba(255,255,255,.5); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.auth-form { padding: 56px; display: flex; flex-direction: column; justify-content: center; max-width: 520px; width: 100%; margin: 0 auto; }
.auth-form h1 { font-size: 32px; }
body.auth .btn.gold { background: #2F7DE1; color: #fff; border-color: #2F7DE1; }
body.auth input:focus, body.auth select:focus { border-color: #2F7DE1; box-shadow: 0 0 0 3px #2F7DE133; }
.auth-alt { margin-top: 26px; padding-top: 20px; border-top: 1px solid #DCE3EC; display: flex; flex-direction: column; gap: 10px; text-align: center; }
body.auth .link { color: #1F5FBF; }

/* ---------- print documents ---------- */
.doc { background: #fff; color: #111; max-width: 900px; margin: 0 auto; padding: 32px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; }
.doc .tbl th { background: #f4f2ec; color: #333; }
.doc .tbl td { border-bottom: 1px solid #e6e2d8; }
.lh { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 2px solid transparent; border-image: var(--gold) 1; }
.lh-l { display: flex; gap: 14px; align-items: flex-start; }
.lh-l img { width: 64px; height: 64px; object-fit: contain; }
.lh-n { font: 600 20px var(--f-display); display: block; }
.lh-l small { color: #555; line-height: 1.5; }
.lh-r { text-align: right; }
.lh-t { font: 600 18px var(--f-display); letter-spacing: .04em; text-transform: uppercase; display: block; margin-bottom: 4px; }
.lh-r small { color: #777; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.doc-parties > div { border: 1px solid #e6e2d8; border-radius: 6px; padding: 10px 12px; }
.doc-parties small { color: #777; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; font-weight: 700; }
.doc-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; font-size: 12px; }
.sign { text-align: right; padding-top: 40px; }
.stickers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sticker { border: 2px solid #111; border-radius: 6px; padding: 12px; page-break-inside: avoid; background: #fff; color: #111; }
.sticker .to { font: 700 18px var(--f-body); }
.sticker .big { font: 700 22px var(--f-body); }

@media print {
  @page { margin: 12mm; }
  body { background: #fff !important; color: #000; }
  .side, .top, .tabbar, .banner, .no-print, .page-actions, .help-box, .flash, .share-bar, .back, .form-actions, .toolbar, .danger-zone { display: none !important; }
  .main { margin: 0 !important; }
  .page { padding: 0 !important; max-width: none; }
  .card, .doc { box-shadow: none !important; border: 0 !important; padding: 0 !important; }
  .page-head { margin-bottom: 8px; }
  .print-only { display: block !important; }
  .tbl th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { text-decoration: none; }
}
.print-only { display: none; }

/* ---------- phones & tablets ---------- */
.only-m { display: none; }
@media (max-width: 960px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; width: 280px; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .main { margin-left: 0; padding-bottom: 72px; }
  .only-m { display: inline-grid; }
  .hide-m { display: none; }
  .top { padding: 10px 14px; gap: 8px; }
  .page { padding: 18px 16px 40px; }
  .banner { padding: 9px 16px; }
  .cols-2-1 { grid-template-columns: 1fr; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; font-size: 11px; font-weight: 600; color: var(--muted); padding: 4px 0; }
  .tabbar a.on { color: var(--text); }
  .tabbar a.on .ic { color: var(--accent); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { padding: 32px 22px; } .auth-art ul, .auth-foot { display: none; } .auth-logo { margin-bottom: 4px; }
  .auth-form { padding: 28px 20px; }
}
@media (max-width: 700px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 12px 14px; } .kpi-v { font-size: 21px; }
  .grid.two, .grid.three, .doc-parties, .doc-foot { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .page-actions .btn { flex: 1; }
  .btn { min-height: 44px; }
  .bar-row { grid-template-columns: 1fr 90px; } .bar-row .progress { grid-column: 1 / -1; grid-row: 2; }
  /* tables become cards */
  .card .tbl:not(.keep) thead { display: none; }
  .card .tbl:not(.keep), .card .tbl:not(.keep) tbody, .card .tbl:not(.keep) tr, .card .tbl:not(.keep) td { display: block; width: 100%; }
  .card .tbl:not(.keep) tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .card .tbl:not(.keep) td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .card .tbl:not(.keep) td::before { content: attr(data-l); color: var(--muted); font-size: 12.5px; text-align: left; font-weight: 600; }
  .card .tbl:not(.keep) td:first-child { font-size: 15px; text-align: left; }
  .card .tbl:not(.keep) td:first-child::before { display: none; }
  .card .tbl:not(.keep) tfoot { display: block; }
  .table-scroll { overflow-x: auto; }
  .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar input, .toolbar select { width: 100%; min-width: 0; }
  .toolbar .grow, .toolbar .share-bar, .toolbar > span, .toolbar > label { grid-column: 1 / -1; }
  .share-bar { margin-left: 0; width: 100%; }
  .share-bar .btn { flex: 1; }
  .doc { padding: 14px; }
  .stickers { grid-template-columns: 1fr; }
}
