/* ==========================================================================
   GESTIONALE ARTIGIANI — DESIGN SYSTEM
   Ispirazione: Stripe / Linear / Tailwind UI. Sobrio, leggibile, orientato ai dati.

   Indice
   1. Design tokens (colori, tipografia, spaziature, ombre)
   2. Reset e base tipografica
   3. Layout applicazione (sidebar, contenuto, header pagina)
   4. Card
   5. Pulsanti (gerarchia: primary > secondary > danger)
   6. Form e campi
   7. Tabelle dati
   8. Badge e alert
   9. Modali (header / body / footer, overlay con blur)
  10. Toast
  11. Utility
  12. Responsive
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Tipografia */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  /* Neutri (scala Slate) */
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  /* Brand — indigo desaturato / navy */
  --brand-50:  #f0f2fa;
  --brand-100: #e0e4f4;
  --brand-200: #c3caea;
  --brand-500: #4a5aa8;
  --brand-600: #3b4a8f;
  --brand-700: #2f3b75;
  --brand-800: #252f5e;

  /* Semantici */
  --success-fg: #047857;  --success-bg-soft: #ecfdf5;  --success-border: #a7f3d0;  --success-solid: #059669;
  --warning-fg: #b45309;  --warning-bg-soft: #fffbeb;  --warning-border: #fde68a;  --warning-solid: #d97706;
  --danger-fg:  #b91c1c;  --danger-bg-soft:  #fef2f2;  --danger-border:  #fecaca;  --danger-solid:  #be123c;
  --info-fg:    #0e7490;  --info-bg-soft:    #ecfeff;  --info-border:    #a5f3fc;  --info-solid:    #0891b2;

  /* Alias legacy (usati dai template esistenti: NON rimuovere) */
  --primary: var(--brand-600);
  --primary-hover: var(--brand-700);
  --primary-light: var(--brand-50);
  --text-main: var(--slate-900);
  --text-muted: var(--slate-500);
  --bg-app: var(--slate-50);
  --bg-card: #ffffff;
  --border: var(--slate-200);
  --border-strong: var(--slate-300);
  --border-focus: var(--brand-500);
  --success: var(--success-fg);
  --success-bg: var(--success-bg-soft);
  --warning: var(--warning-fg);
  --warning-bg: var(--warning-bg-soft);
  --danger: var(--danger-fg);
  --danger-bg: var(--danger-bg-soft);

  /* Forma e profondità */
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-xs: 0 1px 2px 0 rgb(15 23 42 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(15 23 42 / 0.08), 0 1px 2px -1px rgb(15 23 42 / 0.06);
  --shadow:    0 4px 6px -1px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.06);
  --shadow-lg: 0 20px 25px -5px rgb(15 23 42 / 0.14), 0 8px 10px -6px rgb(15 23 42 / 0.10);
  --ring: 0 0 0 3px rgb(74 90 168 / 0.22);

  /* Dimensioni layout */
  --sidebar-w: 248px;
}

/* --------------------------------------------------------------------------
   2. RESET E BASE TIPOGRAFICA
   Scala: Page title 1.5rem · H2 1.125rem · H3 1rem · corpo 0.9375rem
          tabella 0.875rem · micro-copy 0.75rem
   -------------------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}

h1, h2, h3, h4 { color: var(--slate-900); letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; font-weight: 650; line-height: 1.35; }
h3 { font-size: 1rem;     font-weight: 600; line-height: 1.4; }
h4 { font-size: 0.9rem;   font-weight: 600; line-height: 1.4; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-800); text-decoration: underline; }
a.btn, a.nav-link, a.brand { text-decoration: none; }

code, kbd, pre { font-family: var(--font-mono); font-size: 0.875em; }

::selection { background: var(--brand-100); color: var(--brand-800); }

/* Importi e codici: monospace uniforme anche dove i template usano stili inline */
[style*="font-family: monospace"],
.mono, .num {
  font-family: var(--font-mono) !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   3. LAYOUT APPLICAZIONE
   -------------------------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background-color: var(--slate-900);
  color: var(--slate-50);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: flex-start;
  overflow-y: auto;
  border-right: 1px solid rgb(255 255 255 / 0.04);
}

