:root {
  --brand: #f72d2d; /* rgb(247,45,45) */
  --brand-600: #f72d2d;
  --brand-700: #e01e1e;
  --bg: #0b0f14;
  --surface: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #1f2937;
  --accent: #06b6d4; /* cyan-500 */
  --ok: #16a34a;
  --warn: #d97706;
  --error: #dc2626;
}

/* Light theme overrides */
html[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--surface), var(--bg));
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus { left: 12px; top: 12px; z-index: 999; background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: 8px; }

/* Header */
.site-header { position: sticky; top: 0; backdrop-filter: saturate(1.2) blur(8px); background: color-mix(in oklab, var(--surface) 82%, transparent); border-bottom: 1px solid var(--border); z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; }
.brand-name { letter-spacing: 0.2px; }
.site-nav ul { display: flex; list-style: none; gap: 14px; margin: 0; padding: 0; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: 8px; }
.site-nav a[aria-current="page"], .site-nav a:hover { color: var(--text); background: rgba(247, 45, 45, 0.12); }

.theme-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 6px 10px; cursor: pointer; }
.nav-toggle { display: none; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 6px; }
.nav-toggle .bar { display: block; width: 22px; height: 2px; background: var(--text); margin: 4px 2px; }

/* Hero */
.hero { padding: 64px 0 24px; text-align: center; }
.hero h1 { margin: 0 0 10px; font-size: clamp(28px, 5vw, 42px); }
.subhead { color: var(--muted); margin: 0 auto 22px; max-width: 780px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; }
.btn.primary { background: #f72d2d; border-color: #e01e1e; color: #fff; }
.btn.ghost { background: transparent; }

/* Tool Section */
.tool-section { padding: 24px 0 12px; }
.section-head { margin-bottom: 16px; }
.grid-form { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: color-mix(in oklab, var(--surface) 92%, transparent); }
label { font-weight: 600; }
input, select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
input[type="range"] { padding: 0; background: transparent; }
.range-note { color: var(--muted); margin-top: -4px; margin-bottom: 4px; grid-column: span 2; }
.inline-actions { display: flex; gap: 10px; grid-column: span 2; flex-wrap: wrap; }
.help { color: var(--muted); grid-column: span 2; margin: 0; }

/* Results */
.results { margin-top: 18px; }
.results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: color-mix(in oklab, var(--surface) 92%, transparent); }
.card.total { outline: 2px dashed rgba(247, 45, 45, 0.4); }
.label { color: var(--muted); font-size: 14px; }
.value { font-size: clamp(20px, 4vw, 28px); font-weight: 700; }
.breakdown { margin-top: 10px; color: var(--muted); }

/* Accordion */
.faq { padding: 24px 0 56px; }
.accordion { display: grid; gap: 8px; }
.accordion-item { width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.accordion-item[aria-expanded="true"] { background: rgba(247, 45, 45, 0.08); }
.accordion-panel { display: none; padding: 10px 12px 14px; border-radius: 12px; background: color-mix(in oklab, var(--surface) 92%, transparent); border: 1px dashed var(--border); }
.accordion-item[aria-expanded="true"] + .accordion-panel { display: block; animation: fadeIn 220ms ease-out; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: translateY(0); } }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: color-mix(in oklab, var(--surface) 92%, transparent); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 0; }
.footer-inner ul { display: flex; list-style: none; gap: 12px; margin: 0; padding: 0; }
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-brand { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.social a { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 16px; transition: all 0.2s ease; }
.social a:hover { background: #f72d2d; color: #fff; border-color: #f72d2d; transform: translateY(-2px); }
.footer-bottom { border-top: 1px solid var(--border); padding: 12px 0; text-align: center; }
.footer-bottom p { margin: 0; color: var(--muted); font-size: 14px; }

/* Dialog */
dialog { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface); color: var(--text); }
.code { background: #0b1220; padding: 8px 10px; border-radius: 10px; overflow: auto; border: 1px solid var(--border); }

/* Social Media Icons */
.social a { display: inline-flex; width: 32px; height: 32px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 16px; transition: all 0.2s ease; }
.social a:hover { background: #f72d2d; color: #fff; border-color: #f72d2d; transform: translateY(-2px); }
.social svg { width: 18px; height: 18px; fill: currentColor; }


/* Responsive */
@media (max-width: 900px) {
  .results-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .range-note, .inline-actions, .help { grid-column: auto; }
  .site-nav { position: absolute; inset: 60px 0 auto 0; background: var(--surface); border-bottom: 1px solid var(--border); display: none; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: 12px; }
  .nav-toggle { display: inline-block; }
}

/* Focus styles for accessibility */
:is(a, button, input, select):focus { outline: 2px solid var(--accent); outline-offset: 2px; }


