:root {
  --bg: #0c0f0e;
  --bg-elevated: #141a17;
  --ink: #e8efe9;
  --muted: #8a9a8e;
  --line: #243028;
  --accent: #c4f542;
  --accent-ink: #0c0f0e;
  --danger: #ff6b5a;
  --font-display: "Space Grotesk", "Avenir Next", sans-serif;
  --font-body: "IBM Plex Sans", "Helvetica Neue", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a2a1c 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1a2218 0%, transparent 50%),
    linear-gradient(180deg, #0c0f0e 0%, #101512 100%);
  color: var(--ink);
  line-height: 1.5;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  width: min(920px, calc(100% - clamp(1.25rem, 4vw, 2.5rem)));
  margin: 0 auto;
  padding: clamp(1.75rem, 5vw, 3.5rem) 0 clamp(2.5rem, 6vw, 4rem);
}

.brand {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  margin: 0 0 0.75rem;
}

.brand a {
  color: inherit;
  text-decoration: none;
}

.brand a:hover {
  text-decoration: none;
}

.brand a:hover span {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.brand span {
  color: var(--accent);
}

.lede {
  margin: 0 0 clamp(1.5rem, 4vw, 2.5rem);
  color: var(--muted);
  max-width: 36rem;
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
}

.lede code {
  word-break: break-word;
}

.panel {
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: clamp(0.85rem, 2vw, 1rem);
  padding: clamp(1.15rem, 3vw, 1.75rem);
  backdrop-filter: blur(8px);
  min-width: 0;
}

.panel h2 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.panel-head h2 {
  margin: 0;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  align-items: center;
  flex-wrap: wrap;
}

.db-data-filter {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.15rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: color-mix(in srgb, var(--bg-elevated) 80%, #000);
}

.db-data-filter .btn {
  border: 0;
  min-height: 1.9rem;
  padding: 0.3rem 0.75rem;
}

.db-data-filter .btn.is-active {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--ink);
}

.panel + .panel {
  margin-top: 1rem;
}

.panel-tools {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
}

.section-note {
  margin: -0.35rem 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 40rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid var(--line);
  background: #0a0d0b;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  outline: none;
}

input[type="email"] {
  margin-bottom: 1rem;
}

input[type="email"]:focus,
input[type="password"]:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

label.remember {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1rem 0 0;
  color: var(--ink);
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
}

label.remember input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.8rem 1.2rem;
  border: 0;
  border-radius: 0.65rem;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  min-height: 2.75rem;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.btn-small {
  margin-top: 0;
  padding: 0.45rem 0.85rem;
  min-height: 2.15rem;
  font-size: 0.85rem;
  border-radius: 0.5rem;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  color: var(--ink);
  filter: none;
}

.error {
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.55rem;
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: #ffb4ab;
  font-size: 0.92rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  margin-bottom: clamp(1.25rem, 3vw, 1.75rem);
}

.topbar > div {
  min-width: 0;
  flex: 1 1 auto;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 0 0 auto;
}

.topbar .btn {
  margin-top: 0.35rem;
  flex: 0 0 auto;
}

.meta {
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 2vw, 0.78rem);
  color: var(--muted);
  margin-top: 0.35rem;
  line-height: 1.4;
  word-break: break-word;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  padding: clamp(0.85rem, 2.2vw, 1rem) clamp(0.9rem, 2.4vw, 1.1rem);
  border-radius: 0.75rem;
  border: 1px solid var(--line);
  background: #0d1210;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
  min-width: 0;
}

.list a:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: #121815;
  transform: translateX(3px);
}

.row-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1 1 auto;
}

.host {
  font-family: var(--font-mono);
  font-size: clamp(0.82rem, 2.4vw, 0.95rem);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.desc {
  color: var(--muted);
  font-size: clamp(0.8rem, 2.2vw, 0.88rem);
  line-height: 1.35;
}

.chip {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
  flex: 0 0 auto;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  margin: 0;
}

.panel-oen {
  margin-top: 1rem;
}

.panel-oen h2 {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.panel-oen-detail .panel-head {
  margin-bottom: 0.65rem;
}

.panel-oen-detail h2 {
  font-size: clamp(1.55rem, 4.5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.panel-oen-detail h2 .db-count {
  font-size: clamp(0.95rem, 2.8vw, 1.15rem);
  color: var(--accent);
  font-weight: 600;
}

.oen-form {
  margin-bottom: 0.85rem;
}

.oen-form label {
  margin-bottom: 0.35rem;
}

.oen-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: stretch;
}

.oen-input {
  flex: 1 1 14rem;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  border-radius: 0.55rem;
  border: 1px solid var(--line);
  background: #0a0d0b;
  color: var(--ink);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  outline: none;
}

.oen-input:focus {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.oen-row .btn {
  margin-top: 0;
}

.oen-result-meta {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.oen-result-meta strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 500;
}

.oen-table {
  min-width: 420px;
}

.oen-table a {
  color: var(--accent);
  text-decoration: none;
}

.oen-table a:hover {
  text-decoration: underline;
}

.oen-human-link {
  color: inherit;
}

.oen-detail-human {
  margin: -0.25rem 0 0.65rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.oen-subhead {
  margin: 0.85rem 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.oen-subhead code {
  font-size: 0.85em;
}

.oen-aftermarket {
  margin-top: 1.15rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}

.oen-aftermarket h3 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.oen-aftermarket-table {
  min-width: 520px;
}

.panel-databases {
  margin-top: 1rem;
}

.panel-databases h2 {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.db-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.db-errors {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.db-table-wrap {
  overflow-x: auto;
  margin: 0 -0.15rem;
  padding: 0 0.15rem;
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 860px;
}

.db-table th,
.db-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.db-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.db-table tbody tr:hover {
  background: color-mix(in srgb, var(--bg-elevated) 55%, #0a0d0b);
}

.db-table .num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.db-table .db-name {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  white-space: nowrap;
}

.db-table .db-name a {
  color: var(--ink);
}

.db-table .db-name a:hover {
  color: var(--accent);
}

.db-table .db-desc {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  max-width: 16rem;
}

.db-table .db-meta {
  white-space: nowrap;
  font-size: 0.82rem;
}

.db-table .db-data {
  text-align: center;
  vertical-align: middle;
}

.db-data-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  opacity: 0.92;
}

.db-data-icon svg {
  display: block;
}

.db-table .db-copyright-open {
  color: #7dff9a;
  font-weight: 500;
}

.db-table .db-copyright-analysis {
  color: #ff6b5a;
  font-weight: 500;
}

.db-table .chip {
  display: inline-block;
}

.db-select,
.db-input {
  width: 100%;
  min-width: 7.5rem;
  max-width: 14rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.45rem;
  border: 1px solid var(--line);
  background: #0d1210;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
}

.db-input {
  max-width: 18rem;
  min-width: 10rem;
}

.db-select:focus,
.db-input:focus {
  outline: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.db-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.flash {
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.55rem;
  font-size: 0.9rem;
}

.flash-ok {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}

.flash-error {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: #ffb4ab;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
}

.section-note a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.footer {
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--muted);
  font-size: clamp(0.72rem, 2vw, 0.8rem);
  line-height: 1.45;
  word-break: break-word;
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topbar .btn {
    width: 100%;
  }

  .list a {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .chip {
    margin-top: 0.1rem;
  }

  .list a:hover {
    transform: none;
  }
}

@media (max-width: 480px) {
  .panel {
    padding: 1.05rem 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .list a,
  .btn {
    transition: none;
  }

  .list a:hover,
  .btn:hover {
    transform: none;
  }
}