.brand {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #ffffff;
}
.brand:hover { color: #ffffff; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  font-size: 1rem;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.15);
}

.nav-section {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate-500);
  margin: 1.1rem 0.75rem 0.4rem;
}
.nav-section:first-of-type { margin-top: 0; }

.nav-links { list-style: none; display: flex; flex-direction: column; gap: 0.15rem; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--slate-400);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.nav-link:hover { background-color: rgb(255 255 255 / 0.06); color: #ffffff; }
.nav-link.active {
  background-color: rgb(255 255 255 / 0.10);
  color: #ffffff;
  box-shadow: inset 2px 0 0 var(--brand-200);
}

.main-content {
  flex: 1;
  min-width: 0;               /* evita overflow orizzontale di tabelle larghe nei flex */
  padding: 1.75rem 2.25rem 3rem;
  max-width: 1280px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--slate-900);
}

/* Barra azioni: azioni contestuali in alto a destra, distruttive isolate in fondo */
.page-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.action-divider { width: 1px; align-self: stretch; min-height: 1.5rem; background: var(--border-strong); margin: 0 0.25rem; }

/* --------------------------------------------------------------------------
   4. CARD
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--slate-100);
  padding-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   5. PULSANTI
   Gerarchia: 1 solo .btn-primary per blocco · .btn-secondary per le alternative
              .btn-danger / .btn-danger-outline SOLO per eliminazioni e annullamenti critici
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.95rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, color 0.12s ease;
  user-select: none;
}
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled], .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background-color: var(--brand-600); border-color: var(--brand-600); color: #ffffff; box-shadow: var(--shadow-xs); }
.btn-primary:hover { background-color: var(--brand-700); border-color: var(--brand-700); color: #ffffff; }

.btn-secondary { background-color: #ffffff; border-color: var(--border-strong); color: var(--slate-700); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background-color: var(--slate-50); border-color: var(--slate-400); color: var(--slate-900); }

.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-900); }

.btn-danger { background-color: var(--danger-solid); border-color: var(--danger-solid); color: #ffffff; box-shadow: var(--shadow-xs); }
.btn-danger:hover { background-color: #9f1239; border-color: #9f1239; color: #ffffff; }
.btn-danger:focus-visible { box-shadow: 0 0 0 3px rgb(190 18 60 / 0.25); }

.btn-danger-outline { background-color: #ffffff; border-color: var(--danger-border); color: var(--danger-fg); }
.btn-danger-outline:hover { background-color: var(--danger-bg-soft); border-color: #fca5a5; color: #991b1b; }

.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.8125rem; border-radius: 6px; }
.btn-lg { padding: 0.65rem 1.25rem; font-size: 0.9375rem; }
.btn-icon { padding: 0.35rem 0.55rem; min-width: 2rem; }

/* --------------------------------------------------------------------------
   6. FORM E CAMPI
   -------------------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group.col-span-2 { grid-column: span 2; }

label, .form-label { font-size: 0.8125rem; font-weight: 600; color: var(--slate-700); }
.form-hint { font-size: 0.75rem; color: var(--text-muted); }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
select, textarea {
  font-family: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-main);
  background-color: #ffffff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input::placeholder, textarea::placeholder { color: var(--slate-400); }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--slate-400); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--ring); }
input:disabled, select:disabled, textarea:disabled { background: var(--slate-100); color: var(--slate-500); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand-600); }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="file"] { font-size: 0.85rem; }

.form-control { width: 100%; }
textarea.form-control { resize: vertical; }

/* --------------------------------------------------------------------------
   7. TABELLE DATI
   Valori economici: classe .num (monospace, a destra). Azioni di riga: .row-actions
   -------------------------------------------------------------------------- */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.875rem; }

th {
  padding: 0.65rem 1rem;
  background-color: var(--slate-50);
  color: var(--slate-500);
  font-size: 0.7188rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 0.1s ease; }
