/* Domus Accounting — Domus Rentals palette (Manrope, deep teal #044150, coral accent, soft rounded surfaces).
   Light by default; dark follows the system unless <html data-theme="light">, or forced with data-theme="dark". */

:root {
  color-scheme: light;
  --background: #e9f0f1; --surface: #f3f7f7; --surface-2: #e6eff0; --raised: #ffffff;
  --foreground: #041b2c; --muted: #3a5561; --subtle: #66808a; --line: #d6e3e4; --line-strong: #b3cacd;
  --brand: #044150; --brand-2: #0e6273; --on-brand: #ffffff; --brand-text: #0e6273; --mint: #128497; --coral: #ee6c4d;
  --danger: #b42318; --danger-soft: #fde8e6; --warn: #7a5600; --warn-soft: #fbf0c9;
  --ok: #11673f; --ok-soft: #dcf3e5; --info: #0e6273; --info-soft: #dcedf0;
  --hatch: var(--brand); --hatch-muted: #c2ccc8; --overlay: rgba(17, 22, 20, .38);
  --shadow: 0 1px 2px #1116140a; --shadow-lg: 0 18px 50px #1116142e;
  --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r-xs: 6px; --r-sm: 12px; --r-md: 16px; --r-lg: 22px; --r-xl: 26px; --r-pill: 9999px;
  --transition: 150ms ease;

  /* Aliases kept for page modules written against the previous token names. */
  --bg: var(--background); --panel: var(--surface); --ink: var(--foreground); --ink-2: var(--muted); --ink-3: var(--subtle);
  --line-2: var(--surface-2); --accent: var(--brand); --accent-2: var(--brand-2); --accent-soft: var(--ok-soft);
  --blue: var(--info); --blue-soft: var(--info-soft); --amber: var(--warn); --amber-soft: var(--warn-soft);
  --red: var(--danger); --red-soft: var(--danger-soft); --green: var(--ok); --green-soft: var(--ok-soft); --gray-soft: var(--surface-2);
  --radius: var(--r-lg); --font: var(--font-sans);
  --side: var(--background); --side-2: var(--surface); --side-ink: var(--foreground);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #04141f; --surface: #0a2130; --surface-2: #0f2a3a; --raised: #133245;
  --foreground: #f2f3f4; --muted: #a3a6ab; --subtle: #8a8d93; --line: #1d3a4a; --line-strong: #2d5062;
  --brand: #2a7385; --brand-2: #348a9d; --brand-text: #9dd0d7; --mint: #3fb3c6; --coral: #f08a70;
  --danger: #ff8b7b; --danger-soft: #3b1b17; --warn: #f2c35f; --warn-soft: #382c10;
  --ok: #6fd6a0; --ok-soft: #12301f; --info: #9dd0d7; --info-soft: #12313a;
  --hatch-muted: #55585e; --overlay: rgba(0, 0, 0, .55);
  --shadow: 0 1px 0 #ffffff0a inset, 0 8px 24px #00000040; --shadow-lg: 0 18px 50px #00000080;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #04141f; --surface: #0a2130; --surface-2: #0f2a3a; --raised: #133245;
    --foreground: #f2f3f4; --muted: #a3a6ab; --subtle: #8a8d93; --line: #1d3a4a; --line-strong: #2d5062;
    --brand: #2a7385; --brand-2: #348a9d; --brand-text: #9dd0d7; --mint: #3fb3c6; --coral: #f08a70;
    --danger: #ff8b7b; --danger-soft: #3b1b17; --warn: #f2c35f; --warn-soft: #382c10;
    --ok: #6fd6a0; --ok-soft: #12301f; --info: #9dd0d7; --info-soft: #12313a;
    --hatch-muted: #55585e; --overlay: rgba(0, 0, 0, .55);
    --shadow: 0 1px 0 #ffffff0a inset, 0 8px 24px #00000040; --shadow-lg: 0 18px 50px #00000080;
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font-sans); color: var(--foreground); background: var(--background); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1 { font-size: 30px; font-weight: 400; line-height: 1.25; letter-spacing: -.025em; margin: 0; }
h2 { font-size: 17px; font-weight: 500; letter-spacing: -.02em; margin: 0 0 12px; }
h3 { font-size: 11px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--subtle); }
.small { font-size: 12px; }
.neg { color: var(--danger); }
.pos { color: var(--ok); }

