body {
  font-family: Arial, sans-serif;
  margin: 0;
  background: #f5f7fa;
}

/* NAVBAR */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 40px;
  background: white;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.logo {
  margin: 0;
}

nav a {
  margin-left: 25px;
  text-decoration: none;
  font-weight: 600;
  color: #333;
}

nav a:hover {
  color: #4da6ff;
}

/* MAIN CONTAINER */
.container {
  max-width: 1200px;
  margin: auto;
  padding: 30px;
}

/* GENERAL */
.hidden {
  display: none;
}

.value-positive {
  color: #067647 !important;
  text-shadow: 0 0 10px rgba(6, 118, 71, 0.08);
}

.value-negative {
  color: #b42318 !important;
  text-shadow: 0 0 10px rgba(180, 35, 24, 0.08);
}

/* STRATEGY / LETTING */
.strategy-inputs {
  display: none;
}

.strategy-inputs.active-inputs {
  display: block;
}

.strategy-section {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.strategy-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  background: white;
  border: 1px solid #e7eef6;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

.selector-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.strategy-buttons,
.let-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.strategy-buttons button,
.strategy-btn,
.let-btn {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  background: #cfe8ff;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.strategy-buttons button:hover {
  background: #a7d2ff;
}

.strategy-btn.active {
  background: #4da6ff;
  color: white;
}

.strategy-btn.active,
.let-btn.active {
  outline: none;
  box-shadow: 0 0 0 2px #4da6ff, 0 6px 12px rgba(77, 166, 255, 0.25);
}

.strategy-info {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #eef7ff 0%, #e6f2ff 100%);
  border: 1px solid #d6e8fb;
  border-radius: 12px;
  padding: 20px;
}

/* LAYOUT */
.calculator {
  display: flex;
  gap: 30px;
}

/* INPUT PANEL */
.input {
  flex: 1;
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  align-self: flex-start;
}

.deal-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 6px;
}

.finance-fields-group {
  margin-bottom: 18px;
}

.form-group,
.expense-section,
.letting-fields,
.finance-fields-group {
  margin-top: 4px;
}

label {
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 10px;
}

/* INPUTS */
input,
select {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 16px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease;
  height: 42px;
}

input::placeholder {
  color: #98a2b3;
}

input:focus,
select:focus {
  outline: none;
  border: 1px solid #4da6ff;
  box-shadow: 0 0 5px rgba(77, 166, 255, 0.4);
  transform: translateY(-1px);
}

input:hover,
.currency-input:hover,
select:hover {
  border-color: #b8d8f5;
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#btl-deposit,
#brrr-deposit,
#btl-rate,
#brrr-rate,
#brrr-ltv {
  width: 100%;
  max-width: 260px;
}

.input-error {
  border: 1px solid #d92d20 !important;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

/* LABEL ROW */
.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  width: 100%;
  max-width: 260px;
}

.label-row label {
  margin: 0;
}

.label-row span {
  font-weight: 700;
  color: #4da6ff;
  white-space: nowrap;
  text-align: right;
}

/* FINANCE ROW */
.finance-row {
  display: flex;
  gap: 20px;
  margin-top: 6px;
}

.finance-row label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  cursor: pointer;
}

/* CURRENCY INPUT */
.currency-input {
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  height: 42px;
  border: 1px solid #d5dee8;
  border-radius: 10px;
  padding-left: 10px;
  background: white;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.currency-input span {
  font-weight: 700;
  margin-right: 6px;
  color: #4f6b85;
}

.currency-input input {
  border: none;
  flex: 1;
  height: 100%;
  padding: 12px;
  background: transparent;
  box-shadow: none;
}

.currency-input:focus-within {
  border-color: #4da6ff;
  box-shadow: 0 0 0 3px rgba(77, 166, 255, 0.12);
  transform: translateY(-1px);
}

/* BUTTONS */
.calculate-btn {
  margin-top: 10px;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #4da6ff;
  color: white;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

.calculate-btn:hover {
  background: #2f8ef7;
}

#save-deal-btn,
.secondary-btn,
.saved-deal-load-btn,
.saved-deal-delete-btn,
.details-toggle-btn {
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

#save-deal-btn:hover:not(:disabled),
.secondary-btn:hover,
.saved-deal-load-btn:hover,
.saved-deal-delete-btn:hover,
.details-toggle-btn:hover {
  transform: translateY(-1px);
}

.secondary-btn {
  padding: 10px 16px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: white;
  color: #344054;
  font-weight: 600;
  cursor: pointer;
}

.secondary-btn:hover {
  background: #f9fafb;
  border-color: #bfc7d1;
}

#save-deal-btn {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: #4da6ff;
  color: white;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

#save-deal-btn:hover:not(:disabled),
#save-deal-btn:hover {
  background: #2f8ef7;
}

#save-deal-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

#save-deal-btn.saved {
  background: #d1e7dd;
  color: #0f5132;
}

#save-deal-btn.saved:hover {
  background: #bcdccf;
  color: #0f5132;
}

