:root {
  --bg: #0b0f17;
  --surface: #121824;
  --surface-raised: #182234;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-muted: rgba(56, 189, 248, 0.12);
  --accent-border: rgba(56, 189, 248, 0.35);
  --gold: #f59e0b;
  --gold-muted: rgba(245, 158, 11, 0.12);
  --emerald: #10b981;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Header */
.app-header {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tag.tag-uva {
  background: var(--accent-muted);
  color: #7dd3fc;
  border-color: var(--accent-border);
}

h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.helper-text {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Select & Inputs */
select,
input[type="number"],
input[type="text"] {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="number"] {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
}

select:focus,
input[type="number"]:focus,
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

/* Segmented selector */
.segmented-control {
  display: flex;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}

.segmented-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.segmented-btn.active {
  background: #222f44;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.segmented-btn:hover:not(.active) {
  color: var(--text);
}

/* Preset buttons */
.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.preset-btn {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: #222f44;
  color: #ffffff;
  border-color: var(--border-strong);
}

/* Results Hero */
.hero-result {
  background: linear-gradient(180deg, #101926 0%, #0d131f 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.hero-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7dd3fc;
  margin-bottom: 6px;
}

.hero-amount {
  font-family: var(--font-mono);
  font-size: clamp(32px, 8vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ffffff;
  line-height: 1.1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.hero-subrow {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-subitem {
  flex: 1;
  min-width: 140px;
}

.hero-sublabel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 2px;
}

.hero-subval {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
}

.hero-subval.highlight {
  color: #34d399;
}

/* Breakdown Table */
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 6px;
}

.breakdown-table tr {
  border-bottom: 1px solid var(--border);
}

.breakdown-table tr:last-child {
  border-bottom: none;
}

.breakdown-table td {
  padding: 10px 0;
}

.breakdown-table td.col-label {
  color: var(--text);
  font-weight: 500;
}

.breakdown-table td.col-sub {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  margin-top: 2px;
}

.breakdown-table td.col-val {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.breakdown-table tr.total-row {
  border-top: 2px solid var(--border-strong);
}

.breakdown-table tr.total-row td {
  padding-top: 14px;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.breakdown-table tr.total-row td.col-val {
  color: #7dd3fc;
}

/* Action button */
.btn-action {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 14px;
}

.btn-action:hover {
  background: #222f44;
  border-color: var(--accent);
}

.btn-action.copied {
  background: #0c4a6e;
  border-color: #0284c7;
  color: #e0f2fe;
}

/* Accordion FAQ */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.faq-item:first-child {
  padding-top: 4px;
}

.faq-item:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.faq-question {
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.faq-question:hover {
  color: #ffffff;
}

.faq-chevron {
  font-size: 12px;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.faq-item.open .faq-chevron {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.faq-item.open .faq-answer {
  display: block;
}

/* Cross-links */
.nav-suite {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.suite-link {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.suite-link:hover {
  color: #ffffff;
  border-color: var(--border-strong);
}

/* Footer */
footer {
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

footer a {
  color: var(--text-muted);
  text-decoration: none;
}

footer a:hover {
  color: #ffffff;
  text-decoration: underline;
}


/* Related tools section */
.related-tools-section {
  background-color: var(--bg-surface, #171a21);
  border: 1px solid var(--border-color, #272c3b);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 32px;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.related-card {
  background-color: var(--bg-surface-elevated, #1e222d);
  border: 1px solid var(--border-color, #272c3b);
  border-radius: 8px;
  padding: 14px 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}
.related-card:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
}
.related-emoji {
  font-size: 1.4rem;
  margin-bottom: 6px;
}
.related-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #f0f3f8;
  margin-bottom: 4px;
}
.related-desc {
  font-size: 0.75rem;
  color: #9aa5b8;
  line-height: 1.4;
}

.btn-print {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background-color: var(--bg-surface-elevated, #1e222d);
  border: 1px solid var(--border-color, #272c3b);
  color: var(--text-primary, #f0f3f8);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 14px;
}
.btn-print:hover {
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

/* Print Styles */
@media print {
  body {
    background-color: #ffffff !important;
    color: #111111 !important;
    padding: 0 !important;
  }
  header .badge,
  .btn-print,
  .presets-list,
  .related-tools-section,
  .faq-section,
  footer,
  aside,
  nav {
    display: none !important;
  }
  .card, .results-card, table, .table-wrapper {
    background: #ffffff !important;
    border: 1px solid #cccccc !important;
    color: #111111 !important;
    box-shadow: none !important;
  }
  .breakdown-row {
    border-bottom: 1px solid #eeeeee !important;
  }
  .breakdown-val, th, td {
    color: #111111 !important;
  }
}