/* Layout */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 16px 12px 12px; z-index: 40; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--foreground); font-size: 15px; letter-spacing: -.01em; text-decoration: none; min-width: 0; }
.brand:hover { text-decoration: none; }
.brand .wm { white-space: nowrap; font-weight: 400; }
.brand .wm b { font-weight: 700; color: var(--brand-text); }
.brand .logo, .login-brand .logo { width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; }
.brand .logo svg, .login-brand .logo svg { width: 16px; height: 16px; }
.icon-btn.side-close { display: none; }
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; scrollbar-width: thin; margin: 0 -4px; padding: 0 4px; }
.nav a { position: relative; color: var(--muted); padding: 0 10px; min-height: 36px; border-radius: 10px; display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 13.5px; font-weight: 500; line-height: 1.25; transition: background var(--transition), color var(--transition); }
.nav a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--foreground); }
.nav a.on { background: color-mix(in srgb, var(--brand) 10%, var(--raised)); color: var(--brand-text); font-weight: 600; }
.nav a.on::before { content: ""; position: absolute; left: -4px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--brand-text); }
.nav a.on svg { color: var(--brand-text); }
.nav .sep { display: flex; align-items: center; justify-content: space-between; margin: 18px 10px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--subtle); }
.nav .sep:first-child { margin-top: 4px; }
.nav .sep-co { font-size: 10.5px; letter-spacing: .04em; color: var(--brand-text); background: color-mix(in srgb, var(--brand) 10%, transparent); border-radius: var(--r-pill); padding: 1px 8px; }
.nav .count { margin-left: auto; background: var(--coral); color: #fff; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; }
.nav svg { width: 16px; height: 16px; flex: none; opacity: .9; }
.nav a.subtle { font-size: 12.5px; color: var(--subtle); font-weight: 500; min-height: 32px; }
.side-foot { border-top: 1px solid var(--line); margin: 8px -12px 0; padding: 8px 12px 0; display: grid; gap: 4px; }
.menu-cfg { background: none; border: 0; color: var(--subtle); display: flex; gap: 10px; align-items: center; min-height: 32px; padding: 0 10px; font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; border-radius: 10px; }
.menu-cfg:hover { background: var(--surface-2); color: var(--foreground); }
.menu-cfg svg { width: 15px; height: 15px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 4px 2px 6px; min-width: 0; }
.avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; background: color-mix(in srgb, var(--coral) 18%, var(--raised)); color: var(--foreground); font-size: 12px; font-weight: 700; display: grid; place-items: center; letter-spacing: .02em; }
.me-name { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.me-name b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name small { font-size: 11.5px; color: var(--subtle); }
.icon-btn.ghost { background: transparent; box-shadow: none; color: var(--muted); }
.icon-btn.ghost:hover { background: var(--surface-2); color: var(--foreground); }
.icon-btn.menu-btn { display: none; }
.scrim { display: none; }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; margin-bottom: 22px; }
.login-brand b { color: var(--brand-text); }
.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.main { padding: 8px 28px 60px; max-width: 1400px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 18px; flex-wrap: wrap; }
.head .sub { color: var(--muted); margin-top: 4px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--background) 88%, transparent); backdrop-filter: blur(10px); }
.co-switch { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.co-switch select { max-width: 300px; appearance: none; background: var(--raised); color: var(--foreground); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 7px 16px 7px 30px; font: inherit; font-weight: 600; cursor: pointer; text-overflow: ellipsis; box-shadow: var(--shadow); }
.co-switch .dot { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.role-tag { font-size: 11px; color: var(--muted); white-space: nowrap; background: var(--surface-2); border-radius: var(--r-pill); padding: 2px 9px; }
.topbar .btn svg, .icon-btn svg { width: 16px; height: 16px; }
.search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 0 14px; background: var(--raised); box-shadow: var(--shadow); height: 38px; }
.search svg { width: 15px; height: 15px; color: var(--muted); display: block; }
.search input { border: 0; background: none; padding: 0 2px; font: inherit; width: 100%; outline: none; box-shadow: none; height: 36px; border-radius: 0; }
.top-icons { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; background: var(--raised); border: 0; border-radius: var(--r-pill); cursor: pointer; color: var(--foreground); box-shadow: var(--shadow); transition: background var(--transition); }
.icon-btn:hover { background: var(--surface-2); }
.dotn { position: absolute; top: -3px; right: -3px; background: var(--danger); color: #fff; border-radius: var(--r-pill); font-size: 10px; font-weight: 700; padding: 0 5px; line-height: 16px; }
.dropdown { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 16px; max-height: 80vh; overflow: auto; max-width: calc(100vw - 16px); }
.dropdown .menu-cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(180px, 1fr); gap: 18px; }
.dropdown.wide .menu-cols { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); width: min(980px, calc(100vw - 32px)); }
.dropdown .menu-h { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 6px; padding: 0 10px; }
.dropdown a { display: block; padding: 5px 10px; border-radius: var(--r-pill); color: var(--foreground); text-decoration: none; font-size: 13.5px; }
.dropdown a:hover { background: var(--surface-2); }
.notif { width: 340px; }
.notif a { border-radius: var(--r-md); padding: 8px 10px; margin-bottom: 2px; }
.notif a.unread { font-weight: 600; background: var(--surface-2); }
.notif small { display: block; color: var(--muted); font-weight: 400; }
.menu-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* Cards & KPIs */
.card { position: relative; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 14px; }
.card.flush { padding: 0; overflow: hidden; border-radius: var(--r-lg); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { padding: 16px 20px; }
.kpi .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.kpi .value { font-size: 26px; font-weight: 300; margin-top: 2px; line-height: 1.3; letter-spacing: -.02em; }
.kpi .hint { font-size: 12px; color: var(--subtle); margin-top: 2px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border: 1px solid var(--line); background: var(--raised); color: var(--foreground); border-radius: var(--r-pill); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background var(--transition), border-color var(--transition), filter var(--transition); }
.btn:hover { border-color: var(--line-strong); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.dark { background: var(--foreground); border-color: var(--foreground); color: var(--background); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font: inherit; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.link:hover { color: var(--foreground); }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 12px 14px 9px; border-bottom: 1px solid var(--line-strong); }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
tr.total td { font-weight: 600; border-top: 1px solid var(--line-strong); background: var(--surface-2); }
tr.group td { font-weight: 600; background: var(--surface-2); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tr.grand td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--foreground); }
td.code { color: var(--subtle); width: 70px; }
.empty { padding: 40px; text-align: center; color: var(--subtle); }

/* Badges & chips */
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; line-height: 1rem; padding: 2px 10px; border-radius: var(--r-pill); white-space: nowrap; color: var(--muted); background: var(--surface-2); }
.b-blue { background: var(--info-soft); color: var(--info); }
.b-green { background: var(--ok-soft); color: var(--ok); }
.b-amber { background: var(--warn-soft); color: var(--warn); }
.b-red { background: var(--danger-soft); color: var(--danger); }
.b-gray { background: var(--surface-2); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 1px 8px 1px 6px; border-radius: var(--r-pill); background: var(--raised); border: 1px solid var(--line); color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.pill { display: inline-block; padding: 2px 6px; font-size: 11px; font-weight: 600; color: var(--on-brand); background: var(--brand); border-radius: var(--r-xs); }
.progress { height: 6px; background: var(--line); border-radius: var(--r-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.hatch { background: repeating-linear-gradient(-45deg, var(--hatch-muted) 0 1px, transparent 1px 6px); border: 1px solid var(--hatch-muted); }

/* Forms */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 500; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 13.5px; color: var(--foreground); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; background: var(--raised); width: 100%; transition: border-color var(--transition); }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mint) 25%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=color] { height: 38px; padding: 4px 6px; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.span2 { grid-column: span 2; }
.span4 { grid-column: 1 / -1; }
.lines td { padding: 6px; }
.lines input, .lines select { padding: 7px 9px; border-radius: 10px; }
.totals { margin-left: auto; width: 300px; max-width: 100%; margin-top: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { border-top: 2px solid var(--foreground); font-size: 18px; font-weight: 600; padding-top: 8px; }
.callout { border-radius: var(--r-md); padding: 12px 16px; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.callout.info { background: var(--info-soft); color: var(--info); }
.callout.warn { background: var(--warn-soft); color: var(--warn); }
.callout.ok { background: var(--ok-soft); color: var(--ok); }
.callout.err { background: var(--danger-soft); color: var(--danger); }
.callout a { color: inherit; text-decoration: underline; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; padding: 4px; background: var(--surface); border-radius: var(--r-pill); width: fit-content; max-width: 100%; box-shadow: var(--shadow); }
.tabs button, .tabs a { background: none; border: 0; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; border-radius: var(--r-pill); text-decoration: none; white-space: nowrap; }
.tabs button:hover, .tabs a:hover { color: var(--foreground); text-decoration: none; }
.tabs button.on, .tabs a.on { background: var(--foreground); color: var(--background); }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin-bottom: 14px; }
.filters label.f { min-width: 140px; }
.checks, .chips { display: flex; gap: 8px; flex-wrap: wrap; }
.checks label, .chipsel { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); background: var(--raised); padding: 5px 12px; border-radius: var(--r-pill); cursor: pointer; font-weight: 500; font-size: 13px; }

/* Modal / toasts */
.overlay { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: var(--r-xl); width: 100%; max-width: 540px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg); }
.modal.wide { max-width: 880px; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 10px; }
.modal header h2 { margin: 0; font-size: 19px; }
.modal .body { padding: 8px 22px 18px; display: grid; gap: 14px; }
.modal footer { padding: 12px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.x { background: var(--raised); border: 0; width: 32px; height: 32px; border-radius: var(--r-pill); font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; display: inline-grid; place-items: center; }
#toasts { position: fixed; bottom: 18px; right: 18px; display: grid; gap: 8px; z-index: 70; }
.toast { background: var(--foreground); color: var(--background); padding: 11px 18px; border-radius: var(--r-pill); box-shadow: var(--shadow-lg); max-width: 400px; animation: up .2s ease; font-size: 13.5px; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; background: var(--background); padding: 16px; }
.login .card { width: 100%; max-width: 420px; padding: 32px; }
.login h1 { margin-bottom: 6px; font-size: 26px; }
.login form { display: grid; gap: 14px; margin-top: 22px; }
.login .btn.primary { height: 42px; }
.demo { margin-top: 20px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.demo button { margin: 4px 4px 0 0; }

/* Charts, money bar, misc */
.bars { display: flex; align-items: flex-end; gap: 18px; height: 170px; padding: 8px 4px 0; }
.bars .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bars .pair { flex: 1; display: flex; align-items: flex-end; gap: 4px; width: 100%; justify-content: center; }
.bars .bar { width: 38%; max-width: 26px; border-radius: var(--r-pill) var(--r-pill) 4px 4px; min-height: 2px; }
.bars .inc { background: var(--brand); }
.bars .exp { background: repeating-linear-gradient(-45deg, var(--hatch-muted) 0 1px, transparent 1px 6px); border: 1px solid var(--hatch-muted); }
.legend { display: flex; gap: 6px 14px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.legend i, .legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart { width: 100%; height: auto; display: block; }
.matrix td, .matrix th { text-align: center; }
.matrix td.self { background: repeating-linear-gradient(-45deg, var(--hatch-muted) 0 1px, transparent 1px 6px); }
.flow { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.flow .arrow { color: var(--subtle); font-weight: 400; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13.5px; }
.kv dt { color: var(--subtle); }
.kv dd { margin: 0; }
details summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.loading { padding: 60px; text-align: center; color: var(--subtle); }
.moneybar { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.mb-cell { flex: 1; min-width: 160px; padding: 12px 18px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.mb-cell::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--line-strong); }
.mb-v { font-size: 22px; font-weight: 300; letter-spacing: -.02em; }
.mb-l { font-size: 12px; color: var(--muted); }
.mb-blue::after { background: var(--info); } .mb-red::after { background: var(--danger); } .mb-green::after { background: var(--mint); } .mb-gray::after { background: var(--line-strong); }

/* Approvals & petty cash */
.appr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.appr-amt { font-size: 18px; font-weight: 300; display: flex; gap: 8px; align-items: center; margin-left: auto; }
.appr-row + .appr-row { margin-top: 12px; }
.appr-trail { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.appr-level { background: var(--surface-2); border-radius: var(--r-md); padding: 8px 12px; min-width: 200px; flex: 1; }
.appr-n { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.appr-step { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.appr-step .small { flex-basis: 100%; color: var(--muted); }
.appr-box.pending { box-shadow: inset 0 0 0 2px var(--warn-soft), var(--shadow); }
.petty-card { display: block; color: var(--foreground); text-decoration: none !important; transition: transform var(--transition); }
.petty-card:hover { transform: translateY(-1px); }
.petty-card.inactive { opacity: .6; }
.petty-top { display: flex; justify-content: space-between; gap: 8px; }
.progress.low > span { background: var(--danger); }
.petty-meta { display: flex; justify-content: space-between; gap: 8px; margin: 10px 0 4px; color: var(--muted); }

@media (max-width: 1024px) {
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); height: 100dvh; transform: translateX(-102%); transition: transform 220ms ease; box-shadow: var(--shadow-lg); }
  .nav-open .side { transform: none; }
  .icon-btn.side-close { display: inline-grid; }
  .icon-btn.menu-btn { display: inline-grid; flex: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity 220ms ease; }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .nav-open { overflow: hidden; }
}
@media (max-width: 960px) {
  .main { padding: 8px 16px 48px; }
  .g2, .form-grid { grid-template-columns: 1fr; }
  .g2 .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
  .card.flush, .scroll { overflow-x: auto; }
  .topbar { flex-wrap: wrap; gap: 8px 10px; padding: 10px 16px; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .co-switch { flex: 1; }
  .co-switch select { max-width: 100%; width: 100%; }
  h1 { font-size: 26px; }
  .tabs { border-radius: var(--r-lg); }
}
@media (max-width: 600px) {
  .role-tag, #tools-btn { display: none; }
  .topbar .btn.primary.sm { width: 36px; height: 36px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .topbar .btn.primary.sm svg { margin: 0; }
  .top-icons { gap: 4px; }
  .main { padding: 4px 16px 40px; }
  h1 { font-size: 24px; }
  .login .card { padding: 24px; }
  .topbar { position: static; }
  .g2 .g2 { grid-template-columns: 1fr; }
  .tabs { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; border-radius: var(--r-pill); }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs > * { flex: none; white-space: nowrap; }
}
@media (max-width: 600px) { .g4, .g3 { grid-template-columns: 1fr; } }
@media print {
  .topbar, .side, .actions, .filters, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
