: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);
  --success: #10b981;
  --success-muted: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.35);
  --warning: #f59e0b;
  --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: 720px;
  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;
  flex-wrap: wrap;
}

.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-accent {
  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;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

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

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

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

input[type="number"], select {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

input[type="number"]:focus, select:focus {
  border-color: var(--accent);
}

select {
  font-family: var(--font-sans);
  cursor: pointer;
}

/* Segmented Buttons */
.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);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

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

/* Checkbox Toggle Group */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  padding-right: 12px;
}

.toggle-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.toggle-desc {
  font-size: 11px;
  color: var(--text-dim);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface-raised);
  border: 1px solid var(--border-strong);
  transition: .2s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #94a3b8;
  transition: .2s;
  border-radius: 50%;
}

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

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #ffffff;
}

/* Result Box */
.result-banner {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.08) 0%, rgba(18, 24, 36, 0.9) 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}

.result-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.result-total {
  font-family: var(--font-mono);
  font-size: 38px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.result-pct {
  font-size: 13px;
  color: #7dd3fc;
  font-family: var(--font-mono);
}

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

.breakdown-table th {
  text-align: left;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.breakdown-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

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

.tag-discount {
  display: inline-block;
  font-size: 10px;
  background: var(--success-muted);
  color: #34d399;
  border: 1px solid var(--success-border);
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 6px;
}

/* Info section / FAQ */
.faq-section {
  margin-top: 32px;
}

.faq-title {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 16px;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.faq-q {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 6px;
}

.faq-a {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Footer */
footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-links a:hover {
  color: var(--accent);
}

@media (max-width: 600px) {
  .result-total {
    font-size: 30px;
  }
}


/* 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;
  }
}
