/* Sirius Spoofing Service — minimal UI */

:root {
  --bg: #f8f9fb;
  --surface: #fff;
  --text: #1a2332;
  --text-muted: #5c6773;
  --line: #dfe3e8;
  --line-soft: #eef1f4;
  --accent: #1e4d72;
  --accent-hover: #163a57;
  --accent-soft: #e8f0f7;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #1b6e3a;
  --success-soft: #ecfdf3;
  --warning: #9a6700;
  --warning-soft: #fffaeb;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --focus: 0 0 0 3px rgba(30, 77, 114, 0.25);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --max-w: 1080px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: var(--space-md);
  top: var(--space-md);
  width: auto;
  height: auto;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  z-index: 1000;
}

/* Header */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: var(--space-md) var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent); }

.topbar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover {
  color: var(--accent);
  background: var(--accent-soft);
}
.nav-link[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 500;
}

.nav-user {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  background: var(--line-soft);
  border-radius: 999px;
  margin-left: var(--space-xs);
}

.nav-logout {
  color: var(--text-muted);
}
.nav-logout:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

/* Layout */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
}

.page-header {
  margin-bottom: var(--space-lg);
}
.page-header h1 {
  margin: 0 0 var(--space-xs);
}
.page-header .lead {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow);
}
.card.narrow {
  max-width: 420px;
  margin: var(--space-xl) auto;
}
.card.compact { padding: var(--space-md); }

/* Typography */
h1 {
  margin: 0 0 var(--space-md);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
h2 {
  margin: var(--space-xl) 0 var(--space-md);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  padding-top: var(--space-md);
  border-top: 1px solid var(--line-soft);
}
h2:first-child,
.card > h2:first-of-type,
.section:first-child h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
h3 {
  margin: 0 0 var(--space-sm);
  font-size: 0.9375rem;
  font-weight: 600;
}

.muted { color: var(--text-muted); }
.small { font-size: 0.8125rem; line-height: 1.45; }

/* Sections */
.section { margin-bottom: var(--space-lg); }
.section-title {
  margin: 0 0 var(--space-md);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
h2.section-title,
.section .section-title {
  margin: 0 0 var(--space-md);
  padding-top: 0;
  border-top: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md) var(--space-lg);
}
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.field { margin: 0; }
.field label,
label.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-xs);
}
.field-hint {
  display: block;
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Text-like controls: one rule set (includes input without explicit type) */
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]):not([type="image"]):not([type="range"]):not([type="color"]),
select,
textarea {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}
textarea {
  min-height: 5rem;
  resize: vertical;
}
select {
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235c6773' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
}
input[type="number"] {
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
  opacity: 0.55;
}
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}
input::placeholder,
textarea::placeholder {
  color: #9aa3ad;
}
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]):not([type="image"]):not([type="range"]):not([type="color"]):hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: #c5ccd3;
}
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]):not([type="image"]):not([type="range"]):not([type="color"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="file"]):not([type="image"]):not([type="range"]):not([type="color"]):disabled,
select:disabled,
textarea:disabled,
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Checkbox / radio — separate, consistent */
input[type="checkbox"],
input[type="radio"] {
  width: 1rem;
  height: 1rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
  vertical-align: middle;
}

label.inline,
.checkbox-field {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  margin: var(--space-sm) 0;
}

.form-actions {
  display: flex;
  align-items: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* Buttons */
button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
button:hover:not(:disabled),
.btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.btn.secondary,
button.secondary {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}
.btn.secondary:hover {
  background: var(--line-soft);
  border-color: #c5ccd3;
}

.btn.danger,
button.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.btn.danger:hover:not(:disabled) {
  background: #912018;
  border-color: #912018;
}

.btn.small,
button.small {
  padding: 0.35rem 0.65rem;
  font-size: 0.8125rem;
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

button.is-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}
button.is-loading::after {
  content: "";
  position: absolute;
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Alerts */
.alert {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  border: 1px solid #fecaca;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.875rem;
  margin: var(--space-md) 0;
}
.alert.ok {
  border-color: #abefc6;
  background: var(--success-soft);
  color: var(--success);
}
.alert.warn {
  border-color: #fedf89;
  background: var(--warning-soft);
  color: var(--warning);
}

/* Stats row */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-md);
  margin: var(--space-md) 0;
}
.stat {
  padding: var(--space-md);
  background: var(--line-soft);
  border-radius: var(--radius);
  border: 1px solid var(--line-soft);
}
.stat-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}
.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Vehicle picker */
.picker-section {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line-soft);
}
.picker-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  align-items: center;
  margin-bottom: var(--space-sm);
}
.picker-head input[type="search"],
.picker-head #filter {
  flex: 1;
  min-width: 180px;
}
.veh-list {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: var(--space-sm) 0 var(--space-md);
  background: var(--surface);
}
.veh {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  font-size: 0.875rem;
  transition: background 0.1s;
}
.veh:last-child { border-bottom: 0; }
.veh:hover { background: var(--line-soft); }

