/* Aditya Buildcon — Expense & Payment Management · design system */
:root {
  --red: #C10E0E; --red-deep: #8F0707; --red-wash: #FCEDED;
  --ink: #1F2023; --ink-2: #3A3C40; --muted: #6B6F76; --faint: #9A9EA5;
  --line: #E4E6EA; --line-2: #EEF0F2; --bg: #F5F6F8; --panel: #FFFFFF;
  --go: #17803D; --go-wash: #E5F4EA; --amber: #A86400; --amber-wash: #FFF3DC; --blue: #2457A6; --blue-wash: #E9F0FB;
  --font: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --num: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --r: 12px; --r-sm: 8px;
  --side: 248px;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #4C7FD9; outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num, .amt { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: #1C1D20; color: #C9CBD0; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 16px; }
.brand .mk { width: 38px; height: 38px; background: #fff; border-radius: 9px; display: grid; place-items: center; flex: none; }
.brand .mk img { width: 26px; }
.brand b { display: block; color: #fff; font: 700 18px/1.05 var(--num); letter-spacing: .02em; }
.brand span { font-size: 12px; color: #8D9097; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.nav .grp { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6E7178; padding: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: inherit; font-weight: 500; text-decoration: none; position: relative; }
.nav a:hover { background: #26282C; color: #fff; }
.nav a.on { background: #2B2D31; color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--red); }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav .badge { margin-left: auto; }
.me-box { border-top: 1px solid #2C2E32; padding: 12px 16px; font-size: 13px; }
.me-box b { color: #fff; display: block; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(245,246,248,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .back { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px 0 38px; background: #fff; }
.search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--faint); }
.search .kbd { position: absolute; right: 10px; top: 9px; font-size: 12px; color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(20,22,26,.14); max-height: 70vh; overflow: auto; z-index: 40; }
.search-results a { display: flex; gap: 12px; padding: 10px 14px; color: inherit; border-bottom: 1px solid var(--line-2); text-decoration: none; }
.search-results a:hover, .search-results a.on { background: var(--bg); }
.search-results .t { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); width: 108px; flex: none; padding-top: 2px; }
.icon-btn { position: relative; width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; color: var(--ink-2); }
.icon-btn:hover { background: #E9EBEE; }
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn .dot { position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.content:focus { outline: none; }
.content { padding: 22px 24px 90px; max-width: 1400px; width: 100%; }
.page-h { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h h1 { margin: 0; font: 700 30px/1.1 var(--num); letter-spacing: .01em; flex: 1; min-width: 200px; }
.page-h .sub { width: 100%; margin-top: -10px; color: var(--muted); }
.bottom-nav { display: none; }

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 60; transform: translateX(-100%); transition: transform .2s; padding-top: env(safe-area-inset-top, 0px); }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .topbar { padding: 10px 12px; gap: 6px; }
  .search .kbd { display: none; }
  .content { padding: 14px 12px 110px; }
  .page-h h1 { font-size: 26px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
    padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 6px); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); border: 0; background: none; padding: 4px 0; text-decoration: none; }
  .bottom-nav a.on { color: var(--red); }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav .plus { width: 54px; height: 54px; margin-top: -24px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(193,14,14,.35); }
  .bottom-nav .plus svg { width: 28px; height: 28px; }
}

/* ---------- Cards & KPIs ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-h h2 { margin: 0; font: 700 19px/1.2 var(--num); flex: 1; min-width: 140px; letter-spacing: .01em; }
.card-b { padding: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .g-main, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .g2 { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
a.kpi:hover { border-color: #C9CCD2; text-decoration: none; }
.kpi .l { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .v { font: 700 30px/1.15 var(--num); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.kpi.hero { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.hero .l, .kpi.hero .s { color: #AEB1B7; }
.kpi .v.warn { color: var(--amber); } .kpi .v.bad { color: var(--red); } .kpi .v.ok { color: var(--go); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .kpi .v { font-size: 25px; } }

.quick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.quick a, .quick button { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); background: #fff; border-radius: var(--r); color: var(--ink); font-weight: 600; text-decoration: none; text-align: left; }
.quick a:hover, .quick button:hover { border-color: var(--red); text-decoration: none; }
.quick .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--red-wash); color: var(--red); }
.quick .ic svg { width: 20px; height: 20px; }
.quick .ic.dark { background: #EDEEF0; color: var(--ink); }
@media (max-width: 1100px) { .quick { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) {
  .quick { display: flex; overflow-x: auto; gap: 8px; scrollbar-width: none; margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .quick a { flex: none; width: 104px; padding: 10px; font-size: 13.5px; gap: 6px; }
  .quick .ic { width: 32px; height: 32px; }
  .seg { display: flex; flex-wrap: wrap; }
  .seg button { flex: 1 1 auto; }
}
details.filter-box > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; }
details.filter-box > summary::-webkit-details-marker { display: none; }
details.filter-box[open] > summary { margin-bottom: 12px; }
@media (min-width: 701px) { details.filter-box > summary { display: none; } }

.alerts { display: grid; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: 10px; font-weight: 500; color: inherit; text-decoration: none; }
.alert:hover { text-decoration: none; filter: brightness(.98); }
.alert.warn { background: var(--amber-wash); color: #6E4300; }
.alert.bad { background: var(--red-wash); color: var(--red-deep); }
.alert.info { background: var(--blue-wash); color: #183E78; }
.alert svg { width: 18px; height: 18px; flex: none; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-weight: 600; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: #BFC3C9; text-decoration: none; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-deep); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ok { background: var(--go); border-color: var(--go); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue); padding: 0 8px; }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: 13.5px; }
.btn.lg { min-height: 52px; font-size: 17px; padding: 0 22px; }
.btn.block { width: 100%; }
.btn svg { width: 17px; height: 17px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn.busy::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form, .form.three { grid-template-columns: 1fr; } }
.fld { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fld > label, .fld > .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fld .req::after { content: " *"; color: var(--red); }
.in { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid #D6D9DE; border-radius: 9px; background: #fff; }
.in:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(31,32,35,.1); }
.in.err { border-color: var(--red); }
textarea.in { min-height: 84px; resize: vertical; }
.in.amount { font: 700 28px/1 var(--num); min-height: 56px; letter-spacing: .02em; }
.help { font-size: 12.5px; color: var(--muted); }
.ferr { font-size: 12.5px; color: var(--red); font-weight: 600; }
.chk { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.chk input { width: 18px; height: 18px; accent-color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 7px 13px; font-weight: 600; font-size: 14px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.add { color: var(--blue); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 8px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button.on { background: var(--ink); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters .fld { min-width: 140px; }
.filters .in { min-height: 38px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
@media (max-width: 700px) {
  .form-actions.sticky { position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 72px); background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 6px; margin: 0 -2px; }
  .form-actions .btn { flex: 1; min-height: 50px; }
}
details.more { border-top: 1px dashed var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--blue); }

/* ---------- Tables & list cards ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFC; position: sticky; top: 0; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: #FAFBFC; }
.tbl .amt { font-size: 17px; font-weight: 700; text-align: right; white-space: nowrap; }
.tbl .who b { display: block; font-weight: 600; }
.tbl .who span { font-size: 12.5px; color: var(--muted); }
.tbl tfoot td { font-weight: 700; background: #FAFBFC; }
.list { display: none; }
.item { display: flex; gap: 12px; padding: 13px 14px; border-bottom: 1px solid var(--line-2); color: inherit; text-decoration: none; align-items: flex-start; }
.item:hover { background: #FAFBFC; text-decoration: none; }
.item .grow b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .grow span { font-size: 13px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .amt { font: 700 19px/1.2 var(--num); text-align: right; white-space: nowrap; }
@media (max-width: 760px) { .tbl-wrap.resp { display: none; } .list { display: block; } }
.empty { text-align: center; padding: 42px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; color: #C3C6CC; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin: 8px 0 4px; }
.more-row { padding: 12px; text-align: center; }
.sum-bar { display: flex; gap: 18px; padding: 10px 16px; border-bottom: 1px solid var(--line-2); font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.sum-bar b { color: var(--ink); font-family: var(--num); font-size: 17px; }

/* ---------- Status tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: #EEF0F2; color: var(--ink-2); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.tag.paid, .tag.approved, .tag.ok, .tag.active { background: var(--go-wash); color: var(--go); }
.tag.submitted, .tag.under_review, .tag.payment_processing, .tag.info { background: var(--blue-wash); color: var(--blue); }
.tag.returned, .tag.warn, .tag.high, .tag.on_hold { background: var(--amber-wash); color: var(--amber); }
.tag.rejected, .tag.bad, .tag.urgent, .tag.blocked { background: var(--red-wash); color: var(--red); }
.tag.draft, .tag.cancelled, .tag.low, .tag.normal, .tag.inactive, .tag.closed, .tag.completed, .tag.planned { background: #EEF0F2; color: var(--muted); }
.badge { background: var(--red); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11.5px; font-weight: 700; line-height: 19px; }

/* ---------- Detail pages ---------- */
.detail-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.detail-head > .grow { min-width: 240px; flex-basis: 240px; }
.detail-head .big { font: 700 44px/1 var(--num); font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 28px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--faint); }
.timeline .dot.approved, .timeline .dot.paid { border-color: var(--go); }
.timeline .dot.rejected { border-color: var(--red); }
.timeline .dot.returned { border-color: var(--amber); }
.timeline .dot.submitted, .timeline .dot.created { border-color: var(--blue); }
.timeline b { font-weight: 600; }
.timeline .when { font-size: 12.5px; color: var(--muted); }
.timeline q { display: block; margin-top: 4px; padding: 8px 10px; background: var(--bg); border-radius: 8px; quotes: none; font-size: 14px; }
.chain { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chain .step { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #EEF0F2; color: var(--muted); }
.chain .step.done { background: var(--go-wash); color: var(--go); }
.chain .step.now { background: var(--blue-wash); color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.chain .arrow { color: var(--faint); }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.file { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; aspect-ratio: 1; display: flex; flex-direction: column; color: inherit; text-decoration: none; }
.file img { width: 100%; flex: 1; min-height: 0; object-fit: cover; background: #F0F1F3; }
.file .pdf { flex: 1; display: grid; place-items: center; background: #F7F1F1; color: var(--red); font: 700 22px var(--num); }
.file .cap { font-size: 12px; padding: 5px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-top: 1px solid var(--line-2); }
.file .x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 15px; line-height: 1; }
.file.up { border-style: dashed; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; background: #FAFBFC; }
.file.up svg { width: 26px; height: 26px; }
.file .prog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--red); transition: width .2s; }

/* ---------- Charts ---------- */
.chart svg { display: block; width: 100%; height: auto; }
.chart text { font-family: var(--font); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; color: inherit; text-decoration: none; }
.hbar:hover { text-decoration: none; }
.hbar .n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .v { font: 700 16px var(--num); }
.hbar .track { grid-column: 1 / -1; height: 8px; background: #EEF0F2; border-radius: 4px; overflow: hidden; position: relative; }
.hbar .fill { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.hbar .budget { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--red); }
.hbar .meta { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: -2px; }
.donut-wrap { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: center; }
@media (max-width: 480px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }
.donut-legend { display: grid; gap: 7px; font-size: 14px; width: 100%; }
.donut-legend a { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; color: inherit; text-decoration: none; }
.donut-legend i { width: 12px; height: 12px; border-radius: 3px; }
.donut-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend b { font: 700 15px var(--num); }
.status-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #EEF0F2; }
.status-bar span { height: 100%; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.2); white-space: nowrap; }

/* ---------- Modal, sheet, toast ---------- */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(18,19,22,.5); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 12px 12px; overflow-y: auto; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; box-shadow: 0 24px 64px rgba(0,0,0,.28); animation: pop .15s ease-out; }
.modal.wide { max-width: 860px; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-h { display: flex; align-items: center; padding: 16px 18px 12px; border-bottom: 1px solid var(--line-2); }
.modal-h h3 { margin: 0; font: 700 22px var(--num); flex: 1; }
.modal-b { padding: 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
@media (max-width: 640px) {
  .scrim.sheet { align-items: flex-end; padding: 0; }
  .scrim.sheet .modal { border-radius: 18px 18px 0 0; max-height: 92vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); animation: up .18s ease-out; }
  @keyframes up { from { transform: translateY(40px); opacity: 0; } }
}
.actions-sheet { display: grid; gap: 8px; }
.actions-sheet a, .actions-sheet button { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; color: var(--ink); text-align: left; text-decoration: none; font-size: 16px; }
.actions-sheet small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.actions-sheet .ic { width: 40px; height: 40px; border-radius: 11px; background: var(--red-wash); color: var(--red); display: grid; place-items: center; flex: none; }
.actions-sheet .ic svg { width: 22px; height: 22px; }
.toasts { position: fixed; z-index: 110; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100% - 24px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.25); display: flex; gap: 10px; align-items: center; animation: pop .15s; }
.toast.bad { background: var(--red-deep); }
.toast.ok::before { content: "✓"; font-weight: 700; color: #7EE2A2; }
@media (max-width: 920px) { .toasts { bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); } }
.skel { background: linear-gradient(90deg, #EEF0F2 25%, #F6F7F8 50%, #EEF0F2 75%); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 8px; }
@keyframes sh { to { background-position: -200% 0; } }
.err-box { background: var(--red-wash); color: var(--red-deep); padding: 10px 12px; border-radius: 9px; font-weight: 500; }
.ok-box { background: var(--go-wash); color: #0E5528; padding: 10px 12px; border-radius: 9px; font-weight: 500; }
.warn-box { background: var(--amber-wash); color: #6E4300; padding: 10px 12px; border-radius: 9px; font-weight: 500; }

/* ---------- Auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 480px); }
.auth-art { background: #1C1D20; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font: 700 clamp(40px, 5vw, 68px)/.95 var(--num); margin: 0; max-width: 11ch; }
.auth-art h1 em { font-style: normal; color: #FF5A5A; }
.auth-art p { color: #B6B9BF; max-width: 42ch; font-size: 17px; }
.auth-art .flow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.auth-art .flow span { border: 1px solid #3A3C40; border-radius: 999px; padding: 6px 12px; font-size: 13px; color: #D5D7DB; }
.auth-form { background: #fff; padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth-form img { width: 200px; margin-bottom: 26px; }
.auth-form h2 { font: 700 28px var(--num); margin: 0 0 18px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } .auth-form { padding: 32px 20px; min-height: 100vh; } }

/* ---------- Quick add ---------- */
.quick-add { max-width: 560px; margin: 0 auto; }
.qa-amount { display: flex; align-items: baseline; gap: 6px; padding: 18px 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.qa-amount span { font: 700 34px var(--num); color: var(--muted); }
.qa-amount input { border: 0; outline: none; width: 100%; font: 700 48px/1 var(--num); background: none; min-width: 0; }
.qa-step { margin-top: 18px; }
.qa-step > .lbl { display: block; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.suggest { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--blue); margin-top: 6px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .side, .topbar, .bottom-nav, .no-print, .form-actions { display: none !important; } .shell { display: block; } .content { padding: 0; } .card { border: 0; } }
.grid > * { min-width: 0; }   /* long tables scroll inside their card instead of widening the page */
/* link-style segments (sales tabs, e-invoice entry mode) */
.seg a { padding: 8px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.seg a.on { background: var(--ink); color: #fff; }
.seg.tabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
@media (max-width: 640px) { .kpis[style*="repeat(3"] { grid-template-columns: 1fr !important; } }
.tbl tfoot td { white-space: nowrap; }
