 :root {
  --bg: #F4F6F5;
  --card: #FFFFFF;
  --ink: #16241F;
  --ink-muted: #5B7069;
  --border: #DCE3E0;
  --accent: #1F6F5C;
  --accent-ink: #0F4A3C;
  --accent-soft: #E7F1EE;
  --danger: #A13D3D;
  --danger-soft: #FBEDED;
  --caution: #A9631B;
  --caution-soft: #FBF1E4;
  --ok: #2E7D5B;
  --ok-soft: #EAF5EF;
  --shadow: 0 12px 32px rgba(20, 40, 34, 0.08);
  --radius-card: 14px;
  --radius-field: 8px;
  --font-display: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
  --bg: #0E1613;
  --card: #16211D;
  --ink: #E8EFEC;
  --ink-muted: #93A39C;
  --border: #283530;
  --accent: #48B08F;
  --accent-ink: #8FDCC0;
  --accent-soft: #1B2E28;
  --danger: #E08787;
  --danger-soft: #2E1C1C;
  --caution: #E2A868;
  --caution-soft: #2E2416;
  --ok: #7FCBA4;
  --ok-soft: #1A2E24;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { color-scheme: light; }
html:has([data-theme="dark"]) { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  transition: background 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 24px;
}

/* ---------- Header ---------- */

.top-bar {
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
}

.brand-mark {
  display: flex;
  color: var(--accent);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
}

.slider-icon {
  font-size: 0.65rem;
  line-height: 1;
  color: var(--ink-muted);
}

.slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: var(--card);
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
  background: var(--accent);
}

input:checked + .slider::before {
  transform: translateX(20px);
}

/* ---------- Card ---------- */

.card {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.55rem;
  line-height: 1.25;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.subtitle {
  color: var(--ink-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 28px;
  max-width: 46ch;
}

/* ---------- Inputs ---------- */

.input-group {
  margin-bottom: 18px;
  position: relative;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.required {
  color: var(--danger);
  font-weight: 500;
  font-size: 0.78rem;
  margin-left: 4px;
}

.optional {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.78rem;
  margin-left: 4px;
}

.input-shell input {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.98rem;
  font-family: var(--font-body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-field);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-shell input::placeholder {
  color: var(--ink-muted);
  opacity: 0.7;
}

.input-shell input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.suggestion-box {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  box-shadow: var(--shadow);
  z-index: 10;
  overflow: hidden;
  display: none;
}

.suggestion-box.active {
  display: block;
}

.suggestion-item {
  padding: 10px 14px;
  font-size: 0.92rem;
  cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* ---------- Buttons ---------- */

.btn-primary {
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-field);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.99); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 9px 16px;
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-field);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

.btn-back {
  margin-top: 24px;
  padding: 11px 20px;
  background: transparent;
  color: var(--ink-muted);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-field);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-back:hover {
  border-color: var(--ink-muted);
  color: var(--ink);
}

/* ---------- Disclaimer / errors ---------- */

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 0;
  margin: 4px 0 0;
}

.disclaimer {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink);
}

.footer-note {
  margin-top: 18px;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* ---------- Loading ---------- */

#loadingScreen {
  padding: 40px 0;
  text-align: center;
}

.loader-content h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 20px 0 6px;
}

.loader-content p {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin: 0;
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Results ---------- */

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.result-header h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 0;
}

.result-box {
  padding: 16px 18px;
  border-radius: 10px;
  font-size: 0.95rem;
  line-height: 1.55;
  margin-bottom: 16px;
  border: 1.5px solid transparent;
}

.result-box.status-danger {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

.result-box.status-caution {
  background: var(--caution-soft);
  border-color: var(--caution);
  color: var(--caution);
}

.result-box.status-ok {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}

.result-box .status-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  display: block;
  margin-bottom: 4px;
}

.result-box .status-body {
  color: var(--ink);
}

.alert-card {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  font-size: 0.88rem;
  line-height: 1.5;
}

.alert-card .alert-source {
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
}

.section-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 22px 0 10px;
}

.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.78rem;
}

tr:last-child td { border-bottom: none; }

.source-note {
  font-size: 0.76rem;
  color: var(--ink-muted);
  margin-top: 10px;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .card { padding: 26px 20px; }
  .title { font-size: 1.3rem; }
  .result-header { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Print (Save as PDF) ---------- */

@media print {
  .top-bar, .btn-back, .btn-secondary, .footer-note { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; padding: 0; max-width: 100%; }
  .app-container { padding: 0; }
}

