/* Gamagest Parking Platform — Design System · Dark Premium Control Center */
:root {
  /* Surfaces */
  --bg-deep: #061018;
  --bg: #08131E;
  --bg-elevated: #0c1a28;
  --panel: #102234;
  --surface: #102234;
  --card: #15293D;
  --surface-2: #15293D;
  --hover: #1A344B;
  --active: #21496B;

  /* Text hierarchy */
  --text-title: #FFFFFF;
  --text: #E8EEF7;
  --text-dim: #B9C8DA;
  --muted: #8FA5BF;
  --text-disabled: #60748A;

  /* Lines & glow */
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(120, 180, 255, 0.22);
  --cyan: #2EE6FF;
  --cyan-dim: rgba(46, 230, 255, 0.14);
  --cyan-glow: rgba(46, 230, 255, 0.28);
  --blue: #3A7CFF;
  --blue-bright: #5B9BFF;
  --blue-glow: rgba(58, 124, 255, 0.35);
  --accent: #2EE6FF;

  /* Status */
  --ok: #3DD68C;
  --ok-glow: rgba(61, 214, 140, 0.28);
  --warn: #F0B429;
  --warn-glow: rgba(240, 180, 41, 0.28);
  --bad: #FF5D6C;
  --bad-glow: rgba(255, 93, 108, 0.28);
  --info: #5EB0FF;
  --info-glow: rgba(94, 176, 255, 0.28);

  /* Shape */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 18px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 48px rgba(46, 230, 255, 0.1);
  --shadow-card: 0 6px 18px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* Type */
  --font-display: "Sora", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --fs-title: 34px;
  --fs-sub: 22px;
  --fs-body: 16px;
  --fs-info: 14px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --nav-w: 248px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 200ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: #7af0ff; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ——— Typography ——— */
.ds-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text-title);
}
.ds-h1,
.app-main > h1,
.login-card h1 {
  font-family: var(--font-display);
  font-size: var(--fs-title);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-title);
  margin: 0 0 0.4rem;
}
.ds-h2,
.app-main > h2,
.section-title {
  font-family: var(--font-display);
  font-size: var(--fs-sub);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-title);
  margin: 0 0 0.5rem;
}
.ds-h3,
.card h2,
.card h3 {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-title);
  margin: 0 0 0.75rem;
}
.ds-lead { color: var(--text-dim); font-size: 1.1rem; line-height: 1.55; max-width: 38rem; }
.ds-muted, .app-sub { color: var(--muted); }
.ds-mono { font-family: var(--font-mono); font-size: 0.82rem; }
.muted-sm { color: var(--muted); font-size: var(--fs-info); }
.mono-sm { font-family: var(--font-mono); font-size: 0.75rem; word-break: break-all; color: var(--muted); }

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
  padding: 0.72rem 1.25rem;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text) !important;
  font-weight: 650;
  font-size: 0.94rem;
  cursor: pointer;
  text-decoration: none !important;
  transition:
    transform var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease),
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    filter var(--t-fast) var(--ease);
}
.btn:hover {
  transform: translateY(-1px);
  background: var(--hover);
  border-color: rgba(120, 180, 255, 0.4);
}
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, #3A7CFF 0%, #1E5FE0 45%, #2EE6FF 160%);
  color: #FFFFFF !important;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(58, 124, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover {
  filter: brightness(1.12);
  box-shadow: 0 10px 28px rgba(58, 124, 255, 0.45), 0 0 20px rgba(46, 230, 255, 0.2);
  background: linear-gradient(135deg, #4A8CFF 0%, #2A6FF0 45%, #5AF0FF 160%);
}
.btn-ghost,
.btn-secondary {
  background: transparent;
  color: var(--text) !important;
  border: 1px solid rgba(58, 124, 255, 0.55);
  box-shadow: none;
}
.btn-ghost:hover,
.btn-secondary:hover {
  background: rgba(58, 124, 255, 0.12);
  border-color: var(--blue-bright);
  color: #fff !important;
  box-shadow: 0 0 16px rgba(58, 124, 255, 0.18);
}
.btn-danger {
  background: linear-gradient(135deg, #FF5D6C, #D93A4A);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(255, 93, 108, 0.28);
}
.btn-danger:hover { filter: brightness(1.1); }
.btn-success {
  background: linear-gradient(135deg, #3DD68C, #22A866);
  color: #031810 !important;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(61, 214, 140, 0.28);
}
.btn-success:hover { filter: brightness(1.08); }
.btn-sm { padding: 0.42rem 0.85rem; font-size: 0.84rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
.btn[disabled], .btn:disabled {
  opacity: 0.5;
  color: var(--text-disabled) !important;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
}
button.btn.btn-primary,
a.btn.btn-primary { color: #FFFFFF !important; }

/* ——— Surfaces ——— */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel-glass {
  background: rgba(16, 34, 52, 0.78);
  border: 1px solid var(--line-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glow);
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  animation: ds-fade-in 0.45s var(--ease) both;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(46, 230, 255, 0.35), transparent);
  opacity: 0.7;
  pointer-events: none;
}
.card:hover {
  border-color: rgba(120, 180, 255, 0.18);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(46, 230, 255, 0.06);
}
.card:has(.pill.ok) { box-shadow: var(--shadow-card), 0 0 0 1px rgba(61, 214, 140, 0.12); }
.card:has(.pill.bad) { box-shadow: var(--shadow-card), 0 0 0 1px rgba(255, 93, 108, 0.12); }
.card:has(.pill.warn) { box-shadow: var(--shadow-card), 0 0 0 1px rgba(240, 180, 41, 0.12); }
.card:has(.pill.info) { box-shadow: var(--shadow-card), 0 0 0 1px rgba(94, 176, 255, 0.12); }

/* ——— Status pills ——— */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  flex-shrink: 0;
}
.pill.ok {
  background: rgba(61, 214, 140, 0.12);
  color: var(--ok);
  border-color: rgba(61, 214, 140, 0.45);
  box-shadow: 0 0 14px var(--ok-glow);
}
.pill.bad {
  background: rgba(255, 93, 108, 0.12);
  color: var(--bad);
  border-color: rgba(255, 93, 108, 0.45);
  box-shadow: 0 0 14px var(--bad-glow);
}
.pill.warn {
  background: rgba(240, 180, 41, 0.12);
  color: var(--warn);
  border-color: rgba(240, 180, 41, 0.45);
  box-shadow: 0 0 14px var(--warn-glow);
}
.pill.info {
  background: rgba(94, 176, 255, 0.12);
  color: var(--info);
  border-color: rgba(94, 176, 255, 0.45);
  box-shadow: 0 0 14px var(--info-glow);
}
.pill.neutral {
  background: rgba(143, 165, 191, 0.1);
  color: var(--text-dim);
  border-color: rgba(143, 165, 191, 0.28);
  box-shadow: none;
}
.pill.neutral::before { box-shadow: none; opacity: 0.7; }

/* ——— Forms ——— */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: var(--fs-info);
  color: var(--muted);
  font-weight: 550;
}
input, select, textarea {
  background: #091722;
  border: 1px solid rgba(120, 180, 255, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.85rem;
  outline: none;
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-disabled); }
input:hover, select:hover, textarea:hover {
  border-color: rgba(120, 180, 255, 0.4);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(46, 230, 255, 0.18), 0 0 18px rgba(46, 230, 255, 0.12);
  background: #0b1c2a;
}
input:disabled, select:disabled, textarea:disabled {
  color: var(--text-disabled);
  opacity: 0.7;
  cursor: not-allowed;
}

/* ——— Tables ——— */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table th, .table td {
  text-align: left;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(8, 19, 30, 0.55);
}
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr:last-child td { border-bottom: none; }

/* ——— App shell ——— */
.app-shell {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 45% at 0% 0%, rgba(46, 230, 255, 0.07), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(58, 124, 255, 0.1), transparent 50%),
    linear-gradient(180deg, #0a1624 0%, var(--bg) 40%, #07111c 100%);
}
.app-side {
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(16, 34, 52, 0.95), rgba(8, 19, 30, 0.98));
  padding: 1.35rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: inset -1px 0 0 rgba(46, 230, 255, 0.06);
}
.app-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  padding: 0.35rem 0.65rem;
  color: var(--text-title);
  position: relative;
}
.app-brand span { color: var(--cyan); text-shadow: 0 0 18px rgba(46, 230, 255, 0.35); }
.app-brand::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: 0.9rem;
  background: linear-gradient(90deg, rgba(46, 230, 255, 0.45), transparent);
}
.app-nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.app-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-dim);
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 550;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.app-nav a .nav-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
  color: currentColor;
}
.app-nav a .nav-ico svg { width: 100%; height: 100%; display: block; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.app-nav a:hover {
  background: var(--hover);
  color: var(--text-title);
  text-decoration: none;
}
.app-nav a.active {
  background: linear-gradient(90deg, rgba(46, 230, 255, 0.14), rgba(58, 124, 255, 0.08));
  color: var(--cyan);
  box-shadow: inset 3px 0 0 var(--cyan), 0 0 20px rgba(46, 230, 255, 0.08);
}
.app-nav a.app-nav-logout {
  margin-top: auto;
  color: var(--muted);
  border-top: 1px solid var(--line);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  padding-top: 0.9rem;
}
.app-nav a.app-nav-logout:hover { color: var(--bad); background: rgba(255, 93, 108, 0.08); }

.app-main {
  padding: 1.75rem 2rem 3rem;
  min-width: 0;
  animation: ds-fade-in 0.35s var(--ease) both;
}
.app-sub { color: var(--muted); margin: 0 0 1.4rem; font-size: var(--fs-info); }

.stat-row { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.4rem; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  min-width: 132px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  animation: ds-fade-in 0.5s var(--ease) both;
}
.stat::after {
  content: "";
  position: absolute;
  right: -20%;
  top: -40%;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(46, 230, 255, 0.12), transparent 70%);
  pointer-events: none;
}
.stat .n {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-title);
}
.stat .l { color: var(--muted); font-size: var(--fs-info); margin-top: 0.2rem; }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.1rem;
}
.grid-cards .card:nth-child(1) { animation-delay: 0.02s; }
.grid-cards .card:nth-child(2) { animation-delay: 0.06s; }
.grid-cards .card:nth-child(3) { animation-delay: 0.1s; }
.grid-cards .card:nth-child(4) { animation-delay: 0.14s; }
.grid-cards .card:nth-child(5) { animation-delay: 0.18s; }
.grid-cards .card:nth-child(6) { animation-delay: 0.22s; }

