:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --ink: #1c2333;
  --ink-2: #4a5468;
  --muted: #7a8396;
  --line: #e4e7ee;
  --line-2: #eef0f5;
  --primary: #22336b;
  --primary-2: #2f4796;
  --accent: #f2b705;
  --head: #fff3c4;
  --head-ink: #4b3b00;
  --total: #f7c948;
  --good: #1f8a5b;
  --warn: #c77700;
  --bad: #c2362f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, .05), 0 4px 16px rgba(20, 30, 60, .05);
  font-family: Vazirmatn, Tahoma, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 14px; line-height: 1.6; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
h2 { font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num, td, .kpi-value { font-variant-numeric: tabular-nums; }
input, select, button { font: inherit; color: inherit; }

/* ---------- buttons & inputs ---------- */
.btn { border: 1px solid transparent; border-radius: 10px; padding: 8px 16px; cursor: pointer; background: var(--line-2); font-weight: 500; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.primary:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.danger { color: var(--bad); }
.btn.wide { width: 100%; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-2); font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
input, select { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; min-width: 0; }
input:focus, select:focus { outline: 2px solid rgba(47, 71, 150, .25); border-color: var(--primary-2); }
.form-error, .form-msg { min-height: 1.4em; font-size: 13px; }
.form-error, .form-msg.err { color: var(--bad); }
.form-msg.ok { color: var(--good); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 80% -10%, #dfe6ff 0%, transparent 60%), radial-gradient(900px 500px at 0% 110%, #fff1c2 0%, transparent 60%), var(--bg); }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: 18px; padding: 32px 28px; box-shadow: 0 10px 40px rgba(20, 30, 60, .12); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-card label { text-align: right; }
.login-card h1 { font-size: 20px; }
.login-card p { margin: -8px 0 4px; }
.brand-mark { width: 52px; height: 52px; margin: 0 auto; border-radius: 14px; display: grid; place-items: center; font-size: 26px; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: var(--accent); }
.brand-mark.sm { width: 38px; height: 38px; font-size: 19px; border-radius: 11px; margin: 0; }

/* ---------- top bar ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1320px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-title { font-weight: 800; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.tabs button:hover { background: var(--line-2); }
.tabs button.active { background: #e8ecfa; color: var(--primary); font-weight: 700; }
.user-box { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.user-box select { padding: 5px 8px; font-size: 13px; max-width: 230px; }
.user-name { font-weight: 600; }
.role-badge { font-size: 11.5px; padding: 2px 9px; border-radius: 99px; background: #e8ecfa; color: var(--primary); font-weight: 600; }
.role-badge.finance { background: #fff1c2; color: #6b5200; }

/* ---------- layout ---------- */
.container { max-width: 1320px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.tab { display: flex; flex-direction: column; gap: 18px; }
#dashBody { display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.narrow { max-width: 900px; width: 100%; margin: 0 auto; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card-head p { margin: 2px 0 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row.wrap { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }
.save-row { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.empty { text-align: center; padding: 80px 20px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty p { margin-top: 8px; }

/* ---------- month filter bar ---------- */
.filter-bar { position: sticky; top: 61px; z-index: 15; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 16px; border-inline-start: 4px solid var(--accent); }
.month-pick { font-size: 14px; font-weight: 700; color: var(--ink); gap: 6px; }
.month-pick select { font-weight: 600; min-width: 150px; }
.month-pick .step { padding: 4px 10px; font-size: 16px; line-height: 1; }
.month-pick .step:disabled { opacity: .35; cursor: default; }

/* ---------- KPIs ---------- */
.kpi-group { display: flex; flex-direction: column; gap: 8px; }
.kpi-group-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.kpi-delta { font-size: 11.5px; font-weight: 700; }
.kpi-delta.up { color: var(--good); }
.kpi-delta.down { color: var(--bad); }
/* segmented switch (trend chart period) */
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--primary); font-weight: 700; box-shadow: 0 1px 3px rgba(20, 30, 60, .12); }

/* small history chart under a KPI card */
.mini-wrap { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; }
.mini { width: 100%; height: auto; display: block; overflow: visible; }
.mini .m-bar { fill: #c9d1e6; }
.mini .m-bar.cur { fill: var(--primary-2); }
.mini .m-bar.neg { fill: #9fd5bc; }
.mini .m-bar.neg.cur { fill: var(--good); }
.mini .m-zero { stroke: var(--line); stroke-width: 1; }
.mini .m-avg { stroke: var(--accent); stroke-width: 1.8; stroke-dasharray: 5 3; }
.mini .m-lbl { font-size: 9.5px; fill: var(--muted); text-anchor: middle; font-family: inherit; }
.mini .m-lbl.cur { fill: var(--ink); font-weight: 700; }
.mini .m-na { font-size: 9px; fill: var(--muted); text-anchor: middle; }
.mini-cap { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-2); }
.mini-cap .m-key { display: inline-block; width: 14px; height: 0; border-top: 2px dashed var(--accent); vertical-align: middle; margin-inline-end: 4px; }

/* semicircle gauge cards */
.kpi-gauge { align-items: center; text-align: center; }
.kpi-gauge .kpi-label { align-self: stretch; text-align: right; }
.kpi-gauge .kpi-sub { text-align: center; }
.gauge { width: 100%; max-width: 210px; height: auto; display: block; margin: 2px auto 0; overflow: visible; }
.gauge .g-track { fill: none; stroke: var(--line-2); }
.gauge .g-zone { fill: none; stroke-width: 3; opacity: .85; }
.gauge .g-zone.bad { stroke: var(--bad); }
.gauge .g-zone.warn { stroke: var(--warn); }
.gauge .g-zone.good { stroke: var(--good); }
.gauge .g-tick { stroke: #b9bfcc; stroke-width: 1; }
.gauge .g-tick.major { stroke: var(--ink-2); stroke-width: 1.6; }
.gauge .g-lbl { font-size: 9px; fill: var(--muted); text-anchor: middle; font-family: inherit; }
.gauge .g-needle { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.gauge .g-hub { fill: var(--ink); }
.gauge .g-val { font-size: 19px; font-weight: 800; fill: var(--ink); text-anchor: middle; font-family: inherit; }
.kpi-gauge .kpi-value { font-size: 19px; margin-top: 2px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpis.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; border-top: 3px solid var(--primary); min-width: 0; }
.kpi.k-good { border-top-color: var(--good); }
.kpi.k-warn { border-top-color: var(--warn); }
.kpi.k-bad { border-top-color: var(--bad); }
.kpi.k-accent { border-top-color: var(--accent); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.kpi-sub { font-size: 12px; color: var(--ink-2); }
.meter { height: 6px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.meter > span { display: block; height: 100%; background: var(--good); border-radius: 99px; }

/* ---------- report tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { border-collapse: collapse; width: 100%; }
table.rep { border: 1px solid #d9dce4; font-size: 13px; }
table.rep th, table.rep td { border: 1px solid #d9dce4; padding: 9px 10px; text-align: center; white-space: nowrap; }
table.rep thead th { background: var(--head); color: var(--head-ink); font-weight: 700; font-size: 12.5px; }
table.rep thead th.super { background: #fffaf0; font-size: 13.5px; }
table.rep thead th.target-h { background: #ffe27a; }
table.rep td.lead { font-weight: 700; background: #fafbfd; }
table.rep tr.total td { background: var(--total); font-weight: 800; color: #3a2d00; }
table.rep td.pct { font-weight: 700; }
table.rep.clickable tbody tr:not(.total) { cursor: pointer; }
table.rep.clickable tbody tr:not(.total):hover td { background: #f2f5ff; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.pill.good { background: #e3f4ec; color: var(--good); }
.pill.warn { background: #fff1d6; color: var(--warn); }
.pill.bad { background: #fbe4e2; color: var(--bad); }
.footnote { font-size: 12.5px; color: var(--muted); margin: 0; }
.target-bar { display: flex; flex-direction: column; gap: 6px; }
.target-bar .track { position: relative; height: 12px; border-radius: 99px; background: var(--line-2); overflow: visible; }
.target-bar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--good), #34b37a); }
.target-bar .fill.over { background: linear-gradient(90deg, #1f8a5b, #0f6b44); }
.target-bar .mark { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.target-bar .lbls { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); }

/* ---------- lists ---------- */
table.list { font-size: 13px; }
table.list th { text-align: right; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.list td.n { text-align: left; direction: ltr; white-space: nowrap; }
table.list tr.link { cursor: pointer; }
table.list tr.link:hover td { background: #f6f8ff; }
table.list.edit input, table.list.edit select { width: 100%; padding: 6px 8px; }
.card.narrow-left { max-width: 560px; width: 100%; }
table.list.edit th.c, table.list.edit td.c { text-align: center; }
table.list.edit th.c { white-space: normal; line-height: 1.35; min-width: 74px; }
table.list.edit td.c input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary-2); cursor: pointer; }
table.list.edit td.c input:disabled { cursor: not-allowed; opacity: .35; }
table.list.edit tr.hidden-both td:not(.c):not(.ord) input { color: var(--muted); }
table.list.edit td.ord { white-space: nowrap; }
table.list.edit td.ord .btn { padding: 2px 7px; }
table.list.edit input[type=checkbox], table.list.edit input[type=radio] { width: auto; }
.file-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.file-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 9px; background: var(--line-2); font-size: 13px; }
.file-list li.err { background: #fbe4e2; color: var(--bad); }
.file-list li.ok { background: #e3f4ec; color: var(--good); }
.drop { border: 2px dashed #c8cede; border-radius: 14px; padding: 28px; align-items: center; text-align: center; cursor: pointer; color: var(--ink-2); background: #fafbfd; transition: background .15s, border-color .15s; }
.drop.over { background: #eef2ff; border-color: var(--primary-2); }
.drop input { display: none; }
.drop-icon { font-size: 28px; color: var(--primary-2); }
#uploadForm { display: flex; flex-direction: column; gap: 14px; }

/* ---------- charts ---------- */
.chart { width: 100%; min-height: 280px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 11px; }
.chart .grid line { stroke: var(--line-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.dash { height: 0; border-top: 2px dashed var(--ink); border-radius: 0; width: 16px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; font-size: 13px; }
.hbar .bar { height: 14px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.hbar .bar span { display: block; height: 100%; border-radius: 99px; }
.hbar .v { font-weight: 700; direction: ltr; min-width: 140px; text-align: left; }
.chip-filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 99px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; transition: background .15s, border-color .15s, color .15s; }
.chip::before { content: ''; width: 8px; height: 8px; border-radius: 99px; border: 1.5px solid currentColor; box-sizing: border-box; }
.chip[aria-pressed="true"] { background: #e8ecfa; border-color: var(--primary-2); color: var(--primary); font-weight: 600; }
.chip[aria-pressed="true"]::before { background: currentColor; }
.chip.outside { border-style: dashed; }
.chip-link { border: 0; background: none; color: var(--primary-2); font-size: 12px; cursor: pointer; padding: 3px 4px; text-decoration: underline; }
.age-total { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); border-top: 1px solid var(--line-2); padding-top: 8px; }
.tooltip { position: fixed; pointer-events: none; z-index: 100; background: #1c2333; color: #fff; padding: 8px 12px; border-radius: 9px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 280px; }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.tooltip b { display: block; margin-bottom: 4px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 20, 35, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal-card { background: var(--surface); border-radius: 16px; width: min(1100px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-card.small { width: min(400px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); gap: 10px; }
.modal-body { padding: 16px 18px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.modal-tools input { flex: 1; min-width: 180px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .kpis, .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filter-bar { position: static; } }
@media (max-width: 800px) {
  .grid2, .row { grid-template-columns: 1fr; }
  .kpis, .kpis.kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .container { padding: 12px 16px; }
  .topbar-inner { padding: 10px 16px; gap: 10px; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .hbar { grid-template-columns: 80px 1fr; }
  .hbar .v { grid-column: 1 / -1; text-align: right; min-width: 0; }
  /* top bar scrolls away on small screens; the month filter stays pinned instead */
  .topbar { position: static; }
  .filter-bar { position: sticky; top: 0; }
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  body { font-size: 13.5px; }
  .container { padding: 10px 12px; gap: 14px; }
  .tab, #dashBody { gap: 14px; }
  .card { padding: 14px; border-radius: 12px; }
  h2 { font-size: 15px; }

  /* top bar: compact, two short rows */
  .topbar-inner { padding: 8px 12px; gap: 8px; }
  .brand-sub { font-size: 11px; }
  .user-box { width: 100%; gap: 6px; }
  .user-box select { flex: 1 1 100%; max-width: none; order: -1; }
  .user-box .user-name { font-size: 13px; }
  .tabs button { padding: 6px 10px; font-size: 13px; white-space: nowrap; }

  /* month filter: one tight row */
  .filter-bar { padding: 8px 10px; gap: 8px; border-radius: 12px; }
  .filter-bar > .muted { display: none; }
  .month-pick { width: 100%; justify-content: space-between; font-size: 13px; }
  .month-pick select { flex: 1; min-width: 0; }

  /* KPI cards */
  .kpis, .kpis.kpis-4 { gap: 10px; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 18px; }
  .kpi-value small { display: block; margin: 0; font-size: 11px; }
  .kpi-label, .kpi-sub { font-size: 11.5px; }
  .kpi-group-title { font-size: 13px; }
  .gauge { max-width: 150px; }
  .kpi.has-mini { grid-column: 1 / -1; }
  .kpis { grid-auto-flow: row dense; } /* the two gauge cards pair up side by side */
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 6px 8px; }
  .kpi-gauge .kpi-value { font-size: 16px; }

  .card-head { gap: 8px; }
  .chart { min-height: 0; }
  .legend { gap: 4px 12px; font-size: 12px; }
  .target-bar .lbls { flex-direction: column; gap: 2px; }
  .tooltip { max-width: calc(100vw - 24px); }
  .tooltip .tt-hint { margin-top: 6px; font-size: 11px; opacity: .7; }

  /* tables marked .stack become one card per row, each cell labelled with its column name */
  .table-wrap:has(> table.stack) { overflow: visible; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack, table.rep.stack { border: 0; }
  table.stack tr { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: var(--surface); }
  table.stack td, table.rep.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; border: 0; border-bottom: 1px solid var(--line-2); padding: 7px 12px; white-space: normal; background: transparent; }
  table.stack td:last-child { border-bottom: 0; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-weight: 500; font-size: 12px; text-align: right; flex-shrink: 0; max-width: 55%; }
  table.stack td.n { direction: rtl; }
  table.stack td.empty-cell { display: none; }
  table.stack td.lead { order: -1; justify-content: flex-start; font-weight: 800; font-size: 14px; background: var(--head); color: var(--head-ink); }
  table.stack td.lead::before { content: none; }
  table.stack tr.total { border-color: var(--total); }
  table.stack tr.total td { background: #fff8e1; color: #3a2d00; }
  table.stack tr.total td:first-child { order: -1; justify-content: flex-start; background: var(--total); font-size: 14px; }
  table.stack tr.total td:first-child::before { content: none; }
  table.stack tr.link, table.rep.clickable.stack tbody tr:not(.total) { cursor: pointer; }
  table.rep.clickable.stack tbody tr:not(.total) td.lead::after { content: '‹ مشتریان'; margin-inline-start: auto; font-size: 11.5px; font-weight: 500; opacity: .7; }
  /* touch screens keep :hover after a tap; don't leave cards tinted */
  table.rep.clickable.stack tbody tr:not(.total):hover td:not(.lead), table.list.stack tr.link:hover td:not(.lead) { background: transparent; }
  table.rep.clickable.stack tbody tr:not(.total):hover td.lead, table.list.stack tr.link:hover td.lead { background: var(--head); }
  .modal-tools label.inline { white-space: nowrap; }
  table.stack td.actions-cell { justify-content: flex-end; }
  table.stack td.actions-cell::before { content: none; }
  /* the monthly report is a single row: show it as one list with the totals emphasised */
  #r1Table.stack td.lead { justify-content: space-between; }
  #r1Table.stack td.lead::before { content: attr(data-label); color: inherit; font-size: 12.5px; font-weight: 700; }
  #r1Table.stack td.sum { background: #fffaf0; font-weight: 700; }

  /* drill-down modal: full screen */
  .modal { padding: 0; place-items: stretch; }
  .modal-card, .modal-card.small { width: 100%; max-height: none; height: 100%; border-radius: 0; }
  .modal-card.small { height: auto; margin: auto 12px; border-radius: 14px; width: auto; }
  .modal-head { padding: 10px 12px; }
  .modal-head h2 { font-size: 14px; }
  .modal-body { padding: 12px; }
  .modal-tools input { min-width: 0; flex-basis: 100%; }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; }
  .topbar, .actions, .tabs, .user-box, .modal, #trendChart + .legend { display: none !important; }
  .card, .kpi { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .container { padding: 0; max-width: none; }
}
