:root {
  color-scheme: dark;
  --ink: #f3f4f6;
  --muted: #a4acb6;
  --accent: #e0b557;
  --accent-dark: #b27d24;
  --panel: rgba(14, 19, 27, 0.86);
  --shadow: 0 26px 54px rgba(0, 0, 0, 0.45);
  --line: rgba(243, 244, 246, 0.08);
  --ok: #62c07a;
  --bad: #e06b5a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "IBM Plex Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, rgba(224, 181, 87, 0.18), transparent 45%),
    radial-gradient(circle at 82% 25%, rgba(68, 100, 160, 0.28), transparent 40%),
    radial-gradient(circle at 55% 80%, rgba(128, 38, 58, 0.3), transparent 45%),
    linear-gradient(135deg, #090d13, #141a24 50%, #0a0e14);
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 36px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(17, 23, 34, 0.92), rgba(21, 28, 39, 0.78));
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: flex-start;
}

.afi-link,
.print-btn {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.afi-link {
  background: rgba(224, 181, 87, 0.15);
  color: var(--accent);
  border: 1px solid rgba(224, 181, 87, 0.4);
}

.afi-link:hover {
  background: rgba(224, 181, 87, 0.25);
  transform: translateY(-2px);
}

.print-btn {
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  font-family: inherit;
}

.print-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  margin: 0 0 8px;
  color: var(--accent);
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  margin: 0 0 8px;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  max-width: 520px;
}

.grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.panel {
  padding: 24px;
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 1.2rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="date"],
select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font-size: 1rem;
  font-family: inherit;
  background: rgba(7, 11, 17, 0.85);
  color: var(--ink);
}

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

/* Tooltip */
.tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(224, 181, 87, 0.2);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: bold;
  cursor: help;
  position: relative;
  margin-left: 4px;
}

.tooltip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1f2a;
  color: var(--ink);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: normal;
  width: 240px;
  text-align: left;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  z-index: 100;
  line-height: 1.4;
}

/* Toggle switches */
.toggle-grid {
  display: grid;
  gap: 14px;
}

.toggle {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 0;
}

.toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 48px;
  height: 26px;
  background: rgba(100, 100, 100, 0.3);
  border-radius: 26px;
  transition: background 0.25s;
  flex-shrink: 0;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle input:checked + .toggle-track {
  background: var(--ok);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(22px);
}

.toggle input:focus + .toggle-track {
  box-shadow: 0 0 0 3px rgba(224, 181, 87, 0.3);
}

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 6px;
}

.hint.highlight {
  color: var(--accent);
  font-weight: 500;
}

.hint.disclaimer {
  margin-top: 16px;
  padding: 12px;
  background: rgba(224, 181, 87, 0.1);
  border-radius: 10px;
  border-left: 3px solid var(--accent);
}

.result-panel {
  grid-column: span 2;
}

.result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(130deg, rgba(224, 181, 87, 0.18), rgba(17, 23, 34, 0.85));
  border: 1px solid rgba(224, 181, 87, 0.35);
}

.result-label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  margin: 0;
  color: var(--accent);
}

.result-text {
  margin: 6px 0 0;
  font-size: 2.1rem;
  font-weight: 700;
}

.future-date {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.future-date.highlight {
  color: var(--accent);
  font-weight: 500;
}

.pill {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.pill.pass {
  background: rgba(98, 192, 122, 0.18);
  color: var(--ok);
  border-color: rgba(98, 192, 122, 0.35);
}

.pill.fail {
  background: rgba(224, 107, 90, 0.2);
  color: var(--bad);
  border-color: rgba(224, 107, 90, 0.35);
}

.pill.neutral {
  background: rgba(243, 244, 246, 0.08);
  color: var(--muted);
}

.requirements {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.requirement {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.6fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(7, 11, 17, 0.6);
  font-size: 0.95rem;
}

.requirement span:last-child {
  text-align: right;
  font-weight: 600;
}

.requirement.ok span:last-child {
  color: var(--ok);
}

.requirement.bad span:last-child {
  color: var(--bad);
}

.hidden {
  display: none !important;
}

/* Print styles */
@media print {
  body {
    background: #fff;
    color: #1a1a1a;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .page {
    padding: 20px;
  }

  .hero {
    background: #f5f5f5;
    box-shadow: none;
    border: 1px solid #ddd;
    padding: 20px;
  }

  .header-actions {
    display: none;
  }

  .panel {
    background: #fff;
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  .result {
    background: #f9f6ed;
    border: 2px solid #c5a900;
  }

  .result-text {
    color: #1a1a1a;
  }

  .requirement {
    background: #fafafa;
    border: 1px solid #ddd;
  }

  .requirement.ok span:last-child {
    color: #2d7a45;
  }

  .requirement.bad span:last-child {
    color: #b8372a;
  }

  .pill.pass {
    background: #d4edda;
    color: #155724;
  }

  .pill.fail {
    background: #f8d7da;
    color: #721c24;
  }

  .toggle-track {
    display: none;
  }

  .toggle input[type="checkbox"] {
    position: static;
    opacity: 1;
    width: auto;
    height: auto;
  }

  .tooltip {
    display: none;
  }
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    grid-column: span 1;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    flex-direction: row;
    width: 100%;
  }

  .afi-link,
  .print-btn {
    flex: 1;
  }

  .result {
    flex-direction: column;
    align-items: flex-start;
  }

  .requirement {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .requirement span:last-child {
    text-align: left;
  }

  .tooltip:hover::after {
    left: 0;
    transform: translateX(0);
    width: 200px;
  }
}

/* Navigation */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0 24px;
}

.top-nav a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: background 0.2s;
}

.top-nav a:hover {
  background: rgba(255, 255, 255, 0.2);
}

@media print {
  .top-nav { display: none; }
}
