/* =====================================================================
   ParkSaaS — Sistema de diseño
   Paleta inspirada en asfalto + señalización vial. Space Grotesk para
   títulos, Inter para UI, JetBrains Mono para placas/cifras/consecutivos.
   Construido como capa de tokens + overrides sobre Bootstrap 5.
   ===================================================================== */

:root {
  --ink: #1B1F27;
  --ink-soft: #545B6B;
  --ink-faint: #8A90A0;
  --paper: #F6F7F9;
  --surface: #FFFFFF;
  --border: #E3E6EB;
  --accent: #F2A63C;
  --accent-strong: #D98D1F;
  --accent-ink: #7A4B06;
  --accent-soft: #FCEBD0;
  --success: #1F9D63;
  --success-soft: #E3F6ED;
  --danger: #DC4C4C;
  --danger-soft: #FBEAEA;
  --warning: #F2A63C;
  --warning-soft: #FCEBD0;
  --info: #3B6FD9;
  --info-soft: #E9EFFC;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(27, 31, 39, .06);
  --shadow-md: 0 6px 20px rgba(27, 31, 39, .08);
  --shadow-lg: 0 12px 32px rgba(27, 31, 39, .14);

  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ---------------------------------------------------------------- base */
body {
  background-color: var(--paper);
  font-family: var(--font-body);
  color: var(--ink);
  font-size: 14.5px;
}

h1, h2, h3, h4, h5, .fw-bold {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

h2 { font-weight: 600; color: var(--ink); }

.text-muted { color: var(--ink-faint) !important; }

a { color: var(--info); text-decoration: none; }

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

.sidebar {
  width: 252px;
  min-height: 100vh;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  max-height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 20px 10px;
}
.sidebar-brand .brand-mark {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink);
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
}

.sidebar-section {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 16px 12px 6px 12px;
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.72);
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
  transition: background-color .12s ease, color .12s ease;
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.sidebar-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-link.active {
  background: rgba(242,166,60,.12);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-link.active svg { opacity: 1; color: var(--accent); }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.avatar-chip {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
  font-family: var(--font-display);
}

.role-badge {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 9px;
}

/* --------------------------------------------------------------- KPI */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  height: 100%;
}
.kpi-label {
  font-size: .78rem;
  color: var(--ink-faint);
  font-weight: 500;
  margin-bottom: 6px;
}
.kpi-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.65rem;
  color: var(--ink);
  line-height: 1.1;
}
.kpi-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}

/* ------------------------------------------------------------- cards */
.card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 22px; }

/* ------------------------------------------------------------ tables */
.table { font-size: .89rem; }
.table thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-faint);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}
.table td { vertical-align: middle; padding-top: 12px; padding-bottom: 12px; color: var(--ink); }
.table-hover tbody tr:hover { background-color: var(--paper); }

/* ------------------------------------------------------- placa chip */
.plate {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .03em;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  padding: 3px 8px 3px 10px;
  position: relative;
  overflow: hidden;
}
.plate::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--info);
}
.plate { padding-left: 13px; }

/* ------------------------------------------------------------ badges */
.badge { font-weight: 600; font-size: .72rem; padding: 5px 9px; border-radius: 6px; }
.bg-success { background-color: var(--success) !important; }
.bg-danger { background-color: var(--danger) !important; }
.bg-warning { background-color: var(--warning) !important; color: var(--accent-ink) !important; }
.bg-secondary { background-color: var(--ink-faint) !important; }
.bg-info { background-color: var(--info) !important; }

/* ----------------------------------------------------------- buttons */
.btn { border-radius: var(--radius-sm); font-weight: 600; font-size: .87rem; }
.btn-primary {
  background-color: var(--ink); border-color: var(--ink);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: #2A303D; border-color: #2A303D;
}
.btn-outline-secondary { color: var(--ink-soft); border-color: var(--border); }
.btn-outline-danger { --bs-btn-hover-bg: var(--danger); }

/* accent CTA reserved for the single most important action per screen */
.btn-accent {
  background-color: var(--accent); border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-accent:hover { background-color: var(--accent-strong); color: var(--accent-ink); }

/* ------------------------------------------------------------- forms */
.form-control, .form-select {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  font-size: .89rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-label { font-size: .8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }

/* ------------------------------------------------------------- empty */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-faint);
}
.empty-state svg { width: 40px; height: 40px; margin-bottom: 10px; opacity: .5; }
.empty-state .empty-title { font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }

/* -------------------------------------------------------------- toast */
#toastStack {
  position: fixed;
  top: 18px; right: 18px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(340px, 90vw);
}
.toast-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  font-size: .85rem;
  color: var(--ink);
  animation: toast-in .18s ease-out;
}
.toast-item.success { border-left-color: var(--success); }
.toast-item.danger { border-left-color: var(--danger); }
.toast-item.warning { border-left-color: var(--warning); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------- auth pages */
.auth-shell {
  min-height: 100vh;
  display: flex;
  background: var(--ink);
}
.auth-visual {
  flex: 1.1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  color: #fff;
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(-45deg, rgba(242,166,60,.08) 0 18px, transparent 18px 36px),
    var(--ink);
}
.auth-visual .brand-mark {
  width: 46px; height: 46px;
  background: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-ink); font-weight: 700; font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 22px;
}
.auth-visual h1 {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  max-width: 420px;
  line-height: 1.15;
}
.auth-visual p { color: rgba(255,255,255,.65); max-width: 380px; margin-top: 12px; }
.auth-form-panel {
  flex: 1;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 34px;
}

@media (max-width: 860px) {
  .auth-visual { display: none; }
}

/* ------------------------------------------------------------ mobile */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -260px;
    z-index: 1000;
    transition: left .18s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { left: 0; }
  .sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 999;
  }
  .sidebar-backdrop.open { display: block; }
}

/* --------------------------------------------------------- accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
