/*
  Mitr4ALPR Service UI
  - Light theme keeps the current “clean” look.
  - Dark theme uses modern blue tones.
  Notes: We keep Bulma for layout, but override key tokens for a cohesive product feel.
*/

:root {
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  --alpr-radius: 16px;
  --alpr-radius-sm: 12px;

  /* Light theme tokens */
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #f1f6ff;
  --text: #0b1220;
  --muted: rgba(11, 18, 32, 0.72);
  --border: rgba(15, 23, 42, 0.10);
  --shadow: 0 14px 34px rgba(16, 24, 40, 0.12);
  --shadow-sm: 0 10px 22px rgba(16, 24, 40, 0.10);

  --primary: #2563eb;
  --primary-2: #60a5fa;
  --ring: rgba(37, 99, 235, 0.28);
  --good: #22c55e;
  --warn: #f59e0b;

  --nav-bg: rgba(255, 255, 255, 0.78);
  --nav-border: rgba(15, 23, 42, 0.08);
  --nav-text: #0b1220;
  --nav-text-muted: rgba(11, 18, 32, 0.72);

  --code-bg: #0b1320;
  --code-text: rgba(255,255,255,0.92);
}


html[data-theme="dark"] {
  --bg: #040a16;
  --surface: #0b162b;
  --surface-2: #0f2142;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --border: rgba(148, 163, 184, 0.16);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.50);
  --shadow-sm: 0 12px 26px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 26px 70px rgba(0, 0, 0, 0.62);

  --primary: #3b82f6;
  --primary-2: #93c5fd;
  --ring: rgba(59, 130, 246, 0.42);

  --nav-bg: rgba(4, 10, 22, 0.72);
  --nav-border: rgba(148, 163, 184, 0.14);
  --nav-text: rgba(255, 255, 255, 0.92);
  --nav-text-muted: rgba(255, 255, 255, 0.70);

  --code-bg: #071028;
  --code-text: rgba(255,255,255,0.92);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(37, 99, 235, 0.10), transparent 55%),
    radial-gradient(900px 450px at 92% 0%, rgba(96, 165, 250, 0.08), transparent 55%),
    var(--bg);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 620px at 12% -10%, rgba(59, 130, 246, 0.22), transparent 55%),
    radial-gradient(900px 520px at 90% 0%, rgba(147, 197, 253, 0.12), transparent 55%),
    var(--bg);
}

/* Global links */
a { color: var(--primary); }
a:hover { color: var(--primary-2); }

/* Focus ring */
.button:focus-visible,
.input:focus-visible,
.textarea:focus-visible,
.select select:focus-visible,
.navbar-item:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--ring);
  border-radius: 12px;
}

/* HR */
hr { background-color: var(--border); }

/* Mobile-first baseline */
.section {
  padding: 1.25rem 1rem;
}

.container {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

/* Navbar */
.alpr-navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
}

.alpr-navbar .navbar-item,
.alpr-navbar .navbar-link,
.alpr-navbar .navbar-burger {
  color: var(--nav-text);
}

.alpr-navbar .navbar-item:hover { background: rgba(59, 130, 246, 0.10); }
html[data-theme="dark"] .alpr-navbar .navbar-item:hover { background: rgba(59, 130, 246, 0.14); }


.alpr-navbar .navbar-menu {
  background: var(--nav-bg);
}

.alpr-navbar .navbar-dropdown {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.alpr-navbar .navbar-burger span {
  background-color: var(--nav-text);
}


.brand { gap: 0.55rem; }
.brand-logo { height: 28px; width: auto; image-rendering: auto; }
.brand-logo-dark { display: none; }
html[data-theme="dark"] .brand-logo-light { display: none; }
html[data-theme="dark"] .brand-logo-dark { display: inline-block; filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45)); }

.nav-user { color: var(--nav-text-muted); }
.nav-user strong { color: var(--nav-text); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  height: 36px;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease, background .12s ease;
}
.theme-toggle:hover {
  filter: brightness(1.02);
  transform: translateY(-1px);
}
.theme-toggle:active { transform: translateY(0); }

html[data-theme="dark"] .theme-toggle {
  background: linear-gradient(180deg, rgba(37,99,235,0.12), rgba(15,23,42,0.65));
  border-color: rgba(59,130,246,0.35);
}

.theme-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.10);
  border: 1px solid var(--border);
}
html[data-theme="dark"] .theme-toggle__icon {
  background: rgba(59, 130, 246, 0.18);
}

.theme-ic {
  width: 16px;
  height: 16px;
}
html[data-theme="light"] .theme-ic-moon { display: none; }
html[data-theme="dark"] .theme-ic-sun { display: none; }

.theme-toggle__label {
  font-size: 0.9rem;
  letter-spacing: 0.2px;
}