.meta {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 0.4rem 0.75rem;
  font-size: 0.9rem;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(9, 23, 34, 0.85);
  border: 1px solid var(--line);
}
.meta .k { color: var(--muted); font-size: var(--fs-info); }
.meta .v { font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; color: var(--text-dim); }
.actions { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.95rem; align-items: center; }

.alert {
  background: rgba(240, 180, 41, 0.1);
  border: 1px solid rgba(240, 180, 41, 0.35);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 0 18px rgba(240, 180, 41, 0.08);
  color: var(--text);
}
.alert strong { color: var(--warn); }
.section-title {
  font-family: var(--font-display);
  margin: 2rem 0 0.9rem;
  font-size: var(--fs-sub);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-title);
}

/* Live poll stamp */
[data-field="poll_stamp"] {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(16, 34, 52, 0.9);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}
[data-field="poll_stamp"]::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: ds-pulse 2s ease-in-out infinite;
}

/* ——— Animations ——— */
@keyframes ds-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ds-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@keyframes ds-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes ds-glow-ok {
  0%, 100% { box-shadow: 0 0 14px var(--ok-glow); }
  50% { box-shadow: 0 0 22px rgba(61, 214, 140, 0.45); }
}
.pill.ok.is-live,
.pill.ok:hover { animation: ds-glow-ok 2.4s ease-in-out infinite; }
.is-loading,
.loading-shimmer {
  background: linear-gradient(90deg, var(--card) 20%, var(--hover) 50%, var(--card) 80%);
  background-size: 200% 100%;
  animation: ds-shimmer 1.4s linear infinite;
  border-radius: var(--radius-sm);
  min-height: 1rem;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ——— Responsive ——— */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-side {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .app-nav { flex-direction: row; flex-wrap: wrap; }
  .app-nav a.app-nav-logout {
    margin-top: 0;
    border-top: none;
    width: 100%;
  }
  .app-main { padding: 1.2rem 1rem 2.5rem; }
  .ds-h1, .app-main > h1, .login-card h1 { font-size: 28px; }
  .ds-h2, .section-title { font-size: 20px; }
  .meta { grid-template-columns: 108px 1fr; }
}

@media (max-width: 600px) {
  .stat { min-width: calc(50% - 0.5rem); flex: 1 1 120px; }
  .btn { width: auto; }
}

/* ——— Impersonation ——— */
.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.25rem;
  background: linear-gradient(90deg, #3a2a08, #1a3040);
  border-bottom: 1px solid var(--warn);
  color: var(--text);
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.impersonation-banner strong { color: var(--warn); }
.alert.warn {
  background: rgba(240, 180, 41, 0.12);
  border: 1px solid rgba(240, 180, 41, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin: 0.75rem 0;
}
