/* ==========================================================
   Expense Management: corporate light theme
   ========================================================== */
:root {
  /* Indian Oil style palette: deep blue + orange */
  --navy-900: #141f5c;
  --navy-800: #1c2d7a;
  --navy-700: #273d9c;
  --navy-100: #e9ecf8;
  --orange: #f37021;
  --orange-600: #e2630f;
  --orange-700: #c9540a;
  --orange-100: #fff1e7;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --head: #eef2f7;
  --text: #17202e;
  --text-2: #3b4658;
  --muted: #6a7486;
  --border: #dde2ea;
  --border-strong: #c7cfdb;
  --primary: #e2630f;
  --primary-hover: #c9540a;
  --focus: #273d9c;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --success: #17703d;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --c1: #12305a; --c2: #0f766e; --c3: #b45309; --c4: #6d28d9;
  --c5: #be123c; --c6: #0369a1; --c7: #4d7c0f; --c8: #a21caf;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- Form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: #b4bdcb; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.link { border-color: transparent; background: none; color: var(--navy-700); padding: 0 8px; min-height: 28px; font-size: 13px; }
.btn.link:hover { text-decoration: underline; background: none; }
.btn.link.danger { color: var(--danger); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; }
.btn svg { width: 16px; height: 16px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
label .req { color: var(--danger); }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: #fff; color: var(--text);
  font: inherit; font-size: 14.5px; font-weight: 400;
}
input:hover, select:hover { border-color: #aab4c3; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .nav-item:focus-visible, .seg button:focus-visible {
  outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(39, 61, 156, .2);
}
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.input-prefix input { padding-left: 28px; font-weight: 600; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--navy-900), var(--navy-700)); }
.login-panel { width: 100%; max-width: 400px; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.login-brand { display: flex; align-items: center; gap: 12px; padding: 22px 26px; background: var(--navy-800); color: #fff; border-bottom: 4px solid var(--orange); }
.login-company { font-weight: 700; font-size: 16px; }
.login-sub { font-size: 12.5px; opacity: .75; }
.login-form { padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.login-form h1 { font-size: 20px; }
.login-form .muted { margin-top: -10px; font-size: 13.5px; }
.alert { background: var(--danger-bg); color: var(--danger); border: 1px solid #f5c2bd; padding: 9px 12px; border-radius: var(--radius); font-weight: 600; font-size: 13.5px; }
.logo { width: 38px; height: 38px; border-radius: 7px; background: var(--orange); display: grid; place-items: center; flex: 0 0 auto; color: #fff; }
.logo svg { width: 22px; height: 22px; }

/* ---------- Sign-in / sign-up ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-brand {
  position: relative; overflow: hidden; color: #fff; padding: 40px 48px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background:
    radial-gradient(circle at 110% 10%, rgba(243,112,33,.28) 0, rgba(243,112,33,0) 42%),
    radial-gradient(circle at -10% 110%, rgba(255,255,255,.08) 0, rgba(255,255,255,0) 45%),
    linear-gradient(160deg, var(--navy-900), var(--navy-700));
  border-top: 5px solid var(--orange);
}
.auth-brand::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--orange); }
.auth-brand-top { display: flex; align-items: center; gap: 14px; }
.auth-company { font-size: 19px; font-weight: 700; line-height: 1.25; }
.auth-tag { font-size: 13px; opacity: .75; }
.auth-pitch h2 { font-size: 32px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; max-width: 440px; }
.auth-pitch ul { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-pitch li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: #dfe4f6; }
.auth-pitch li::before { content: ""; width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; background: var(--orange) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3'%3E%3Cpath d='M6 12l4 4 8-8'/%3E%3C/svg%3E") center / 13px no-repeat; }
.auth-foot { font-size: 12.5px; opacity: .6; }
.logo.has-img { background: #fff; padding: 3px; overflow: hidden; }
.logo.has-img img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 5px; }
.logo.lg { width: 48px; height: 48px; border-radius: 10px; }
.logo.lg svg { width: 28px; height: 28px; }

.auth-main { display: grid; place-items: center; padding: 40px 24px; background: var(--bg); }
.auth-card {
  width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--orange);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(20, 31, 92, .08); padding: 30px 30px 26px;
  display: flex; flex-direction: column; gap: 16px;
}
.auth[data-page="login"] #signupForm, .auth[data-page="signup"] #loginForm { display: none; }
.auth-card h1 { font-size: 22px; color: var(--navy-800); }
.auth-card > .muted { margin-top: -10px; font-size: 13.5px; }
.notice { background: #ecfdf3; color: #146c3a; border: 1px solid #abefc6; padding: 9px 12px; border-radius: var(--radius); font-weight: 600; font-size: 13.5px; }
.role-pick { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }
.role-pick legend { padding: 0; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.role-opt { display: block; position: relative; }
.role-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.role-card {
  display: flex; flex-direction: column; gap: 1px; padding: 12px 14px; height: 100%;
  border: 1.5px solid var(--border-strong); border-radius: 8px; cursor: pointer; background: #fff; transition: .15s;
}
.role-card svg { width: 22px; height: 22px; color: var(--navy-700); margin-bottom: 6px; }
.role-card strong { font-size: 14.5px; color: var(--text); }
.role-card small { font-size: 12px; font-weight: 400; color: var(--muted); }
.role-card:hover { border-color: #aab4c3; }
.role-opt input:checked + .role-card { border-color: var(--orange); background: var(--orange-100); box-shadow: inset 0 0 0 1px var(--orange); }
.role-opt input:checked + .role-card svg { color: var(--orange-600); }
.role-opt input:focus-visible + .role-card { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn.lg { min-height: 46px; font-size: 15px; }
.auth-switch { text-align: center; font-size: 14px; color: var(--text-2); }
.auth-switch a, .auth-hint a { color: var(--navy-700); font-weight: 600; }
.auth-hint { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: -8px; }
.field-hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 18px 20px 22px; gap: 0; }
  .auth-pitch, .auth-foot { display: none; }
  .auth-main { place-items: start center; padding: 20px 16px 40px; }
  .auth-card { padding: 22px 18px; }
}
@media (max-width: 420px) { .row-2 { grid-template-columns: 1fr; } }

/* Developer credit */
.auth-main { grid-template-rows: 1fr auto; }
.credit { margin: 18px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.credit a, .app-foot a { color: var(--navy-700); font-weight: 600; text-decoration: none; }
.credit a:hover, .app-foot a:hover { text-decoration: underline; }
.app-foot {
  margin-top: auto; padding: 14px 28px; border-top: 1px solid var(--border); background: var(--surface);
  display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted);
}
@media (max-width: 900px) { .app-foot { padding: 12px 16px; } }
@media print { .app-foot { display: none !important; } }

/* Item list & Quantity */
.optional { font-weight: 400; color: var(--muted); font-size: 12px; }
.cat-block { border-bottom: 1px solid var(--border); }
.cat-block .settings-row { border-bottom: 0; padding-bottom: 6px; }
.cat-opts { padding: 0 18px 14px 58px; display: flex; flex-direction: column; gap: 12px; }
.check { flex-direction: row; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; width: fit-content; }
.check input { width: 18px; height: 18px; min-height: 0; margin: 0; accent-color: var(--orange-600); }
.check small { font-weight: 400; color: var(--muted); }
.cat-items { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 14px; align-items: start; }
.cat-items textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
@media (max-width: 700px) { .cat-opts { padding-left: 18px; } .cat-items { grid-template-columns: 1fr; } }
table.rpt.detail.wide { min-width: 720px; }
.item-sum-title { margin: 10px 0 5px; font-size: 12px; font-weight: 700; color: var(--text-2); }
table.rpt.item-sum { max-width: 560px; }

/* Status badges (manager accounts) */
.badge.ok { background: #e7f6ed; color: #146c3a; }
.badge.warn { background: #fff4e0; color: #9a5800; }
.badge.off { background: #eef0f3; color: #5b6576; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--orange); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.reset-row { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.reset-row input { width: 170px; min-height: 32px; padding: 4px 8px; font-size: 13px; }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: 0 0 248px; background: var(--navy-900); color: #cfd6ee; border-top: 4px solid var(--orange);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.side-company { color: #fff; font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.side-sub { font-size: 11.5px; opacity: .7; }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #f9a46e; padding: 14px 10px 6px; }
.nav-group:first-child { padding-top: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 5px;
  background: none; color: #cfd6ee; font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item[aria-current="page"] { background: rgba(243,112,33,.16); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--orange); }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .85; }
.nav-swatch { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.side-user { border-top: 1px solid rgba(255,255,255,.08); padding: 14px 18px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--orange); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.side-user .who { flex: 1; min-width: 0; }
.side-user .who strong { display: block; color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user a { color: #f9a46e; font-size: 12.5px; text-decoration: none; font-weight: 600; }
.side-user a:hover { color: #fff; text-decoration: underline; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pagebar {
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: inset 0 -2px 0 var(--orange-100);
  padding: 18px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.pagebar h1 { font-size: 19px; font-weight: 700; color: var(--navy-800); }
.pagebar p { font-size: 13px; margin-top: 2px; }
.pagebar-date { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.content { padding: 24px 28px 56px; max-width: 1280px; width: 100%; }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h2 { font-size: 14.5px; font-weight: 700; color: var(--navy-800); }
.panel-head .muted { font-size: 12.5px; }
.panel-body { padding: 18px; }
.panel-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 8px 8px; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px 18px; box-shadow: var(--shadow); border-top: 3px solid var(--orange); }
.kpi-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 22px; font-weight: 700; color: var(--navy-800); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }

.layout-entry { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-actions { display: flex; gap: 8px; padding-top: 4px; }
.form-actions .btn.primary { flex: 1; }
.editing-note { background: #fff7e6; border: 1px solid #f3d9a4; color: #7a4a00; padding: 8px 11px; border-radius: var(--radius); font-size: 13px; font-weight: 600; }

/* ---------- Data tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  background: var(--navy-800); color: #fff; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  text-align: left; padding: 10px 14px; border-bottom: 2px solid var(--orange); white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tbody tr:nth-child(even) td { background: #fafbfd; }
table.data tbody tr:hover td { background: var(--orange-100); }
table.data th.num, table.data td.num { text-align: right; }
table.data tfoot td { font-weight: 700; color: var(--navy-800); background: var(--navy-100); border-top: 2px solid var(--navy-800); border-bottom: 0; }
table.data .actions { text-align: right; white-space: nowrap; width: 1%; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: var(--navy-100); color: var(--navy-800); white-space: nowrap; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.select-sm { min-height: 34px; padding: 4px 8px; width: auto; font-size: 13.5px; }

/* ---------- Reports ---------- */
.report-controls { display: grid; grid-template-columns: auto minmax(160px, 220px) minmax(180px, 260px) auto; gap: 16px; align-items: end; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; height: 40px; }
.seg button { flex: 1; border: 0; background: #fff; padding: 0 18px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button[aria-pressed="true"] { background: var(--navy-800); color: #fff; }
.report-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; flex-wrap: wrap; }
.report-toolbar .btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* The report document (looks like a printed A4 page) */
.doc {
  background: #fff; border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(16,24,40,.08);
  max-width: 900px; margin: 0 auto; padding: 40px 44px; color: #111827;
}
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 16px; border-bottom: 3px solid var(--navy-800); box-shadow: 0 3px 0 var(--orange); }
.doc-brand { display: flex; align-items: center; gap: 14px; }
.doc-logo { width: 52px; height: 52px; object-fit: contain; flex: 0 0 auto; }
.doc-company { font-size: 21px; font-weight: 700; color: var(--navy-800); }
.doc-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.doc-title { text-align: right; }
.doc-title h2 { font-size: 17px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--orange-600); }
.doc-title div { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.doc-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border-strong); margin: 18px 0 22px; }
.doc-meta div { padding: 8px 12px; border-right: 1px solid var(--border-strong); font-size: 12.5px; }
.doc-meta div:last-child { border-right: 0; }
.doc-meta span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.doc-meta strong { font-weight: 600; }
.doc h3 { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--navy-800); margin: 24px 0 8px; padding-left: 8px; border-left: 3px solid var(--orange); }
.doc h3:first-of-type { margin-top: 0; }
table.rpt { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.rpt th { background: var(--navy-800); color: #fff; font-weight: 600; text-align: left; padding: 7px 10px; border: 1px solid var(--navy-800); white-space: nowrap; }
table.rpt td { padding: 6px 10px; border: 1px solid #d4dae3; vertical-align: top; }
table.rpt tbody tr:nth-child(even) td { background: #f5f7fa; }
table.rpt th.num, table.rpt td.num { text-align: right; }
table.rpt td.zero { color: #a0a8b5; }
table.rpt.detail { table-layout: fixed; min-width: 560px; }
table.rpt.detail td { overflow-wrap: anywhere; }
table.rpt tr.subtotal td { font-weight: 700; background: #e9eef5 !important; }
table.rpt tr.grand td { font-weight: 700; background: var(--navy-100) !important; border-top: 2px solid var(--navy-800); }
.cat-title { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.grand-box { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 22px; padding: 12px 16px; border: 2px solid var(--navy-800); border-left: 6px solid var(--orange); background: var(--navy-100); }
.grand-box .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--navy-800); }
.grand-box .amt { font-size: 20px; font-weight: 700; color: var(--navy-800); }
.grand-box .words { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; margin-top: 56px; }
.signs div { border-top: 1px solid #6b7280; padding-top: 6px; font-size: 12px; color: var(--text-2); text-align: center; }
.doc-foot { margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; }

/* ---------- Settings ---------- */
.settings-list { display: flex; flex-direction: column; }
.settings-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.settings-row .idx { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; right: 24px; bottom: 24px; max-width: min(380px, calc(100% - 32px)); z-index: 50;
  background: var(--navy-900); color: #fff; padding: 11px 16px; border-radius: var(--radius); font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); border-left: 4px solid var(--orange);
  opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { border-left-color: #ef4444; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout-entry { grid-template-columns: 1fr; }
  .report-controls { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; height: auto; position: sticky; top: 0; z-index: 20; }
  .side-brand { padding: 10px 16px; border-bottom: 0; }
  .side-nav { display: flex; gap: 4px; overflow-x: auto; padding: 0 10px 10px; scrollbar-width: none; }
  .side-nav::-webkit-scrollbar { display: none; }
  .nav-group { display: none; }
  .nav-item { width: auto; flex: 0 0 auto; white-space: nowrap; padding: 8px 12px; }
  .nav-item[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--orange); }
  .side-user { position: absolute; top: 10px; right: 16px; border: 0; padding: 0; }
  .side-user .who, .side-user .avatar { display: none; }
  .pagebar { padding: 14px 16px; }
  .pagebar-date { display: none; }
  .content { padding: 16px 16px 48px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .doc { padding: 22px 16px; }
  .doc-head { flex-direction: column; }
  .doc-title { text-align: left; }
  .doc-meta { grid-template-columns: 1fr 1fr; }
  .doc-meta div:nth-child(2) { border-right: 0; }
  .doc-meta div:nth-child(-n+2) { border-bottom: 1px solid var(--border-strong); }
  .signs { gap: 16px; }
}
@media (max-width: 520px) {
  .report-controls { grid-template-columns: 1fr; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  table.data .hide-sm { display: none; }
}

/* ---------- Print: only the report document ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .sidebar, .pagebar, .report-controls-panel, .report-toolbar, .toast { display: none !important; }
  .content { padding: 0; max-width: none; }
  .doc { border: 0; box-shadow: none; padding: 0; max-width: none; }
  table.rpt th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  table.rpt tr, .grand-box, .signs { break-inside: avoid; }
  table.rpt td, table.rpt tr td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
