/* ==========================================================================
   Sheikh Hassan land project — V4 visual system (docs/DESIGN.md)
   Screen styles first; print/PDF rules are at the end of this file.
   ========================================================================== */

/* Tajawal, bundled locally for offline use (SIL OFL 1.1 — see /fonts/OFL.txt) */
@font-face { font-family: 'Tajawal'; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/tajawal-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-display: swap; font-weight: 400; src: url(/fonts/tajawal-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/tajawal-arabic-500-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-display: swap; font-weight: 500; src: url(/fonts/tajawal-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-display: swap; font-weight: 700; src: url(/fonts/tajawal-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-display: swap; font-weight: 700; src: url(/fonts/tajawal-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-display: swap; font-weight: 800; src: url(/fonts/tajawal-arabic-800-normal.woff2) format('woff2'); unicode-range: U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0897-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC; }
@font-face { font-family: 'Tajawal'; font-style: normal; font-display: swap; font-weight: 800; src: url(/fonts/tajawal-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  /* design tokens */
  --forest: #173E30;
  --forest-deep: #102E23;
  --forest-hover: #20503E;
  --sage: #A5B883;
  --sage-soft: #EEF3E6;
  --bg: #F7F7F2;
  --surface: #FFFFFF;
  --border: #DFE5DB;
  --border-strong: #CDD6C8;
  --text: #172B22;
  --muted: #65756A;
  --gold: #C9A85C;
  --gold-soft: #F4EBD3;
  --error: #B44343;
  --warning: #8A5A12;
  --success: #21623B;
  --radius-lg: 20px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(16,46,35,.04), 0 6px 18px rgba(16,46,35,.05);
  --shadow: 0 12px 32px rgba(16,46,35,.10);
  --ease: cubic-bezier(.2,.7,.2,1);
  --font: 'Tajawal', 'Segoe UI', Tahoma, 'Noto Sans Arabic', Arial, sans-serif;
  /* legacy aliases still referenced by older rules */
  --ink: var(--text); --line: var(--border); --paper: var(--surface); --cream: var(--bg); --danger: var(--error);
  --sand: var(--gold-soft); --blue: #345F77; --forest-2: var(--forest-hover);
  font-family: var(--font);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow: hidden; font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }
.icon { display: block; flex-shrink: 0; }
bdi, .amt { unicode-bidi: isolate; }
.amt .num, .money, .kpi-value, .summary-box strong, .import-summary strong, td.money { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.sidebar :focus-visible, .bottom-nav :focus-visible, .topbar :focus-visible, .kpi-hero :focus-visible { outline-color: var(--gold); }
.sr-only, .page-head-text h3 { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.sr-only table { min-width: 0; }

/* ---------- boot ---------- */
.boot-card { width: min(360px, calc(100% - 32px)); margin: 15vh auto; padding: 36px 28px; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.boot-card img { width: 96px; height: 96px; }
.boot-card h1 { margin: 16px 0 6px; color: var(--forest); font-size: 22px; }
.boot-card p { color: var(--muted); }
.loader { display: inline-block; width: 28px; height: 28px; margin-top: 12px; border: 3px solid var(--sage-soft); border-top-color: var(--forest); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100vh; height: 100dvh; transition: grid-template-columns .2s var(--ease); }
.sidebar {
  background: linear-gradient(180deg, var(--forest) 0%, var(--forest-deep) 100%); color: #fff;
  padding: 20px 14px 14px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; overflow-x: hidden; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px 18px; border-bottom: 1px solid rgba(255,255,255,.10); }
.brand img { width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0; box-shadow: 0 6px 16px rgba(0,0,0,.22); }
.brand-text { min-width: 0; }
.brand h1 { font-size: 16px; font-weight: 800; line-height: 1.4; margin: 0 0 2px; color: #fff; overflow-wrap: anywhere; }
.brand p { margin: 0; font-size: 12px; color: #BFD0C2; line-height: 1.6; }
.brand .brand-area { color: #E3CC8E; font-weight: 500; }
.nav { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.nav-group { display: flex; flex-direction: column; gap: 3px; }
.nav-group-label { font-size: 11.5px; font-weight: 700; color: #A9BDAF; padding: 0 12px 4px; }
.nav button {
  width: 100%; min-height: 44px; border: 0; background: transparent; color: #DCE6DD; padding: 9px 12px; border-radius: 12px;
  display: flex; align-items: center; gap: 12px; text-align: right; font-size: 14.5px; font-weight: 500;
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav button.active { background: linear-gradient(270deg, #E9D7A7 0%, #F7EFD9 100%); color: var(--forest-deep); font-weight: 700; box-shadow: 0 6px 16px rgba(0,0,0,.20); }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; flex-shrink: 0; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-footer { margin-top: auto; padding: 14px 4px 0; display: grid; gap: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.side-note { font-size: 11.5px; color: #A9BDAF; padding: 0 8px; }
.collapse-btn { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border: 0; border-radius: 12px; background: rgba(255,255,255,.06); color: #DCE6DD; font-size: 13px; }
.collapse-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.collapse-btn .icon { transform: scaleX(-1); transition: transform .2s var(--ease); }

/* collapsed rail (desktop toggle) */
.shell.collapsed { grid-template-columns: 84px minmax(0, 1fr); }
.shell.collapsed .sidebar { padding-inline: 12px; }
.shell.collapsed .brand { justify-content: center; padding-inline: 0; }
.shell.collapsed .brand-text, .shell.collapsed .nav-label, .shell.collapsed .nav-group-label, .shell.collapsed .side-note { display: none; }
.shell.collapsed .nav button, .shell.collapsed .collapse-btn { justify-content: center; padding-inline: 0; }
.shell.collapsed .nav-group + .nav-group { border-top: 1px solid rgba(255,255,255,.10); padding-top: 12px; }
.shell.collapsed .collapse-btn .icon { transform: none; }

.main { overflow-y: auto; min-width: 0; position: relative; scroll-padding-top: 90px; }
.topbar {
  position: sticky; top: 0; z-index: 4; min-height: 76px; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: rgba(247,247,242,.9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-brand { display: none; }
.topbar-title { min-width: 0; }
.topbar h2 { margin: 0; color: var(--forest); font-size: 22px; font-weight: 800; line-height: 1.35; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.date-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.date-chip .icon { color: var(--forest); }
.content { padding: 24px 28px 40px; max-width: 1600px; margin: 0 auto; }
.bottom-nav, .ops-tabs, .hero-link { display: none; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head-text p { margin: 0; color: var(--muted); font-size: 14px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 700; font-size: 14px; line-height: 1.3; text-decoration: none; white-space: nowrap;
  transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:hover { background: #F2F5EE; border-color: #BFCBB9; }
.btn-primary { background: var(--forest); border-color: var(--forest); color: #fff; box-shadow: 0 6px 14px rgba(23,62,48,.18); }
.btn-primary:hover { background: var(--forest-hover); border-color: var(--forest-hover); color: #fff; }
.btn-outline { border-color: #B9C7B3; color: var(--forest); }
.btn-gold { background: var(--gold-soft); border-color: #E2D0A0; color: #4A3A12; }
.btn-gold:hover { background: #EEDFB8; border-color: #D8C28B; }
.btn-danger { color: var(--error); border-color: #EBCACA; background: #FFF8F8; }
.btn-danger:hover { background: #FCEDED; border-color: #DFB0B0; }
.btn-sm { min-height: 34px; padding: 5px 11px; border-radius: 10px; font-size: 12.5px; }
.btn-lg { min-height: 46px; padding: 10px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
select.btn { padding-inline: 12px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; font-size: 22px; line-height: 1; color: var(--text); }
.icon-btn:hover { background: #F2F5EE; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--forest); font-weight: 700; text-decoration: underline; text-decoration-color: #B9C7B3; text-underline-offset: 4px; text-align: right; }
.link-btn:hover { text-decoration-color: var(--forest); }

/* ---------- dashboard ---------- */
.dash { display: flex; flex-direction: column; gap: 18px; }
.dash > .page-head { margin-bottom: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi {
  container-type: inline-size; position: relative; min-width: 0; display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.kpi-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kpi:has(.card-link) .kpi-top { padding-inline-end: 44px; }
.kpi-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--sage-soft); color: var(--forest); flex-shrink: 0; }
.kpi-label { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.4; }
.kpi-value { font-size: clamp(20px, 11.5cqi, 32px); font-weight: 800; color: var(--forest); line-height: 1.25; overflow-wrap: anywhere; }
.kpi-value .cur { font-size: .62em; font-weight: 700; color: var(--muted); }
.scope-tag { align-self: flex-start; font-size: 11.5px; font-weight: 500; color: #4D5F53; background: #F0F3EA; border-radius: 999px; padding: 2px 10px; }
.kpi-foot { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.75; }
.kpi-foot .cur { font-size: 1em; }
.kpi-small { padding: 16px 18px; }
.kpi-small .kpi-value { font-size: clamp(19px, 10cqi, 26px); }
.kpi-warn .kpi-value { color: #7A5410; }
.card-link { position: absolute; top: 14px; inset-inline-end: 14px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--forest); transition: background-color .18s var(--ease); }
.card-link:hover { background: var(--sage-soft); }
.hero-link { align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-top: 4px; padding: 8px 16px; border: 0; border-radius: 999px; background: #F2E6C4; color: var(--forest-deep); font-weight: 700; font-size: 14px; }

.dash-analytics, .dash-bottom { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.panel-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.chip-select { min-height: 36px; padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: 13px; font-weight: 500; color: var(--text); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 8px; font-size: 13px; color: #3F5247; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i, .donut-legend i { width: 11px; height: 11px; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.chart-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-narrow { display: none; }
.flow-chart text { font-family: var(--font); }
.chart-note { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.chart-empty { display: grid; place-items: center; text-align: center; gap: 4px; padding: 36px 12px; color: var(--muted); }
.chart-empty p { margin: 0; max-width: 34ch; }
.donut-layout { display: grid; gap: 16px; }
.donut-wrap { position: relative; width: 200px; max-width: 100%; margin: 0 auto; }
.donut { display: block; width: 100%; height: auto; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 0 44px; gap: 2px; }
.donut-center > span { font-size: 11.5px; color: var(--muted); }
.donut-center strong { font-size: 14px; font-weight: 800; color: var(--forest); line-height: 1.35; }
.donut-center .cur { font-weight: 500; color: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.donut-legend li { display: grid; grid-template-columns: 11px minmax(0, 1fr) auto auto; align-items: center; gap: 4px 10px; padding: 7px 4px; border-bottom: 1px dashed #E6EBE2; font-size: 13.5px; }
.donut-legend li:last-child { border-bottom: 0; }
.dl-label { min-width: 0; overflow-wrap: anywhere; }
.dl-label small { color: var(--muted); }
.dl-pct { font-weight: 700; color: var(--forest); font-variant-numeric: tabular-nums; }
.dl-amt { color: var(--muted); font-size: 12.5px; }

.table-compact table { min-width: 0; }
.recent-table .cell-desc { white-space: normal; min-width: 180px; line-height: 1.65; }
.recent-table .cell-date { white-space: nowrap; color: var(--muted); }
.chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: #EFF3E8; color: #33503F; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid #E0E8D8; }
.recon-balance { display: grid; gap: 2px; padding: 14px 16px; margin-bottom: 12px; border-radius: 14px; background: var(--sage-soft); }
.recon-balance > span { font-size: 13px; color: #44564A; font-weight: 500; }
.recon-balance strong { font-size: clamp(22px, 2vw, 28px); font-weight: 800; color: var(--forest); }
.recon-balance .cur { font-size: .6em; color: var(--muted); }
.recon-list { margin: 0 0 12px; display: grid; }
.recon-list div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 2px; border-bottom: 1px solid #EEF1EB; font-size: 13.5px; }
.recon-list dt { color: var(--muted); }
.recon-list dd { margin: 0; font-weight: 700; white-space: nowrap; }
.recon-list .recon-total { border-bottom: 0; }
.recon-list .recon-total dt, .recon-list .recon-total dd { color: var(--forest); font-weight: 800; }

/* ---------- legacy stat cards (kept for any older markup) ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; box-shadow: var(--shadow-sm); }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { margin-top: 10px; color: var(--forest); font-size: clamp(21px, 2vw, 28px); font-weight: 800; overflow-wrap: anywhere; }
.stat-foot { margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.65; }

/* ---------- panels & grids ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 18px; }
.grid-equal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0; }
.panel-head { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap; border-bottom: 1px solid #EDF0EA; }
.panel-head h4 { margin: 0; color: var(--text); font-size: 16px; font-weight: 800; }
.panel-body { padding: 18px 20px; }
.panel-body > .table-wrap + .table-wrap, .preview-box + .table-wrap { margin-top: 12px; }
.archive-panel { margin-top: 20px; }

/* ---------- filters & forms ---------- */
.filter-block { margin-bottom: 16px; }
.filters-toggle { display: none; }
.filters { background: var(--surface); border: 1px solid var(--border); padding: 14px; border-radius: var(--radius); display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.report-filters { margin-bottom: 0; }
.filter-wide { grid-column: span 2; }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field label { font-size: 13px; color: #44564A; font-weight: 700; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .import-input {
  width: 100%; min-height: 42px; border: 1px solid #D0D9CC; background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm); outline: none; font-size: 14.5px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.field input[type=file] { padding: 8px; background: #FAFBF8; }
.field input:focus, .field select:focus, .field textarea:focus, .import-input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(23,62,48,.14); }
.field input[readonly] { background: #F4F6F1; }
.field textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--forest); }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.75; }
.preview-box { background: var(--sage-soft); border: 1px solid #D4E0C5; padding: 12px 14px; border-radius: var(--radius-sm); color: var(--forest); line-height: 1.8; }
.attachment-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 12px; margin-bottom: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #FAFBF8; }
.attachment-row a { color: var(--forest); font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-row > label { display: flex; align-items: center; gap: 6px; color: var(--error); }
#area-confirm { display: flex; gap: 9px; align-items: flex-start; line-height: 1.7; }
#area-confirm[hidden] { display: none; }
.exit-shares { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
.exit-shares > div { background: var(--surface); padding: 10px; border-radius: 10px; display: flex; justify-content: space-between; gap: 8px; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th { background: #F1F4EC; color: #3A4F42; font-size: 12.5px; font-weight: 700; text-align: right; padding: 12px 14px; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
td { padding: 12px 14px; border-top: 1px solid #EEF1EB; font-size: 13.5px; vertical-align: middle; }
tbody tr:nth-child(even) td { background: #FAFBF8; }
tbody tr:hover td { background: #F2F6EE; }
.money { white-space: nowrap; font-weight: 700; unicode-bidi: isolate; }
.cell-desc { white-space: normal; min-width: 200px; max-width: 420px; line-height: 1.65; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 54px; height: 54px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 16px; background: var(--sage-soft); color: var(--forest); font-size: 23px; }
.row-section td { background: #E8EEDF !important; font-weight: 700; color: var(--forest); }
.row-total td, tfoot td { background: #E8F0E6 !important; font-weight: 700; border-top: 2px solid #8DAA8F; color: var(--forest); }
.sign-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; margin-top: 34px; break-inside: avoid; }
.sign-row div { border-top: 1px solid #444; padding-top: 6px; text-align: center; color: #444; font-size: 12px; }

/* ---------- badges & progress ---------- */
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-success { background: #DFF1E5; color: #1D5A35; }
.badge-warning { background: #FBEFD6; color: #7A5410; }
.badge-danger { background: #F8E1E1; color: #8E3030; }
.badge-blue { background: #E2EEF3; color: #2F5A71; }
.badge-neutral { background: #ECEFEB; color: #4F5B53; }
.badge-credit { background: #EAE5F6; color: #4F3D80; }
.progress { height: 9px; background: #E8EDE5; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--forest); border-radius: inherit; }

/* ---------- modal & sheet ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(16,46,35,.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 20; display: grid; place-items: center; padding: 24px; animation: fade .18s var(--ease); }
.modal { width: min(720px, 100%); max-height: 92vh; max-height: 92dvh; overflow: auto; overscroll-behavior: contain; background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 28px 80px rgba(0,0,0,.25); animation: rise .2s var(--ease); }
.modal.wide { width: min(1100px, 100%); }
.modal-head { position: sticky; top: 0; z-index: 2; background: var(--surface); padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; color: var(--forest); font-size: 18px; font-weight: 800; }
.modal-body { padding: 20px; }
.modal-body > h4, .modal-body > h3 { color: var(--forest); }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 10px; position: sticky; bottom: 0; background: var(--surface); }
.modal.sheet { width: min(480px, 100%); }
.sheet-list { display: grid; gap: 6px; }
.sheet-item { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); text-align: right; color: var(--text); }
.sheet-item:hover, .sheet-item.active { background: var(--sage-soft); border-color: #CFDCC3; }
.sheet-item .nav-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--sage-soft); color: var(--forest); }
.sheet-item strong, .sheet-item small { display: block; }
.sheet-item strong { font-size: 15px; }
.sheet-item small { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---------- toast ---------- */
.toast { position: fixed; left: 24px; bottom: 24px; z-index: 50; min-width: 260px; max-width: min(430px, calc(100vw - 32px)); background: var(--forest-deep); color: #fff; padding: 14px 18px; border-radius: 14px; box-shadow: var(--shadow); animation: rise .2s var(--ease); line-height: 1.6; }
.toast.error { background: #8E3333; }

/* ---------- report pages & previews ---------- */
.statement-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 18px 22px; border: 1px solid #CFDFD3; border-inline-start: 5px solid var(--forest); border-radius: 14px; background: #F4F8F2; line-height: 1.7; }
.statement-head img { width: 60px; height: 60px; flex-shrink: 0; }
.statement-head h2 { margin: 0 0 4px; color: var(--forest); font-size: 22px; line-height: 1.35; }
.statement-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; margin-bottom: 18px; }
.summary-box { border: 1px solid var(--border); border-radius: 12px; padding: 12px 10px; text-align: center; background: #FAFBF8; }
.summary-box span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.summary-box strong { color: var(--forest); font-size: 18px; overflow-wrap: anywhere; }
.report-center { margin: 0 0 18px; padding: 20px 22px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.report-center h4 { margin: 0 0 4px; color: var(--forest); font-size: 17px; font-weight: 800; }
.report-center p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.report-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.report-action { display: block; text-align: right; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 14px 16px; min-height: 84px; color: var(--text); transition: background-color .18s var(--ease), border-color .18s var(--ease); }
.report-action:hover { background: #F2F6EE; border-color: #C5D3BF; }
.report-action.primary-report { background: var(--sage-soft); border-color: #D2DFC6; }
.report-action.primary-report:hover { background: #E3ECD8; }
.report-action strong, .report-action span { display: block; }
.report-action strong { color: var(--forest); margin-bottom: 4px; font-size: 14.5px; }
.report-action span { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.active-filter { margin: 12px 0 16px; padding: 10px 14px; border: 1px solid #D4E0C5; border-radius: 12px; background: var(--sage-soft); color: #44564A; font-size: 13px; text-align: center; }
.active-filter strong { color: var(--forest); }

/* ---------- Excel expense import ---------- */
.import-upload { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px; border: 1px dashed #B7C6AF; border-radius: 14px; background: #F8FBF5; }
.import-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
.import-summary > div { background: #F3F7EF; border: 1px solid var(--border); border-radius: 12px; padding: 11px; text-align: center; min-width: 0; }
.import-summary span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.import-summary strong { display: block; color: var(--forest); font-size: 16px; overflow-wrap: anywhere; }
.import-table { max-height: 54vh; }
.import-table table { min-width: 1180px; }
.import-input { min-width: 125px; min-height: 36px; padding: 6px 8px; border-radius: 8px; font-size: 13.5px; }
.import-desc { min-width: 240px; }
.import-amount { min-width: 105px; direction: ltr; text-align: right; }
.import-review-row td { background: #FFF8EA !important; }
.import-invalid-row td { background: #FFF0F0 !important; }
.import-status { min-width: 210px; max-width: 280px; white-space: normal; }
.import-note { margin-top: 10px; padding: 10px 12px; background: #FFF8E7; border: 1px solid #ECD7AA; border-radius: 10px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media screen and (max-width: 1279.98px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media screen and (min-width: 1100px) and (max-width: 1279.98px) {
  .kpi-secondary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media screen and (max-width: 1099.98px) {
  .dash-analytics, .dash-bottom { grid-template-columns: minmax(0, 1fr); }
  .grid-equal, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media screen and (min-width: 600px) and (max-width: 1099.98px) {
  .donut-layout { grid-template-columns: 220px minmax(0, 1fr); align-items: center; }
}
/* tablet: icon rail instead of the full sidebar */
@media screen and (min-width: 768px) and (max-width: 1023.98px) {
  .shell, .shell.collapsed { grid-template-columns: 84px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand-text, .nav-label, .nav-group-label, .side-note, .collapse-btn { display: none; }
  .nav button { justify-content: center; padding-inline: 0; }
  .nav-group + .nav-group { border-top: 1px solid rgba(255,255,255,.10); padding-top: 12px; }
  .side-footer { border-top: 0; }
  .topbar { padding-inline: 20px; }
  .content { padding: 20px 20px 36px; }
}
/* phones: compact header, bottom navigation, card lists, full-screen sheets */
@media screen and (max-width: 767.98px) {
  body { font-size: 15px; }
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .sidebar { display: none; }
  .topbar {
    min-height: 0; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "logo name" "logo title"; align-items: center; gap: 0 12px;
    background: linear-gradient(160deg, var(--forest) 0%, var(--forest-deep) 100%); border-bottom: 0; -webkit-backdrop-filter: none; backdrop-filter: none; color: #fff;
  }
  .topbar-brand { display: contents; }
  .topbar-brand img { grid-area: logo; width: 40px; height: 40px; border-radius: 12px; }
  .topbar-brand span { grid-area: name; font-size: 12px; color: #C9D9CB; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar-title { grid-area: title; }
  .topbar h2 { color: #fff; font-size: 18px; line-height: 1.35; overflow-wrap: anywhere; }
  .view-dashboard .topbar-brand span { display: none; }
  .view-dashboard .topbar-title { grid-row: 1 / span 2; }
  .topbar p, .date-chip { display: none; }
  .content { padding: 14px 16px 24px; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; z-index: 6;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: var(--forest-deep); border-radius: 18px 18px 0 0; box-shadow: 0 -6px 20px rgba(16,46,35,.18);
  }
  .bottom-nav button { min-height: 56px; border: 0; border-radius: 14px; background: transparent; color: #D5E0D2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px; font-size: 12px; font-weight: 500; transition: background-color .18s var(--ease), color .18s var(--ease); }
  .bottom-nav button.active { background: linear-gradient(180deg, #F4E9C9 0%, #E6D3A0 100%); color: var(--forest-deep); font-weight: 700; }

  .ops-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 14px; padding: 4px; background: #ECF0E7; border-radius: 14px; scrollbar-width: none; }
  .ops-tabs::-webkit-scrollbar { display: none; }
  .ops-tabs button { flex: 1 0 auto; min-height: 40px; padding: 6px 14px; border: 0; border-radius: 10px; background: transparent; color: #3F5247; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
  .ops-tabs button.active { background: var(--surface); color: var(--forest); box-shadow: 0 2px 6px rgba(16,46,35,.10); }

  .page-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
  .page-head .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .page-head .actions > .btn, .page-head .actions > select, .page-head .actions > label { width: 100%; min-height: 44px; white-space: normal; text-align: center; }
  .page-head .actions > .btn-primary { grid-column: 1 / -1; order: -1; }
  .page-head .actions > :last-child:nth-child(odd):not(.btn-primary), .page-head .actions > :first-child:nth-last-child(2):not(.btn-primary) { grid-column: 1 / -1; }

  .dash { gap: 14px; }
  .dash > .kpi-main { order: 1; }
  .dash > .page-head { order: 2; }
  .dash > .kpi-secondary { order: 3; }
  .dash > .dash-analytics { order: 4; }
  .dash > .dash-bottom { order: 5; }
  .dash > .partners-panel { order: 6; }
  .dash .page-head-text { display: none; }
  .dash .page-head .actions > .btn { grid-column: auto !important; }
  .dash .page-head .actions > .btn { min-height: 52px; font-size: 15px; padding-inline: 10px; white-space: nowrap; }
  .kpi-grid { gap: 10px; }
  .kpi { padding: 14px; border-radius: 16px; gap: 6px; }
  .kpi-icon { width: 34px; height: 34px; border-radius: 10px; }
  .kpi-label { font-size: 13.5px; }
  .kpi-value { font-size: clamp(19px, 12cqi, 26px); }
  .kpi-foot { font-size: 12px; }
  .kpi-hero { grid-column: 1 / -1; order: -1; background: linear-gradient(155deg, #1E4A3A 0%, var(--forest-deep) 100%); border-color: transparent; color: #fff; padding: 18px; }
  .kpi-hero .kpi-label { color: #fff; }
  .kpi-hero .kpi-value { color: #fff; font-size: clamp(28px, 10cqi, 38px); }
  .kpi-hero .kpi-value .cur { color: #D5E0D2; }
  .kpi-hero .kpi-foot { color: #D2DED0; }
  .kpi-hero .scope-tag { background: rgba(255,255,255,.12); color: #E8EFE4; }
  .kpi-hero .kpi-icon { background: rgba(255,255,255,.12); color: #F1E3BC; }
  .kpi-hero .hero-link { display: inline-flex; align-self: flex-start; }
  .kpi-area { grid-column: 1 / -1; }
  .card-link { width: 44px; height: 44px; top: 8px; inset-inline-end: 8px; }
  .kpi:has(.card-link) .kpi-top { padding-inline-end: 48px; }
  .chart-wide { display: none; }
  .chart-narrow { display: block; }
  .panel { border-radius: 16px; }
  .panel-head { padding: 14px 16px; }
  .panel-body { padding: 14px 16px; }

  .filters-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--forest); font-weight: 700; }
  .filter-count { margin-inline-start: auto; min-width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; background: var(--forest); color: #fff; font-size: 12px; padding: 0 6px; }
  .filter-block:not(.open) .filters { display: none; }
  .filter-block .filters { margin-top: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; }
  .filter-wide { grid-column: 1 / -1; }

  .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea { min-height: 46px; font-size: 16px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: 1; }
  .form-grid .btn-primary { width: 100%; min-height: 48px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .grid-equal { gap: 14px; }

  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; height: 100%; max-height: none; border-radius: 0; animation: sheet-up .22s var(--ease); }
  .modal-head { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 40%; }
  .modal.sheet { height: auto; max-height: 85dvh; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .modal.sheet .modal-head { padding-top: 14px; }
  .statement-head { padding: 14px; gap: 10px; }
  .statement-head h2 { font-size: 18px; }
  .statement-head img { width: 44px; height: 44px; }
  .statement-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sign-row { gap: 16px; }
  .import-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-actions { grid-template-columns: minmax(0, 1fr); }
  .report-center { padding: 16px; }
  .attachment-row { grid-template-columns: minmax(0, 1fr) auto; }
  .toast { left: 12px; right: 12px; min-width: 0; max-width: none; bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* list tables become touch-friendly cards */
  .mcards { border: 0; border-radius: 0; background: transparent; overflow: visible; }
  .mcards table { min-width: 0; display: block; }
  .mcards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .mcards tbody { display: grid; gap: 10px; }
  .mcards tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-sm); }
  .mcards td, .mcards tbody tr:nth-child(even) td, .mcards tbody tr:hover td { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: 0; background: transparent; font-size: 14px; min-width: 0; max-width: none; overflow-wrap: anywhere; }
  .mcards td::before { content: attr(data-label); font-size: 12px; font-weight: 500; color: var(--muted); }
  .mcards td.money { white-space: normal; }
  .mcards td.card-title { grid-column: 1 / -1; order: -1; font-size: 15.5px; font-weight: 700; line-height: 1.6; }
  .mcards td.card-title::before, .mcards td.cell-actions::before, .mcards td.empty-cell::before { display: none; }
  .mcards td.cell-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid #EEF1EB; }
  .mcards td.cell-actions .actions { width: 100%; }
  .mcards td.cell-actions .btn { flex: 1 1 auto; min-height: 44px; }
  .mcards td.empty-cell { grid-column: 1 / -1; align-items: stretch; }
  .mcards tr:has(.empty-cell) { padding: 0; }
  .recent-table tr { grid-template-columns: minmax(0, 1fr) auto; }
  .recent-table td.cell-amount { font-size: 16px; color: var(--forest); }
  .recent-table td.cell-amount::before, .recent-table td.cell-cat::before, .recent-table td.cell-date::before { display: none; }
  .recent-table td.cell-date { align-items: flex-end; justify-content: center; color: var(--muted); }
  .recent-table td.cell-date { order: 1; }
  .recent-table td.cell-cat { order: 2; grid-column: 1 / -1; }
}
@media screen and (max-width: 389.98px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .content { padding-inline: 12px; }
  .topbar { padding-inline: 12px; }
  .bottom-nav { padding-inline: 4px; }
  .bottom-nav button { font-size: 11px; }
  .filter-block .filters { grid-template-columns: minmax(0, 1fr); }
  .mcards tr { grid-template-columns: minmax(0, 1fr); }
  .recent-table tr { grid-template-columns: minmax(0, 1fr) auto; }
  .donut-legend li { grid-template-columns: 11px minmax(0, 1fr) auto; }
  .dl-amt { grid-column: 2 / -1; }
}
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   Print / PDF (A4). Kept from v3.8 and extended for the new shell.
   ========================================================================== */
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  body { overflow: visible; background: white; }
  body.modal-open .shell { display: none !important; }
  .sidebar, .topbar, .page-head .actions, .filters, .no-print, .modal-head button, .modal-foot { display: none !important; }
  .shell { display: block; height: auto; }
  .main { overflow: visible; }
  .content { padding: 0; max-width: none; }
  .panel, .table-wrap { box-shadow: none; border-color: #999; }
  .modal-backdrop { position: static; display: block; padding: 0; background: white; }
  .modal { width: 100%; max-height: none; box-shadow: none; overflow: visible; }
  .modal-head { position: static; }
  .modal-head h3 { display: none; }
  table { min-width: 0; font-size: 9pt; }
  th { position: static; background: #dfe8d5 !important; color: #173d2d !important; }
  th, td { padding: 6px; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; page-break-inside: avoid; }
  .statement-head { break-inside: avoid-page; page-break-inside: avoid; border-color: #173d2d; }
  .statement-summary { break-inside: avoid-page; page-break-inside: avoid; }
  .print-section { break-inside: auto; page-break-inside: auto; }
  .modal-body > h4, .modal-body > h3, .print-section h4 { break-after: avoid; page-break-after: avoid; margin: 14px 0 6px; color: #173d2d; font-size: 13pt; }
  .modal-body > .table-wrap, .print-section .table-wrap { break-inside: auto; page-break-inside: auto; }
  .statement-summary { margin-bottom: 8px; }
  .modal-body { padding: 0; }
  .table-wrap { overflow: visible; border-radius: 0; }
  .badge { border: 1px solid #777; background: white !important; color: #222 !important; }
  a { color: #111; text-decoration: none; }
}

@media print { @page {size:A4 landscape;margin:10mm 9mm 14mm;} body{background:white;print-color-adjust:exact;-webkit-print-color-adjust:exact;} .shell{display:block;height:auto;} .content{padding:0;} .statement-head{padding:10px 14px;margin-bottom:10px;break-inside:avoid;} .statement-head h2{font-size:19pt;} .statement-head img{width:45px;height:45px;} .summary-box{padding:7px;border-radius:4px;} .summary-box strong{font-size:13pt;} .statement-summary{grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:6px;} table{table-layout:auto;width:100%;min-width:0;font-size:9pt;} th,td{font-size:9pt;white-space:normal;padding:5px 6px;overflow-wrap:anywhere;} td.money{white-space:nowrap;} th{background:#164739!important;color:#fff!important;} .table-wrap{overflow:visible;border-radius:0;} tfoot{display:table-row-group;} .sign-row{margin-top:22px;} .modal-head{display:none;} .report-center,.archive-panel .actions{box-shadow:none;} }

/* V4 shell additions for print/PDF */
@media print {
  html, body { height: auto; background: #fff !important; }
  .sidebar, .topbar, .bottom-nav, .ops-tabs, .filter-block, .filters-toggle, .card-link, .hero-link, .collapse-btn { display: none !important; }
  .page-head-text h3 { position: static !important; width: auto; height: auto; margin: 0 0 4px; overflow: visible; clip: auto; clip-path: none; white-space: normal; color: #173E30; font-size: 15pt; }
  .page-head-text p { color: #444; }
  .modal, .modal-backdrop, .toast { animation: none !important; }
  .modal-backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .panel, .kpi, .report-center { box-shadow: none; }
  .money, .amt { unicode-bidi: isolate; }
}

/* V4 reconciliation page */
.recon-compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.recon-diff.bad { border-color: #E8C4C4; background: #FDF6F6; }
.recon-diff.bad .kpi-value { color: var(--danger, #B44343); }
.recon-diff.ok { border-color: #C9E2D1; background: #F5FBF7; }
.finding-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.finding-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper, #fff); }
.finding-list li > div { min-width: 0; }
.finding-list strong { display: block; color: var(--ink); font-size: 14px; }
.finding-list p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.steps { margin: 8px 0; padding-inline-start: 22px; line-height: 1.9; }
@media (max-width: 1023px) { .recon-compare { grid-template-columns: minmax(0, 1fr); } }

/* V4 web/PWA cloud mode */
.cloud-status { position: fixed; inset-inline-start: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 12px; color: var(--muted); box-shadow: 0 6px 18px rgba(23, 62, 48, .1); max-width: calc(100vw - 24px); }
.cloud-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 4px; }
.cloud-status .dot.ok { background: #2E7448; } .cloud-status .dot.bad { background: #B44343; }
.link-btn { background: none; border: 0; color: var(--forest); text-decoration: underline; font: inherit; padding: 0; min-height: 24px; }
.cloud-login { max-width: 420px; width: calc(100% - 32px); text-align: right; }
.cloud-login img, .cloud-login h1, .cloud-login > p { text-align: center; display: block; margin-inline: auto; }
.partner-ledger { max-width: 1100px; margin: 0 auto; padding: 16px 16px calc(80px + env(safe-area-inset-bottom)); }
.partner-ledger .pl-head { display: flex; gap: 12px; align-items: center; background: var(--forest); color: #fff; border-radius: 18px; padding: 16px; margin-bottom: 16px; }
.partner-ledger .pl-head img { width: 48px; height: 48px; }
.partner-ledger .pl-head h1 { font-size: 18px; margin: 0; } .partner-ledger .pl-head p { margin: 4px 0 0; color: #D7E2D2; font-size: 13px; }
.partner-ledger .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 767px) { .partner-ledger .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cloud-status { bottom: calc(76px + env(safe-area-inset-bottom)); } }
@media (max-width: 389px) { .partner-ledger .kpis { grid-template-columns: minmax(0, 1fr); } }
@media print { .cloud-status { display: none !important; } }