#save-deal-btn.update {
  background: #fff3cd;
  color: #664d03;
}

#save-deal-btn.update:hover {
  background: #f7e29f;
  color: #664d03;
}

/* INPUT / LETTING ITEMS */
.input-item,
.letting-item,
.expense-item {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0;
}

.input-item label,
.letting-item label,
.expense-item label {
  line-height: 1.3;
}

.input-item .currency-input,
.input-item input,
.input-item select,
.letting-item .currency-input,
.letting-item input,
.letting-item select,
.expense-item .currency-input,
.expense-item input,
.expense-item select {
  width: 100% !important;
  box-sizing: border-box;
  margin-top: 2px;
}

/* INPUT CARDS */
.input-card,
.letting-card {
  padding: 20px;
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

.input-card-title,
.letting-card-title {
  margin: 0 0 14px 0;
  font-size: 15px;
  font-weight: 700;
  color: #2f4b66;
}

.input-grid,
.letting-grid,
.expense-grid {
  row-gap: 18px;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* FINANCE OPTIONS */
.finance-card {
  margin-top: 8px;
}

.finance-options {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.finance-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 600;
  color: #48627b;
  cursor: pointer;
}

/* INLINE FINANCE FIELDS */
.finance-inline-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.finance-inline-grid .input-item label {
  margin-top: 0;
  margin-bottom: 8px;
}

#btl-mortgage-type,
#brrr-mortgage-type,
#btl-term,
#brrr-term {
  margin-top: 8px;
  margin-bottom: 14px;
  padding: 11px 12px;
  border: 1px solid #d5dee8;
  border-radius: 10px;
  background: white;
  font-size: 15px;
  color: #344054;
  box-sizing: border-box;
}

#btl-mortgage-type:focus,
#brrr-mortgage-type:focus,
#btl-term:focus,
#brrr-term:focus {
  border-color: #4da6ff;
  box-shadow: 0 0 0 3px rgba(77, 166, 255, 0.12);
  outline: none;
}

/* LETTING */
.letting-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.letting-fields.hidden {
  display: none !important;
}

.letting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* EXPENSES */
.expense-section {
  margin-top: 18px;
}

.section-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
}

.details-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  padding: 10px 14px;
  min-width: 190px;
  border: 1px solid #cfe0f2;
  border-radius: 10px;
  background: #eef6ff;
  color: #2f4b66;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.details-toggle-btn:hover {
  background: #dff1ff;
  border-color: #b8d8f5;
  color: #1f3d5a;
}

.details-toggle-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 166, 255, 0.18);
}

.details-toggle-btn.active {
  background: #4da6ff;
  border-color: #4da6ff;
  color: white;
}

.details-toggle-text {
  pointer-events: none;
}

.details-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  color: #2f4b66;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  pointer-events: none;
}

.details-toggle-btn.active .details-toggle-icon {
  transform: rotate(45deg);
  background: rgba(255, 255, 255, 0.22);
  color: white;
}