.navbar-brand .navbar-item strong {
  letter-spacing: 0.2px;
}

.navbar-item {
  padding: 0.75rem 0.9rem;
}

/* Navbar polish */
.alpr-navbar .navbar-start {
  flex-wrap: wrap;
  gap: 0.1rem;
}
.alpr-navbar .navbar-item {
  border-radius: 999px;
  margin: 0.25rem 0.15rem;
  transition: background .12s ease, transform .12s ease, color .12s ease;
}
.alpr-navbar .navbar-item:hover {
  background: rgba(59, 130, 246, 0.08);
}
html[data-theme="dark"] .alpr-navbar .navbar-item:hover {
  background: rgba(59, 130, 246, 0.12);
}

/* Landing */

/* Buttons (override Bulma colors to match tokens) */
.button.is-primary {
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}
.button.is-primary:hover { filter: brightness(1.05); }

.button.is-light {
  background: rgba(16, 24, 40, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
}
html[data-theme="dark"] .button.is-light {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--text);
}
.button.is-light:hover { filter: brightness(1.03); }

/* Buttons */
.button.is-gradient {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.25);
}
.button.is-gradient:hover { filter: brightness(1.03); }

/* Secondary buttons on landing hero */
.hero-landing .button.is-light {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.92);
  border: 1px solid rgba(255,255,255,0.18);
}
.hero-landing .button.is-light:hover {
  background: rgba(255,255,255,0.16);
  color: #fff;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
}

.badge-soft { opacity: 0.95; }

/* Surfaces */
.card, .box, .notification {
  border-radius: var(--alpr-radius);
}


/* Core surfaces (override Bulma defaults to avoid white-on-white in dark theme) */
.box {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--alpr-radius);
  box-shadow: var(--shadow-sm);
}

.card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--alpr-radius);
  box-shadow: var(--shadow-sm);
}

.notification {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--alpr-radius);
}

.notification.is-info.is-light {
  background: rgba(59, 130, 246, 0.10);
  border-color: rgba(59, 130, 246, 0.22);
}

.notification.is-success.is-light {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.22);
}

.notification.is-warning.is-light {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.24);
}

.notification.is-danger.is-light {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.22);
}

.card.soft, .box.soft {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card.alpr-card {
  border-radius: var(--alpr-radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Inputs */
.input, .textarea, .select select {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.input:focus, .textarea:focus, .select select:focus { border-color: rgba(59, 130, 246, 0.45); }
.input::placeholder, .textarea::placeholder { color: rgba(148, 163, 184, 0.9); }

html[data-theme="dark"] .input::placeholder,
html[data-theme="dark"] .textarea::placeholder {
  color: rgba(148, 163, 184, 0.85);
}

.label { color: var(--muted); }

/* Tables */

/* Tags */
.tag {
  border-radius: 999px;
}
.tag.is-light {
  background: rgba(59, 130, 246, 0.10);
  color: var(--text);
  border: 1px solid var(--border);
}
html[data-theme="dark"] .tag.is-light {
  background: rgba(59, 130, 246, 0.14);
}

.table {
  background: transparent;
  color: var(--text);
}
.table thead th { color: var(--muted); border-bottom: 1px solid var(--border); }
.table td { border-bottom: 1px solid var(--border); }
html[data-theme="dark"] .table.is-striped tbody tr:not(.is-selected):nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

/* Landing / Marketing blocks */
.hero.hero-landing {
  border-radius: var(--alpr-radius);
  overflow: hidden;
  background:
    radial-gradient(900px 450px at 10% 10%, rgba(59, 130, 246, 0.35), transparent 55%),
    radial-gradient(700px 380px at 80% 0%, rgba(147, 197, 253, 0.22), transparent 55%),
    linear-gradient(135deg, #0b1320, #0a1630);
}

html[data-theme="light"] .hero.hero-landing {
  background:
    radial-gradient(900px 450px at 10% 10%, rgba(37, 99, 235, 0.18), transparent 55%),
    radial-gradient(700px 380px at 80% 0%, rgba(96, 165, 250, 0.14), transparent 55%),
    linear-gradient(135deg, #0b1320, #112650);
}

.landing-title {
  font-size: 2.25rem;
  line-height: 1.15;
}

.landing-subtitle { color: rgba(255,255,255,0.78); }
html[data-theme="light"] .landing-subtitle { color: rgba(255,255,255,0.82); }

.landing-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.85);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.85rem;
  margin-bottom: 0.9rem;
}

.landing-badge .dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--good);
  box-shadow: 0 0 0 6px rgba(34,197,94,0.20);
}

.landing-card {
  border-radius: var(--alpr-radius);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 18px 45px rgba(0,0,0,0.35);
  overflow: hidden;
}


.landing-banner-wrap {
  width: 100%;
  background: rgba(0,0,0,0.18);
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.landing-banner-img {
  width: 100%;
  height: auto;
  display: block;
}

html[data-theme="light"] .landing-banner-wrap {
  background: rgba(255,255,255,0.06);
}

.landing-card-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.logo-big {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: rgba(255,255,255,0.08);
  display: grid;
  place-items: center;
}

.landing-steps { padding: 1.1rem 1.2rem 1.25rem; display: grid; gap: 0.65rem; }
.step { display: flex; align-items: center; gap: 0.75rem; }
.step-n {
  width: 28px; height: 28px; border-radius: 999px;
  background: rgba(59,130,246,0.25);
  color: rgba(255,255,255,0.92);
  display: grid; place-items: center;
  font-weight: 700;
}
.step-t { color: rgba(255,255,255,0.85); font-size: 0.95rem; }

.landing-metrics { margin-top: 1.25rem; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0.75rem; }
.metric { padding: 0.75rem 0.85rem; border-radius: 14px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); }
.metric-k { color: rgba(255,255,255,0.70); font-size: 0.8rem; font-weight: 600; }
.metric-v { color: rgba(255,255,255,0.92); font-size: 0.95rem; font-weight: 700; }

.feature-card {
  border-radius: var(--alpr-radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1rem;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(59, 130, 246, 0.22);
}

.feature-title { font-weight: 700; margin-bottom: 0.35rem; }
.feature-text { color: var(--muted); }

.landing-list li { margin: 0.35rem 0; color: var(--muted); }
.landing-list strong { color: var(--text); }

/* Code blocks */
.code-block {
  border-radius: var(--alpr-radius-sm);
  padding: 1rem 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: var(--code-bg);
  color: var(--code-text);
  overflow-x: auto;
}

.code-block code { color: inherit; }

/* Footer */
.alpr-footer { padding: 1.2rem 0; border-top: 1px solid var(--border); }
.alpr-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.alpr-footer-meta { color: var(--muted); font-size: 0.9rem; }

.alpr-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: rgba(16, 24, 40, 0.04);
}

.alpr-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
  background: rgba(72, 149, 239, 0.12);
}

/* Images */
img.alpr-img {
  width: 100%;
  height: auto;
  border-radius: var(--alpr-radius);
  box-shadow: var(--shadow);
}

figure.image {
  margin: 0;
}

/* Upload spinner */
#uploadSpinner {
  display: none;
}

