/* ============================================================
   Debt Freedom Calculators — Main Stylesheet
   Mobile-first. Designed for portrait phone screens (360–430px).
   All colours driven by CSS custom properties set via PHP.
   ============================================================ */

/* ---- Reset / base ---------------------------------------- */
.dfc-wrap *, .dfc-wrap *::before, .dfc-wrap *::after {
    box-sizing: border-box;
}
.dfc-wrap {
    font-family: var(--dfc-font-b);
    color: var(--dfc-text);
    background: var(--dfc-bg);
    padding: 14px;
    border-radius: 0;
    border: none;
    max-width: 100%;
    margin: 0;
}

/* ---- Header ---------------------------------------------- */
.dfc-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e8f0e8;
}
.dfc-logo {
    max-height: 48px;
    margin: 0 auto 8px;
    display: block;
}
.dfc-header h2 {
    font-family: var(--dfc-font-h);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dfc-primary);
    margin: 0 0 4px;
    line-height: 1.2;
}
.dfc-subtitle {
    color: #666;
    font-size: 0.85rem;
    margin: 0;
}

/* ---- Buttons --------------------------------------------- */
.dfc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 18px;
    border-radius: 10px;
    border: none;
    font-family: var(--dfc-font-b);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
    min-height: 44px; /* iOS tap target */
    touch-action: manipulation;
}
.dfc-btn:active { transform: scale(0.97); }
.dfc-btn--primary   { background: var(--dfc-primary);   color: #fff; }
.dfc-btn--primary:hover { background: var(--dfc-secondary); color: #fff; }
.dfc-btn--secondary { background: var(--dfc-accent);    color: #111; }
.dfc-btn--secondary:hover { filter: brightness(0.92); }
.dfc-btn--ghost     { background: transparent; color: var(--dfc-primary); border: 2px solid var(--dfc-primary); }
.dfc-btn--ghost:hover { background: var(--dfc-primary); color: #fff; }
.dfc-btn--full { width: 100%; }

/* ---- Controls bar ---------------------------------------- */
.dfc-controls-bar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
    padding: 14px;
    background: #f5faf6;
    border-radius: 12px;
    border: 1px solid #d4e8d4;
}
.dfc-control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dfc-control-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dfc-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Method toggle — full width side-by-side on mobile */
.dfc-method-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.dfc-method-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px;
    border-radius: 10px;
    border: 2px solid #c8dfc8;
    background: #fff;
    cursor: pointer;
    font-family: var(--dfc-font-b);
    font-size: 0.82rem;
    font-weight: 600;
    color: #555;
    transition: all 0.18s;
    touch-action: manipulation;
    min-height: 58px;
}
.dfc-method-btn small {
    font-weight: 400;
    font-size: 0.68rem;
    color: #888;
    margin-top: 2px;
    text-align: center;
}
.dfc-method-btn.active {
    border-color: var(--dfc-primary);
    background: var(--dfc-primary);
    color: #fff;
}
.dfc-method-btn.active small { color: rgba(255,255,255,0.8); }
.dfc-method-icon { font-size: 1.25rem; }

/* Inputs with prefix/suffix */
.dfc-input-prefix, .dfc-input-suffix {
    display: flex;
    align-items: stretch;
    border: 1.5px solid #ccc;
    border-radius: 9px;
    overflow: hidden;
    background: #fff;
}
.dfc-input-prefix span, .dfc-input-suffix span {
    padding: 0 10px;
    background: #f0f4f0;
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
    border-right: 1px solid #ddd;
    display: flex;
    align-items: center;
    white-space: nowrap;
}
.dfc-input-suffix span { border-right: none; border-left: 1px solid #ddd; }
.dfc-input-prefix input, .dfc-input-suffix input {
    border: none;
    outline: none;
    padding: 11px 10px;
    font-size: 1rem;
    flex: 1;
    min-width: 0;
    background: transparent;
    -webkit-appearance: none;
}
#dfc-extra-payment { font-size: 1rem; }

/* Method info banner */
.dfc-method-info {
    background: #fffde7;
    border-left: 4px solid var(--dfc-accent);
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    margin-bottom: 14px;
    font-size: 0.82rem;
    line-height: 1.45;
}

/* Tooltip */
.dfc-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--dfc-primary);
    color: #fff;
    font-size: 0.7rem;
    cursor: help;
    margin-left: 4px;
    flex-shrink: 0;
}

/* ============================================================
   DEBT TABLE — card-stack layout on mobile
   Each debt row becomes a self-contained card.
   The traditional table is only shown on wider screens.
   ============================================================ */

/* Hide the scrollable table on mobile — !important prevents theme overrides */
.dfc-table-wrap {
    display: none !important;
}

/* Mobile debt cards */
.dfc-debt-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}
.dfc-debt-card {
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.dfc-debt-card.is-focus-debt {
    border-color: var(--dfc-accent);
    box-shadow: 0 0 0 3px rgba(244,185,66,0.25);
}
.dfc-debt-card.is-paid-off {
    border-color: #b8e8c8;
    opacity: 0.7;
}
.dfc-debt-card.is-paid-off .dfc-card-inputs { opacity: 0.5; pointer-events: none; }

/* Card header bar */
.dfc-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px 8px;
    background: #f8fdf8;
    border-bottom: 1px solid #eee;
}
.dfc-card-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--dfc-primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.dfc-debt-card.is-focus-debt .dfc-card-num {
    background: var(--dfc-accent);
    color: #111;
}
.dfc-debt-card.is-focus-debt .dfc-card-num::after { content: ' 🎯'; font-size: 0.7rem; }
.dfc-card-name-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: var(--dfc-font-b);
    font-size: 0.92rem;
    font-weight: 600;
    background: transparent;
    color: var(--dfc-text);
    min-width: 0;
    padding: 0;
}
.dfc-card-name-input::placeholder { color: #aaa; font-weight: 400; }
.dfc-debt-card.is-paid-off .dfc-card-name-input { text-decoration: line-through; color: #999; }
.dfc-card-paid-badge {
    display: none;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--dfc-success);
    white-space: nowrap;
}
.dfc-debt-card.is-paid-off .dfc-card-paid-badge { display: inline; }

/* Card input grid: 3 inputs side by side */
.dfc-card-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1px;
    background: #eee;
}
.dfc-card-input-cell {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    background: #fff;
}
.dfc-card-input-cell label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.04em;
}
.dfc-card-input-cell input {
    border: none;
    border-bottom: 1.5px solid #ddd;
    padding: 4px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dfc-text);
    background: transparent;
    outline: none;
    width: 100%;
    -webkit-appearance: none;
}
.dfc-card-input-cell input:focus {
    border-bottom-color: var(--dfc-primary);
}
/* Prefix symbol inside the cell */
.dfc-card-input-cell .dfc-sym {
    font-size: 0.75rem;
    color: #aaa;
    display: inline;
}

