/* ============================================================
   UniPlanner — design system (light + dark, responsive, a11y)
   Zero dipendenze: solo font di sistema e CSS.
   ============================================================ */

:root {
  color-scheme: light dark;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --surface-3: #e5e9f4;
  --text: #171a23;
  --text-muted: #596074;
  --text-faint: #7d8497;
  --border: #e1e5f0;
  --border-strong: #cdd3e3;

  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eceefe;
  --brand-contrast: #ffffff;

  --success: #047857;
  --success-soft: #d9f4e8;
  --warning: #a3540a;
  --warning-soft: #fdefd8;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --lode: #7c3aed;
  --lode-soft: #efe7fd;
  --info: #0369a1;
  --info-soft: #e0f2fe;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 26px -18px rgba(16, 24, 40, 0.35);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.32);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10131c;
    --surface: #171b26;
    --surface-2: #1f2432;
    --surface-3: #272d3e;
    --text: #e9ecf5;
    --text-muted: #a5adc2;
    --text-faint: #838ca3;
    --border: #2a3042;
    --border-strong: #3a4159;

    --brand: #8b93ff;
    --brand-strong: #a5abff;
    --brand-soft: #232749;
    --brand-contrast: #10131c;

    --success: #6ee7b7;
    --success-soft: #123528;
    --warning: #fcd34d;
    --warning-soft: #3a2c10;
    --danger: #fca5a5;
    --danger-soft: #3c1a18;
    --lode: #c4b5fd;
    --lode-soft: #2c2450;
    --info: #7dd3fc;
    --info-soft: #102c3e;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px -18px rgba(0, 0, 0, 0.8);
    --ring: 0 0 0 3px rgba(139, 147, 255, 0.4);
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5rem; letter-spacing: -0.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--brand-strong); }

.lede { color: var(--text-muted); max-width: 62ch; }

/* ---------- a11y ---------- */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--brand); color: var(--brand-contrast);
  padding: 10px 16px; border-radius: 0 0 10px 10px;
  font-weight: 600; text-decoration: none; transition: top 0.15s ease;
}
.skip-link:focus { top: 0; }

.noscript-msg { max-width: 560px; margin: 12vh auto; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- struttura ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand-mark { color: var(--brand); display: flex; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-sub { font-size: 0.72rem; color: var(--text-muted); }
.header-badge {
  margin-left: auto; font-size: 0.72rem; font-weight: 600;
  color: var(--success); background: var(--success-soft);
  padding: 5px 10px; border-radius: 999px; border: 1px solid transparent;
}

.app-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }

main { flex: 1; padding: 20px 16px 96px; }
#view-root { max-width: 1120px; margin: 0 auto; }

/* ---------- navigazione ---------- */
.app-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.app-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(6, 1fr);
}
.app-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 58px; padding: 6px 2px;
  color: var(--text-muted); text-decoration: none; font-size: 0.63rem; font-weight: 600;
}
.app-nav a[aria-current="page"] { color: var(--brand-strong); background: var(--brand-soft); }
.nav-icon svg {
  width: 21px; height: 21px; fill: none;
  stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 920px) {
  .app-body { flex-direction: row; }
  .app-nav {
    position: sticky; top: 60px; bottom: auto; left: auto; right: auto;
    width: 224px; flex: 0 0 224px; align-self: flex-start;
    height: calc(100dvh - 60px);
    background: transparent; border-top: 0; border-right: 1px solid var(--border);
    padding: 18px 12px;
  }
  .app-nav ul { display: flex; flex-direction: column; gap: 4px; }
  .app-nav a {
    flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 44px; padding: 8px 12px;
    font-size: 0.92rem; border-radius: var(--radius-sm);
  }
  main { padding: 28px 28px 48px; }
  .nav-icon svg { width: 20px; height: 20px; }
}

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  font: inherit; font-size: 0.9rem; font-weight: 600;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { min-height: 34px; padding: 5px 11px; font-size: 0.82rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-xs);
  color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (max-width: 560px) {
  .btn { min-height: 44px; }
  .icon-btn { width: 40px; height: 40px; }
}

/* ---------- carte e griglie ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 16px; margin-bottom: 16px;
}
.card > header, .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

.stat-grid {
  display: grid; gap: 14px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 3px;
}
.stat-label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-value small { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.stat-sub { font-size: 0.82rem; color: var(--text-muted); }

.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

.section-gap { margin-top: 16px; }

/* ---------- barre di avanzamento ---------- */
.progress {
  height: 9px; background: var(--surface-3); border-radius: 999px;
  overflow: hidden; margin: 8px 0 6px;
}
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.3s ease; }
.progress.success > span { background: var(--success); }
.progress.warning > span { background: var(--warning); }
.progress-meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); }

