/* Kitab Ghar — application design system.
   Hand-written, no build step (this app deploys as plain files to shared
   hosting) — one file, organized as tokens -> base -> layout -> components. */

:root {
  --bg: #F7F2E7;
  --surface: #FFFFFF;
  --surface-alt: #EFE8D6;
  --surface-raised: #FFFFFF;
  --border: #E2D9C2;
  --border-strong: #CBBC98;
  --text: #221E13;
  --text-muted: #5E5642;
  --text-faint: #8D8265;
  --primary: #1F6F4A;
  --primary-hover: #17593C;
  --primary-soft: #E3EFE1;
  --primary-ink: #FFFFFF;
  --accent-gold: #A9791F;
  --accent-gold-soft: #F5EAD1;
  --danger: #B3261E;
  --danger-soft: #FBE8E2;
  --warning: #96650A;
  --warning-soft: #FAEED2;
  --info: #2A5D8A;
  --info-soft: #E4EDF3;
  --lost: #8A4EA6;
  --lost-soft: #F0E6F3;
  --focus-ring: #1F6F4A;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-xs: 0 1px 1px rgba(35, 27, 10, .05);
  --shadow-sm: 0 1px 2px rgba(35, 27, 10, .06), 0 1px 1px rgba(35, 27, 10, .05);
  --shadow-md: 0 10px 28px -10px rgba(35, 27, 10, .22), 0 2px 8px -2px rgba(35, 27, 10, .10);
  --shadow-lg: 0 22px 52px -16px rgba(35, 27, 10, .32);
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16130B;
    --surface: #201A10;
    --surface-alt: #271F13;
    --surface-raised: #241D12;
    --border: #372C1B;
    --border-strong: #4C3E27;
    --text: #F0EADC;
    --text-muted: #B7AC8D;
    --text-faint: #8C8065;
    --primary: #6FBF8E;
    --primary-hover: #86CC9F;
    --primary-soft: #223223;
    --primary-ink: #0B140D;
    --accent-gold: #D9B15C;
    --accent-gold-soft: #332815;
    --danger: #E5897C;
    --danger-soft: #3B241B;
    --warning: #E0AC5C;
    --warning-soft: #392B16;
    --info: #8FB6D9;
    --info-soft: #23303A;
    --lost: #C79EDA;
    --lost-soft: #2D2432;
    --focus-ring: #6FBF8E;
    --shadow-xs: 0 1px 1px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 8px 24px -10px rgba(0, 0, 0, .55), 0 2px 6px -2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 20px 48px -16px rgba(0, 0, 0, .7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 100% -8%, color-mix(in srgb, var(--primary) 7%, transparent), transparent 60%),
    radial-gradient(800px 500px at -5% 105%, color-mix(in srgb, var(--accent-gold) 5%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 700; letter-spacing: -.014em; text-wrap: balance; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--primary); }
code, .mono { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--primary-soft); color: var(--primary); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn {
  display: none;
  width: 38px; height: 38px; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; transition: background .15s var(--ease);
}
.topbar .menu-btn:hover { background: var(--surface-alt); }
.topbar .brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 1.08rem; letter-spacing: -.01em; text-decoration: none; color: var(--text); white-space: nowrap; }
.topbar .brand img { border-radius: 8px; display: block; box-shadow: var(--shadow-xs); }
.topbar .spacer { flex: 1; }

.dept-switcher { position: relative; }
.dept-switcher select {
  appearance: none; -webkit-appearance: none;
  font-size: .82rem; font-weight: 600; padding: 7px 30px 7px 12px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface-alt); color: var(--text);
  cursor: pointer;
}
.dept-switcher::after {
  content: ""; position: absolute; right: 11px; top: 50%; width: 7px; height: 7px;
  border-right: 1.6px solid var(--text-muted); border-bottom: 1.6px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg); pointer-events: none;
}
.role-badge {
  font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-gold); background: var(--accent-gold-soft); padding: 3px 8px; border-radius: 999px;
}

