/* ===== RESET ===== */
.al-wrap *, .al-wrap *::before, .al-wrap *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

/* ===== BASE ===== */
.al-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: clamp(13px, 1.5vw, 15px);
  color: #1e293b; max-width: 1060px; margin: 0 auto;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 16px; overflow: hidden;
}

/* ===== HEADER ===== */
.al-header {
  padding: clamp(14px, 2vw, 22px) clamp(14px, 2.5vw, 24px);
  background: #1c1917;
  display: flex; align-items: center; gap: clamp(10px, 1.5vw, 14px);
}
.al-header-icon {
  width: clamp(40px, 5vw, 50px); height: clamp(40px, 5vw, 50px);
  border-radius: 12px; background: rgba(255,255,255,0.13);
  display: flex; align-items: center; justify-content: center;
  color: #fbbf24; flex-shrink: 0;
}
.al-title    { font-size: clamp(16px, 2vw, 20px); font-weight: 700; color: #fff; margin-bottom: 3px; }
.al-subtitle { font-size: clamp(11px, 1.3vw, 13px); color: rgba(255,255,255,0.7); line-height: 1.4; }

/* ===== BODY — default stacked ===== */
.al-body    { display: flex; flex-direction: column; }
.al-form    { padding: 16px; display: flex; flex-direction: column; gap: 14px; width: 100%; }
.al-results { padding: 16px; display: flex; flex-direction: column; gap: 12px;
              background: #fafaf9; width: 100%; border-top: 1px solid #e2e8f0; }

/* ===== SECTION LABELS ===== */
.al-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: #64748b;
  padding-bottom: 4px; border-bottom: 1px solid #f1f5f9;
  margin-top: 2px; display: flex; align-items: center; gap: 8px;
}
.al-section-tag {
  font-size: 9.5px; font-weight: 600; background: #fef3c7; color: #92400e;
  padding: 2px 7px; border-radius: 20px; text-transform: none; letter-spacing: 0;
}

/* ===== FIELDS ===== */
.al-field      { display: flex; flex-direction: column; gap: 5px; }
.al-label      { font-size: 13px; font-weight: 600; color: #334155; }
.al-label-hint { font-size: 11px; font-weight: 400; color: #94a3b8; }
.al-field-hint { font-size: 12px; color: #64748b; line-height: 1.5; }
.al-row-2      { display: grid; grid-template-columns: 1fr; gap: 10px; }

/* ===== INPUTS ===== */
.al-prefix-wrap, .al-suffix-wrap {
  display: flex; align-items: center;
  border: 1.5px solid #cbd5e1; border-radius: 8px;
  overflow: hidden; background: #f8fafc; min-width: 0;
}
.al-prefix-wrap:focus-within, .al-suffix-wrap:focus-within {
  border-color: #1c1917; background: #fff;
}
.al-prefix, .al-suffix {
  padding: 0 10px; height: 42px;
  display: flex; align-items: center;
  font-size: 14px; font-weight: 600; color: #64748b;
  background: #f1f5f9; white-space: nowrap; flex-shrink: 0;
}
.al-prefix { border-right: 1px solid #e2e8f0; }
.al-suffix  { border-left:  1px solid #e2e8f0; }
.al-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;
}
.al-input::-webkit-outer-spin-button,
.al-input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ===== SLIDER ===== */
.al-slider {
  width: 100%; height: 6px; -webkit-appearance: none; appearance: none;
  background: #e2e8f0; border-radius: 3px; outline: none; cursor: pointer;
}
.al-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px;
  border-radius: 50%; background: #1c1917; cursor: pointer;
  border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.al-slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #1c1917; cursor: pointer; border: 3px solid #fff;
}
.al-dp-display {
  display: flex; justify-content: space-between;
  font-size: 12.5px; font-weight: 600; color: #334155;
  margin-top: 4px;
}

/* ===== BUTTON GROUPS ===== */
.al-type-group {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px;
}
.al-type-btn {
  padding: 11px 8px; border: 1.5px solid #e2e8f0;
  border-radius: 9px; background: #f8fafc;
  font-size: 13px; font-weight: 600; color: #475569;
  cursor: pointer; transition: all .15s; text-align: center;
}
.al-type-btn.active { background: #1c1917; border-color: #1c1917; color: #fff; }
.al-type-btn:hover:not(.active) { border-color: #1c1917; color: #ffffff; }

.al-credit-group {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.al-credit-btn {
  padding: 9px 4px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; background: #f8fafc;
  font-size: 11.5px; font-weight: 600; color: #475569;
  cursor: pointer; transition: all .15s; text-align: center; white-space: nowrap;
}
.al-credit-btn.active { background: #1c1917; border-color: #1c1917; color: #fff; }
.al-credit-btn:hover:not(.active) { border-color: #1c1917; color: #ffffff; }

.al-term-group {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.al-term-btn {
  padding: 9px 4px; border: 1.5px solid #cbd5e1;
  border-radius: 8px; font-size: 12px; font-weight: 600;
  cursor: pointer; background: #f8fafc; color: #475569;
  transition: all .15s; text-align: center; white-space: nowrap;
}
.al-term-btn.active { background: #1c1917; border-color: #1c1917; color: #fff; }
.al-term-btn:hover:not(.active) { border-color: #1c1917; color: #ffffff; }
.al-term-warn { border-color: #fca5a5; color: #dc2626; background: #fff5f5; }
.al-term-warn.active { background: #dc2626; border-color: #dc2626; color: #fff; }

.al-term-long-warning {
  background: #fff5f5; border: 1px solid #fca5a5;
  border-radius: 8px; padding: 10px 13px;
  font-size: 12px; color: #991b1b; line-height: 1.5;
}

/* OBBBA buttons */
.al-assembled-group { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.al-assembled-btn {
  padding: 10px 6px; border: 1.5px solid #e2e8f0;
  border-radius: 8px; background: #f8fafc;
  font-size: 12.5px; font-weight: 600; color: #475569;
  cursor: pointer; transition: all .15s; text-align: center;
}
.al-assembled-btn.active { background: #1c1917; border-color: #1c1917; color: #fff; }
.al-assembled-btn:hover:not(.active) { border-color: #1c1917; color: #ffffff; }

.al-filing-group, .al-bracket-group {
  display: grid; gap: 6px;
}
.al-filing-group  { grid-template-columns: 1fr 1fr; }
.al-bracket-group { grid-template-columns: repeat(3, 1fr); }
.al-filing-btn, .al-bracket-btn {
  padding: 9px 4px; border: 1.5px solid #cbd5e1;
  border-radius: 8px; font-size: 12.5px; font-weight: 600;
  cursor: pointer; background: #f8fafc; color: #475569;
  transition: all .15s; text-align: center;
}
.al-filing-btn.active, .al-bracket-btn.active {
  background: #1c1917; border-color: #1c1917; color: #fff;
}
.al-filing-btn:hover:not(.active), .al-bracket-btn:hover:not(.active) {
  border-color: #1c1917; color: #ffffff;
}

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

/* ===== PLACEHOLDER ===== */
.al-placeholder {
  text-align: center; padding: 40px 20px; color: #94a3b8;
}
.al-placeholder-icon { font-size: 40px; margin-bottom: 10px; }
.al-placeholder-text { font-size: 14px; }

/* ===== HERO ===== */
.al-hero-card {
  background: #1c1917; border-radius: 14px;
  padding: clamp(16px, 2vw, 22px) 20px; text-align: center; color: #fff;
}
.al-hero-label  { font-size: 12px; font-weight: 600; opacity: .7; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 5px; }
.al-hero-amount { font-size: clamp(34px, 5vw, 48px); font-weight: 800; line-height: 1; color: #fbbf24; }
.al-hero-sub    { font-size: 12px; opacity: .65; margin-top: 5px; }
.al-hero-loan   { font-size: 13px; opacity: .75; margin-top: 6px; font-weight: 600; }

/* ===== NEGATIVE EQUITY CARD ===== */
.al-neg-equity-card {
  background: #fff; border: 2px solid #fca5a5;
  border-radius: 12px; overflow: hidden;
}
.al-neg-header {
  display: flex; align-items: center; gap: 8px;
  background: #fee2e2; padding: 10px 16px;
  border-bottom: 1px solid #fca5a5;
}
.al-neg-icon  { font-size: 18px; }
.al-neg-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #991b1b; }
.al-neg-rows  { padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
.al-neg-row   { display: flex; justify-content: space-between; font-size: 13px; color: #475569; padding: 5px 0; border-bottom: 1px solid #fff5f5; }
.al-neg-row:last-child { border-bottom: none; }
.al-neg-row span:last-child { font-weight: 600; }
.al-neg-total span:last-child { font-size: 15px; }
.al-neg-warn { padding: 10px 16px; background: #fff5f5; font-size: 12.5px; color: #991b1b; line-height: 1.5; }
.al-red   { color: #dc2626; }
.al-green { color: #16a34a; }

/* ===== 20/4/10 RULE CARD ===== */
.al-rule-card {
  background: #fff; border: 1.5px solid #e2e8f0;
  border-radius: 12px; padding: 16px;
}
.al-rule-title { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 10px; }
.al-rule-rows  { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.al-rule-row   { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; }
.al-rule-icon  { font-size: 16px; flex-shrink: 0; width: 22px; text-align: center; }
.al-rule-text  { color: #475569; line-height: 1.4; }
.al-rule-verdict {
  font-size: 13px; font-weight: 700; padding: 10px 14px;
  border-radius: 8px; text-align: center;
}
.al-verdict-pass    { background: #f0fdf4; color: #15803d; }
.al-verdict-partial { background: #fffbeb; color: #92400e; }
.al-verdict-fail    { background: #fff5f5; color: #991b1b; }

/* ===== OBBBA CARD ===== */
.al-obbba-card {
  background: #fff; border: 1.5px solid #bbf7d0;
  border-radius: 12px; padding: 16px;
}
.al-obbba-title  { font-size: 13px; font-weight: 700; color: #15803d; margin-bottom: 12px; }
.al-obbba-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 10px; }
.al-obbba-item   { background: #f0fdf4; border-radius: 8px; padding: 10px 12px; }
.al-obbba-label  { font-size: 11px; font-weight: 600; color: #64748b; margin-bottom: 3px; }
.al-obbba-val    { font-size: 15px; font-weight: 700; color: #1e293b; }
.al-obbba-sub    { font-size: 10.5px; color: #94a3b8; margin-top: 2px; }
.al-obbba-monthly { font-size: 13px; color: #475569; margin-bottom: 8px; }
.al-obbba-phase  {
  font-size: 12.5px; font-weight: 600; padding: 8px 12px;
  border-radius: 7px; margin-bottom: 8px;
}
.al-phase-full    { background: #f0fdf4; color: #15803d; }
.al-phase-partial { background: #fffbeb; color: #92400e; }
.al-phase-none    { background: #fff5f5; color: #991b1b; }
.al-obbba-note   { font-size: 11.5px; color: #64748b; line-height: 1.5; }

/* ===== TERM TABLE ===== */
.al-term-table-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 16px;
}
.al-term-table-title { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 3px; }
.al-term-table-hint  { font-size: 12px; color: #64748b; margin-bottom: 12px; }
.al-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid #e2e8f0; }
.al-table      { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 360px; }
.al-table th   { background: #1c1917; color: #fff; padding: 9px 10px; text-align: left; font-size: 11px; font-weight: 600; white-space: nowrap; }
.al-table td   { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.al-table tr:last-child td { border-bottom: none; }
.al-term-selected td  { background: #fef9ee !important; font-weight: 700; }
.al-row-danger td     { background: #fff8f8; }
.al-risk { font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.al-risk-low    { background: #dcfce7; color: #15803d; }
.al-risk-ok     { background: #d1fae5; color: #065f46; }
.al-risk-watch  { background: #fef3c7; color: #92400e; }
.al-risk-high   { background: #fed7aa; color: #9a3412; }
.al-risk-danger { background: #fee2e2; color: #991b1b; }

/* ===== TRUE COST CARD ===== */
.al-cost-card {
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 16px;
}
.al-cost-title { font-size: 13px; font-weight: 700; color: #1e293b; margin-bottom: 10px; }
.al-cost-rows  { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.al-cost-row   { display: flex; justify-content: space-between; font-size: 13px; color: #475569; padding: 6px 0; border-bottom: 1px solid #f8fafc; }
.al-cost-row:last-child { border-bottom: none; }
.al-cost-row span:last-child { font-weight: 600; color: #1e293b; }
.al-cost-total { border-top: 2px solid #e2e8f0 !important; padding-top: 10px !important; font-size: 14px !important; }
.al-cost-total span:last-child { font-size: 16px !important; color: #1c1917 !important; }
.al-cost-note { font-size: 12px; color: #64748b; line-height: 1.5; background: #f8fafc; border-radius: 7px; padding: 9px 12px; }

/* ===== STATS ===== */
.al-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.al-stat       { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; }
.al-stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; margin-bottom: 4px; }
.al-stat-val   { font-size: clamp(13px, 1.8vw, 16px); font-weight: 700; color: #1e293b; }

/* ==============================================
   SCREEN 1 — MOBILE: max 480px
   ============================================== */
@media (max-width: 480px) {
  .al-wrap   { font-size: 13px; border-radius: 12px; }
  .al-header { padding: 14px; gap: 10px; }
  .al-header-icon { width: 38px; height: 38px; }
  .al-title  { font-size: 15px; }
  .al-subtitle { font-size: 11px; }
  .al-form, .al-results { padding: 14px; gap: 12px; }
  .al-body   { flex-direction: column; }
  .al-row-2  { grid-template-columns: 1fr; }
  .al-credit-group  { grid-template-columns: repeat(2, 1fr); }
  .al-term-group    { grid-template-columns: repeat(3, 1fr); }
  .al-bracket-group { grid-template-columns: repeat(3, 1fr); }
  .al-obbba-grid    { grid-template-columns: 1fr; }
  .al-stats-grid    { grid-template-columns: 1fr; }
  .al-hero-amount   { font-size: 30px; }
}

/* ==============================================
   SCREEN 2 — TABLET: 481px – 899px
   ============================================== */
@media (min-width: 481px) and (max-width: 899px) {
  .al-wrap   { font-size: 14px; }
  .al-header { padding: 18px 20px; }
  .al-form, .al-results { padding: 18px; gap: 14px; }
  .al-body   { flex-direction: column; }
  .al-results { border-top: 1px solid #e2e8f0; }
  .al-row-2  { grid-template-columns: 1fr 1fr; }
  .al-credit-group  { grid-template-columns: repeat(6, 1fr); }
  .al-term-group    { grid-template-columns: repeat(6, 1fr); }
  .al-bracket-group { grid-template-columns: repeat(6, 1fr); }
  .al-obbba-grid    { grid-template-columns: repeat(4, 1fr); }
  .al-stats-grid    { grid-template-columns: repeat(4, 1fr); }
  .al-hero-amount   { font-size: 40px; }
}

/* ==============================================
   SCREEN 3 — DESKTOP: 900px+
   ============================================== */
@media (min-width: 900px) {
  .al-wrap   { font-size: 15px; }
  .al-header { padding: 22px 24px; }
  .al-form, .al-results { padding: 20px; gap: 14px; }
  .al-body   { flex-direction: row; align-items: flex-start; }
  .al-form   { width: 50%; border-right: 1px solid #e2e8f0; border-top: none; }
  .al-results { width: 50%; border-top: none; }
  .al-row-2  { grid-template-columns: 1fr 1fr; }
  .al-credit-group  { grid-template-columns: repeat(3, 1fr); }
  .al-term-group    { grid-template-columns: repeat(3, 1fr); }
  .al-bracket-group { grid-template-columns: repeat(3, 1fr); }
  .al-obbba-grid    { grid-template-columns: 1fr 1fr; }
  .al-stats-grid    { grid-template-columns: 1fr 1fr; }
  .al-hero-amount   { font-size: 44px; }
}
