:root {
  --navy: #002C5D;
  --navy-dark: #001B3A;
  --teal: #11BEA7;
  --teal-dark: #0B9985;
  --red-accent: #DD1B22;
  --bg: #F9F9F7;
  --tint: #E8F0F8;
  --muted-blue: #66809E;
  --text: #1E2839;
  --text-body: #585858;
  --border: #E2E8F0;
  --white: #FFFFFF;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(16, 30, 54, 0.04), 0 8px 24px rgba(16, 30, 54, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: 'Mont', 'Poppins', 'Segoe UI', -apple-system, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-brand { display: flex; align-items: center; gap: 14px; }
.logo { height: 24px; width: auto; display: block; }
.divider { width: 1px; height: 20px; background: var(--border); }
.suite-name { font-size: 14px; font-weight: 600; color: var(--navy); letter-spacing: 0.01em; }
.topbar-meta { display: flex; align-items: center; gap: 10px; }

.chip {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.chip-rate { background: var(--tint); color: var(--navy); }
.chip-demo { background: #FDF0E4; color: #8A4B12; }

/* ---- Layout ---- */
.layout {
  display: flex;
  flex: 1;
  max-width: 1320px;
  width: 100%;
  margin: 0 auto;
  gap: 28px;
  padding: 28px;
}

.sidenav {
  width: 268px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-blue);
  padding: 0 14px;
  margin-bottom: 6px;
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item:hover { background: var(--tint); }
.nav-item.active { background: var(--navy); color: var(--white); font-weight: 600; }

.content { flex: 1; min-width: 0; }

.calc-header { margin-bottom: 20px; }
.calc-header h1 { margin: 0 0 6px; font-size: 26px; color: var(--navy); font-weight: 700; }
.calc-header p { margin: 0; font-size: 14px; color: var(--text-body); max-width: 640px; }

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidenav { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .calc-grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}

/* ---- Form fields ---- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--muted-blue); margin-top: 4px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.input-wrap { position: relative; }
.input-wrap input[type="number"],
.input-wrap input[type="text"],
.input-wrap input[type="date"],
.input-wrap select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  font-family: inherit;
}
.input-wrap input:focus, .input-wrap select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(17, 190, 167, 0.15);
}
.input-wrap.has-suffix input { padding-right: 42px; }
.input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--muted-blue);
  font-weight: 600;
  pointer-events: none;
}

.checkbox-field { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--teal); }
.checkbox-field label { margin: 0; }
.checkbox-field .hint { flex-basis: 100%; margin-top: 0; }

/* .field and .checkbox-field set display, which would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }

.input-wrap input.readonly-input { background: var(--tint); color: var(--navy); font-weight: 600; cursor: default; }

.btn-primary {
  background: var(--teal);
  color: var(--white);
  border: none;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 28px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  width: 100%;
  margin-top: 4px;
  transition: background 0.12s ease;
}
.btn-primary:hover { background: var(--teal-dark); }

/* ---- Results ---- */
.empty-state {
  color: var(--muted-blue);
  font-size: 14px;
  padding: 40px 10px;
  text-align: center;
}

.result-hero {
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
  color: var(--white);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 18px;
}
.result-hero .hero-label { font-size: 12px; opacity: 0.75; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.result-hero .hero-value { font-size: 32px; font-weight: 700; margin-top: 4px; }
.result-hero .hero-sub { font-size: 13px; opacity: 0.85; margin-top: 6px; }

.result-rows { display: flex; flex-direction: column; gap: 0; }
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  gap: 12px;
}
.result-row:last-child { border-bottom: none; }
.result-row .r-label { color: var(--text-body); }
.result-row .r-value { color: var(--text); font-weight: 700; text-align: right; }
.result-row.total .r-label, .result-row.total .r-value { color: var(--navy); font-weight: 800; }

.scenario-block { margin-top: 18px; }
.scenario-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  background: var(--tint);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-green { background: #E3F6EC; color: #147A46; }
.badge-amber { background: #FFF3D9; color: #92650A; }
.badge-red { background: #FBE4E4; color: #A31E1E; }

.schedule-wrap { margin-top: 18px; }
.schedule-table-scroll { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); }
table.schedule-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.schedule-table th {
  position: sticky; top: 0;
  background: var(--tint);
  color: var(--navy);
  text-align: right;
  padding: 8px 10px;
  font-weight: 700;
}
table.schedule-table th:first-child, table.schedule-table td:first-child { text-align: left; }
table.schedule-table td {
  text-align: right;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  color: var(--text-body);
}
.schedule-note { font-size: 12px; color: var(--muted-blue); margin-top: 8px; }

.app-footer {
  text-align: center;
  font-size: 12px;
  color: var(--muted-blue);
  padding: 18px 28px 28px;
  max-width: 900px;
  margin: 0 auto;
}

.error-banner {
  background: #FBE4E4;
  color: #A31E1E;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
}
