/* ─── Design Tokens ─────────────────────────────────────── */
:root{
  --font-ui:"IRANSans",Tahoma,Arial,sans-serif;
  --bg:#f4f8fa;
  --card:#ffffff;
  --text:#0b1b2a;
  --muted:#4b6477;
  --border:#dde8ec;
  --teal:#0ea5a4;
  --teal2:#06b6d4;
  --teal-light:#e8faf9;
  --blue:#0b2a46;
  --danger:#b42318;
  --danger-light:#fff2f2;
  --warning:#a16207;
  --warning-light:#fefce8;
  --success:#065f46;
  --success-light:#ecfdf5;
  --shadow:0 4px 24px rgba(10,35,55,.07);
  --shadow-sm:0 2px 8px rgba(10,35,55,.05);
  --shadow-md:0 8px 32px rgba(10,35,55,.1);
  --radius:16px;
  --radius-sm:10px;
  --radius-xs:7px;
  --topbar-h:64px;
  --sidebar-w:240px;
  --content-max:1380px;
  --gap:18px;
}

/* ─── Font Faces ─────────────────────────────────────────── */
@font-face{
  font-family:"IRANSans";
  src:url("../fonts/IRANSansWeb(FaNum).woff2") format("woff2");
  font-weight:400;font-style:normal;font-display:swap;
}
@font-face{
  font-family:"IRANSans";
  src:url("../fonts/IRANSansWeb(FaNum)_Medium.woff2") format("woff2");
  font-weight:500;font-style:normal;font-display:swap;
}
@font-face{
  font-family:"IRANSans";
  src:url("../fonts/IRANSansWeb(FaNum)_Bold.woff2") format("woff2");
  font-weight:700;font-style:normal;font-display:swap;
}