#uploadSpinner.is-active {
  display: flex;
}

.alpr-spinner {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 3px solid rgba(148, 163, 184, 0.22);
  border-top-color: rgba(59, 130, 246, 0.95);
  animation: alpr-spin 0.8s linear infinite;
}

@keyframes alpr-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Tables (mobile-friendly)
   JS will add .alpr-responsive-table and data-label attributes. */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.alpr-responsive-table {
  width: 100%;
}

@media (max-width: 768px) {
  .landing-title {
    font-size: 1.85rem;
  }

  .hero .subtitle {
    font-size: 1rem;
  }

  .section {
    padding: 1rem 0.85rem;
  }

  .container {
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  /* Make Bulma columns stack a bit tighter */
  .columns {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    margin-top: -0.5rem;
  }

  .column {
    padding: 0.5rem;
  }

  /* Turn tables into “cards” on mobile */
  .alpr-responsive-table thead {
    display: none;
  }

  .alpr-responsive-table,
  .alpr-responsive-table tbody,
  .alpr-responsive-table tr,
  .alpr-responsive-table td {
    display: block;
    width: 100%;
  }

  .alpr-responsive-table tr {
    margin-bottom: 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--alpr-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }

  .alpr-responsive-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .alpr-responsive-table td:last-child {
    border-bottom: none;
  }

  .alpr-responsive-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    flex: 0 0 auto;
    max-width: 45%;
  }

  .alpr-responsive-table td > * {
    max-width: 55%;
  }

  /* Buttons and inputs more touch-friendly */
  .button {
    min-height: 44px;
  }

  .input,
  .select select,
  textarea {
    min-height: 44px;
  }

  .navbar-menu {
    padding-bottom: 0.5rem;
  }
}

