:root {
  color-scheme: light;
  --bg: #0b1020;
  --card: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --accent: #7c5cff;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 800px at 30% 10%, rgba(124, 92, 255, 0.2), transparent 55%),
    radial-gradient(900px 650px at 80% 0%, rgba(70, 174, 255, 0.18), transparent 60%),
    var(--bg);
  color: var(--text);
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 32px 16px;
}

.header h1 {
  margin: 0 0 6px 0;
  font-size: 32px;
  letter-spacing: -0.02em;
}

.sub {
  margin: 0 0 18px 0;
  color: var(--muted);
}

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  backdrop-filter: blur(10px);
  margin: 14px 0;
}

.card:has(.autocomplete-wrap) {
  z-index: 10;
}

.form .label {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.between {
  justify-content: space-between;
}

.autocomplete-wrap {
  flex: 1;
  position: relative;
}

.input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  outline: none;
}

.input:focus {
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(14, 18, 36, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  max-height: 260px;
  overflow-y: auto;
}

.suggestion-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.1s;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
  background: rgba(124, 92, 255, 0.18);
}

.suggestion-primary {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.suggestion-secondary {
  font-size: 12px;
  color: var(--muted);
}

.button {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(124, 92, 255, 0.6);
  background: rgba(124, 92, 255, 0.18);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  background: rgba(124, 92, 255, 0.25);
}

.button.secondary {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.08);
}

.h2 {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
}

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

.small {
  font-size: 12px;
}

.meta {
  color: var(--muted);
  font-size: 12px;
}

.error {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 96, 124, 0.5);
  background: rgba(255, 96, 124, 0.1);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

.table-wrap {
  margin-top: 12px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table th,
.table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

.table th {
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.35);
  text-align: left;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 650;
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.table th.sortable:hover {
  color: rgba(255, 255, 255, 1);
  background: rgba(124, 92, 255, 0.12);
}

.table th.sortable .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.3;
  transition: opacity 0.15s;
}

.table th.sortable.sort-asc .sort-arrow,
.table th.sortable.sort-desc .sort-arrow {
  opacity: 1;
  color: var(--accent);
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.4;
}

.badge.warn {
  border-color: rgba(255, 196, 0, 0.45);
  background: rgba(255, 196, 0, 0.1);
}

.badge.ok {
  border-color: rgba(124, 92, 255, 0.55);
  background: rgba(124, 92, 255, 0.14);
}

/* ── FCC tech code tooltip chips ───────────────────────────────────── */

.tech-code {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  line-height: 1.5;
}

.tech-code--hasTip {
  cursor: help;
  position: relative;
  outline: none;
}

.tech-code--hasTip:hover,
.tech-code--hasTip:focus-visible {
  border-color: rgba(124, 92, 255, 0.55);
  background: rgba(124, 92, 255, 0.14);
}

.tech-code--hasTip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  max-width: 240px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(14, 18, 36, 0.98);
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.tech-code--hasTip:hover::after,
.tech-code--hasTip:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* ── Plan filters ──────────────────────────────────────────────────── */

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.filter-dropdown {
  position: relative;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
}

.filter-btn.active {
  border-color: rgba(124, 92, 255, 0.55);
  background: rgba(124, 92, 255, 0.12);
  color: var(--text);
}

.filter-btn.open {
  border-color: rgba(124, 92, 255, 0.55);
}

.filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.filter-chevron {
  font-size: 10px;
  opacity: 0.5;
}

.filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 200px;
  max-height: 300px;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(14, 18, 36, 0.97);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.filter-panel-header {
  display: flex;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.filter-action {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.1s;
}

.filter-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.filter-options {
  overflow-y: auto;
  padding: 6px 0;
  flex: 1;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
}

.filter-option:hover {
  background: rgba(124, 92, 255, 0.12);
}

.filter-option input[type="checkbox"] {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.filter-option input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.filter-option input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}

.details {
  margin: 0;
}

.details-summary {
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 16px;
}

.details-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.details[open] .details-hint {
  display: none;
}

.log {
  margin: 12px 0 0 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.22);
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.35;
}

/* ── Login page ───────────────────────────────────────────────────── */

.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
  backdrop-filter: blur(12px);
}

.login-title {
  margin: 0 0 4px 0;
  font-size: 28px;
  letter-spacing: -0.02em;
  text-align: center;
}

.login-sub {
  margin: 0 0 24px 0;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.login-form .label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin: 14px 0 6px 0;
}

.login-form .label:first-of-type {
  margin-top: 0;
}

.login-form .input {
  width: 100%;
}

.login-error {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 96, 124, 0.5);
  background: rgba(255, 96, 124, 0.1);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
}

.login-btn {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  font-size: 15px;
}

/* ── Header user bar ──────────────────────────────────────────────── */

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.user-badge {
  padding: 4px 12px;
  border-radius: 8px;
  background: rgba(124, 92, 255, 0.14);
  border: 1px solid rgba(124, 92, 255, 0.4);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover {
  text-decoration: underline;
}

/* ── Admin page ───────────────────────────────────────────────────── */

.admin-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 12px;
}

.admin-field {
  flex: 1;
  min-width: 140px;
}

.admin-field .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.admin-field .input {
  width: 100%;
}

.admin-field-btn {
  flex: 0 0 auto;
  min-width: auto;
}

.admin-msg {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.admin-msg.error {
  border: 1px solid rgba(255, 96, 124, 0.5);
  background: rgba(255, 96, 124, 0.1);
  color: rgba(255, 255, 255, 0.92);
}

.admin-msg.success {
  border: 1px solid rgba(80, 200, 120, 0.5);
  background: rgba(80, 200, 120, 0.1);
  color: rgba(255, 255, 255, 0.92);
}

.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.small-btn {
  padding: 4px 10px;
  font-size: 12px;
}

.danger-btn {
  border-color: rgba(255, 96, 124, 0.5) !important;
  color: rgba(255, 140, 160, 1);
}

.danger-btn:hover {
  background: rgba(255, 96, 124, 0.15) !important;
}

/* ── Modal ─────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: rgba(14, 18, 36, 0.98);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}

.modal-title {
  margin: 0 0 4px 0;
  font-size: 18px;
}

.modal-sub {
  margin: 0 0 16px 0;
  color: var(--muted);
  font-size: 14px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ── Misc ──────────────────────────────────────────────────────────── */

.nowrap {
  white-space: nowrap;
}

select.input {
  appearance: auto;
  cursor: pointer;
}