tbody tr:hover td { background-color: var(--slate-50); }

th.num, td.num, th[style*="text-align: right"], td[style*="text-align: right"] { text-align: right; }
td.num { white-space: nowrap; }

.row-actions { display: inline-flex; gap: 0.25rem; justify-content: flex-end; align-items: center; }

/* --------------------------------------------------------------------------
   8. BADGE E ALERT
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--slate-100);
  color: var(--slate-700);
}
.badge-success { background: var(--success-bg-soft); color: var(--success-fg); }
.badge-warning { background: var(--warning-bg-soft); color: var(--warning-fg); }
.badge-danger  { background: var(--danger-bg-soft);  color: var(--danger-fg); }
.badge-info    { background: var(--info-bg-soft);    color: var(--info-fg); }
.badge-brand   { background: var(--brand-50);        color: var(--brand-700); }
.badge-neutral { background: var(--slate-100);       color: var(--slate-600); }

.badge-private { background: var(--info-bg-soft); color: var(--info-fg); }
.badge-company { background: var(--warning-bg-soft); color: var(--warning-fg); }
.badge-condominium { background: var(--brand-50); color: var(--brand-700); }

.alert { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem 1.1rem; border-radius: var(--radius); border: 1px solid; font-size: 0.875rem; margin-bottom: 1.25rem; }
.alert-success { background: var(--success-bg-soft); border-color: var(--success-border); color: var(--success-fg); }
.alert-warning { background: var(--warning-bg-soft); border-color: var(--warning-border); color: var(--warning-fg); }
.alert-danger  { background: var(--danger-bg-soft);  border-color: var(--danger-border);  color: var(--danger-fg); }
.alert-info    { background: var(--info-bg-soft);    border-color: var(--info-border);    color: var(--info-fg); }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   9. MODALI — overlay sfocato + header / body / footer distinti
   Footer: "Annulla" (secondary) a sinistra del pulsante primario, allineati a destra.
   Gli overlay legacy (position: fixed; inset: 0) ereditano overlay, blur e scroll.
   -------------------------------------------------------------------------- */
.modal-overlay,
[style*="position: fixed"][style*="inset: 0"] {
  background: rgb(15 23 42 / 0.6) !important;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  padding: 1.25rem;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active,
.modal-overlay[style*="display: block"],
.modal-overlay[style*="display: flex"] {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.modal-card {
  width: 100%;
  max-width: 580px;
  margin: auto;
  max-height: calc(100vh - 2.5rem);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid var(--border);
  animation: modalPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-card.modal-sm { max-width: 440px; }
.modal-card.modal-lg { max-width: 720px; }

@keyframes modalPopIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1.0625rem; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 0.5rem; }
.modal-subtitle { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.15rem; font-weight: 400; }
.modal-close {
  background: none; border: none; cursor: pointer; color: var(--slate-400);
  font-size: 1.25rem; line-height: 1; padding: 0.25rem 0.4rem; border-radius: 6px;
}
.modal-close:hover { background: var(--slate-100); color: var(--slate-700); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--slate-50);
}

/* Card dentro overlay legacy: ombra e raggio coerenti (le larghezze inline restano rispettate) */
[style*="position: fixed"][style*="inset: 0"] > .card {
  box-shadow: var(--shadow-lg);
  border-radius: 14px;
}

/* --------------------------------------------------------------------------
   10. TOAST & NOTIFICA POP-UP IN SOVRAIMPRESSIONE
   -------------------------------------------------------------------------- */
.toast-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9998;
  animation: fadeIn 0.2s ease-out;
}

.toast-popup {
  position: fixed;
  top: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(520px, calc(100vw - 2rem));
  background: #ffffff;
  border: 1px solid var(--border);
  border-top: 4px solid var(--success-solid);
  border-radius: 14px;
  box-shadow: 0 25px 30px -5px rgba(0, 0, 0, 0.25), 0 12px 15px -6px rgba(0, 0, 0, 0.15);
  animation: toastPopupIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes toastPopupIn {
  from {
    opacity: 0;
    transform: translate(-50%, -24px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.toast-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--slate-100);
}

.toast-popup-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.toast-popup-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.01em;
}

.toast-popup-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--slate-400);
  font-size: 1.15rem;
  line-height: 1;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.toast-popup-close:hover {
  background: var(--slate-100);
  color: var(--slate-700);
}