.topbar .welcome { display: flex; align-items: center; gap: 10px; font-size: .86rem; color: var(--text-muted); text-align: right; line-height: 1.3; white-space: nowrap; }
.topbar .welcome strong { color: var(--text); font-weight: 700; }
.topbar .welcome a { color: var(--text-muted); text-decoration: none; }
.topbar .welcome a:hover { color: var(--primary); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: .74rem; font-weight: 800; flex: none;
}

.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 16px 12px 90px; z-index: 20;
}
.nav-group { margin-bottom: 2px; }
.nav-group-flat { margin-bottom: 6px; }
.nav-group-header {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: none; border: none; cursor: pointer; font: inherit; text-align: left;
  padding: 10px 12px; margin-top: 2px;
  font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-faint);
  border-radius: var(--radius-sm);
  transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-group-header:hover { color: var(--text-muted); background: var(--surface-alt); }
.nav-group-header svg { width: 14px; height: 14px; flex: none; opacity: .7; transition: transform .18s var(--ease); }
.nav-group.collapsed .nav-group-header svg { transform: rotate(-90deg); }
.nav-group.has-active .nav-group-header { color: var(--primary); }
.nav-group-header-right { display: flex; align-items: center; gap: 6px; flex: none; }
.nav-badge {
  flex: none; background: var(--accent-gold); color: var(--surface);
  font-size: .68rem; font-weight: 800; padding: 1px 6px; border-radius: 999px; line-height: 1.5;
}
.nav-item .nav-badge { margin-left: auto; }
.nav-group-items {
  max-height: 600px; overflow: hidden; opacity: 1;
  transition: max-height .2s var(--ease), opacity .15s var(--ease);
}
.nav-group.collapsed .nav-group-items { max-height: 0; opacity: 0; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none; font-size: .89rem; font-weight: 550;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.nav-item svg { flex: none; width: 18px; height: 18px; opacity: .8; transition: opacity .14s var(--ease); }
.nav-item:hover { background: var(--surface-alt); color: var(--text); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.sidebar-divider { height: 1px; background: var(--border); margin: 12px 4px; }

.sidebar-scrim {
  display: none; position: fixed; inset: 0; background: rgba(10, 14, 8, .45); z-index: 19;
  backdrop-filter: blur(2px);
}

.main {
  margin-left: var(--sidebar-w);
  padding: 34px 36px 70px;
  max-width: 1320px;
}

.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 28px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { display: flex; align-items: center; gap: 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--primary); font-weight: 800; margin-bottom: 6px; }
.page-header h1 { margin-bottom: 0; }
.page-desc { color: var(--text-muted); font-size: .9rem; margin: 6px 0 0; max-width: 62ch; }

@media (max-width: 960px) {
  .topbar .menu-btn { display: inline-flex; }
  .sidebar {
    left: calc(-1 * var(--sidebar-w)); transition: left .2s var(--ease); box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .sidebar-scrim.open { display: block; }
  .main { margin-left: 0; padding: 20px 16px 52px; }
  .topbar .welcome span.welcome-text { display: none; }
  .topbar .brand .brand-text { display: none; }
  .topbar { gap: 8px; padding: 0 12px; }
  .dept-switcher select { max-width: 118px; padding-right: 26px; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: .87rem; font-weight: 650;
  cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease), box-shadow .16s var(--ease);
}
.btn svg { flex: none; width: 16px; height: 16px; }
.btn:hover { background: var(--surface-alt); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary {
  background: linear-gradient(155deg, color-mix(in srgb, var(--primary) 92%, white 8%), var(--primary));
  border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 1px 2px rgba(35,27,10,.14);
}
.btn-primary:hover {
  background: linear-gradient(155deg, color-mix(in srgb, var(--primary-hover) 92%, white 8%), var(--primary-hover));
  border-color: var(--primary-hover); box-shadow: var(--shadow-md); transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(1px); }
.btn-danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-alt); box-shadow: none; }
.btn-sm { padding: 7px 13px; font-size: .8rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; flex: none; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-strong); }
.btn-group .btn { border: none; border-radius: 0; }
.btn-group .btn:hover { transform: none; box-shadow: none; }
.btn-group .btn + .btn { border-left: 1px solid var(--border-strong); }
.btn-group .btn.is-active { background: var(--primary-soft); color: var(--primary); }

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: .82rem; font-weight: 650; color: var(--text-muted); margin-bottom: 7px; }
.field .hint { font-size: .76rem; color: var(--text-faint); margin-top: 6px; line-height: 1.5; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], input[type="email"], input[type="file"],
select, textarea {
  width: 100%; padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: .9rem; font-family: inherit;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input:read-only { background: var(--surface-alt); color: var(--text-muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus-ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 18%, transparent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
fieldset.group { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 18px; }
fieldset.group legend { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: 0 6px; }

/* ---------- Cards / surfaces ---------- */
.card { background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 26px 28px; box-shadow: var(--shadow-md); }
.card + .card { margin-top: 18px; }
.card-title { display: flex; align-items: center; gap: 9px; font-size: .95rem; font-weight: 700; margin-bottom: 18px; }
.card-title svg { width: 17px; height: 17px; color: var(--primary); flex: none; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.center-page { display: flex; min-height: calc(100vh - var(--topbar-h) - 40px); align-items: flex-start; justify-content: center; padding-top: 40px; }
.narrow { max-width: 640px; margin: 0 auto; width: 100%; }

/* ---------- Badges / status ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: .73rem; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--primary-soft); color: var(--primary); }
.badge-warn { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-lost { background: var(--lost-soft); color: var(--lost); }
.badge-neutral { background: var(--surface-alt); color: var(--text-muted); }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: flex-start; gap: 10px; border-radius: var(--radius-sm); padding: 12px 14px; font-size: .87rem; border: 1px solid transparent; margin-bottom: 16px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-ok { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }

/* ---------- Stat tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-tile {
  position: relative; overflow: hidden; display: block;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px 22px; box-shadow: var(--shadow-md);
  color: inherit; text-decoration: none; transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
a.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-tile::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 40%, var(--accent-gold)));
}
.stat-tile-warn::after { background: linear-gradient(90deg, var(--danger), color-mix(in srgb, var(--danger) 40%, var(--accent-gold))); }
.stat-tile .icon {
  position: absolute; z-index: 1; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(150deg, var(--primary-soft), color-mix(in srgb, var(--primary-soft) 45%, var(--surface-raised)));
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 12%, transparent);
}
.stat-tile .icon svg { width: 17px; height: 17px; }
.stat-tile-warn .icon { color: var(--danger); background: linear-gradient(150deg, var(--danger-soft), color-mix(in srgb, var(--danger-soft) 45%, var(--surface-raised))); }
.stat-tile .num { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat-tile .label { font-size: .8rem; color: var(--text-muted); margin-top: 4px; font-weight: 550; }
.stat-tile .delta { display: inline-flex; align-items: center; gap: 3px; font-size: .74rem; font-weight: 700; margin-top: 9px; }
.stat-tile .delta svg { width: 11px; height: 11px; }
.stat-tile .delta-good { color: var(--primary); }
.stat-tile .delta-bad { color: var(--danger); }
.stat-tile .delta-neutral { color: var(--text-faint); }
.chart-card canvas { max-width: 100%; }

/* ---------- Tables (plain + DataTables) ---------- */
.table-wrap { overflow-x: auto; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }
table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); background: var(--surface-alt); padding: 13px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--surface-alt); }
.cover-thumb { width: 34px; height: 46px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); box-shadow: var(--shadow-xs); background: var(--surface-alt); flex: none; }
.cover-thumb-placeholder {
  width: 34px; height: 46px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-alt);
  display: flex; align-items: center; justify-content: center; color: var(--text-faint); flex: none;
}
.cover-thumb-placeholder svg { width: 15px; height: 15px; }