.expense-details {
  margin-top: 14px;
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(to bottom, #f8fbff, #f3f8fd);
  border: 1px solid #d9e9f7;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.expense-details-title {
  margin: 0 0 14px 0;
  font-size: 15px;
  font-weight: 700;
  color: #2f4b66;
}

.expense-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.expense-item label {
  margin: 0 0 14px 0;
  font-size: 15px;
  font-weight: 700;
  color: #2f4b66;
}

.expense-item .currency-input,
.expense-item input {
  background: white;
}

.expense-item .currency-input {
  display: flex;
  align-items: center;
}

.expense-item .currency-input span {
  color: #4f6b85;
  font-weight: 700;
}

.expense-item .currency-input input {
  width: 100%;
  padding: 11px 12px;
  font-size: 15px;
  background: transparent;
  box-sizing: border-box;
}

.expense-item input {
  padding: 11px 12px;
  border: 1px solid #d5dee8;
  border-radius: 10px;
  font-size: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.expense-item input:focus {
  border-color: #4da6ff;
  box-shadow: 0 0 0 3px rgba(77, 166, 255, 0.12);
}

.expense-helper-text {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #6b7f93;
}

.expense-section .input-card > .currency-input {
  width: 100%;
}

#btl-expenses,
#brrr-expenses,
#r2r-expenses {
  width: 100%;
  box-sizing: border-box;
  font-size: 15px;
}

/* RESULT PANEL */
.result {
  flex: 1;
  background: white;
  padding: 26px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  border: 1px solid #e7eef6;
  align-self: flex-start;
  position: sticky;
  top: 20px;
}

.result h3,
.result-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #101828;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.result-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #eef2f6;
  opacity: 0.95;
  border-radius: 8px;
  transition: background 0.18s ease, transform 0.18s ease;
}

.result-item:last-of-type {
  border-bottom: none;
}

.result-item:hover {
  background: rgba(77, 166, 255, 0.04);
}

.result-item p {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: #344054;
}

.result-item span {
  margin-left: auto;
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  color: #101828;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.help-icon {
  font-size: 14px;
  margin-left: 6px;
  cursor: pointer;
  color: #4da6ff;
}

/* SUMMARY CARDS */
.summary-cards {
  margin: 0 0 18px 0;
}

.summary-group {
  display: none;
  gap: 12px;
}

.summary-group.active {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.summary-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
  border: 1px solid #dbe7f3;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(16, 24, 40, 0.04);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: fadeInUp 0.25s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(16, 24, 40, 0.08);
  border-color: #c9dbee;
}

.summary-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.35) 50%, transparent 100%);
  transform: translateX(-120%);
  transition: transform 0.5s ease;
}

.summary-card:hover::after {
  transform: translateX(120%);
}

.summary-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #667085;
  text-transform: uppercase;
}

.summary-card span:last-child {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
  color: #101828;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
  transition: color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.value-updated {
  animation: valuePulse 0.35s ease;
}

@keyframes valuePulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.03);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* LEGACY BRRR SUMMARY */
.brrr-only {
  display: none;
}

.brrr-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 6px 0;
}

.brrr-summary-card {
  border: 1px solid #dbe7f3;
  border-radius: 12px;
  background: #f8fbff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brrr-summary-label {
  font-size: 12px;
  font-weight: 600;
  color: #667085;
}

.brrr-summary-value {
  font-size: 20px;
  font-weight: 700;
  color: #101828;
  font-variant-numeric: tabular-nums;
}

/* DEAL RATING */
.deal-rating {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  font-weight: 700;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 6px 16px rgba(16, 24, 40, 0.05);
  transition: all 0.2s ease;
  transform: translateY(-1px);
}

.deal-rating.poor {
  background: #fde2e1;
  color: #842029;
}

.deal-rating.average {
  background: #fff3cd;
  color: #664d03;
}

.deal-rating.good {
  background: #d1e7dd;
  color: #0f5132;
}

.deal-rating.excellent {
  background: #c7f9cc;
  color: #065f46;
}

/* WARNINGS */
.deal-warnings {
  margin-top: 20px;
  margin-bottom: 8px;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8db 0%, #fff4c2 100%);
  border: 1px solid #f1df8b;
  color: #6b5200;
  font-size: 14px;
  line-height: 1.5;
}

.deal-warnings.hidden {
  display: none;
}

.deal-warnings ul {
  margin: 0;
  padding-left: 18px;
}

/* SAVED DEALS */
.saved-deals-page {
  background: white;
  padding: 28px;
  border: 1px solid #e7eef6;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
}

.saved-deals-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
}

.saved-deals-header h2 {
  margin: 0 0 6px 0;
  font-size: 24px;
}

.saved-deals-header p {
  margin: 0;
  color: #667085;
}

.saved-deals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 280px));
  gap: 18px;
  justify-content: start;
}