.toast-popup-body {
  padding: 1rem 1.25rem;
}

.toast-popup-item-tag {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.toast-popup-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 6px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.toast-popup-desc {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--slate-800);
  line-height: 1.4;
}

.toast-popup-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  background: var(--slate-50);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
}

.toast-popup-stat {
  display: flex;
  flex-direction: column;
}

.toast-popup-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
  margin-bottom: 0.15rem;
}

.toast-popup-stat-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--slate-800);
}

.toast-popup-stat-highlight {
  background: #ffffff;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
}

.toast-popup-stat-highlight .toast-popup-stat-label {
  color: #047857;
  font-weight: 700;
}

.toast-popup-stat-highlight .toast-popup-stat-val {
  color: #065f46;
  font-weight: 700;
}

.toast-popup-footer {
  padding: 0.75rem 1.25rem 1rem;
  background: #ffffff;
}

.toast {
  position: fixed;
  top: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: min(480px, calc(100vw - 2.5rem));
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.85rem 1rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--success-solid);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  color: var(--slate-800);
  animation: toastCenterIn 0.25s ease-out;
}
.toast-warning { border-left-color: var(--warning-solid); }
.toast-danger  { border-left-color: var(--danger-solid); }
.toast-info    { border-left-color: var(--info-solid); }
.toast-icon  { font-size: 1.15rem; line-height: 1.3; }
.toast-content { flex: 1; min-width: 0; word-break: break-word; }
.toast-title { font-size: 0.875rem; font-weight: 650; color: var(--slate-900); }
.toast-body  { font-size: 0.8125rem; color: var(--slate-600); margin-top: 0.15rem; }
.toast-meta  { font-size: 0.75rem; color: var(--slate-500); margin-top: 0.35rem; }
.toast-meta strong { color: var(--slate-800); font-family: var(--font-mono); font-weight: 600; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--slate-400); font-size: 1rem; line-height: 1; padding: 0.15rem; border-radius: 4px; }
.toast-close:hover { color: var(--slate-700); background: var(--slate-100); }

@keyframes toastCenterIn { from { transform: translate(-50%, -15px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes toastIn { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateY(-12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --------------------------------------------------------------------------
   11. UTILITY
   -------------------------------------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-sm { font-size: 0.8125rem; }
.text-xs { font-size: 0.75rem; }
.fw-600 { font-weight: 600; }
.actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.actions-end { justify-content: flex-end; }

details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* Scrollbar discrete */
* { scrollbar-width: thin; scrollbar-color: var(--slate-300) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--slate-300); border-radius: 9999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--slate-400); background-clip: content-box; border: 2px solid transparent; }

/* --------------------------------------------------------------------------
   12. RESPONSIVE
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .main-content { padding: 1.5rem 1.25rem 2.5rem; }
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 0.75rem 1rem;
    border-right: none;
    border-bottom: 1px solid rgb(255 255 255 / 0.06);
  }
  .brand { margin: 0 0 0.6rem; }
  .nav-section { display: none; }
  .nav-links { flex-direction: row; flex-wrap: wrap; gap: 0.25rem; }
  .nav-link { padding: 0.35rem 0.65rem; font-size: 0.8125rem; }
  .nav-link.active { box-shadow: none; }

  .main-content { padding: 1rem; max-width: 100vw; }
  .page-header { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .page-actions { justify-content: flex-start; }
  .card { padding: 1.1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.col-span-2 { grid-column: span 1; }
  .modal-body, .modal-header { padding-left: 1.1rem; padding-right: 1.1rem; }
  .modal-footer { padding-left: 1.1rem; padding-right: 1.1rem; flex-wrap: wrap; }
}

@media print {
  .sidebar, .global-header, .toast { display: none !important; }
  .main-content { padding: 0; max-width: none; }
}
