:root {
  /* Wedding palette: ivory base, sage + dusty rose accents, champagne + silver touches */
  --bg: #f6f3ee;
  --bg-alt: #efeae1;
  --card: #ffffff;
  --sage: #7f9c79;
  --sage-light: #9caf88;
  --rose: #bd8398;
  --rose-light: #d4a5a5;
  --gold: #b29a6a;
  --silver: #c9ccce;
  --text: #3c3a37;
  --text-dim: #8b847b;
  --grid: #ece7df;
  --border: #e6e0d6;
  --success: #6f8f6a;
  --warning: #c9a14a;
  --danger: #c46b6b;
  --shadow: 0 1px 3px rgba(60, 58, 55, 0.06), 0 8px 24px rgba(60, 58, 55, 0.06);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Lato', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  padding: 2.5rem 1rem;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2.5rem;
}

h1 {
  font-family: var(--serif);
  color: var(--text);
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-dim);
  font-size: 1.05rem;
  font-weight: 300;
  letter-spacing: 0.3px;
}

/* A delicate divider under the header */
header::after {
  content: "";
  display: block;
  width: 80px;
  height: 1px;
  margin: 1.25rem auto 0;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}

h2 {
  font-family: var(--serif);
  color: var(--sage);
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  letter-spacing: 0.3px;
}

h3 {
  font-family: var(--serif);
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
}

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 2rem;
  margin-bottom: 1.75rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.note {
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 1.25rem;
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.tab-button {
  background: var(--card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.6rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-button:hover {
  border-color: var(--sage-light);
  color: var(--sage);
}

.tab-button.active {
  background: var(--sage);
  color: #fff;
  border-color: var(--sage);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(127, 156, 121, 0.3);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--card);
  border-radius: 14px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--sage-light);
  text-align: center;
  box-shadow: var(--shadow);
}

.kpi-label {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-family: var(--serif);
  color: var(--text);
  font-size: 2.3rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.kpi-note {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.kpi-card.positive {
  border-top-color: var(--success);
}

.kpi-card.positive .kpi-value {
  color: var(--success);
}

.kpi-card.negative {
  border-top-color: var(--danger);
}

.kpi-card.negative .kpi-value {
  color: var(--danger);
}

/* Selection summary chips (under the KPI cards) */
.selection-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
  min-height: 1.5rem;
}

.selection-summary .selection-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin-right: 0.15rem;
}

.selection-summary .chip {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--sage-light);
  color: var(--text);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

/* Slider range hint (vendor sliders) */
.range-hint {
  display: block;
  color: var(--text-dim);
  font-size: 0.78rem;
}

/* Charts */
.chart-container {
  position: relative;
  height: 400px;
  margin-bottom: 1.5rem;
}

.breakdown-container {
  height: 460px;
}

.scenario-toggles {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.scenario-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-alt);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 0.9rem;
}

.scenario-toggle:hover {
  background: #e6dfd3;
}

.scenario-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--sage);
}

.scenario-toggle label {
  cursor: pointer;
  user-select: none;
}

/* Final Cost Breakdown table */
.breakdown-table {
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.breakdown-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid var(--border);
}

.breakdown-line .bl-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.bl-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.bl-label {
  font-weight: 400;
}

.bl-pct {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-left: 0.35rem;
}

.bl-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.breakdown-line.total {
  border-bottom: none;
  border-top: 2px solid var(--sage);
  margin-top: 0.5rem;
  padding-top: 0.9rem;
}

.breakdown-line.total .bl-label {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sage);
}

.breakdown-line.total .bl-amount {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: var(--sage);
}

/* Builder Controls */
.builder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
}

.control-group input[type="number"],
.control-group input[type="range"],
.control-group select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem;
  font-size: 1rem;
  font-family: inherit;
}

.control-group input[type="number"]:focus,
.control-group input[type="range"]:focus,
.control-group select:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(127, 156, 121, 0.15);
}

.control-group input[type="range"] {
  padding: 0.5rem 0;
  accent-color: var(--sage);
}

.control-group select[multiple] {
  min-height: 150px;
}

.control-note {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background 0.2s;
  font-weight: 400 !important;
}

.checkbox-label:hover {
  background: var(--bg-alt);
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--sage);
}

/* Receipt */
#builder-receipt {
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 1.5rem 1.75rem;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  overflow-x: auto;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.receipt-row.header {
  font-weight: 700;
  color: var(--sage);
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--sage);
  margin-bottom: 0.5rem;
}

.receipt-row.section {
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.85rem;
  margin-top: 1rem;
  border-bottom: none;
}

.receipt-row.total {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--sage);
  border-top: 2px solid var(--sage);
  border-bottom: none;
  margin-top: 1rem;
  padding-top: 1rem;
}

.receipt-row.subtotal {
  color: var(--text-dim);
  font-style: italic;
}

/* Lists */
.menu-item,
.vendor-item,
.room-item,
.hotel-item {
  background: var(--bg-alt);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  border-left: 3px solid var(--sage-light);
}

.menu-item h4,
.vendor-item h4,
.room-item h4,
.hotel-item h4 {
  font-family: var(--serif);
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.menu-item p,
.vendor-item p,
.room-item p,
.hotel-item p {
  color: var(--text-dim);
  margin-bottom: 0.2rem;
}

.price {
  color: var(--sage);
  font-weight: 700;
  font-size: 1.05rem;
}

.price-range {
  color: var(--rose);
  font-weight: 700;
}

/* Bar packages */
.bar-package {
  background: var(--bg-alt);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--rose-light);
}

.bar-package h4 {
  font-family: var(--serif);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.bar-tier {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  padding: 0.4rem 0;
}

.bar-tier-label {
  color: var(--text-dim);
  font-weight: 400;
}

.bar-tier-price {
  color: var(--sage);
  font-weight: 700;
}

/* Vendor Summary */
.vendor-summary {
  background: var(--bg-alt);
  padding: 1.5rem;
  border-radius: 10px;
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-label {
  color: var(--text);
  font-weight: 700;
}

.summary-value {
  color: var(--sage);
  font-weight: 700;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

/* Logistics */
.logistics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.logistics-item {
  background: var(--bg-alt);
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border-left: 3px solid var(--sage-light);
}

.logistics-list {
  list-style: none;
  padding: 0;
}

.logistics-list li {
  background: var(--bg-alt);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  border-radius: 10px;
  border-left: 3px solid var(--sage-light);
}

.logistics-list a {
  color: var(--sage);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s;
}

.logistics-list a:hover {
  color: var(--rose);
  text-decoration: underline;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.9rem;
}

footer code {
  background: var(--bg-alt);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: var(--sage);
  font-family: 'SFMono-Regular', Menlo, monospace;
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 1.5rem 0.75rem;
  }

  h1 {
    font-size: 2.1rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
  }

  .kpi-value {
    font-size: 1.7rem;
  }

  .builder-grid {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 320px;
  }

  .breakdown-container {
    height: 420px;
  }

  .card {
    padding: 1.4rem;
  }
}

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