/* ===== RESET & BASE ===== */
.ma-wrap *, .ma-wrap *::before, .ma-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }
.ma-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; color: #1e293b;
  max-width: 1060px; margin: 0 auto;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 16px; overflow: hidden;
}

/* ===== HEADER ===== */
.ma-header {
  padding: 22px 24px 20px;
  background: #064e3b;
  display: flex; align-items: center; gap: 14px;
}
.ma-header-icon {
  width: 50px; height: 50px; border-radius: 12px;
  background: rgba(255,255,255,0.15);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.ma-title { font-size: 20px; font-weight: 700; color: #fff; margin-bottom: 3px; }
.ma-subtitle { font-size: 13px; color: rgba(255,255,255,0.72); }

/* ===== BODY LAYOUT ===== */
.ma-body { display: flex; flex-direction: column; }
@media (min-width: 720px) {
  .ma-body { flex-direction: row; align-items: flex-start; }
  .ma-form { width: 50%; border-right: 1px solid #e2e8f0; }
  .ma-results { width: 50%; position: sticky; top: 0; max-height: 100vh; overflow-y: auto; }
}
.ma-form { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ma-results { padding: 20px; display: flex; flex-direction: column; gap: 13px; background: #f0fdf4; }

/* ===== SECTION LABELS ===== */
.ma-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #64748b;
  display: flex; align-items: center; gap: 8px;
}
.ma-section-tag {
  font-size: 10px; font-weight: 600; background: #dcfce7; color: #166534;
  padding: 2px 8px; border-radius: 20px; text-transform: none; letter-spacing: 0;
}

/* ===== FIELDS ===== */
.ma-field { display: flex; flex-direction: column; gap: 7px; }
.ma-label-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.ma-label { font-size: 13px; font-weight: 600; color: #334155; }
.ma-badge { font-size: 12.5px; font-weight: 700; color: #064e3b; background: #dcfce7; padding: 2px 10px; border-radius: 20px; }
.ma-val-hint { font-size: 11.5px; color: #94a3b8; }
.ma-field-hint { font-size: 12px; color: #64748b; }

/* ===== SLIDER ===== */
.ma-slider { width: 100%; height: 5px; accent-color: #064e3b; cursor: pointer; }

/* ===== INPUTS ===== */
.ma-input-prefix-wrap, .ma-input-suffix-wrap {
  display: flex; align-items: center;
  border: 1.5px solid #cbd5e1; border-radius: 8px;
  overflow: hidden; background: #f8fafc;
}
.ma-input-prefix-wrap:focus-within, .ma-input-suffix-wrap:focus-within {
  border-color: #064e3b; background: #fff;
}
.ma-prefix, .ma-suffix {
  padding: 0 10px; height: 42px;
  display: flex; align-items: center;
  font-size: 14px; font-weight: 600; color: #64748b;
  background: #f1f5f9; white-space: nowrap;
}
.ma-prefix { border-right: 1px solid #e2e8f0; }
.ma-suffix { border-left: 1px solid #e2e8f0; }
.ma-input {
  flex: 1; border: none; background: transparent;
  padding: 0 12px; height: 42px;
  font-size: 14px; color: #1e293b; outline: none; min-width: 0;
  -moz-appearance: textfield;
}
.ma-input::-webkit-outer-spin-button,
.ma-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ===== SELECT ===== */
.ma-select {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1.5px solid #cbd5e1; border-radius: 8px;
  background: #f8fafc; font-size: 13.5px; color: #1e293b;
  outline: none; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.ma-select:focus { border-color: #064e3b; }

/* ===== ROW 2 ===== */
.ma-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ===== TERM BUTTONS ===== */
.ma-btn-group { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.ma-term-btn {
  padding: 10px 0; border: 1.5px solid #cbd5e1;
  border-radius: 8px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; background: #f8fafc; color: #475569;
  transition: all .15s;
}
.ma-term-btn.active { background: #064e3b; border-color: #064e3b; color: #fff; }
.ma-term-btn:hover:not(.active) { border-color: #064e3b; color: #ffffff; }

/* ===== TOGGLE ===== */
.ma-toggle { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.ma-toggle input { opacity: 0; width: 0; height: 0; }
.ma-toggle-track {
  position: absolute; inset: 0;
  background: #cbd5e1; border-radius: 24px; transition: .2s;
}
.ma-toggle input:checked + .ma-toggle-track { background: #064e3b; }
.ma-toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.ma-toggle input:checked + .ma-toggle-track .ma-toggle-thumb { left: 23px; }

/* ===== DISCLAIMER ===== */
.ma-disclaimer {
  background: #fefce8; border: 1px solid #fde68a;
  border-radius: 8px; padding: 12px 14px;
  font-size: 12px; color: #78350f; line-height: 1.5;
}

/* ===== HERO CARD ===== */
.ma-hero-card {
  background: #064e3b; border-radius: 12px;
  padding: 22px 20px; text-align: center; color: #fff;
}
.ma-hero-label { font-size: 12px; font-weight: 600; opacity: .75; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 5px; }
.ma-hero-amount { font-size: 44px; font-weight: 800; line-height: 1; }
.ma-hero-sub { font-size: 12px; opacity: .7; margin-top: 6px; }

/* ===== STATS GRID ===== */
.ma-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ma-stat { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; }
.ma-stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-bottom: 5px; }
.ma-stat-val { font-size: 15px; font-weight: 700; color: #1e293b; }
.ma-red { color: #dc2626; }
.ma-green { color: #16a34a; }

/* ===== TIPPING POINT CARD ===== */
.ma-tip-card {
  background: #fff; border: 1.5px solid #bbf7d0;
  border-radius: 12px; padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
}
.ma-tip-icon { font-size: 24px; flex-shrink: 0; margin-top: 1px; }
.ma-tip-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #064e3b; margin-bottom: 3px; }
.ma-tip-val { font-size: 15px; font-weight: 700; color: #1e293b; }
.ma-tip-sub { font-size: 11.5px; color: #64748b; margin-top: 2px; }

/* ===== SAVINGS CARD ===== */
.ma-savings-card, .ma-lump-card {
  background: #fff; border: 1.5px solid #bbf7d0;
  border-radius: 12px; padding: 14px 16px;
}
.ma-savings-title { font-size: 13px; font-weight: 700; color: #064e3b; margin-bottom: 10px; }
.ma-savings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.ma-savings-item { background: #f0fdf4; border-radius: 8px; padding: 10px 12px; }
.ma-savings-label { font-size: 11px; font-weight: 600; color: #64748b; margin-bottom: 3px; }
.ma-savings-val { font-size: 15px; font-weight: 700; color: #1e293b; }

/* ===== BALLOON RESULT ===== */
.ma-balloon-result {
  background: #fff7ed; border: 1.5px solid #fed7aa;
  border-radius: 12px; padding: 14px 16px; text-align: center;
}
.ma-balloon-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #c2410c; margin-bottom: 6px; }
.ma-balloon-amount { font-size: 28px; font-weight: 800; color: #c2410c; }
.ma-balloon-sub { font-size: 12px; color: #9a3412; margin-top: 4px; }

/* ===== SCHEDULE CONTROLS ===== */
.ma-schedule-controls {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ma-view-toggle {
  display: flex; border: 1.5px solid #cbd5e1;
  border-radius: 8px; overflow: hidden;
}
.ma-view-btn {
  padding: 8px 14px; border: none; background: #f8fafc;
  font-size: 12.5px; font-weight: 600; color: #64748b; cursor: pointer;
}
.ma-view-btn.active { background: #064e3b; color: #fff; }
.ma-print-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 8px 14px; border: 1.5px solid #cbd5e1;
  border-radius: 8px; background: #f8fafc;
  font-size: 12.5px; font-weight: 600; color: #475569;
  cursor: pointer;
}
.ma-print-btn:hover { border-color: #064e3b; color: #ffffff; }

/* ===== AMORT BUTTON ===== */
.ma-amort-btn {
  width: 100%; padding: 12px;
  border: 1.5px solid #064e3b; border-radius: 10px;
  background: transparent; color: #064e3b;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.ma-amort-btn:hover { background: #064e3b; color: #fff; }

/* ===== AMORT SECTION ===== */
.ma-amort-section { border-top: 1px solid #e2e8f0; padding: 20px; }
.ma-amort-header { margin-bottom: 14px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ma-amort-title { font-size: 16px; font-weight: 700; color: #064e3b; }
.ma-amort-meta { font-size: 12.5px; color: #64748b; }

/* ===== TABLE ===== */
.ma-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #e2e8f0; }
.ma-table { width: 100%; border-collapse: collapse; min-width: 560px; font-size: 13px; }
.ma-table th {
  background: #064e3b; color: #fff;
  padding: 10px 12px; text-align: right;
  font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.ma-table th:first-child, .ma-table td:first-child { text-align: left; }
.ma-table td { padding: 9px 12px; text-align: right; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.ma-table tr:nth-child(even) td { background: #f8fafc; }
.ma-table tr.ma-tip-row td { background: #dcfce7 !important; font-weight: 600; }
.ma-table tr.ma-balloon-row td { background: #fed7aa !important; font-weight: 700; }
.ma-table tr.ma-lump-row td { background: #dbeafe !important; font-weight: 600; }

/* ===== PRINT ===== */
@media print {
  .ma-form, .ma-header, .ma-schedule-controls, .ma-amort-btn, .ma-savings-card, .ma-lump-card,
  .ma-tip-card, .ma-balloon-result, .ma-stats-grid, .ma-hero-card { display: none !important; }
  .ma-amort-section { display: block !important; }
  .ma-table-wrap { border: none; }
}

/* ===== MOBILE ===== */
@media (max-width: 480px) {
  .ma-header { padding: 16px; }
  .ma-form, .ma-results { padding: 14px; }
  .ma-title { font-size: 17px; }
  .ma-hero-amount { font-size: 36px; }
  .ma-btn-group { grid-template-columns: repeat(2,1fr); }
  .ma-savings-grid { grid-template-columns: 1fr; }
}
/* Year row styling */
.ma-year-row { cursor: pointer; background: #f0fdf4 !important; }
.ma-year-row:hover td { background: #dcfce7; }
.ma-year-row td { font-size: 13px; border-bottom: 1px solid #bbf7d0; }
.ma-year-toggle { font-size: 10px; color: #064e3b; margin-right: 4px; display: inline-block; width: 12px; }

/* Month rows indent */
.ma-month-row td:first-child { color: #64748b; font-size: 12.5px; }

/* Print: only year rows, no monthly detail */
@media print {
  .ma-month-row { display: none !important; }
  .ma-year-row { display: table-row !important; }
  .ma-year-toggle { display: none !important; }
  .ma-form, .ma-header, .ma-schedule-controls,
  .ma-amort-btn, .ma-savings-card, .ma-lump-card,
  .ma-tip-card, .ma-balloon-result, .ma-stats-grid,
  .ma-hero-card, .ma-results { display: none !important; }
  .ma-amort-section { display: block !important; padding: 10px; }
}