/* Card results row */
.dfc-card-results {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: #eee;
    border-top: 1px solid #eee;
}
.dfc-card-result-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 7px 8px;
    background: #f8fdf8;
    text-align: center;
}
.dfc-debt-card.is-focus-debt .dfc-card-results { background: #fffde7; }
.dfc-debt-card.is-focus-debt .dfc-card-result-cell { background: #fffde7; }
.dfc-card-result-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #aaa;
    letter-spacing: 0.03em;
}
.dfc-card-result-value {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--dfc-primary);
}
.dfc-debt-card.is-paid-off .dfc-card-result-value { color: var(--dfc-success); }

/* Card footer: payments made + remove */
.dfc-card-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid #f0f0f0;
}
.dfc-card-payments-label {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
}
.dfc-card-payments-input {
    border: 1.5px solid #ddd;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.88rem;
    width: 64px;
    text-align: center;
    -webkit-appearance: none;
}
.dfc-card-payments-input:focus {
    border-color: var(--dfc-primary);
    outline: none;
}
.dfc-remove-card {
    margin-left: auto;
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    color: var(--dfc-danger);
    font-size: 1rem;
    width: 32px; height: 32px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
}
.dfc-remove-card:hover { background: #fde8e8; }

/* Add row bar */
.dfc-add-row-bar {
    margin: 4px 0 16px;
}

/* ---- Focus Panel ----------------------------------------- */
.dfc-focus-panel {
    background: linear-gradient(135deg, var(--dfc-primary) 0%, var(--dfc-secondary) 100%);
    color: #fff;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
}
.dfc-focus-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}
.dfc-focus-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    opacity: 0.75;
}
.dfc-focus-name {
    font-family: var(--dfc-font-h);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}
.dfc-focus-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.dfc-focus-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dfc-focus-stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.7;
}
.dfc-focus-stat-value {
    font-family: var(--dfc-font-h);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dfc-accent);
    line-height: 1.2;
}
.dfc-focus-total-payment { font-size: 1.3rem; }

/* Payment breakdown — full width row */
.dfc-focus-stat--breakdown {
    grid-column: 1 / -1;
    order: -1; /* show payment total first on mobile */
}
.dfc-payment-breakdown {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
}
.dfc-pbd-item {
    background: rgba(255,255,255,0.18);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}
