/* ============================================================
   ISOPLUS360 - Sistema de Gestión de Calidad
   Estilos principales - Paleta clara y profesional
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Paleta principal - azul corporativo suave */
  --primary:       #1e6fa8;
  --primary-light: #e8f3fb;
  --primary-dark:  #155a8a;
  --secondary:     #0d9488;
  --accent:        #f59e0b;

  /* Semáforos */
  --verde:    #16a34a;
  --amarillo: #d97706;
  --rojo:     #dc2626;
  --azul:     #2563eb;

  /* Neutros */
  --bg:         #f0f4f8;
  --surface:    #ffffff;
  --surface2:   #f8fafc;
  --border:     #e2e8f0;
  --border2:    #cbd5e1;
  --text:       #1e293b;
  --text-2:     #475569;
  --text-3:     #94a3b8;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:  0 10px 30px rgba(0,0,0,.12);

  /* Layout */
  --sidebar-w:  260px;
  --header-h:   64px;
  --radius:     10px;
  --radius-sm:  6px;
  --radius-lg:  16px;

  /* Aliases semánticos usados en módulos */
  --text-primary:   #1e293b;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --success:        #16a34a;
  --warning:        #d97706;
  --danger:         #dc2626;
  --warning-dark:   #b45309;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.06);
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      16px;
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'DM Mono', monospace;
}

/* Reset de links en toda la app (evita el azul/morado del navegador) */
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

