:root {
  --bg: #0b1220;
  --card: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --border: #1f2937;
  --input: #0f172a;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  /* WITHOUT THIS, EVERY <select> ON THIS SITE OPENS AN UNREADABLE LIST.
     The rule below styles `select` with near-white text on a dark background, which is right for
     the closed control. The POPUP is drawn by the browser, not by that rule, and with no
     color-scheme declared the browser assumes a LIGHT page and paints the popup on a light
     surface -- while each <option> inherits the select's #e5e7eb. Near-white on white: the list
     is there and cannot be read. Reported 2026-08-17 against the microphone picker; all seven
     selects on this site (logbook x4, parts x2, voice-enroll x1) had it from the start.
     This also fixes scrollbars, focus rings and date pickers. Safe site-wide: there is no
     prefers-color-scheme block and no light variant anywhere in this file. */
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #1e293b 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

.top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 0.5rem;
  max-width: 960px;
  margin: 0 auto;
}

h1 { margin: 0.15rem 0; font-size: 1.55rem; letter-spacing: -0.02em; }
h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }
.eyebrow { margin: 0; color: var(--accent); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.sub, .muted { color: var(--muted); font-size: 0.9rem; }
.muted-card { opacity: 0.95; }

.badge-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-start; }
.badge {
  border: 1px solid var(--border);
  background: #0f172a;
  color: var(--accent2);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
}
.badge-warn { color: var(--warn); }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem 2.5rem;
  display: grid;
  gap: 1rem;
}

.card {
  background: color-mix(in srgb, var(--card) 92%, black);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

.targets ul { margin: 0.25rem 0 0.5rem 1.1rem; padding: 0; }

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.5rem 0.75rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  border-radius: 10px;
  padding: 0.75rem 0.75rem;
  min-height: 44px;
  font: inherit;
}

/* Belt and braces to `color-scheme: dark` above, and not redundant: an engine that ignores
   color-scheme still honours this, and this is the rule that directly contradicts the near-white
   an <option> would otherwise inherit from its <select>. */
option {
  background-color: var(--input);
  color: var(--text);
}

textarea { resize: vertical; }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.actions.tight { margin: 0; }
.row-between { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem; align-items: center; }