.dfc-pbd-item b {
    font-weight: 700;
    color: var(--dfc-accent);
}
.dfc-pbd-sep {
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0.65;
}

/* ---- Totals bar ------------------------------------------ */
.dfc-totals-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.dfc-total-card {
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.dfc-total-card--highlight {
    border-color: var(--dfc-primary);
    background: #f5faf6;
    grid-column: 1 / -1; /* full width on mobile */
}
.dfc-total-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.04em;
}
.dfc-total-value {
    font-family: var(--dfc-font-h);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dfc-primary);
}
.dfc-total-sub {
    font-size: 0.68rem;
    color: #bbb;
    line-height: 1.3;
}

/* ---- Congratulations overlay ----------------------------- */
.dfc-congrats-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.dfc-congrats-box {
    background: #fff;
    border-radius: 18px;
    padding: 32px 24px;
    text-align: center;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: dfcPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes dfcPop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.dfc-congrats-text {
    font-family: var(--dfc-font-h);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dfc-success);
    margin-bottom: 10px;
    line-height: 1.2;
}
.dfc-congrats-sub {
    font-size: 0.92rem;
    color: #555;
    margin-bottom: 20px;
}

/* ---- Actions bar ----------------------------------------- */
.dfc-actions-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid #e8e8e8;
}
.dfc-actions-bar .dfc-btn {
    width: 100%;
    justify-content: center;
}
.dfc-save-status {
    grid-column: 1 / -1;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--dfc-success);
    text-align: center;
    min-height: 18px;
}
.dfc-save-status.error { color: var(--dfc-danger); }
.dfc-last-saved {
    grid-column: 1 / -1;
    font-size: 0.72rem;
    color: #bbb;
    text-align: center;
}

/* ---- Locked card ----------------------------------------- */
.dfc-locked-wrap {
    display: flex;
    justify-content: center;
    padding: 30px 16px;
}
.dfc-locked-card {
    text-align: center;
    max-width: 360px;
    width: 100%;
    padding: 32px 20px;
    border-radius: 14px;
    border: 2px dashed #ccc;
    background: #fafafa;
}
.dfc-lock-icon { font-size: 2.2rem; display: block; margin-bottom: 10px; }
.dfc-locked-card h3 { margin: 0 0 8px; font-family: var(--dfc-font-h); color: var(--dfc-primary); }
.dfc-locked-card .dfc-btn { margin: 8px 4px 0; width: 100%; }

/* ============================================================
   BUDGET CALCULATOR — mobile-first
   ============================================================ */

/* ---- Budget tab nav -------------------------------------- */
.dfc-budget-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin-bottom: 0;
    background: var(--dfc-primary);
    border-radius: 12px 12px 0 0;
    padding: 6px 6px 0;
    overflow: hidden;
}
.dfc-btab {
    padding: 9px 6px;
    border: none;
    background: rgba(255,255,255,0.15);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    font-family: var(--dfc-font-b);
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(255,255,255,0.75);
    transition: background 0.15s, color 0.15s;
    text-align: center;
    touch-action: manipulation;
    min-height: 44px;
    line-height: 1.25;
}
.dfc-btab.active {
    background: #fff;
    color: var(--dfc-primary);
}
.dfc-btab:hover:not(.active) {
    background: rgba(255,255,255,0.28);
    color: #fff;
}

/* ---- Budget tab panes ------------------------------------ */
.dfc-bpane {
    display: none;
    padding: 16px 14px 20px;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 12px 12px;
    background: #fff;
}
.dfc-bpane.active { display: block; }
.dfc-bpane h3 {
    font-family: var(--dfc-font-h);
    color: var(--dfc-primary);
    font-size: 1.1rem;
    margin: 0 0 14px;
}
.dfc-subheading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dfc-secondary);
    font-weight: 700;
    margin: 16px 0 6px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e8f0e8;
    grid-column: 1 / -1;
}