/* ---------- chip / badge ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-strong); white-space: nowrap;
}
.chip-lode { background: var(--lode-soft); color: var(--lode); }
.chip-idoneo { background: var(--surface-3); color: var(--text-muted); }
.chip-planned { background: var(--warning-soft); color: var(--warning); border: 1px dashed currentColor; }
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-plain { background: var(--surface-2); color: var(--text-muted); font-weight: 600; }
.chip-kind-appello { background: var(--brand-soft); color: var(--brand-strong); }
.chip-kind-scadenza { background: var(--danger-soft); color: var(--danger); }
.chip-kind-esame { background: var(--info-soft); color: var(--info); }
.chip-kind-altro { background: var(--surface-3); color: var(--text-muted); }

/* ---------- elenco prossimi appelli ---------- */
.upcoming-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.upcoming-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.upcoming-item:last-child { border-bottom: 0; }
.date-block {
  flex: 0 0 auto; width: 52px; text-align: center;
  background: var(--surface-2); border-radius: var(--radius-sm); padding: 6px 2px;
}
.date-block .d { display: block; font-size: 1.05rem; font-weight: 700; line-height: 1.1; }
.date-block .m { display: block; font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; }
.date-block.today { background: var(--brand); color: var(--brand-contrast); }
.date-block.today .m { color: inherit; opacity: 0.85; }
.upcoming-body { min-width: 0; flex: 1; }
.upcoming-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- tabelle ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table caption { text-align: left; font-size: 0.82rem; color: var(--text-muted); padding-bottom: 8px; }
.table th {
  text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); padding: 8px 10px; border-bottom: 2px solid var(--border);
}
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tfoot td { font-weight: 700; border-bottom: 0; background: var(--surface-2); }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; }
.exam-name { font-weight: 600; }
.exam-notes { display: block; font-size: 0.78rem; color: var(--text-faint); }

@media (max-width: 720px) {
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }
  .table tr {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 10px; padding: 8px 10px; background: var(--surface);
  }
  .table td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
  .table td::before {
    content: attr(data-label); font-size: 0.74rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
  }
  .table td:first-child { font-size: 1rem; }
  .table td:first-child::before { display: none; }
  .table .num { text-align: left; }
  .table tfoot { display: block; }
  .table tfoot tr { background: var(--surface-2); font-size: 0.88rem; }
  .cell-actions { justify-content: flex-end; }
}

/* ---------- toolbar ---------- */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  margin-bottom: 14px;
}
.toolbar .search { flex: 1 1 220px; min-width: 180px; }
.toolbar-spacer { flex: 1; }