@media (min-width: 769px) {
  .section {
    padding: 1.75rem 1.25rem;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .landing-title {
    font-size: 3rem;
  }
}


/* Footer */
.alpr-footer { padding: 22px 0; border-top: 1px solid var(--border); background: var(--surface); }
.alpr-footer-grid { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.alpr-footer-links { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.alpr-footer-links a { color: var(--muted); font-weight: 500; }
.alpr-footer-links a:hover { color: var(--text); }
.alpr-footer-sub { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.alpr-footer-sub .sep { opacity: 0.6; }
.alpr-footer-note { margin-top: 6px; color: var(--muted); font-size: 0.95rem; }

/* Cookie banner */
.cookie-banner { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; }
.cookie-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 14px 14px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cookie-card .cookie-text { color: var(--muted); max-width: 820px; }
.cookie-card .cookie-text strong { color: var(--text); }
.cookie-card .buttons { margin: 0; }


/* ------------------------------------------------------------
   UI polish: page layout, typography, accessibility
------------------------------------------------------------ */

/* Typography (Bulma defaults are light-theme oriented) */
 .title:not(.has-text-white) { color: var(--text); }
 .subtitle:not(.has-text-white) { color: var(--muted); }
.content { color: var(--text); }
.help { color: var(--muted); }



/* Hero text on dark gradients */
.hero .title, .hero .subtitle, .hero .has-text-white { color: rgba(255,255,255,0.96) !important; }
.hero .subtitle { color: rgba(255,255,255,0.78) !important; }
/* Bulma helper colors can clash with dark theme; map key greys to tokens */
.has-text-grey,
.has-text-grey-light,
.has-text-grey-lighter,
.has-text-grey-dark { color: var(--muted) !important; }

/* Ensure code/mono blocks remain readable */
pre, code, .is-family-monospace {
  color: var(--text);
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--alpr-radius-sm);
}

/* KBD tokens */
.kbd {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(59, 130, 246, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.85em;
  line-height: 1.2;
  white-space: nowrap;
}
html[data-theme="dark"] .kbd { background: rgba(59, 130, 246, 0.14); }

/* Badges */
.badge.is-ok {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.22);
}
.badge.is-warn {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.26);
}
.badge.is-bad {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.24);
}

/* Messages (Bulma defaults can look wrong in dark theme) */
.message {
  border-radius: var(--alpr-radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.message-header {
  background: rgba(59, 130, 246, 0.10);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.message-body {
  background: transparent;
  color: var(--text);
}
.message.is-success .message-header { background: rgba(34, 197, 94, 0.14); }
.message.is-warning .message-header { background: rgba(245, 158, 11, 0.16); }
.message.is-danger .message-header { background: rgba(239, 68, 68, 0.14); }

/* Layout container (avoid full-bleed "local" feel, keep wide for dashboards) */
.section .container.is-fluid {
  max-width: 1220px;
}

/* Page scaffold */
.page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--alpr-radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.page-title {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.page-subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 72ch;
}
.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 768px) {
  .page-head { flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* Table container (consistent surface + borders) */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--alpr-radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.table-wrap .table {
  margin-bottom: 0;
}
.table thead th {
  background: transparent;
  padding: 0.85rem 0.9rem;
}
.table td {
  padding: 0.85rem 0.9rem;
}

/* Active nav item */
.alpr-navbar .navbar-item.is-active {
  background: rgba(59, 130, 246, 0.12);
  border-radius: 999px;
}
html[data-theme="dark"] .alpr-navbar .navbar-item.is-active {
  background: rgba(59, 130, 246, 0.16);
}

/* Tooltip (pure CSS) */
.hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(59, 130, 246, 0.08);
  color: var(--text);
  font-weight: 800;
  font-size: 0.8rem;
  cursor: help;
}
.hint::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  width: min(320px, 80vw);
  padding: 0.6rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  z-index: 40;
}
.hint:hover::after { opacity: 1; }

/* Make "button is-link" match tokens (used in settings toggles) */
.button.is-link {
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.24);
  color: var(--text);
}
.button.is-link:hover { filter: brightness(1.03); }


/* Auth pages */
.auth-wrap{min-height:calc(100vh - 220px);display:flex;align-items:center;justify-content:center;padding:1.75rem 0}
.auth-card{width:min(480px,100%);border:1px solid var(--border);border-radius:var(--alpr-radius)}
.auth-card .title{margin-bottom:.25rem}
.auth-card .subtitle{margin-top:.35rem!important;margin-bottom:1rem!important;line-height:1.35}
.auth-card .help{margin-top:.25rem}
.auth-footer{display:flex;gap:.5rem;flex-wrap:wrap;justify-content:center;border-top:1px solid var(--border);margin-top:1.25rem;padding-top:1rem}

/* Status / emphasis */
.danger-box{border:1px solid rgba(239,68,68,.22);background:rgba(239,68,68,.06)}
.badge.is-ok{background:rgba(16,185,129,.12);border-color:rgba(16,185,129,.25)}
.badge.is-warn{background:rgba(245,158,11,.14);border-color:rgba(245,158,11,.25)}



/* Tabs */
.tabs a { color: var(--muted); }
.tabs a:hover { color: var(--text); }
.tabs.is-toggle li.is-active a { background: rgba(59,130,246,0.14) !important; border-color: rgba(59,130,246,0.35) !important; color: var(--text) !important; }
.tabs.is-toggle a { border-color: var(--border) !important; }
