:root {
  --bg: #0f1720;
  --surface: #16202b;
  --surface-2: #1e2a36;
  --border: #2c3c4c;
  --text: #eef4fa;
  --muted: #9eb0c1;
  --danger: #e55353;
  --warn: #f0ad4e;
  --success: #2dce89;
  --neutral: #607080;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Segoe UI, Arial, sans-serif; background: var(--bg); color: var(--text); overflow-x: hidden; }
a { color: var(--text); text-decoration: none; }
.wrap { width: min(1320px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #0b1118; border-bottom: 1px solid var(--border); }
.topbar-inner, .nav-inner, .banner-inner, .section-head, .list-row, .hero, .hero-actions, .action-row, .inline-form, .footer-inner, .alert-actions {
  display: flex; align-items: center;
}
.topbar-inner, .nav-inner, .banner-inner, .hero, .section-head, .footer-inner {
  justify-content: space-between; gap: 16px;
}
.topbar-inner { padding: 18px 0; }
.brand { display: flex; gap: 12px; align-items: center; }
.header-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.brand-mark { width: 18px; height: 18px; border-radius: 4px; background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
.brand-title { font-weight: 700; }
.brand-subtitle { font-size: 12px; color: var(--muted); }

.nav { background: #101923; border-bottom: 1px solid var(--border); }
.nav-inner { padding: 12px 0; }
.nav-links { display: flex; gap: 12px; flex-wrap: wrap; }
.nav a { padding: 10px 14px; border-radius: 10px; background: transparent; color: var(--muted); }
.nav a:hover { color: var(--text); background: var(--surface); }

.banner { background: #553f06; border-bottom: 1px solid #806311; color: #ffedb3; }
.banner-inner { padding: 12px 0; gap: 16px; }

.page { padding: 24px 0 48px; min-height: calc(100vh - 180px); }
.hero { margin-bottom: 30px; flex-wrap: wrap; }
.hero-actions, .action-row, .inline-form, .alert-actions { gap: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.narrow { width: min(520px, 100%); margin: 48px auto; }
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-size: 13px; }
.table tbody tr:hover { background: rgba(255,255,255,.02); }

.input, textarea.input, select.input { width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 12px 14px; }
label span { display: block; font-size: 13px; margin-bottom: 8px; color: var(--muted); }
.stack { display: grid; gap: 12px; }
.btn { border: 0; padding: 12px 16px; border-radius: 10px; background: var(--brand); color: #fff; cursor: pointer; font-weight: 600; }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--border); }
.btn-ghost { background: transparent; border: 1px solid var(--border); }
.btn-danger { background: var(--danger); }
.btn:hover { filter: brightness(1.06); }

.muted { color: var(--muted); }
.notice { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.notice-danger { background: rgba(229,83,83,.16); border: 1px solid rgba(229,83,83,.35); }
.notice-info { background: rgba(45, 120, 255, .12); border: 1px solid rgba(45, 120, 255, .28); color: #cfe0ff; }

.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; }
.pill-common { background: rgba(45,206,137,.15); color: #8ef1bf; }
.pill-uncommon { background: rgba(240,173,78,.15); color: #ffd084; }
.pill-rare { background: rgba(229,83,83,.15); color: #ff9e9e; }
.pill-neutral { background: rgba(96,112,128,.2); color: #d8e2eb; }
.pill-vor {
  color: #17120a;
  background: repeating-linear-gradient(
    -45deg,
    #f6c244 0 10px,
    #f6c244 10px 20px,
    #1f1f1f 20px 30px,
    #1f1f1f 30px 40px
  );
  border: 1px solid rgba(0,0,0,.35);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.pill-rail_replacement { background: #39607b; color: white; }

.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 8px; }
.stat-value.small { font-size: 16px; font-weight: 600; }
.list { display: grid; gap: 12px; }
.list-item { padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0 20px; }
code { background: rgba(255,255,255,.06); border-radius: 6px; padding: 2px 6px; }

.livery-pill {
  width: 48px;
  height: 28px;
  border-radius: 9px;
  background-size: 200% 200%;
  background-position: center;
  image-rendering: auto;
}

.table td:nth-child(3) { white-space: nowrap; }

.alert-delete {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
}
.alert-delete:hover { background: rgba(255,255,255,0.08); color: #fff; }

.supervisors {
  margin-top: 6px;
}

.supervisor-tag {
  display: inline-block;
  background: #5865F2;
  color: white;
  padding: 4px 10px;
  margin: 3px;
  border-radius: 12px;
  font-size: 13px;
  text-decoration: none;
  transition: 0.15s;
}

.supervisor-tag:hover {
  background: #4752C4;
}

.supervisor-add {
  margin-top: 6px;
  font-size: 12px;
}

.supervisor-add a {
  color: #5865F2;
  text-decoration: none;
}

.supervisor-add a:hover {
  text-decoration: underline;
}

.recent-operators,
.operator-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-operators li,
.operator-list li {
  margin: 6px 0;
}

.recent-operators a,
.operator-list a {
  text-decoration: none;
  font-weight: 500;
}

.welcome {
  margin-bottom: 16px;
}

.bulk-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 16px 0;
}

.footer {
  border-top: 1px solid var(--border);
  background: #0b1118;
  margin-top: 24px;
}
.footer-inner {
  padding: 18px 0;
  color: var(--muted);
  flex-wrap: wrap;
}
.footer-links { display:flex; gap:14px; flex-wrap:wrap; }

.hero img {
  height: 40px;
  object-fit: contain;
}
.dev-banner {
  background: #16202b;
  opacity: 0.5;
  color: white;
  text-align: center;
  padding: 6px;
  font-size: 14px;
}

.banner-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.banner-message {
  flex: 1;
}

.banner-close button {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  opacity: 0.7;
}

.banner-close button:hover {
  opacity: 1;
}

.hero-actions {
  display:flex;
  justify-content:center;
  align-items:center;
  gap:12px;
  margin-top:18px;
}

.hero-form {
  margin:0;
  display:flex;
}

.hero-actions .btn {
  min-width:190px;
  height:44px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.hero-center {
  text-align:center;
  max-width:700px;
  margin:0 auto;
}

.hero-logo {
  display:flex;
  justify-content:center;
  align-items:center;
  margin-bottom:12px;
}

.operator-logo {
  height:100px;
}

.operator-name-fallback {
  font-size:40px;
  font-weight:700;
}

.hero-subtitle {
  margin-top:10px;
}

.hero-fleet-url {
  margin-top:8px;
}

.hero-actions {
  margin-top:16px;
  display:flex;
  justify-content:center;
  gap:12px;
  flex-wrap:wrap;
}

.hero-actions .btn {
  width:180px;
  max-width:100%;
}

.hero-inner {
  text-align:center;
  max-width:720px;
  margin:0 auto;
}

.hero-logo {
  margin-bottom:12px;
}

.table td:nth-child(7),
.table th:nth-child(7) {
  white-space: nowrap;
  width: 1%;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: #9aa4b2;
}

.form input,
.form select,
.form textarea {
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid #2a3441;
  background: #0f1720;
  color: #e6edf3;
  font-size: 0.95rem;
}

.form textarea {
  min-height: 120px;
  resize: vertical;
}

.form-actions {
  margin-top: 1.5rem;
}

.alert-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-delete {
  background: none;
  border: none;
  color: #ff4d4d;
  font-size: 16px;
  cursor: pointer;
  padding: 0 6px;
}

.alert-delete:hover {
  color: #ff0000;
}

.release-notes {
  margin-top: 14px;
}

.release-notes strong {
  display: block;
  margin-bottom: 10px;
}

.release-list {
  margin: 0;
  padding-left: 18px;
}

.release-list li + li {
  margin-top: 6px;
}

@media (max-width: 960px) {
  .grid.two,
  .grid.three {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .key-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner,
  .nav-inner,
  .banner-inner,
  .section-head,
  .list-row,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-inner,
  .banner-inner {
    gap: 12px;
  }

  .nav-links,
  .header-actions {
    width: 100%;
  }

  .nav-links {
    align-items: stretch;
  }

  .nav-links .inline-form,
  .nav-links .input,
  .nav-links .btn,
  .header-actions .btn,
  .header-actions form {
    width: 100%;
  }

  .hero {
    margin-bottom: 20px;
  }

  .operator-logo {
    max-width: 100%;
    height: auto;
    max-height: 96px;
  }

  .table-wrap {
    margin: 0 -6px;
    padding-bottom: 4px;
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(100% - 20px, 1320px);
  }

  .page {
    padding: 18px 0 32px;
  }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .brand {
    width: 100%;
    align-items: flex-start;
  }

  .hero-actions,
  .action-row,
  .inline-form,
  .alert-actions {
    width: 100%;
  }

  .hero-actions .btn,
  .hero-form,
  .hero-form .btn,
  .bulk-controls .btn {
    width: 100%;
    min-width: 0;
  }

  .table th,
  .table td {
    padding: 10px;
  }

  .table td:nth-child(3),
  .table td:nth-child(7),
  .table th:nth-child(7) {
    white-space: normal;
    width: auto;
  }
}