/* ─── Base Reset ─────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%;scroll-behavior:smooth}
html,body{margin:0;height:100%}
html,body,input,select,textarea,button,optgroup,option{
  font-family:var(--font-ui);
}
body{
  background:var(--bg);
  color:var(--text);
  line-height:1.65;
  font-size:14px;
}
button,.btn,.pill,input,select,textarea{font-family:inherit}
table,th,td{font-family:inherit}
code,kbd,pre,samp{font-family:var(--font-ui)}
a{color:inherit;text-decoration:none}
img,svg{display:block;max-width:100%}

/* ─── Layout Shell ───────────────────────────────────────── */
.container{
  max-width:var(--content-max);
  margin:0 auto;
  padding:0 24px 32px;
}
/* Topbar */
.topbar{
  background:#fff;
  border-bottom:1px solid var(--border);
  position:sticky;top:0;z-index:200;
  box-shadow:var(--shadow-sm);
}
.topbar-inner{
  max-width:var(--content-max);
  margin:0 auto;
  padding:0 24px;
  height:var(--topbar-h);
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.brand{display:flex;gap:11px;align-items:center;flex-shrink:0}
.brand-text{line-height:1.3}
.brand-name{font-weight:800;font-size:15px;color:var(--blue)}
.brand-sub{font-size:11px;color:var(--muted)}
.logo{
  width:40px;height:40px;border-radius:12px;flex-shrink:0;
  background:linear-gradient(135deg,var(--teal) 0%,var(--teal2) 100%);
  display:flex;align-items:center;justify-content:center;
  color:#fff;font-weight:900;font-size:18px;letter-spacing:-1px;
}

/* Nav Pills */
.nav{display:flex;gap:6px;flex-wrap:nowrap;align-items:center;overflow-x:auto;scrollbar-width:none}
.nav::-webkit-scrollbar{display:none}
.pill{
  display:inline-flex;align-items:center;gap:5px;
  padding:7px 13px;border-radius:var(--radius-xs);
  border:1px solid var(--border);
  background:#fff;font-size:13px;color:var(--blue);
  transition:background .15s,border-color .15s;
  white-space:nowrap;flex-shrink:0;
  min-height:36px;
}
.pill:hover{background:var(--teal-light);border-color:#9ed8d6}
.pill.primary{background:var(--teal);border-color:transparent;color:#fff}
.pill.primary:hover{background:#0b9493}
.pill.danger{background:#fff;border-color:#ffd6d6;color:var(--danger)}
.pill.danger:hover{background:var(--danger-light)}
.pill.sm{padding:4px 9px;font-size:12px;min-height:28px}

/* Print-only blocks (default hidden) */
.print-only{display:none}

/* Mobile hamburger (hidden by default) */
.nav-toggle{
  display:none;
  background:none;border:1.5px solid var(--border);border-radius:var(--radius-xs);
  padding:7px 10px;cursor:pointer;color:var(--blue);font-size:18px;line-height:1;
  flex-shrink:0;
}

/* Force hide hamburger on desktop */
@media(min-width:768px){
  .nav-toggle{display:none!important}
}

/* Page padding below topbar */
.page-wrap{padding-top:20px}

/* ─── Content Area ───────────────────────────────────────── */
/* Grids */
.grid{display:grid;grid-template-columns:1fr;gap:var(--gap)}
.grid-2{grid-template-columns:1fr}
.grid-3{grid-template-columns:1fr}

@media(min-width:640px){
  .grid-2{grid-template-columns:1fr 1fr}
  .grid-3{grid-template-columns:1fr 1fr}
}
@media(min-width:1024px){
  .grid-2{grid-template-columns:1.15fr .85fr}
  .grid-3{grid-template-columns:repeat(3,1fr)}
}

.page-grid{display:grid;gap:var(--gap)}
@media(min-width:1024px){
  .page-grid{grid-template-columns:1.2fr .8fr;align-items:start}
}
@media(min-width:1440px){
  .page-grid{grid-template-columns:1.3fr .7fr}
}

.stack{display:flex;flex-direction:column;gap:var(--gap)}

/* ─── Stats dashboard (admin آمار) ───────────────────────── */
.stats-page{font-size:14px}
.stats-page > .stats-lead{
  color:var(--muted);font-size:14px;line-height:1.8;margin:-4px 0 22px;max-width:46rem;
}
.stats-section{margin-bottom:30px}
.stats-section-head{
  display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;
  gap:10px 16px;margin-bottom:16px;padding-bottom:12px;border-bottom:2px solid var(--teal-light);
}
.stats-section-head h2{margin:0;font-size:17px;font-weight:800;color:var(--blue);line-height:1.35}
.stats-section-head p{margin:0;font-size:13px;color:var(--muted);line-height:1.6}
.stats-kpi-row{
  display:grid;gap:14px;grid-template-columns:1fr;margin-bottom:26px;
}
@media(min-width:560px){.stats-kpi-row{grid-template-columns:repeat(2,1fr)}}
@media(min-width:1024px){.stats-kpi-row{grid-template-columns:repeat(4,1fr)}}
.stats-kpi{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow-sm);
  padding:18px 14px;text-align:center;min-width:0;
}
.stats-kpi .kpi-label{font-size:12px;color:var(--muted);font-weight:600;margin-bottom:8px;line-height:1.4}
.stats-kpi .kpi-num{
  font-size:clamp(26px,3.6vw,36px);font-weight:900;line-height:1.1;color:var(--teal);letter-spacing:-0.02em;
}
.stats-kpi .kpi-num--blue{color:var(--blue)}
.stats-kpi .kpi-num--warn{color:var(--warning)}
.stats-kpi .kpi-num--muted{color:var(--muted)}
.stats-kpi .kpi-sub{font-size:11px;color:var(--muted);margin-top:10px;line-height:1.55}
.stats-chart-grid{
  display:grid;gap:var(--gap);grid-template-columns:1fr;
}
@media(min-width:900px){.stats-chart-grid{grid-template-columns:1fr 1fr}}
@media(min-width:900px){.stats-chart-grid--single{grid-template-columns:1fr}}
.chart-card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow-sm);
  padding:18px 16px 12px;
  display:flex;flex-direction:column;min-width:0;
}
.chart-card .chart-card-title{margin:0 0 6px;font-size:15px;font-weight:800;color:var(--blue);line-height:1.35}
.chart-card .chart-card-caption{margin:0 0 14px;font-size:12px;color:var(--muted);line-height:1.65}
.chart-card .chart-canvas-wrap{
  position:relative;flex:1;width:100%;
  min-height:252px;height:280px;
}
.chart-card.chart-card--ring .chart-canvas-wrap{min-height:232px;height:268px}
.chart-card.chart-card--tall .chart-canvas-wrap{min-height:280px;height:320px}
.stats-iv-wrap{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}
.stats-iv-wrap .chart-card-title{margin-bottom:8px;font-size:15px}
.stats-iv-wrap .chart-canvas-wrap{min-height:240px}
.stats-summary-table{
  width:100%;border-collapse:collapse;font-size:13px;margin-top:4px;
}
.stats-summary-table th,.stats-summary-table td{
  padding:11px 13px;border-bottom:1px solid var(--border);text-align:right;vertical-align:top;
}
.stats-summary-table th{width:44%;font-weight:600;color:var(--muted);background:#f7fbfc;font-size:12.5px}
.stats-summary-table td{font-weight:600;color:var(--text)}
.stats-summary-table tr:last-child th,.stats-summary-table tr:last-child td{border-bottom:0}
[data-theme="dark"] .stats-summary-table th{background:#111e2a}
.stats-actions-card{padding:18px 16px}

@media(max-width:599px){
  .chart-card .chart-canvas-wrap{min-height:220px;height:248px}
  .chart-card.chart-card--tall .chart-canvas-wrap{min-height:240px;height:268px}
}

/* ─── Cards ──────────────────────────────────────────────── */
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
}
.card-nested{
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:14px;
  background:#fafdfd;
  box-shadow:none;
}

/* ─── Typography ─────────────────────────────────────────── */
.title{margin:0 0 10px;font-size:18px;font-weight:800;color:var(--blue);line-height:1.3}
.subtitle{margin:0 0 8px;font-size:15px;font-weight:700;color:var(--blue)}
.muted{color:var(--muted);font-size:13px;line-height:1.85}
.section-divider{border:0;border-top:1px solid var(--border);margin:14px 0}

/* ─── Forms ──────────────────────────────────────────────── */
.field{margin-bottom:14px}
label{display:block;margin-bottom:5px;font-size:13px;color:#173148;font-weight:600}
input,select,textarea{
  width:100%;
  padding:10px 13px;
  border:1.5px solid #d2e4ea;
  border-radius:var(--radius-sm);
  font-size:14px;font-family:inherit;
  background:#fff;outline:none;
  transition:border-color .15s,box-shadow .15s;
  min-height:42px;
}
textarea{min-height:110px;resize:vertical}
input:focus,select:focus,textarea:focus{
  border-color:var(--teal);
  box-shadow:0 0 0 3px rgba(14,165,164,.14);
}
input.date-masked{
  direction:ltr;letter-spacing:3px;font-size:16px;
  text-align:center;font-weight:600;
}
.fieldset-plain{border:0;margin:0;padding:0;min-width:0}
form.is-disabled{opacity:.55;pointer-events:none}

/* Filter bar */
.filter-bar{
  display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end;
  padding:14px;background:#f7fbfc;
  border:1px solid var(--border);border-radius:var(--radius-sm);
  margin-bottom:16px;
}
.filter-bar .field{margin:0;min-width:0}
.filter-bar .field label{font-size:12px}
.filter-bar .field input,
.filter-bar .field select{padding:8px 10px;font-size:13px;min-height:36px}
.filter-bar .f-grow{flex:1;min-width:180px}
.filter-bar .f-sm{width:130px;flex-shrink:0}
.filter-bar .f-md{width:165px;flex-shrink:0}
.filter-bar .f-xs{width:100px;flex-shrink:0}
.filter-actions{display:flex;gap:8px;align-items:flex-end;flex-wrap:wrap}

/* ─── Buttons ────────────────────────────────────────────── */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;
  padding:10px 18px;border-radius:var(--radius-sm);border:0;cursor:pointer;
  background:var(--teal);color:#fff;
  font-size:14px;font-family:inherit;font-weight:600;
  transition:background .15s,transform .1s;
  white-space:nowrap;min-height:42px;
}
.btn:hover{background:#0b9493}
.btn:active{transform:scale(.97)}
.btn.secondary{background:#fff;color:var(--blue);border:1.5px solid var(--border)}
.btn.secondary:hover{background:#f0fbfb;border-color:#a7d8d8}
.btn.danger{background:var(--danger)}
.btn.danger:hover{background:#991b1b}
.btn.warning{background:#d97706;color:#fff}
.btn.sm{padding:7px 12px;font-size:13px;min-height:34px}
.btn-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:14px}

/* ─── Alerts ─────────────────────────────────────────────── */
.alert{
  border-radius:var(--radius-sm);padding:11px 15px;
  border:1px solid var(--border);background:#fff;
  font-size:13px;line-height:1.7;
}
.alert.ok{border-color:#a7f3d0;background:var(--success-light);color:var(--success)}
.alert.err{border-color:#fca5a5;background:var(--danger-light);color:#7a0d0d}
.alert.warn{border-color:#fcd34d;background:var(--warning-light);color:var(--warning)}
.alert.info{border-color:#bfdbfe;background:#eff6ff;color:#1e40af}

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrap{
  width:100%;overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  margin:8px 0;
  border-radius:var(--radius-sm);
  border:1px solid var(--border);
}
.table{
  width:100%;border-collapse:collapse;
  min-width:540px;
}
.table th,.table td{
  padding:10px 12px;
  border-bottom:1px solid var(--border);
  font-size:13px;vertical-align:middle;text-align:right;
}
.table th{
  background:#f0faf9;color:#173148;
  font-weight:700;font-size:12px;
  white-space:nowrap;
}
.table tr:last-child td{border-bottom:0}
.table tbody tr:hover td{background:#f5fdfc}
.table .actions-col{white-space:nowrap;text-align:left;width:1px}

/* info-table (key-value pairs) */
.info-table{min-width:0}
.info-table th{width:38%;font-size:13px;font-weight:600;color:var(--muted)}
.info-table td{font-size:13px}

/* ─── Badges ─────────────────────────────────────────────── */
.badge{
  display:inline-flex;align-items:center;
  padding:3px 10px;border-radius:999px;
  font-size:12px;font-weight:600;
  border:1px solid var(--border);background:#fff;
  white-space:nowrap;
}
.badge.teal{background:#e6faf9;border-color:#99e6e4;color:#065f46}
.badge.gray{background:#f6f8f9;border-color:#dde4e8;color:#374151}
.badge.blue{background:#eff6ff;border-color:#bfdbfe;color:#1e40af}
.badge.red{background:var(--danger-light);border-color:#fca5a5;color:#991b1b}
.badge.yellow{background:var(--warning-light);border-color:#fcd34d;color:var(--warning)}
.badge.green{background:var(--success-light);border-color:#a7f3d0;color:var(--success)}

/* ─── Score Pill ─────────────────────────────────────────── */
.score-pill{
  display:inline-flex;align-items:center;justify-content:center;
  width:34px;height:34px;border-radius:999px;
  font-weight:900;font-size:14px;
  background:var(--teal-light);color:var(--teal);border:2px solid #99e6e4;
  flex-shrink:0;
}
.score-pill.high{background:#ecfdf5;color:#065f46;border-color:#a7f3d0}
.score-pill.low{background:var(--danger-light);color:#991b1b;border-color:#fca5a5}

/* ─── Step Indicator ─────────────────────────────────────── */
.steps{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:14px}
.step{
  padding:6px 14px;border-radius:999px;
  border:1px solid var(--border);background:#fff;
  font-size:12px;font-weight:600;
}
.step.active{background:var(--teal);border-color:transparent;color:#fff}
.step.done{background:#e6faf9;border-color:#99e6e4;color:#065f46}

/* ─── Q&A Blocks ─────────────────────────────────────────── */
.qa-block{
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:12px 14px;margin:8px 0;
  background:#fff;
  transition:box-shadow .15s;
}
.qa-block:hover{box-shadow:var(--shadow-sm)}
.qa-q{
  font-weight:700;font-size:13px;margin-bottom:6px;color:#173148;
  display:flex;gap:7px;align-items:flex-start;
}
.qa-q::before{
  content:"سوال";flex-shrink:0;
  font-size:10px;background:var(--teal-light);
  color:var(--teal);border:1px solid #b2e8e7;
  border-radius:999px;padding:2px 7px;margin-top:1px;
}
.qa-a{
  font-size:13px;line-height:1.9;color:var(--text);
  border-right:3px solid #99e6e4;padding-right:10px;margin-top:4px;
}

/* ─── Stat Cards ─────────────────────────────────────────── */
.stat-card{text-align:center;padding:24px 18px}
.stat-card .stat-num{font-size:36px;font-weight:900;color:var(--teal);line-height:1}
.stat-card .stat-label{color:var(--muted);font-size:13px;margin-top:6px}

/* ─── Check Rows ─────────────────────────────────────────── */
.check-row{
  display:flex;gap:9px;align-items:flex-start;
  margin:6px 0;cursor:pointer;padding:4px 0;
}
.check-row input{width:auto;margin-top:3px;flex-shrink:0;accent-color:var(--teal)}
.check-row span{font-size:13px;color:var(--text)}

/* ─── Misc Utilities ─────────────────────────────────────── */
code.kbd{
  direction:ltr;unicode-bidi:bidi-override;
  background:#f2f7f8;padding:2px 8px;
  border-radius:6px;font-size:12px;border:1px solid var(--border);
}
.empty-state{text-align:center;padding:48px 20px;color:var(--muted)}
.empty-state .icon{font-size:36px;margin-bottom:10px;opacity:.4;display:block}

/* ─── Settings Page ──────────────────────────────────────── */
.settings-details > summary.settings-summary{
  cursor:pointer;font-weight:800;font-size:16px;
  list-style:none;padding:4px 0;color:#173148;
}
.settings-details > summary.settings-summary::-webkit-details-marker{display:none}
.settings-subhead{margin:16px 0 8px;font-size:15px;font-weight:800;color:#173148}
.settings-qg{border:1px solid var(--border);border-radius:var(--radius-sm);padding:12px;background:#fafdfd}
.settings-row-flex{display:flex;gap:8px;align-items:flex-start;margin-bottom:8px}
.settings-row-flex input{flex:1}
.settings-row-flex .btn{flex-shrink:0}

/* ─── ≥ 1440px Wide Desktop (1680×1050 etc.) ────────────── */
@media(min-width:1440px){
  :root{--gap:22px}
  .container{padding:0 32px 40px}
  .card{padding:24px}
  .title{font-size:20px}
  .subtitle{font-size:16px}
  .table th,.table td{padding:11px 14px}
  .stat-card .stat-num{font-size:42px}
}

/* ─── 1024–1439px Desktop ────────────────────────────────── */
@media(min-width:1024px){
  .container{padding:0 28px 36px}
}

/* ─── 768–1023px Tablet ──────────────────────────────────── */
@media(max-width:1023px) and (min-width:768px){
  :root{--gap:16px}
  .container{padding:0 18px 28px}
  .filter-bar .f-sm{width:120px}
  .filter-bar .f-md{width:148px}
}

/* ─── ≤ 767px Mobile ─────────────────────────────────────── */
@media(max-width:767px){
  :root{--gap:12px}

  body{font-size:14px}

  .container{padding:0 14px 24px}

  /* Topbar mobile layout */
  .topbar{position:sticky;top:0}
  .topbar-inner{
    flex-wrap:wrap;
    height:auto;
    padding:0 14px;
    row-gap:0;
  }
  /* Nav wrap resets height */
  .topbar-inner{height:auto}
  /* Brand row always visible */
  .brand{padding:10px 0;flex:1}
  .brand-sub{display:none}
  .nav-toggle{display:flex;align-items:center;flex-shrink:0}

  /* Nav collapsed by default on mobile */
  .nav{
    display:none;
    width:100%;
    flex-direction:column;gap:4px;
    padding:8px 0 12px;
    border-top:1px solid var(--border);
    background:#fff;
    overflow-x:visible;flex-wrap:wrap;
  }
  .nav.open{display:flex}
  .nav .pill{
    width:100%;justify-content:flex-start;
    min-height:44px;font-size:14px;
    border-radius:var(--radius-xs);
    border-left:none;border-right:none;
    border-radius:8px;
  }

  .page-wrap{padding-top:12px}

  /* Cards */
  .card{padding:14px;border-radius:12px}
  .card-nested{padding:11px}

  /* Typography */
  .title{font-size:16px}
  .subtitle{font-size:14px}

  /* Forms */
  input,select,textarea{min-height:46px;font-size:15px}
  .btn{min-height:46px;font-size:14px;padding:10px 14px;border-radius:var(--radius-xs)}
  .btn.sm{min-height:38px;padding:8px 11px}
  label{font-size:14px}

  /* Filter bar: stack all fields */
  .filter-bar{flex-direction:column;gap:8px}
  .filter-bar .f-sm,
  .filter-bar .f-md,
  .filter-bar .f-xs,
  .filter-bar .f-grow{width:100% !important}
  .filter-bar .field{width:100%}
  .filter-actions{width:100%}
  .filter-actions .btn,.filter-actions a{flex:1;text-align:center;justify-content:center}

  /* Tables: allow scroll, visual cue */
  .table-wrap{border-radius:var(--radius-xs)}
  .table-wrap::after{
    content:"← اسکرول کنید";
    display:block;text-align:center;
    font-size:11px;color:var(--muted);
    padding:6px;border-top:1px solid var(--border);
    background:#fafcfc;
  }
  .table th,.table td{padding:9px 10px;font-size:12px}
  .table .actions-col{min-width:90px}

  /* Stat cards */
  .stat-card{padding:16px 12px}
  .stat-card .stat-num{font-size:28px}

  /* Grid for stats */
  .grid-3{grid-template-columns:1fr 1fr}
}

/* ─── ≤ 480px Small Mobile ───────────────────────────────── */
@media(max-width:480px){
  .container{padding:0 10px 20px}
  .grid-3{grid-template-columns:1fr}
  .steps{gap:5px}
  .step{padding:5px 9px;font-size:11px}
  .pill{font-size:12px;padding:6px 10px;min-height:38px}
  .score-pill{width:30px;height:30px;font-size:13px}
}

/* ─── Reduced Motion ─────────────────────────────────────── */
@media(prefers-reduced-motion:reduce){
  *{transition:none !important;scroll-behavior:auto !important}
}

/* ─── Dark Mode ──────────────────────────────────────────── */
[data-theme="dark"]{
  --bg:#0f1923;
  --card:#162030;
  --text:#e2eaf0;
  --muted:#7fa4b8;
  --border:#1e3448;
  --teal:#0ec8c8;
  --teal2:#06d8f0;
  --teal-light:#0a2535;
  --blue:#a8d0e8;
  --danger:#ef4444;
  --danger-light:#2a1010;
  --warning:#fbbf24;
  --warning-light:#1e1400;
  --success:#34d399;
  --success-light:#0a2018;
  --shadow:0 4px 24px rgba(0,0,0,.3);
  --shadow-sm:0 2px 8px rgba(0,0,0,.2);
  --shadow-md:0 8px 32px rgba(0,0,0,.4);
}
[data-theme="dark"] .topbar{background:#162030}
[data-theme="dark"] input,[data-theme="dark"] select,[data-theme="dark"] textarea{
  background:#0f1923;color:var(--text);border-color:var(--border);
}
[data-theme="dark"] .pill{background:#162030;color:var(--text)}
[data-theme="dark"] .pill.primary{background:var(--teal);color:#fff}
[data-theme="dark"] .pill.danger{background:#162030;color:var(--danger);border-color:var(--danger)}
[data-theme="dark"] .btn.secondary{background:#162030;color:var(--text)}
[data-theme="dark"] .table th{background:#0f1923}
[data-theme="dark"] .table tbody tr:hover td{background:#1a2d3f}
[data-theme="dark"] .filter-bar{background:#0f1923}
[data-theme="dark"] .card-nested{background:#111e2a}
[data-theme="dark"] .qa-block{background:#162030}
[data-theme="dark"] .alert{background:#162030}
[data-theme="dark"] code.kbd{background:#0f1923}

/* ─── Print Styles ───────────────────────────────────────── */
@media print{
  @page{size:A4;margin:10mm}
  html,body{height:auto}
  body{
    background:#fff!important;
    color:#000!important;
    font-family:var(--font-ui)!important;
    font-size:11pt;
    line-height:1.55;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }

  /* Hide screen UI */
  .topbar,.nav-toggle,.nav,footer,
  .btn,.btn-row,.filter-bar,.actions-col,.pagination,
  .pill.primary,.pill.danger,
  form[method="post"],.alert.warn,.is-disabled,
  .empty-state{display:none!important}

  /* Print-only blocks */
  .print-only{display:block!important}
  .screen-only{display:none!important}

  .container{max-width:100%!important;padding:0!important}
  .page-wrap{padding-top:0!important}

  /* Cards become clean sections */
  .card,.card-nested{
    box-shadow:none!important;
    border:1px solid #d1d5db!important;
    border-radius:10px!important;
    background:#fff!important;
    break-inside:avoid;
  }
  .card{padding:12px!important}
  .card-nested{padding:10px!important}

  /* Headings */
  .title{font-size:14pt!important;margin:0 0 6px!important}
  .subtitle{font-size:12pt!important;margin:0 0 6px!important}
  .muted{color:#111827!important}

  /* Tables */
  .table-wrap{overflow:visible!important}
  .table{
    min-width:0!important;
    border-collapse:collapse!important;
  }
  .table th,.table td{
    border:1px solid #e5e7eb!important;
    padding:6px 8px!important;
    vertical-align:top!important;
  }
  .table th{
    background:#f8fafc!important;
    color:#111827!important;
    font-weight:800!important;
    white-space:nowrap;
  }

  /* Badges as simple chips */
  .badge{
    border:1px solid #d1d5db!important;
    background:#f8fafc!important;
    color:#111827!important;
    box-shadow:none!important;
  }

  /* Avoid breaking inside important blocks */
  details,summary{display:none!important}
  .qa-block{break-inside:avoid}

  /* Print header */
  .print-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:10px 12px;
    border:2px solid #0ea5a4;
    border-radius:12px;
    margin:0 0 10px;
  }
  .print-brand{display:flex;align-items:center;gap:10px}
  .print-brand img{width:40px;height:40px;border-radius:10px;object-fit:contain;background:#fff;padding:2px}
  .print-meta{font-size:10pt;color:#111827}
  .print-meta b{font-weight:900}

  .print-summary{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:8px;
  }
  .print-kv{
    border:1px dashed #d1d5db;
    border-radius:10px;
    padding:8px 10px;
    break-inside:avoid;
  }
  .print-k{font-size:9.5pt;color:#374151;margin-bottom:2px}
  .print-v{font-size:11pt;font-weight:900}

  .stats-page .chart-card,
  .stats-page .stats-kpi{break-inside:avoid}
  .stats-page .chart-canvas-wrap{height:220px!important;min-height:200px!important}
}