/* ---------- moduli ---------- */
.field { margin-bottom: 14px; }
.field > label, .fieldset-label {
  display: block; font-size: 0.84rem; font-weight: 600; margin-bottom: 5px;
}
.field .hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; font: inherit; font-size: 0.95rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 12px; min-height: 40px;
}
textarea { min-height: 74px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
fieldset { border: 0; margin: 0 0 14px; padding: 0; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.radio-pill span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 7px 16px;
  border: 1px solid var(--border-strong); border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; color: var(--text-muted); background: var(--surface);
}
.radio-pill input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.radio-pill input:focus-visible + span { box-shadow: var(--ring); }
.form-errors {
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid var(--danger); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 12px; font-size: 0.88rem;
}
.form-errors div + div { margin-top: 4px; }

/* ---------- dialog ---------- */
dialog.dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
dialog.dialog::backdrop { background: rgba(10, 12, 20, 0.55); backdrop-filter: blur(2px); }
.dialog-form { padding: 20px; }
.dialog-title { margin-bottom: 14px; font-size: 1.15rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@media (max-width: 560px) {
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions .btn { width: 100%; }
}

/* ---------- calendario ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-toolbar .cal-title { font-size: 1.15rem; font-weight: 700; margin: 0 6px; }
.cal-weekdays, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-weekdays span {
  text-align: center; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted); text-transform: uppercase; padding: 4px 0;
}
.cal-cell {
  min-height: 88px; text-align: left; vertical-align: top;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px 6px; font: inherit; color: var(--text); cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; overflow: hidden;
}
.cal-cell:hover { border-color: var(--brand); }
.cal-cell.other-month { background: var(--surface-2); color: var(--text-faint); }
.cal-cell.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-cell.selected { background: var(--brand-soft); border-color: var(--brand); }
.cal-daynum { font-size: 0.78rem; font-weight: 700; }
.cal-cell.today .cal-daynum {
  background: var(--brand); color: var(--brand-contrast);
  border-radius: 999px; padding: 0 7px; align-self: flex-start;
}
.ev-chip {
  display: flex; align-items: center; gap: 4px; min-width: 0;
  font-size: 0.68rem; font-weight: 600; padding: 1.5px 6px;
  border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong);
}
.ev-chip .ev-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-chip.ev-derived { background: var(--success-soft); color: var(--success); }
.ev-chip.ev-scadenza { background: var(--danger-soft); color: var(--danger); }
.ev-chip.ev-esame { background: var(--info-soft); color: var(--info); }
.ev-chip.ev-altro { background: var(--surface-3); color: var(--text-muted); }
.ev-more { font-size: 0.66rem; color: var(--text-muted); font-weight: 600; }

@media (max-width: 700px) {
  .cal-cell { min-height: 54px; padding: 4px; }
  .cal-grid, .cal-weekdays { gap: 3px; }
  .ev-chip .ev-label { display: none; }
  .ev-chip { width: 7px; height: 7px; padding: 0; border-radius: 50%; flex: 0 0 auto; }
  .ev-more { display: none; }
  .cal-weekdays span { font-size: 0.62rem; }
}

.day-panel { margin-top: 14px; }
.day-events { list-style: none; margin: 0; padding: 0; }
.day-events li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--border);
}
.day-events li:last-child { border-bottom: 0; }
.day-events .ev-body { flex: 1; min-width: 0; }
.day-events .ev-title { font-weight: 600; }
.day-events .ev-meta { font-size: 0.8rem; color: var(--text-muted); }

/* ---------- simulazioni ---------- */
.result-panel {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin-top: 12px;
}
.result-big { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.result-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-top: 10px; }
.result-item { font-size: 0.85rem; color: var(--text-muted); }
.result-item strong { display: block; font-size: 1.05rem; color: var(--text); }
.verdict { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius-sm); font-size: 0.92rem; }
.verdict-feasible { background: var(--success-soft); color: var(--success); }
.verdict-impossible { background: var(--danger-soft); color: var(--danger); }
.verdict-easy { background: var(--info-soft); color: var(--info); }
.verdict-none { background: var(--surface-3); color: var(--text-muted); }
.verdict strong { display: block; }
.delta-up { color: var(--success); font-weight: 700; }
.delta-down { color: var(--danger); font-weight: 700; }
.delta-flat { color: var(--text-muted); font-weight: 700; }

.seg-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden; }
.seg-toggle button {
  font: inherit; font-size: 0.84rem; font-weight: 600; border: 0;
  background: var(--surface); color: var(--text-muted);
  padding: 7px 14px; min-height: 38px; cursor: pointer;
}
.seg-toggle button[aria-pressed="true"] { background: var(--brand); color: var(--brand-contrast); }

/* ---------- studio ---------- */
.task-list { list-style: none; margin: 0; padding: 0; }
.task-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.task-item:last-child { border-bottom: 0; }
.task-check {
  width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--brand); cursor: pointer;
}
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; }
.task-item.done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 140px; margin-top: 8px; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.week-bar-track { width: 100%; max-width: 44px; height: 100%; display: flex; align-items: flex-end; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.week-bar { width: 100%; background: var(--brand); border-radius: 6px 6px 0 0; min-height: 2px; }
.week-bar.done-part { background: var(--success); }
.week-label { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; text-align: center; }
.week-min { font-size: 0.66rem; color: var(--text-faint); }

/* ---------- impostazioni ---------- */
.settings-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 980px) { .settings-grid { grid-template-columns: 1fr 1fr; } .settings-grid .span-all { grid-column: 1 / -1; } }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; flex: 1 1 150px; }
.note-box {
  background: var(--warning-soft); color: var(--warning);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 0.85rem; margin-top: 12px;
}
.note-box strong { display: block; }
.info-box {
  background: var(--info-soft); color: var(--info);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 0.85rem;
}
.rule-list { margin: 0; padding-left: 18px; font-size: 0.88rem; color: var(--text-muted); }
.rule-list li { margin-bottom: 5px; }
.action-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.storage-meter { font-size: 0.82rem; color: var(--text-muted); }

/* ---------- empty state ---------- */
.empty {
  text-align: center; padding: 34px 16px; color: var(--text-muted);
  background: var(--surface-2); border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.empty .empty-icon { font-size: 1.9rem; display: block; margin-bottom: 6px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* ---------- toast ---------- */
.toast-region {
  position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: calc(100vw - 32px);
}
.toast {
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: 0.88rem; font-weight: 600;
  box-shadow: var(--shadow); animation: toast-in 0.18s ease; max-width: 100%;
}
.toast.ok { background: var(--success); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
@media (min-width: 920px) { .toast-region { bottom: 24px; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- varie ---------- */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.muted { color: var(--text-muted); }
.small { font-size: 0.84rem; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.mt-0 { margin-top: 0; }
.nowrap { white-space: nowrap; }