/* Sidebar links específicamente */
.sidebar a,
.sidebar button { color: var(--text-secondary, #475569); text-decoration: none; }



html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: .85rem;
}

.sidebar-logo-text { font-size: 1rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.sidebar-logo-sub  { font-size: .65rem; color: var(--text-3); font-weight: 400; }

.sidebar-empresa {
  padding: 12px 16px;
  margin: 8px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  color: var(--primary);
  font-weight: 500;
}

.sidebar-section {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 14px 4px;
  font-size: .6875rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--text-3);
  font-weight: 700;
  margin-top: 2px;
  /* separador visual sutil entre grupos */
  border-top: 1px solid transparent;
}

/* Primera sección no necesita separador */
.sidebar-nav > .sidebar-section:first-child { border-top: none; margin-top: 0; }

/* Separador entre grupos de módulos */
.sidebar-nav > .sidebar-section:not(:first-child) {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 14px;
}

.sidebar-nav { flex: 1; padding: 4px 8px 8px; }

/* ── Nav item base ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary, #475569);
  text-decoration: none;
  font-size: .8125rem;
  font-weight: 500;
  transition: all .15s ease;
  cursor: pointer;
  margin-bottom: 1px;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.nav-item:hover  { background: var(--bg); color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .65; transition: opacity .15s; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { opacity: 1; }

/* Texto del ítem */
.nav-item-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Flecha del parent */
.nav-arrow {
  margin-left: auto;
  flex-shrink: 0;
  transition: transform .2s;
  opacity: .5;
}
.nav-parent.open .nav-arrow { transform: rotate(180deg); opacity: .8; }

/* ── Submenú ── */
.nav-submenu {
  display: none;
  padding: 3px 0 5px 0;
  margin: 0 0 2px 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 2px solid #c7dff0;
  /* Ensure items stack vertically */
  flex-direction: column;
}
.nav-submenu.open {
  display: block;  /* block so children stack by default */
  /* Specifically NOT flex, to ensure each item on own line */
}

/* Sub-ítems individuales */
.nav-subitem {
  display: flex;        /* flex para el contenido interno (punto + texto) */
  width: 100%;          /* CLAVE: ocupa todo el ancho del contenedor */
  box-sizing: border-box;
  align-items: center;
  padding: 6px 10px 6px 12px;
  font-size: .8rem;
  font-weight: 400;
  color: var(--text-secondary, #475569);
  text-decoration: none;
  border-radius: 4px;
  transition: background .12s, color .12s;
  margin: 1px 4px;
  gap: 6px;
  line-height: 1.4;
}
.nav-subitem::before {
  content: '·';
  color: var(--text-muted, #94a3b8);
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}
.nav-subitem:hover {
  background: var(--primary-light, #e8f3fb);
  color: var(--primary, #1e6fa8);
  text-decoration: none;
}
.nav-subitem:hover::before { color: var(--primary, #1e6fa8); }
.nav-subitem.active { color: var(--primary, #1e6fa8); font-weight: 600; }

/* Badge de notificación */
.nav-badge {
  margin-left: auto;
  background: var(--rojo);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 20px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

/* ---- MAIN AREA ---- */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- HEADER ---- */
.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: var(--text-2);
}
.topbar-breadcrumb a { color: var(--primary); text-decoration: none; }
.topbar-breadcrumb span.sep { color: var(--text-3); }

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-2);
  transition: all .15s;
  position: relative;
  text-decoration: none;
}
.topbar-btn:hover { background: var(--bg); color: var(--primary); }

.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 8px; height: 8px;
  background: var(--rojo);
  border-radius: 50%;
  border: 1.5px solid #fff;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-size: .8rem;
  transition: all .15s;
}
.user-chip:hover { background: var(--bg); border-color: var(--primary); }

.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- CONTENT ---- */
.content {
  flex: 1;
  padding: 24px;
}

/* ============================================================
   COMPONENTES
   ============================================================ */

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { color: var(--primary); }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; color: var(--verde); }
.stat-icon.yellow { background: #fef3c7; color: var(--amarillo); }
.stat-icon.red    { background: #fee2e2; color: var(--rojo); }
.stat-icon.teal   { background: #ccfbf1; color: var(--secondary); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-val  { font-size: 1.7rem; font-weight: 700; line-height: 1; color: var(--text); }
.stat-lbl  { font-size: .75rem; color: var(--text-2); margin-top: 2px; }
.stat-diff { font-size: .72rem; margin-top: 4px; }
.stat-diff.up   { color: var(--verde); }
.stat-diff.down { color: var(--rojo); }

/* Página header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: .85rem; color: var(--text-2); margin-top: 2px; }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-secondary:hover { background: #0b7a6e; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--border2); }
.btn-outline:hover { background: var(--primary-light); border-color: var(--primary); }
.btn-danger { background: var(--rojo); color: #fff; border-color: var(--rojo); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn-lg { padding: 10px 22px; font-size: .95rem; }
.btn-icon { padding: 7px; }

/* Badges / Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green   { background: #dcfce7; color: #15803d; }
.badge-red     { background: #fee2e2; color: #b91c1c; }
.badge-yellow  { background: #fef3c7; color: #b45309; }
.badge-blue    { background: #dbeafe; color: #1d4ed8; }
.badge-gray    { background: var(--bg); color: var(--text-2); }
.badge-teal    { background: #ccfbf1; color: #0f766e; }
.badge-purple  { background: #ede9fe; color: #6d28d9; }

/* Tabla */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; font-size: .83rem; }
thead th {
  background: var(--surface2);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface2); }

/* Formularios */
.form-group { margin-bottom: 1.125rem; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-required { color: var(--rojo); }

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .85rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,111,168,.1);
}

.form-control:disabled { background: var(--bg); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-hint { font-size: .72rem; color: var(--text-3); margin-top: 4px; }
.form-error { font-size: .72rem; color: var(--rojo); margin-top: 4px; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  box-sizing: border-box;
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform .2s;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-overlay.open .modal {
  box-sizing: border-box; transform: translateY(0); }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: .95rem; font-weight: 700; }
.modal-body { padding: 1.25rem 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Semáforo */
.semaforo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  font-weight: 600;
}
.semaforo-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.semaforo.verde .semaforo-dot  { background: var(--verde); }
.semaforo.amarillo .semaforo-dot { background: var(--amarillo); }
.semaforo.rojo .semaforo-dot   { background: var(--rojo); }
.semaforo.verde   { color: var(--verde); }
.semaforo.amarillo { color: var(--amarillo); }
.semaforo.rojo    { color: var(--rojo); }

/* Progress */
.progress {
  height: 8px;
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 10px;
  transition: width .4s ease;
}
.progress-bar.green  { background: var(--verde); }
.progress-bar.yellow { background: var(--amarillo); }
.progress-bar.red    { background: var(--rojo); }

/* Tabs — estilo legacy .tab/.tab-panel */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; gap: 0; }
.tab {
  padding: 10px 18px;
  font-size: .83rem;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Tabs modernos — .tab-nav + .tab-btn + .tab-content (usados en módulos) */
.tab-nav {
  display: flex;
  gap: 2px;
  padding: 0 0 0 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-secondary, #475569);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  border-radius: 6px 6px 0 0;
  white-space: nowrap;
  font-family: var(--font);
}
.tab-btn:hover {
  color: var(--primary);
  background: var(--primary-light, #e8f3fb);
}
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: var(--primary-light, #e8f3fb);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Alert / Toast */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  margin-bottom: 16px;
}
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: #dcfce7; color: #14532d; border: 1px solid #bbf7d0; }
.alert-warning { background: #fef3c7; color: #78350f; border: 1px solid #fde68a; }
.alert-danger  { background: #fee2e2; color: #7f1d1d; border: 1px solid #fecaca; }

/* Toast */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .83rem;
  min-width: 280px;
  max-width: 400px;
  animation: slideIn .2s ease;
  cursor: pointer;
}
.toast.success { background: var(--verde); }
.toast.error   { background: var(--rojo); }
.toast.warning { background: var(--amarillo); color: #1c1917; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}
.empty-state svg { margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: .95rem; font-weight: 600; color: var(--text-2); margin-bottom: 4px; }
.empty-state p  { font-size: .82rem; }

/* Loading */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Utilities */
.flex    { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.ml-auto { margin-left: auto; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }
.mb-16   { margin-bottom: 16px; }
.mb-24   { margin-bottom: 24px; }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .72rem; }
.text-muted { color: var(--text-2); }
.text-primary { color: var(--primary); }
.fw-600  { font-weight: 600; }
.fw-700  { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Responsive */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-260px); --sidebar-w: 260px; }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Form grids (used across all modal forms) ─── */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) {
    .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
}
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-2 { gap: .5rem; }
.gap-8 { gap: .5rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.fw-600 { font-weight: 600; }
.text-sm { font-size: .875rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-danger, .text-red { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-warning { color: #d97706; }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: .75rem; }
.text-center { text-align: center; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.badge-blue { background: #eff6ff; color: #1e6fa8; border: 1px solid #bfdbfe; }
.badge-red { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.badge-yellow { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.badge-green { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-teal { background: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc; }
.badge-gray { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-secondary { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