/* ---- Budget field grid ----------------------------------- */
.dfc-field-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 14px;
}
.dfc-field-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #f0f0f0;
}
.dfc-field-row:last-child { border-bottom: none; }
.dfc-field-row label {
    flex: 1;
    font-size: 0.84rem;
    font-weight: 500;
    color: #444;
    line-height: 1.3;
}
.dfc-field-row .dfc-input-prefix {
    flex-shrink: 0;
    width: 110px;
}
.dfc-field-row .dfc-input-prefix input {
    width: 80px;
    padding: 8px 6px;
    font-size: 0.95rem;
    text-align: right;
}
.dfc-field-row .dfc-input-prefix span {
    padding: 0 7px;
}
.dfc-budget-field {
    border: 1.5px solid #ccc;
    border-radius: 7px;
    padding: 9px 10px;
    font-size: 0.95rem;
    background: #fff;
    width: 100%;
    transition: border-color 0.15s;
    -webkit-appearance: none;
}
.dfc-budget-field:focus {
    border-color: var(--dfc-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(26,107,60,0.1);
}

/* ---- Tab total ------------------------------------------- */
.dfc-tab-total {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 11px 14px;
    background: #f5faf6;
    border-radius: 8px;
    border-left: 4px solid var(--dfc-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}
.dfc-tab-total strong {
    color: var(--dfc-primary);
    font-size: 1.05rem;
}
.dfc-pct-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
}
.dfc-pct-badge.ok   { background: #d4edda; color: #155724; }
.dfc-pct-badge.warn { background: #fff3cd; color: #856404; }
.dfc-pct-badge.over { background: #f8d7da; color: #721c24; }

/* ---- Budget tab navigation buttons ----------------------- */
.dfc-tab-nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.dfc-tab-nav .dfc-btn {
    flex: 1;
    justify-content: center;
}
.dfc-tab-nav .dfc-btn--ghost { flex: 0 0 auto; padding: 12px 14px; }

/* ---- Budget summary tab ---------------------------------- */
.dfc-summary-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.dfc-sum-card {
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    border: 1.5px solid #e0e0e0;
}
.dfc-sum-card:last-child {
    grid-column: 1 / -1; /* debt available spans full width */
}
.dfc-sum-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
}
.dfc-sum-value {
    font-family: var(--dfc-font-h);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
}
.dfc-sum-sub { font-size: 0.68rem; color: #aaa; }
.dfc-sum-income  { background: #f5faf6; }
.dfc-sum-income  .dfc-sum-value { color: var(--dfc-primary); }
.dfc-sum-expense { background: #fff5f5; }
.dfc-sum-expense .dfc-sum-value { color: var(--dfc-danger); }
.dfc-sum-surplus { background: #fffde7; }
.dfc-sum-surplus.positive { background: #f0fff4; }
.dfc-sum-surplus.positive .dfc-sum-value { color: var(--dfc-success); }
.dfc-sum-surplus.negative .dfc-sum-value { color: var(--dfc-danger); }
.dfc-sum-debt-available { background: #f5faf6; border-color: var(--dfc-primary); }
.dfc-sum-debt-available .dfc-sum-value { color: var(--dfc-primary); }

/* Analysis table — scrollable on mobile */
.dfc-breakdown-table { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 14px; }
.dfc-analysis-table {
    width: 100%;
    min-width: 460px;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.dfc-analysis-table th {
    background: var(--dfc-primary);
    color: #fff;
    padding: 8px;
    text-align: left;
    font-size: 0.73rem;
    white-space: nowrap;
}
.dfc-analysis-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}
.dfc-analysis-table tr:nth-child(even) td { background: #f8f8f8; }
.status-ok   { color: var(--dfc-success); font-weight: 700; }
.status-warn { color: #e67e22; font-weight: 700; }
.status-over { color: var(--dfc-danger);  font-weight: 700; }

/* Alerts */
.dfc-alerts-box {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.dfc-alerts-box h4 { margin: 0 0 6px; color: #b45309; font-size: 0.88rem; }
.dfc-alerts-box ul { margin: 0; padding-left: 16px; }
.dfc-alerts-box li { font-size: 0.8rem; margin-bottom: 4px; line-height: 1.4; }

/* Surplus tip */
.dfc-surplus-tip {
    background: #f0fff4;
    border-left: 4px solid var(--dfc-success);
    border-radius: 0 8px 8px 0;
    padding: 10px 14px;
    font-size: 0.82rem;
    margin-bottom: 14px;
    line-height: 1.45;
}

/* Plan name bar */
.dfc-plan-name-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0;
    padding: 10px 12px;
    background: #f5f5f5;
    border-radius: 8px;
}
.dfc-plan-name-bar label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}
.dfc-plan-name-bar input {
    flex: 1;
    border: 1.5px solid #ccc;
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 0.9rem;
    min-width: 0;
    -webkit-appearance: none;
}

/* ============================================================
   TABLET / DESKTOP OVERRIDES (≥ 640px)
   ============================================================ */
@media (min-width: 640px) {

    /* Base wrap */
    .dfc-wrap {
        padding: 24px;
        border-radius: 12px;
        border: 1px solid #e0e0e0;
        max-width: 1200px;
        margin: 0 auto;
    }

    .dfc-header h2 { font-size: 1.75rem; }

    /* Controls bar goes horizontal */
    .dfc-controls-bar {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 20px;
    }

    /* Restore the traditional table, hide card stack */
    .dfc-table-wrap {
        display: block !important;
        overflow-x: auto;
        margin-bottom: 10px;
        border-radius: 8px;
        border: 1px solid #e0e0e0;
    }
    .dfc-debt-cards { display: none !important; }

    .dfc-debt-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.87rem;
        min-width: 900px;
    }
    .dfc-debt-table thead tr {
        background: var(--dfc-primary);
        color: #fff;
    }
    .dfc-debt-table th {
        padding: 10px 8px;
        text-align: left;
        font-weight: 600;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    .dfc-th-order { width: 36px; }
    .dfc-th-result { text-align: center; }
    .dfc-debt-row:nth-child(even) { background: #f8fdf8; }
    .dfc-debt-row:hover { background: #eaf5ea; }
    .dfc-debt-table td { padding: 7px 8px; vertical-align: middle; }
    .dfc-debt-row.is-focus-debt {
        background: #fffde7 !important;
        outline: 2px solid var(--dfc-accent);
        outline-offset: -2px;
    }
    .dfc-debt-row.is-focus-debt .dfc-row-number::after { content: ' 🎯'; }
    .dfc-debt-row.is-paid-off {
        background: #f0fff4 !important;
        opacity: 0.7;
    }
    .dfc-debt-row.is-paid-off td:not(:last-child) { text-decoration: line-through; color: #999; }
    .dfc-field {
        border: 1px solid #ccc;
        border-radius: 5px;
        padding: 5px 7px;
        font-size: 0.85rem;
        width: 100%;
        background: #fff;
    }
    .dfc-field:focus { border-color: var(--dfc-primary); outline: none; box-shadow: 0 0 0 2px rgba(26,107,60,0.15); }
    .dfc-field-label { min-width: 120px; }
    .dfc-input-prefix input.dfc-field,
    .dfc-input-suffix input.dfc-field { border: none; border-radius: 0; width: 90px; }
    .dfc-result { text-align: center; font-weight: 600; color: var(--dfc-primary); }
    .dfc-remove-row {
        background: none; border: 1px solid #e0e0e0; border-radius: 5px;
        color: var(--dfc-danger); font-size: 1.1rem; width: 28px; height: 28px;
        cursor: pointer; display: flex; align-items: center; justify-content: center;
        transition: background 0.15s;
    }
    .dfc-remove-row:hover { background: #fde8e8; }

    /* Focus panel — horizontal on desktop */
    .dfc-focus-meta {
        grid-template-columns: auto auto 1fr auto;
    }
    .dfc-focus-stat--breakdown { grid-column: auto; order: 0; }

    /* Totals bar */
    .dfc-totals-bar {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    .dfc-total-card--highlight { grid-column: auto; }

    /* Actions bar */
    .dfc-actions-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }
    .dfc-actions-bar .dfc-btn { width: auto; }
    .dfc-save-status { grid-column: auto; text-align: left; }
    .dfc-last-saved  { grid-column: auto; margin-left: auto; }

    /* Budget tabs go horizontal */
    .dfc-budget-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        background: transparent;
        border-radius: 0;
        padding: 0;
        border-bottom: 2px solid var(--dfc-primary);
    }
    .dfc-btab {
        padding: 9px 14px;
        border: 1px solid #ccc;
        border-bottom: none;
        background: #f0f0f0;
        border-radius: 6px 6px 0 0;
        font-size: 0.85rem;
        color: #555;
        min-height: unset;
        flex: 0 0 auto;
    }
    .dfc-btab.active {
        background: #fff;
        color: var(--dfc-primary);
        border-color: var(--dfc-primary);
        border-bottom: 2px solid #fff;
        margin-bottom: -2px;
    }
    .dfc-btab:hover:not(.active) { background: #e4f0e4; color: #333; }

    /* Budget field grid — 2-column on tablet */
    .dfc-field-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px 20px;
    }
    .dfc-field-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 0;
        border-bottom: none;
    }
    .dfc-field-row .dfc-input-prefix { width: 100%; }
    .dfc-field-row .dfc-input-prefix input { width: 100%; text-align: left; }

    /* Budget tab pane */
    .dfc-bpane { padding: 24px; }
    .dfc-bpane h3 { font-size: 1.2rem; }

    /* Summary */
    .dfc-summary-cards { grid-template-columns: repeat(4, 1fr); }
    .dfc-sum-card:last-child { grid-column: auto; }
}

@media (min-width: 1024px) {
    .dfc-focus-meta { grid-template-columns: auto 1fr auto auto; }
}
