/* ==========================================================================
   VARIABLES & THEME SETUP
   ========================================================================== */
:root {
    --bg-main: #f1f5f9;
    --bg-card: #ffffff;
    --bg-subtle: #f8fafc;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    
    --emerald: #10b981;
    --emerald-light: #d1fae5;
    --amber: #f59e0b;
    --amber-light: #fef3c7;
    --rose: #f43f5e;
    --rose-light: #ffe4e6;
    --sky: #0ea5e9;
    --sky-light: #e0f2fe;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    --radius-md: 12px;
    --radius-lg: 16px;
}

[data-theme="dark"] {
    --bg-main: #0b1120;
    --bg-card: #1e293b;
    --bg-subtle: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;

    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-light: rgba(99, 102, 241, 0.15);

    --emerald-light: rgba(16, 185, 129, 0.15);
    --amber-light: rgba(245, 158, 11, 0.15);
    --rose-light: rgba(244, 63, 94, 0.15);
    --sky-light: rgba(14, 165, 233, 0.15);
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    transition: background-color 0.25s ease, color 0.25s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */
.navbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-container {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.brand h1 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.brand h1 span {
    color: var(--primary);
}

.brand p {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ==========================================================================
   LAYOUT GRID & CARDS
   ========================================================================== */
.main-grid {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 1.75rem;
    padding-top: 2rem;
    padding-bottom: 3rem;
    flex: 1;
    align-items: start;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.card-header {
    margin-bottom: 1.5rem;
}

.card-header h2, .card-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.card-header h2 i, .card-header h3 i {
    color: var(--primary);
}

.card-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================================================
   FORM ELEMENTS
   ========================================================================== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-group label small {
    color: var(--text-muted);
    font-weight: 400;
}

.req {
    color: var(--rose);
}

/* Category Pills */
.category-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.pill {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.55rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pill.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

/* Inputs */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon, .input-prefix {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    pointer-events: none;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-main);
    background-color: var(--bg-subtle);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    outline: none;
}

.input-wrapper input {
    padding-left: 2.75rem;
}

input:focus, select:focus {
    border-color: var(--primary);
    background-color: var(--bg-card);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Quick Amounts */
.quick-amounts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.quick-amounts button {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: 0.15s;
}

.quick-amounts button:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.quick-amounts button.text-danger:hover {
    background: var(--rose-light);
    color: var(--rose);
    border-color: var(--rose);
}

/* Mode Switch */
.mode-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-subtle);
    padding: 0.3rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.mode-btn {
    background: transparent;
    border: none;
    padding: 0.55rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: 0.2s;
}

.mode-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.split-input {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0.75rem;
}

/* Buttons */
.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-primary {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    border: none;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.btn-secondary, .btn-outline, .btn-icon, .btn-action {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    transition: 0.2s;
}

.btn-secondary:hover, .btn-outline:hover, .btn-icon:hover, .btn-action:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.badge {
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
}

/* ==========================================================================
   RESULTS SECTION
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-illustration {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    max-width: 460px;
    margin: 0 auto 1.5rem;
    font-size: 0.92rem;
}

/* Summary Banner */
.summary-banner {
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.summary-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.goal-badge-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.goal-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
}

.category-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.15rem 0.6rem;
    border-radius: 99px;
    margin-bottom: 0.25rem;
}

.summary-top h2 {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.25;
}

.summary-actions {
    display: flex;
    gap: 0.5rem;
}

/* Progress Box */
.progress-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.progress-labels small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-labels strong {
    font-size: 1.05rem;
    font-weight: 700;
}

.text-right {
    text-align: right;
}

.progress-track {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 0.65rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--emerald));
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.text-highlight {
    color: var(--primary);
}

/* ETA Banner */
.eta-banner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-top: 0.5rem;
}

.eta-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.eta-item i {
    font-size: 1.35rem;
    color: var(--primary);
}

.eta-item small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.eta-item strong {
    font-size: 0.95rem;
}

/* Breakdown Cards */
.section-title {
    margin-bottom: 1rem;
}

.section-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title h3 i {
    color: var(--amber);
}

.section-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.breakdown-card {
    position: relative;
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.breakdown-card:hover {
    transform: translateY(-3px);
}

.highlight-daily { border-top: 4px solid var(--emerald); }
.highlight-weekly { border-top: 4px solid var(--sky); }
.highlight-monthly { border-top: 4px solid var(--primary); }

.bd-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.bd-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.2rem 0.65rem;
    border-radius: 99px;
}

.highlight-daily .bd-badge { background: var(--emerald-light); color: var(--emerald); }
.highlight-daily .bd-header i { color: var(--emerald); font-size: 1.2rem; }

.highlight-weekly .bd-badge { background: var(--sky-light); color: var(--sky); }
.highlight-weekly .bd-header i { color: var(--sky); font-size: 1.2rem; }

.highlight-monthly .bd-badge { background: var(--primary-light); color: var(--primary); }
.highlight-monthly .bd-header i { color: var(--primary); font-size: 1.2rem; }

.bd-amount {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.bd-sub {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.bd-tip {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border-color);
}

/* Milestone Timeline */
.milestone-card {
    margin-bottom: 1.5rem;
}

.milestone-timeline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    position: relative;
}

.milestone-step {
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    position: relative;
}

.milestone-step.achieved {
    border-color: var(--emerald);
    background: var(--emerald-light);
}

.ms-percent {
    display: inline-block;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.2rem 0.65rem;
    border-radius: 99px;
    margin-bottom: 0.5rem;
}

.milestone-step.achieved .ms-percent {
    background: var(--emerald);
    color: #fff;
}

.ms-amount {
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 0.2rem;
}

.ms-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Schedule Table */
.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.schedule-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.schedule-header h3 i {
    color: var(--primary);
}

.schedule-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.schedule-filter {
    display: flex;
    background: var(--bg-subtle);
    padding: 0.25rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.sched-tab {
    background: transparent;
    border: none;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
}

.sched-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.table-responsive {
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.schedule-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-subtle);
    z-index: 10;
}

.schedule-table th,
.schedule-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.schedule-table th {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.schedule-table tbody tr:hover {
    background: var(--bg-subtle);
}

.prog-pill {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
}

.schedule-note {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

/* ==========================================================================
   MODAL & TOAST
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
}

.saved-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.saved-item-info h4 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.saved-item-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.saved-item-actions {
    display: flex;
    gap: 0.4rem;
}

.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--text-main);
    color: var(--bg-card);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 300;
}

.toast i {
    color: var(--emerald);
}

/* ==========================================================================
   FOOTER & RESPONSIVE
   ========================================================================== */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
    background: var(--bg-card);
}

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

@media (max-width: 640px) {
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
    .milestone-timeline {
        grid-template-columns: 1fr 1fr;
    }
    .eta-banner {
        grid-template-columns: 1fr;
    }
    .summary-top {
        flex-direction: column;
    }
    .nav-actions span {
        display: none;
    }
    .nav-actions .badge {
        display: inline-block;
    }
}

@media print {
    .navbar, .form-card, .summary-actions, .schedule-filter, .footer {
        display: none !important;
    }
    .main-grid {
        display: block;
    }
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        margin-bottom: 1rem;
    }
}

/* Modern responsive refinements */
:root {
  --primary: #0f9f8f;
  --primary-hover: #0b8276;
  --primary-light: #d9f7f0;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(16, 35, 52, .05);
  --shadow-md: 0 8px 24px rgba(16, 35, 52, .07);
  --shadow-lg: 0 20px 55px rgba(16, 35, 52, .16);
}
[data-theme="dark"] {
  --primary: #4dd6c1;
  --primary-hover: #7ce8d8;
  --primary-light: rgba(77, 214, 193, .14);
}
body {
  background-image: radial-gradient(ellipse at 10% 0%, rgba(15,159,143,.08), transparent 34%),
                    radial-gradient(ellipse at 100% 8%, rgba(99,102,241,.07), transparent 30%);
}
button, input, select, a { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent);
  outline-offset: 2px;
}
.navbar { backdrop-filter: blur(14px); }
.nav-container { gap: 1rem; }
.home-link { text-decoration: none; white-space: nowrap; }
.main-grid { grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: clamp(1rem, 2vw, 1.5rem); }
.card { border-radius: var(--radius-lg); }
.form-card { position: sticky; top: 92px; }
.category-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pill { min-height: 42px; }
.btn-primary, .btn-secondary, .btn-outline, .btn-icon, .btn-action { min-height: 42px; }
.btn-primary { background: linear-gradient(135deg, var(--primary), #397ce7); }
.summary-banner { background: linear-gradient(145deg, var(--bg-card), var(--bg-subtle)); }
.breakdown-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.breakdown-card { min-width: 0; }
.bd-amount { overflow-wrap: anywhere; }
.milestone-row { min-width: 0; }
.schedule-table { min-width: 680px; }
.modal-overlay { overscroll-behavior: contain; }
.modal-box { border-radius: 22px; }
.saved-item { align-items: flex-start; }
.saved-item-info { min-width: 0; overflow-wrap: anywhere; }
.saved-item-actions { flex-shrink: 0; }
.toast { max-width: min(420px, calc(100vw - 2rem)); }
@media (max-width: 1100px) {
  .main-grid { grid-template-columns: minmax(0, 1fr); }
  .form-card { position: static; }
  .category-pills { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .container { padding-left: 1rem; padding-right: 1rem; }
  .nav-container { min-height: 70px; height: auto; padding-top: .7rem; padding-bottom: .7rem; }
  .brand { gap: .6rem; }
  .brand-icon { width: 40px; height: 40px; }
  .brand h1 { font-size: 1.05rem; }
  .brand p { font-size: .68rem; }
  .nav-actions { gap: .4rem; }
  .nav-actions .btn-outline, .nav-actions .btn-icon { padding: .55rem .65rem; min-height: 40px; }
  .nav-actions .home-link span, .nav-actions #btnSavedGoals > span:not(.badge) { display: none; }
  .main-grid { padding-top: 1rem; padding-bottom: 2rem; }
  .card { padding: 1.1rem; }
  .category-pills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdown-grid { grid-template-columns: 1fr; }
  .breakdown-card { min-height: 150px; }
  .milestone-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-top { flex-direction: column; }
  .summary-actions { width: 100%; }
  .summary-actions .btn-action { flex: 1; }
  .progress-labels { gap: .8rem; }
  .progress-labels strong { font-size: .95rem; overflow-wrap: anywhere; }
  .progress-footer { align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
  .eta-banner { grid-template-columns: 1fr; }
  .schedule-header { align-items: stretch; }
  .schedule-filter { width: 100%; }
  .sched-tab { flex: 1; }
  .saved-item { flex-direction: column; }
  .saved-item-actions { width: 100%; }
  .saved-item-actions button { flex: 1; }
  .toast { left: 1rem; right: 1rem; bottom: 1rem; }
}
@media (max-width: 380px) {
  .brand p { display: none; }
  .nav-actions { gap: .25rem; }
  .nav-actions .btn-outline, .nav-actions .btn-icon { padding: .5rem; }
  .mode-switch { grid-template-columns: 1fr; }
  .milestone-timeline { grid-template-columns: 1fr; }
  .split-input { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  body { background: #fff !important; color: #111 !important; }
  .navbar, .form-card, .summary-actions, .schedule-filter, .footer, .modal-overlay, .toast { display: none !important; }
  .main-grid { display: block; max-width: none; padding: 0; }
  .card { box-shadow: none !important; break-inside: avoid; }
  #resultContent { display: block !important; }
}


/* Components used by the current calculator markup */
.milestone-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) minmax(95px, auto);
  align-items: center;
  gap: .85rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--border-color);
}
.milestone-row:last-child { border-bottom: 0; }
.m-percent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-radius: 12px;
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 800;
}
.m-details { min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.m-details strong { overflow-wrap: anywhere; }
.m-details span, .m-date { color: var(--text-muted); font-size: .8rem; }
.m-date { text-align: right; }
.milestone-row.achieved .m-percent { background: var(--emerald-light); color: var(--emerald); }
.saved-empty { color: var(--text-muted); padding: 1rem 0; text-align: center; }
body.modal-open { overflow: hidden; }
@media (max-width: 520px) {
  .milestone-row { grid-template-columns: 44px minmax(0, 1fr); gap: .65rem; }
  .m-date { grid-column: 2; text-align: left; }
}