.btn {
  border: 1px solid var(--border);
  background: #1e293b;
  color: var(--text);
  border-radius: 10px;
  padding: 0.75rem 0.95rem;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: linear-gradient(135deg, #0369a1, #0ea5e9); border-color: transparent; font-weight: 600; }
.btn.danger { color: var(--danger); }

.entries { display: grid; gap: 0.65rem; }
.entry {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: #0b1220;
}
.entry header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.entry .cat { color: var(--accent); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
.entry .tag {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.tag-CONFIRMED { color: var(--accent2); }
.tag-CLAIMED { color: var(--warn); }
.tag-OPEN { color: var(--muted); }
.entry p { margin: 0.25rem 0; }
.meta { font-size: 0.8rem; color: var(--muted); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0 1rem 2rem;
}

a { color: var(--accent); }

@media (max-width: 560px) {
  h1 { font-size: 1.3rem; }
  .btn { flex: 1 1 auto; }
}

.nav {display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:.75rem;
  max-width:1100px;margin:0 auto;padding:0.85rem 1.25rem;border-bottom:1px solid var(--border);
  position:sticky;top:0;background:rgba(11,18,32,.92);backdrop-filter:blur(8px);z-index:20}
.nav .brand {font-weight:700;color:var(--accent);text-decoration:none;letter-spacing:.04em}
.nav-links {display:flex;flex-wrap:wrap;gap:.35rem}
.nav-links a {color:var(--text);text-decoration:none;padding:.45rem .7rem;border-radius:999px;border:1px solid transparent;min-height:40px;display:inline-flex;align-items:center}
.nav-links a:hover {border-color:var(--accent);color:var(--accent)}
.hero {max-width:1100px;margin:0 auto;padding:1.25rem}
.hero h1 {font-size:clamp(1.5rem,4vw,2.1rem);margin:.2rem 0}
.chips {display:flex;flex-wrap:wrap;gap:.4rem;margin:.75rem 0}
.chip {border:1px solid var(--border);border-radius:999px;padding:.25rem .65rem;font-size:.78rem;background:#0f172a}
.chip.ok {color:var(--accent2)} .chip.warn {color:var(--warn)} .chip.bad {color:var(--danger)}
.grid-cards {display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:1rem;max-width:1100px;margin:0 auto;padding:0 1.25rem 1.5rem}
.card-cta {display:block;text-decoration:none;color:inherit;transition:transform .12s ease}
.card-cta:hover {transform:translateY(-2px);border-color:var(--accent)}
.gallery {display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.65rem}
.gallery a {display:block;border-radius:12px;overflow:hidden;border:1px solid var(--border);background:#000;aspect-ratio:4/3}
.gallery img {width:100%;height:100%;object-fit:cover;display:block}
.manual-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:.75rem}
.manual-btn {display:flex;flex-direction:column;gap:.25rem;padding:1rem;border-radius:14px;border:1px solid var(--border);
  background:linear-gradient(160deg,#0f172a,#111827);text-decoration:none;color:var(--text);min-height:96px}
.manual-btn strong {color:var(--accent)}
.manual-btn span {color:var(--muted);font-size:.85rem}
.parts-table {width:100%;border-collapse:collapse;font-size:.9rem}
.parts-table th,.parts-table td {border-bottom:1px solid var(--border);padding:.55rem .4rem;text-align:left;vertical-align:top}
.parts-table th {color:var(--muted);font-weight:600}
.vendor-links {display:flex;flex-wrap:wrap;gap:.35rem}
.vendor-links a {font-size:.78rem;padding:.3rem .5rem;border-radius:8px;border:1px solid var(--border);text-decoration:none;color:var(--accent);min-height:36px;display:inline-flex;align-items:center}
.totals {display:flex;flex-wrap:wrap;gap:1rem;margin-top:.75rem}
.totals div {background:#0b1220;border:1px solid var(--border);border-radius:12px;padding:.65rem .85rem;min-width:120px}
.order-row.status-delivered {border-left:3px solid var(--accent2)}
.order-row.status-shipped {border-left:3px solid var(--accent)}
.order-row.status-ordered {border-left:3px solid var(--warn)}

.buy-stack {display:flex;flex-direction:column;gap:.35rem}
.buy-link {display:flex;align-items:flex-start;gap:.4rem;font-size:.82rem;padding:.45rem .55rem;border-radius:10px;
  border:1px solid var(--border);text-decoration:none;color:var(--text);background:#0b1220;min-height:40px}
.buy-link:hover {border-color:var(--accent);color:var(--accent)}
.tag-mini {font-size:.65rem;padding:.1rem .35rem;border-radius:6px;border:1px solid var(--border);white-space:nowrap;color:var(--muted)}
.tag-mini.ok {color:var(--accent2);border-color:#14532d}
.tag-mini.warn {color:var(--warn)}
.chip.bad {color:var(--danger)}

/* AI Advisor Chat UI */
.ai-advisor-btn {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
  margin-top: 0.5rem;
  animation: pulse-glow 2s infinite alternate;
}
.ai-advisor-btn:hover {
  background: var(--accent);
  color: #fff;
}
@keyframes pulse-glow {
  0% { box-shadow: 0 0 5px rgba(59, 130, 246, 0.2); }
  100% { box-shadow: 0 0 15px rgba(59, 130, 246, 0.6); }
}

#aiAdvisorModal {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
.ai-modal-content {
  background: var(--card);
  border: 1px solid var(--accent);
  width: 90%;
  max-width: 500px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  max-height: 85vh;
}
.ai-modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-modal-header h3 { margin: 0; color: var(--accent); font-size: 1.1rem; }
.ai-modal-body {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: rgba(0,0,0,0.2);
}
.ai-msg {
  padding: 0.8rem;
  border-radius: 8px;
  max-width: 85%;
  font-size: 0.9rem;
}
.ai-msg.system { background: rgba(59, 130, 246, 0.1); border-left: 3px solid var(--accent); align-self: flex-start; }
.ai-msg.user { background: rgba(255, 255, 255, 0.1); align-self: flex-end; }
.ai-modal-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
}
.ai-modal-footer input[type="text"] { flex: 1; min-height: 40px; }
.ai-modal-footer button { padding: 0 1rem; border-radius: 8px; background: var(--accent); color: #fff; border: none; font-weight: bold; cursor: pointer; }
.upload-icon-btn { background: #334155 !important; }


/* Spoken-runbook player. Deliberately plain: it sits under the page heading and must not compete
   with the procedure itself. `preload="none"` on the element means nothing is fetched until the
   listener asks -- the full audio set is ~17 MB per voice and is not worth spending on a visitor
   who came to read. */
.audio-host { max-width: 1100px; margin: 0 1.25rem 1rem; }
.audio-bar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  padding: 0.75rem 0.9rem; background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 6px;
}
.audio-bar audio { flex: 1 1 18rem; min-width: 14rem; height: 2.2rem; }
.audio-voice { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: #94a3b8; }
.audio-voice select {
  margin-left: 0.4rem; background: #0f172a; color: var(--text);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 4px; padding: 0.25rem 0.4rem;
  font-family: inherit; font-size: 0.8rem; text-transform: none; letter-spacing: 0;
}
.audio-note { flex: 1 1 100%; margin: 0; font-size: 0.72rem; color: #94a3b8; line-height: 1.45; }