/* DataTables 3.x class names (dt-container etc.) — not the legacy
   dataTables_wrapper names still shown in a lot of docs/examples.
   Its own stylesheet styles .dt-input via `div.dt-container .dt-search
   input`, which out-specifies a plain `.dt-search .dt-input` rule here —
   DataTables exposes --dt-input_* custom properties for exactly this,
   so set those instead of fighting the selector. */
div.dt-container {
  padding: 20px 22px; color: var(--text); font-family: var(--font-sans);
  --dt-input_border: 1px solid var(--border-strong);
  --dt-input_border-radius: var(--radius-sm);
  --dt-input_padding: 7px 11px;
  --dt-input_background: var(--surface);
  --dt-input_color: var(--text);
}
.dt-search .dt-input, .dt-length select { margin-left: 6px; transition: border-color .14s var(--ease), box-shadow .14s var(--ease); }
.dt-search .dt-input:focus, .dt-length select:focus { outline: none; border-color: var(--focus-ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus-ring) 20%, transparent); }
.dt-info, .dt-search, .dt-length { color: var(--text-muted) !important; font-size: .82rem; }
table.dataTable thead th { background: var(--surface-alt); color: var(--text-faint); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border) !important; padding: 13px 16px !important; }
table.dataTable tbody td { border-bottom: 1px solid var(--border); color: var(--text); padding: 12px 16px; }
table.dataTable.cell-border tbody td, table.dataTable.cell-border thead th { border-right: 1px solid var(--border); }
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control::before { background-color: var(--primary); }
.dt-button, .dataTables-button {
  background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important; padding: 7px 15px !important; font-size: .78rem !important; margin-right: 6px !important;
  font-weight: 600 !important; transition: background .14s var(--ease), border-color .14s var(--ease) !important;
}
.dt-button:hover, .dataTables-button:hover { background: var(--surface-alt) !important; }