.saved-deal-card {
  border: 1px solid #dbe7f3;
  border-radius: 16px;
  background: linear-gradient(to bottom, #f9fbff, #f4f8fd);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.saved-deal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  border-color: #c6d8eb;
}

.saved-deal-card.best {
  border: 2px solid #4da6ff;
  box-shadow: 0 8px 20px rgba(77, 166, 255, 0.2);
}

.saved-deal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.saved-deal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.saved-deal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #24384d;
}

.saved-deal-subtitle {
  margin: 0;
  font-size: 12px;
  color: #667085;
}

.saved-deal-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.saved-deal-score-label {
  font-size: 11px;
  color: #667085;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.saved-deal-score {
  min-width: 64px;
  text-align: center;
  padding: 8px 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.saved-deal-score.excellent {
  background: #c7f9cc;
  color: #065f46;
}

.saved-deal-score.good {
  background: #d1e7dd;
  color: #0f5132;
}

.saved-deal-score.average {
  background: #fff3cd;
  color: #664d03;
}

.saved-deal-score.poor {
  background: #fde2e1;
  color: #842029;
}

.saved-deal-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

.saved-deal-metric {
  padding: 10px 12px;
  background: white;
  border: 1px solid #e7eef6;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.saved-deal-metric-label {
  font-size: 12px;
  color: #667085;
}

.saved-deal-metric-value {
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
}

.saved-deal-actions {
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.saved-deal-actions button {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.saved-deal-load-btn {
  background: #4da6ff;
  color: white;
}

.saved-deal-load-btn:hover {
  background: #2f8ef7;
}

.saved-deal-delete-btn {
  background: #eef2f6;
  color: #344054;
}

.saved-deal-delete-btn:hover {
  background: #dbe4ec;
}

.saved-deals-empty {
  padding: 36px 20px;
  border: 1px dashed #cfd8e3;
  border-radius: 14px;
  text-align: center;
  background: #f8fbff;
  color: #667085;
}

.saved-deals-usage {
  padding: 10px 14px;
  border-radius: 10px;
  background: #eef6ff;
  color: #2f4b66;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.saved-deal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 2px 0;
}

.best-deal-badge {
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  background: #4da6ff;
  color: white;
}

/* APP MESSAGE */
.app-message {
  max-width: 1200px;
  margin: 16px auto 0 auto;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

.app-message.hidden {
  display: none;
}

.app-message.success {
  background: #d1e7dd;
  color: #0f5132;
  border-color: #badbcc;
}

.app-message.warning {
  background: #fff3cd;
  color: #664d03;
  border-color: #ffecb5;
}

.app-message.error {
  background: #fde2e1;
  color: #842029;
  border-color: #f5c2c7;
}

.app-message:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .summary-group.active,
  .brrr-summary-grid {
    grid-template-columns: 1fr;
  }

  .calculator {
    flex-direction: column;
  }

  .result {
    position: static;
  }
}

@media (max-width: 700px) {
  .finance-inline-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .label-row {
    width: 100%;
    max-width: 260px;
  }
}

/* SAVE AS NEW */
#save-as-new-btn {
  white-space: nowrap;
}

/* BREAKDOWN PANEL */
.breakdown-panel {
  margin-top: 20px;
  border: 1px solid #e7eef6;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fc 100%);
  overflow: hidden;
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #e7eef6;
}

.breakdown-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #24384d;
}

.breakdown-content {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.breakdown-section {
  border: 1px solid #e7eef6;
  border-radius: 12px;
  background: white;
  padding: 14px;
}

.breakdown-section h5 {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 700;
  color: #48627b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f4f8;
  font-size: 14px;
}

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

.breakdown-row span:first-child {
  color: #475467;
  font-weight: 500;
}

.breakdown-row span:last-child {
  color: #101828;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.breakdown-row.total {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #dbe7f3;
}

.breakdown-row.total span:first-child,
.breakdown-row.total span:last-child {
  font-weight: 700;
}

@media (max-width: 900px) {
  .breakdown-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.breakdown-content {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.breakdown-content.hidden {
  display: none !important;
}

.compare-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.compare-panel {
  margin-top: 10px;
  padding: 22px;
  border: 1px solid #dbe7f3;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

.compare-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.compare-panel-header h3 {
  margin: 0;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.compare-column {
  background: white;
  border: 1px solid #e7eef6;
  border-radius: 14px;
  padding: 18px;
}

.compare-column h4 {
  margin: 0 0 14px 0;
  font-size: 16px;
  color: #24384d;
}

.compare-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #eef2f6;
  font-size: 14px;
}

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

.compare-row span:last-child {
  font-weight: 700;
  text-align: right;
}

.saved-deal-card.selected {
  border: 2px solid #4da6ff;
  box-shadow: 0 8px 20px rgba(77, 166, 255, 0.18);
  background: linear-gradient(to bottom, #f4f9ff, #eef6ff);
}

.saved-deal-select-btn {
  background: #eef6ff;
  color: #2f4b66;
}

.saved-deal-select-btn:hover {
  background: #dff1ff;
}

.saved-deal-select-btn.selected {
  background: #4da6ff;
  color: white;
}

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

.compare-warning {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffecb5;
  font-size: 14px;
  font-weight: 600;
}

.compare-better {
  color: #067647 !important;
}

.compare-worse {
  color: #b42318 !important;
}

.compare-equal {
  color: #667085 !important;
}

.compare-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.compare-badge.better {
  background: #d1e7dd;
  color: #0f5132;
}

.compare-badge.worse {
  background: #fde2e1;
  color: #842029;
}

.saved-deal-card.selected {
  border: 2px solid #4da6ff;
  box-shadow: 0 10px 24px rgba(77, 166, 255, 0.22);
  background: linear-gradient(to bottom, #f4f9ff, #eef6ff);
}

.compare-helper-text {
  margin-top: 18px;
  margin-bottom: 12px;
  color: #667085;
  font-size: 14px;
  font-weight: 600;
}

.compare-column h4 {
  margin: 0 0 14px 0;
  font-size: 16px;
  color: #24384d;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f6;
}

input[type="radio"] {
  outline: none;
  accent-color: #4da6ff;
  cursor: pointer;
}

input[type="radio"]:focus {
  outline: none;
}

input[type="radio"]:focus-visible {
  outline: 2px solid #4da6ff;
  outline-offset: 2px;
}

.finance-options input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 2px solid #98a2b3;
  border-radius: 50%;
  background: white;
  display: inline-grid;
  place-content: center;
  cursor: pointer;
  outline: none;
  box-shadow: none;
}

.finance-options input[type="radio"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.15s ease-in-out;
  background: #4da6ff;
}

.finance-options input[type="radio"]:checked {
  border-color: #4da6ff;
  background: white;
}

.finance-options input[type="radio"]:checked::before {
  transform: scale(1);
}

.finance-options input[type="radio"]:focus {
  outline: none;
  box-shadow: none;
}

.finance-options input[type="radio"]:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

.finance-options input[type="radio"]:focus-visible {
  outline: 2px solid #4da6ff;
  outline-offset: 2px;
}

.finance-options label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.finance-options label:hover {
  background: #f5f8fb;
  border-radius: 8px;
}

.logo {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #1d3557;
}

nav a {
  margin-left: 25px;
  text-decoration: none;
  font-weight: 600;
  color: #333;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

nav a:hover {
  color: #4da6ff;
  border-color: #b8d8f5;
}

nav a.nav-active {
  color: #4da6ff;
  border-color: #4da6ff;
}

/* ABOUT / FAQ PAGES */
.info-page-card {
  background: white;
  border: 1px solid #e7eef6;
  border-radius: 18px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
  max-width: 900px;
}

.info-page-eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: #2f4b66;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.info-page-card h2 {
  margin: 0 0 12px 0;
  font-size: 30px;
  line-height: 1.15;
  color: #101828;
}

.info-page-lead {
  margin: 0 0 24px 0;
  font-size: 17px;
  line-height: 1.7;
  color: #475467;
  max-width: 760px;
}

.info-page-section {
  margin-top: 24px;
}

.info-page-section h4,
.faq-item h4,
.feedback-box h4 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #24384d;
}

.info-page-section p,
.faq-item p,
.feedback-box p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: #475467;
}

.info-list {
  margin: 0;
  padding-left: 20px;
  color: #475467;
  line-height: 1.8;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.faq-item {
  padding: 18px 20px;
  border: 1px solid #e7eef6;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f7fbff 100%);
}

.feedback-box {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid #d8e7f6;
  border-radius: 14px;
  background: #f8fbff;
}

.feedback-email {
  margin-top: 10px !important;
  font-weight: 700;
  color: #1d4f91 !important;
}

/* MOBILE */
@media (max-width: 700px) {
  .info-page-card {
    padding: 22px;
  }

  .info-page-card h2 {
    font-size: 24px;
  }

  .info-page-lead {
    font-size: 16px;
  }
}

.feedback-email a {
  color: #1d4f91;
  text-decoration: none;
}

.feedback-email a:hover {
  text-decoration: underline;
}

/* =========================
   MOBILE NAV + SELECTION POLISH
   ========================= */
@media (max-width: 768px) {
  /* NAVBAR */
  .topbar,
  .navbar,
  header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .logo {
    text-align: center;
    font-size: 22px;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  nav a {
    margin-left: 0;
    padding: 8px 10px;
    font-size: 14px;
    border-bottom: none;
    border-radius: 10px;
    background: #f7f9fc;
  }

  nav a.nav-active {
    background: #eaf3ff;
    border-bottom: none;
  }

  /* STRATEGY BUTTONS */
  .strategy-grid,
  .strategy-buttons,
  .strategy-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .strategy-btn {
    width: 100%;
    min-height: 44px;
    padding: 12px 10px;
    font-size: 14px;
    border-radius: 12px;
    text-align: center;
  }

  /* LETTING MODEL BUTTONS */
  .let-buttons,
  .letting-buttons,
  .let-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
  }

  .let-btn {
    width: 100%;
    min-height: 44px;
    padding: 12px 10px;
    font-size: 14px;
    border-radius: 12px;
    text-align: center;
  }

  /* If there are 3 letting buttons, make them stack more neatly */
  .let-btn[data-let="sa"]:last-child {
    grid-column: 1 / -1;
  }

  /* STRATEGY / LETTING INFO BOX */
  .strategy-info,
  .strategy-description-box {
    padding: 14px;
    border-radius: 14px;
  }

  .strategy-info h3,
  .strategy-description-box h3,
  #strategy-title {
    font-size: 18px;
    line-height: 1.3;
  }

  #strategy-description {
    font-size: 14px;
    line-height: 1.6;
  }

  /* GENERAL CONTAINER SPACING */
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* SMALLER PHONES */
@media (max-width: 480px) {
  nav {
    grid-template-columns: 1fr 1fr;
  }

  nav a {
    width: 100%;
    text-align: center;
    font-size: 13px;
    padding: 8px;
  }

  .strategy-grid,
  .strategy-buttons,
  .strategy-selector,
  .let-buttons,
  .letting-buttons,
  .let-selector {
    grid-template-columns: 1fr;
  }

  .strategy-btn,
  .let-btn {
    font-size: 14px;
    padding: 12px;
  }

  .let-btn[data-let="sa"]:last-child {
    grid-column: auto;
  }
}

@media (max-width: 768px) {
  header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: white;
  }
}

.strategy-btn:active,
.let-btn:active,
nav a:active {
  transform: scale(0.97);
}

.strategy-btn,
.let-btn,
nav a {
  transition: all 0.2s ease;
}

/* =========================
   TOP TIER UI POLISH
   ========================= */

:root {
  --bg-soft: #f7f9fc;
  --card-bg: #f4f8ff;
  --card-bg-strong: #eef5ff;
  --border-soft: #e6ecf3;
  --text-main: #101828;
  --text-soft: #475467;
  --blue-soft: #eaf3ff;
  --blue-main: #4da6ff;
  --shadow-soft: 0 10px 30px rgba(16, 24, 40, 0.06);
  --shadow-hover: 0 16px 40px rgba(16, 24, 40, 0.10);
}

body {
  background: linear-gradient(180deg, #f8fbff 0%, #f5f7fb 100%);
  color: var(--text-main);
}

.container {
  max-width: 1180px;
}

/* MAIN CARDS */
.card,
.results-card,
.input-card,
.summary-card,
.breakdown-panel,
.compare-panel,
.info-page-card {
  background: var(--card-bg);
  border: 1px solid var(--border-soft);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.saved-deal-card {
  background: #ffffff;
}

/* HOVER LIFT */
.saved-deal-card,
.summary-card,
.strategy-btn,
.let-btn {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.saved-deal-card:hover,
.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* SECTION HEADINGS */
h1, h2, h3, h4 {
  letter-spacing: -0.02em;
}

#strategy-title {
  font-size: 20px;
  color: #16324f;
}

#strategy-description {
  color: var(--text-soft);
  line-height: 1.65;
}

/* STRATEGY + LET BUTTONS */
.strategy-btn,
.let-btn {
  border: 1px solid var(--border-soft);
  background: #fff;
  border-radius: 14px;
  font-weight: 700;
  min-height: 46px;
}

.strategy-btn:hover,
.let-btn:hover {
  border-color: #bfdcff;
  background: #f8fbff;
}

.strategy-btn.active,
.let-btn.active {
  background: linear-gradient(180deg, #eaf3ff 0%, #dcecff 100%);
  border: 2px solid #4da6ff;
  color: #0f3d73;
  box-shadow: 
    0 6px 18px rgba(77, 166, 255, 0.18),
    0 0 0 3px rgba(77, 166, 255, 0.15);
  transform: translateY(-1px);
}

/* NAV */
nav a {
  border-radius: 12px;
  padding: 8px;
}

nav a.nav-active {
  background: var(--blue-soft);
  color: #1a4f8b;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue-main);
  box-shadow: 0 0 0 4px rgba(77, 166, 255, 0.12);
}

/* SUMMARY CARDS */
.summary-card,
.metric-card {
  padding: 18px;
}

.summary-card .label,
.metric-label {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.summary-card .value,
.metric-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #12263f;
}

/* RESULTS / BREAKDOWN */
#deal-rating-box {
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

#deal-warnings {
  border-radius: 14px;
  border: 1px solid #fde7b2;
  background: #fffaf0;
}

/* SAVED DEAL CARDS */
.saved-deal-card {
  padding: 22px;
  background: var(--card-bg);
}

.saved-deal-title {
  font-size: 20px;
  line-height: 1.25;
}

.saved-deal-subtitle {
  color: var(--text-soft);
}

.saved-deal-actions button {
  border-radius: 12px;
  min-height: 42px;
  font-weight: 700;
}

/* COMPARE CELLS */
.compare-better {
  background: #edfdf3;
  border-radius: 10px;
}

.compare-worse {
  background: #fff1f3;
  border-radius: 10px;
}

.compare-equal {
  background: #f8fafc;
  border-radius: 10px;
}

/* SMALL ANIMATION */
.value-updated {
  animation: valuePulse 0.35s ease;
}

@keyframes valuePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.card,
.results-card,
.input-card,
.summary-card {
  background: linear-gradient(180deg, #f8fbff 0%, #f2f7ff 100%);
}

.strategy-btn,
.let-btn {
  background: #ffffff;
  border: 1.5px solid #d8e6f5;
  color: #344054;
}

.strategy-btn:hover,
.let-btn:hover {
  border-color: #a8cdf5;
  background: #f8fbff;
}

.let-btn.active {
  background: linear-gradient(180deg, #eaf3ff 0%, #dcecff 100%);
}

body {
  background: linear-gradient(180deg, #f5f9ff 0%, #f7f9fc 100%);
}

.deal-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.secondary-action-btn {
  background: #f8fbff;
  color: #1d4f91;
  border: 1px solid #d7e6f5;
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.secondary-action-btn:hover {
  background: #eef6ff;
  border-color: #bfdcff;
}

.secondary-action-btn:active {
  transform: scale(0.98);
}

@media (max-width: 768px) {
  .deal-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .deal-action-row button {
    width: 100%;
  }
}

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

.deal-explanation-box {
  margin-top: 18px;
  padding: 18px 20px;
  background: linear-gradient(180deg, #fbfdff 0%, #f7fbff 100%);
  border: 1px solid #e3edf7;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
}

.deal-explanation-box h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #183b63;
}

.deal-explanation-box p {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: #475467;
}

@media (max-width: 768px) {
  .deal-explanation-box {
    padding: 16px;
  }

  .deal-explanation-box p {
    font-size: 14px;
  }
}

.deal-action-row button {
  min-height: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: 12px;
}

.deal-action-row button {
  min-height: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: 12px;
}

#save-deal-btn {
  height: 48px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  border: none;
  font-weight: 800;
}

#save-deal-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}

@media (max-width: 768px) {
  .deal-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .deal-action-row button {
    width: 100%;
    height: 48px;
  }
}

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

.deal-action-row button {
  transition: all 0.18s ease;
}

.deal-action-row button:hover {
  transform: translateY(-1px);
}