/* Progress */
.progress-card { text-align: center; max-width: 520px; margin: var(--space-xl) auto; }
.progress-card h1 { margin-bottom: var(--space-sm); }
.progress-stage {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 var(--space-lg);
  min-height: 1.5em;
}
.bar {
  background: var(--line-soft);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: var(--space-md) 0 var(--space-sm);
}
.fill {
  background: var(--accent);
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-pct {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin: 0;
}

/* Results */
.row-between {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.row-between h1 { margin: 0; }

.meta-line {
  margin: 0 0 var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--line-soft);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.letter {
  white-space: pre-wrap;
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-md);
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.55;
  overflow-x: auto;
  max-height: 480px;
  overflow-y: auto;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md);
  margin: var(--space-md) 0;
}
.gallery a {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.gallery a:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.gallery img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--line-soft);
}

.gallery-thumb {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: zoom-in;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.gallery-thumb:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.gallery-thumb:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.gallery-thumb img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--line-soft);
  pointer-events: none;
}

/* Lightbox */
body.lightbox-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 16, 28, 0.88);
  padding: var(--space-md);
}
.lightbox.hidden { display: none; }

.lightbox-figure {
  margin: 0;
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 3rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  background: #111;
}

.lightbox-caption {
  color: #e8edf2;
  font-size: 0.875rem;
  text-align: center;
  max-width: 90vw;
}

.lightbox-counter {
  color: #b8c2cc;
  font-size: 0.8125rem;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: fixed;
  border: 0;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
  z-index: 2001;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.22);
}
.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.lightbox-close {
  top: var(--space-md);
  right: var(--space-md);
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.5rem;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  width: 2.75rem;
  height: 3.5rem;
  font-size: 1.75rem;
  line-height: 1;
}
.lightbox-prev { left: var(--space-md); }
.lightbox-next { right: var(--space-md); }
.lightbox-prev:disabled,
.lightbox-next:disabled {
  opacity: 0.35;
  cursor: default;
}

@media (max-width: 720px) {
  .lightbox-prev,
  .lightbox-next {
    width: 2.25rem;
    height: 2.75rem;
    font-size: 1.35rem;
  }
}

.page-footer-link {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--line-soft);
}
.page-footer-link a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
}
.page-footer-link a:hover { text-decoration: underline; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: var(--space-md) 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line-soft);
}
.data-table th {
  background: var(--line-soft);
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tr.inactive { opacity: 0.6; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: flex-start;
}

.inline-form { display: inline; margin: 0; }
.inline-form button { margin: 0; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--line-soft);
  color: var(--text-muted);
}
.badge.ok {
  background: var(--success-soft);
  color: var(--success);
}
.badge.warn {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge.running {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Details / password change */
.pwd-details { display: inline-block; }
.pwd-details summary {
  list-style: none;
  cursor: pointer;
}
.pwd-details summary::-webkit-details-marker { display: none; }
.pwd-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--line-soft);
  border-radius: var(--radius);
}
.pwd-form input:not([type="hidden"]) {
  flex: 1;
  min-width: 120px;
}

/* Storage overrides */
.override-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto auto;
  gap: var(--space-xs);
  align-items: end;
  margin-top: var(--space-xs);
}

/* Utility */
.hidden { display: none !important; }
.text-right { text-align: right; }
.mt-sm { margin-top: var(--space-sm); }
.mt-lg { margin-top: var(--space-lg); }
.mt-0 { margin-top: 0; }
.mb-md { margin-bottom: var(--space-md); }

/* Responsive */
@media (max-width: 720px) {
  .topbar {
    padding: var(--space-sm) var(--space-md);
  }
  .brand { font-size: 0.9375rem; }
  .nav-user { display: none; }
  .container { padding: var(--space-md); }
  .card { padding: var(--space-md); }
  .form-grid,
  .form-grid.cols-3,
  .override-form {
    grid-template-columns: 1fr;
  }
  .row-between { flex-direction: column; align-items: stretch; }
  .row-between .btn { width: 100%; justify-content: center; }
  h1 { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