/* ---------- Loading / empty states ---------- */
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 70px 20px; color: var(--text-muted); }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--primary); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 48px 20px; color: var(--text-faint); font-size: .9rem; }
.empty-state svg { width: 32px; height: 32px; opacity: .5; }

/* ---------- Timeline (activity log) ---------- */
.timeline { display: flex; flex-direction: column; }
.timeline-row { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline-row:last-child { border-bottom: none; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 7px; flex: none; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-body .headline { font-size: .87rem; }
.timeline-body .headline strong { font-weight: 700; }
.timeline-body .meta { font-size: .76rem; color: var(--text-faint); margin-top: 2px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 14, 8, .5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; padding: 22px 24px;
  animation: modal-in .15s var(--ease);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-title { font-size: 1.02rem; font-weight: 700; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed; bottom: 22px; right: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 360px;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 13px 14px; font-size: .87rem; line-height: 1.4;
  animation: toast-in .22s var(--ease);
}
.toast.leaving { animation: toast-out .16s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px); } }
.toast-icon {
  flex: none; width: 20px; height: 20px; border-radius: 50%; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
}
.toast-icon svg { width: 12px; height: 12px; }
.toast-ok .toast-icon { background: var(--primary-soft); color: var(--primary); }
.toast-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-info .toast-icon { background: var(--info-soft); color: var(--info); }
.toast-body { flex: 1; min-width: 0; color: var(--text); padding-top: 1px; }
.toast-close {
  flex: none; background: none; border: none; cursor: pointer; color: var(--text-faint);
  padding: 2px; line-height: 0; border-radius: 4px; transition: color .14s var(--ease);
}
.toast-close:hover { color: var(--text); }
.toast-close svg { width: 12px; height: 12px; }
@media (max-width: 480px) {
  .toast-container { left: 12px; right: 12px; bottom: 12px; max-width: none; }
}

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); font-weight: 600; }
.text-faint { color: var(--text-faint); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
