/* =============================================================
   Family Budget Tracker — Styles
   ============================================================= */

/* Nunito font is enqueued separately via wp_enqueue_style in PHP
   to avoid a render-blocking @import chain. */

#fbt-app {
    max-width: 980px;
    margin: 0 auto;
    padding: 16px;
    font-family: 'Nunito', sans-serif;
    color: #1a1d2e;
    line-height: 1.4;
}
#fbt-app *, #fbt-app *::before, #fbt-app *::after { box-sizing: border-box; }
#fbt-app h1, #fbt-app h2, #fbt-app h3, #fbt-app p { margin: 0; padding: 0; }

/* ── Header ── */
.fbt-header {
    background: linear-gradient(135deg, #4361ee, #7b2d8b);
    border-radius: 16px;
    padding: 24px 28px;
    color: #fff;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
}
.fbt-header::before {
    content: '';
    position: absolute;
    right: -40px; top: -40px;
    width: 180px; height: 180px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}
.fbt-header h1 { font-size: 1.5rem; font-weight: 900; letter-spacing: -0.5px; }
.fbt-header p { opacity: .85; font-size: .9rem; margin-top: 4px; }
.fbt-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    z-index: 1;
}
.fbt-header-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.fbt-hstat { text-align: center; }
.fbt-hstat-val { font-size: 1.2rem; font-weight: 800; }
.fbt-hstat-lab { font-size: .7rem; opacity: .75; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ── Tabs ── */
.fbt-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.fbt-tab {
    padding: 9px 18px;
    border-radius: 50px;
    border: 2px solid #e4e8f5;
    background: #fff;
    color: #7b8299;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    transition: all .2s ease;
    font-family: 'Nunito', sans-serif;
}
.fbt-tab:hover { border-color: #4361ee; color: #4361ee; }
.fbt-tab.active { background: #4361ee; color: #fff; border-color: #4361ee; }

/* ── Card ── */
.fbt-card {
    background: #fff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 4px 24px rgba(67,97,238,.10);
    margin-bottom: 14px;
}
.fbt-card h3 {
    font-size: .98rem;
    font-weight: 800;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Loader ── */
.fbt-loader {
    text-align: center;
    padding: 40px;
    color: #7b8299;
    font-weight: 700;
    font-size: 1rem;
}

/* ── Alerts ── */
.fbt-alert {
    border-radius: 12px;
    padding: 13px 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: .9rem;
    animation: fbt-slide .3s ease;
}
@keyframes fbt-slide {
    from { transform: translateY(-6px); opacity: 0; }
    to { transform: none; opacity: 1; }
}
.fbt-alert.green  { background: #d8fff4; color: #037a5e; border: 1.5px solid #06d6a0; }
.fbt-alert.yellow { background: #fff8e1; color: #a07000; border: 1.5px solid #ffd166; }
.fbt-alert.red    { background: #ffe8ed; color: #b5103a; border: 1.5px solid #ef476f; }

/* ── Half-cycle cards ── */
.fbt-halves {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
@media (max-width: 640px) { .fbt-halves { grid-template-columns: 1fr; } }

.fbt-half {
    border-radius: 16px;
    padding: 18px;
    border: 2px solid #e4e8f5;
}
.fbt-half.h1 { background: linear-gradient(135deg, #f0f4ff, #e8ecff); border-color: rgba(67,97,238,.2); }
.fbt-half.h2 { background: linear-gradient(135deg, #fff0f8, #ffe8f5); border-color: rgba(247,37,133,.2); }
.fbt-half-title { font-weight: 900; font-size: 1rem; }
.fbt-half-dates { font-size: .76rem; color: #7b8299; margin: 2px 0 10px; font-weight: 600; }

.fbt-progress {
    height: 10px;
    border-radius: 10px;
    background: #e4e8f5;
    overflow: hidden;
    margin: 8px 0;
}
.fbt-progress-fill {
    height: 100%;
    border-radius: 10px;
    transition: width .6s ease;
}
.fbt-progress-fill.safe { background: linear-gradient(90deg, #06d6a0, #4cc9f0); }
.fbt-progress-fill.warn { background: linear-gradient(90deg, #ffd166, #ff9f1c); }
.fbt-progress-fill.over { background: linear-gradient(90deg, #ef476f, #f72585); }

.fbt-half-meta {
    display: flex;
    justify-content: space-between;
    font-size: .8rem;
    margin-top: 4px;
}
.fbt-half-meta .spent { font-weight: 800; }
.fbt-half-meta .of   { color: #7b8299; }

/* ── Summary / chart ── */
.fbt-summary {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 20px;
    align-items: center;
}
@media (max-width: 560px) { .fbt-summary { grid-template-columns: 1fr; } }
.fbt-chart-wrap {
    width: 160px;
    height: 160px;
    margin: 0 auto;
    position: relative;
}
.fbt-savings-box {
    border-radius: 14px;
    padding: 18px;
    background: linear-gradient(135deg, #06d6a0, #4cc9f0);
    color: #fff;
    text-align: center;
    margin-bottom: 12px;
}
.fbt-savings-box.over {
    background: linear-gradient(135deg, #ef476f, #f72585);
}
.fbt-savings-box .big { font-size: 1.8rem; font-weight: 900; }
.fbt-savings-box .lab { font-size: .8rem; opacity: .9; margin-top: 2px; }

.fbt-cat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.fbt-cat-pill {
    padding: 5px 11px;
    border-radius: 50px;
    font-size: .76rem;
    font-weight: 700;
    background: #eef0ff;
    color: #4361ee;
}

/* ── Expense list ── */
.fbt-exp-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.fbt-exp-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 12px;
    background: #f7f9ff;
    border: 1.5px solid #e4e8f5;
    transition: .2s;
}
.fbt-exp-item:hover { border-color: #4361ee; }
.fbt-exp-item.fixed { border-left: 4px solid #4361ee; }

.fbt-chk {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    border: 2px solid #d0d5e8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #fff;
    font-size: .85rem;
    color: #fff;
    transition: .15s;
    user-select: none;
}
.fbt-chk:hover { border-color: #4361ee; }
.fbt-chk.on {
    background: #06d6a0;
    border-color: #06d6a0;
}

.fbt-exp-info { flex: 1; min-width: 0; }
.fbt-exp-label {
    font-weight: 700;
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fbt-exp-meta {
    font-size: .73rem;
    color: #7b8299;
    margin-top: 2px;
}
.fbt-exp-amt {
    font-weight: 800;
    font-size: .92rem;
    white-space: nowrap;
    color: #4361ee;
}
.fbt-del {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #b0b6cc;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 800;
    white-space: nowrap;
    transition: .2s;
    flex-shrink: 0;
}
.fbt-del:hover { background: #ffe8ed; color: #ef476f; }

/* ── Forms ── */
.fbt-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 540px) { .fbt-grid { grid-template-columns: 1fr; } }
.fbt-grid .full { grid-column: 1 / -1; }

.fbt-label {
    font-size: .75rem;
    font-weight: 800;
    color: #7b8299;
    margin-bottom: 5px;
    display: block;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.fbt-input, .fbt-select {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    border: 2px solid #e4e8f5;
    font-family: 'Nunito', sans-serif;
    font-size: .92rem;
    font-weight: 600;
    color: #1a1d2e;
    background: #fff;
    transition: .2s;
    outline: none;
}
.fbt-input:focus, .fbt-select:focus {
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67,97,238,.15);
}

.fbt-btn {
    padding: 11px 22px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: .88rem;
    transition: .2s;
}
.fbt-btn:hover { transform: translateY(-1px); }
.fbt-btn.pri { background: #4361ee; color: #fff; }
.fbt-btn.pri:hover { background: #3251d3; }
.fbt-btn.suc { background: #06d6a0; color: #fff; }
.fbt-btn.suc:hover { background: #05b888; }
.fbt-btn.out { background: transparent; color: #4361ee; border: 2px solid #4361ee; }
.fbt-btn.out:hover { background: #eef0ff; }
.fbt-btn.danger { background: #ef476f; color: #fff; }
.fbt-btn.sm { padding: 7px 14px; font-size: .8rem; border-radius: 8px; }

/* ── Fixed bills ── */
.fbt-fixed-list { display: flex; flex-direction: column; gap: 8px; }
.fbt-fixed-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 14px;
    border-radius: 12px;
    background: #f0f4ff;
    border: 2px solid transparent;
    transition: .2s;
}
.fbt-fixed-item.paid {
    background: #d8fff4;
    border-color: rgba(6,214,160,.3);
}
.fbt-fbadge {
    font-size: .7rem;
    padding: 3px 10px;
    border-radius: 50px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.fbt-fbadge.pending { background: #4361ee; color: #fff; }
.fbt-fbadge.paid    { background: #06d6a0; color: #fff; }

/* ── History ── */
.fbt-hist-list { display: flex; flex-direction: column; gap: 7px; }
.fbt-hist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 16px;
    border-radius: 12px;
    background: #f7f9ff;
    border: 1.5px solid #e4e8f5;
    cursor: pointer;
    transition: .2s;
}
.fbt-hist-item:hover { border-color: #4361ee; }
.fbt-hist-item.current { border-color: #4361ee; background: #eef0ff; }
.fbt-hist-status {
    font-size: .72rem;
    padding: 3px 11px;
    border-radius: 50px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.fbt-hist-status.active { background: #d8fff4; color: #037a5e; }
.fbt-hist-status.completed { background: #eef0ff; color: #4361ee; }

/* ── Section divider ── */
.fbt-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 10px;
}
.fbt-divider span {
    font-size: .75rem;
    font-weight: 800;
    color: #7b8299;
    text-transform: uppercase;
    letter-spacing: .8px;
    white-space: nowrap;
}
.fbt-divider::before, .fbt-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e4e8f5;
}

/* ── Helpers ── */
.fbt-helper {
    font-size: .75rem;
    color: #7b8299;
    margin-top: 4px;
    line-height: 1.4;
}
.fbt-empty {
    text-align: center;
    color: #7b8299;
    padding: 30px 20px;
    font-size: .9rem;
}
.fbt-no-cycle {
    text-align: center;
    padding: 40px 20px;
}
.fbt-no-cycle .ico { font-size: 3rem; margin-bottom: 12px; }
.fbt-no-cycle h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; justify-content: center; }
.fbt-no-cycle p { color: #7b8299; font-size: .9rem; margin-bottom: 18px; }

/* ── Settings rows ── */
.fbt-set-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.fbt-set-row .fbt-input, .fbt-set-row .fbt-select { flex: 1; min-width: 0; }
.fbt-set-row .label-col { flex: 2; }

.fbt-totals-box {
    margin-top: 14px;
    padding: 13px 16px;
    border-radius: 12px;
    background: #eef0ff;
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.6;
}

/* ── Editable expenses ── */
.fbt-edit {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #7b8299;
    cursor: pointer;
    font-size: .85rem;
    font-weight: 800;
    white-space: nowrap;
    transition: .2s;
    flex-shrink: 0;
}
.fbt-edit:hover { background: #eef0ff; color: #4361ee; }
.fbt-exp-edit {
    padding: 14px;
    border-radius: 14px;
    border: 2px solid #4361ee;
    background: #fafbff;
}
.fbt-edit-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.fbt-edit-actions label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
}

/* ── Cycle monthly summary table ── */
.fbt-cycle-summary-card { margin-top: 14px; }
.fbt-cycle-month {
    font-weight: 800;
    color: #4361ee;
    background: #eef0ff;
    border-radius: 10px;
    padding: 9px 12px;
    margin-bottom: 12px;
    display: inline-block;
}
.fbt-summary-table-wrap { overflow-x: auto; }
.fbt-summary-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
    font-size: .86rem;
}
.fbt-summary-table th,
.fbt-summary-table td {
    padding: 12px 14px;
    border: 1.5px solid #e4e8f5;
    text-align: right;
}
.fbt-summary-table th:first-child,
.fbt-summary-table td:first-child {
    text-align: left;
    font-weight: 900;
    color: #1a1d2e;
}
.fbt-summary-table th {
    background: #f7f9ff;
    font-weight: 900;
    color: #4361ee;
}
.fbt-summary-table th span {
    font-size: .72rem;
    color: #7b8299;
    font-weight: 700;
}
.fbt-summary-table td { font-weight: 800; }
.fbt-summary-table .pos { color: #037a5e; }
.fbt-summary-table .neg { color: #b5103a; }

/* ── Monthly Reports ── */
.fbt-report-card .fbt-cycle-summary-card {
    box-shadow: none;
    padding: 0;
    margin-top: 14px;
    margin-bottom: 18px;
}
.fbt-report-title {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    background: #eef0ff;
    color: #4361ee;
    font-weight: 900;
    margin-bottom: 14px;
}
.fbt-report-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
@media (max-width: 760px) { .fbt-report-kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .fbt-report-kpis { grid-template-columns: 1fr; } }
.fbt-report-kpis div {
    padding: 13px 14px;
    border-radius: 13px;
    background: #f7f9ff;
    border: 1.5px solid #e4e8f5;
}
.fbt-report-kpis span {
    display: block;
    color: #7b8299;
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .4px;
    margin-bottom: 4px;
}
.fbt-report-kpis strong {
    display: block;
    font-size: .98rem;
    font-weight: 900;
    color: #1a1d2e;
}
.fbt-report-kpis .pos { color: #037a5e; }
.fbt-report-kpis .neg { color: #b5103a; }
.fbt-report-chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 14px;
}
.fbt-report-chart-wrap {
    padding-top: 4px;
}
.fbt-report-chart-wrap h3 {
    margin-bottom: 4px;
}
.fbt-bar-wrap {
    width: 100%;
    height: 280px;
    border-radius: 14px;
    background: #fafbff;
    border: 1.5px solid #e4e8f5;
    padding: 14px;
}
.fbt-bar-wrap.compact {
    height: 240px;
    margin-top: 10px;
}
@media (max-width: 820px) {
    .fbt-report-chart-grid {
        grid-template-columns: 1fr;
    }
}

.fbt-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

/* ── Custom Login / Register ── */
.fbt-auth-wrap {
    max-width: 460px;
    margin: 32px auto;
    padding: 16px;
}
.fbt-auth-card {
    background: #fff;
    border: 1.5px solid #e4e8f5;
    border-radius: 24px;
    box-shadow: 0 18px 50px rgba(31, 41, 55, .12);
    padding: 24px;
}
.fbt-auth-brand { text-align: center; margin-bottom: 18px; }
.fbt-auth-icon {
    width: 58px;
    height: 58px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: #eef0ff;
    margin-bottom: 10px;
}
.fbt-auth-brand h1 { margin: 0; font-size: 1.55rem; color: #1a1d2e; }
.fbt-auth-brand p { margin: 8px 0 0; color: #7b8299; font-weight: 700; }
.fbt-auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 6px;
    border-radius: 16px;
    background: #f7f9ff;
    margin-bottom: 18px;
}
.fbt-auth-tabs button {
    border: 0;
    background: transparent;
    border-radius: 12px;
    padding: 10px;
    font-weight: 900;
    cursor: pointer;
    color: #7b8299;
}
.fbt-auth-tabs button.active {
    background: #fff;
    color: #4361ee;
    box-shadow: 0 8px 18px rgba(67, 97, 238, .12);
}
.fbt-auth-form { display: grid; gap: 9px; }
.fbt-auth-form label { font-size: .82rem; font-weight: 900; color: #33384d; margin-top: 3px; }
.fbt-auth-note { color: #7b8299; font-size: .82rem; font-weight: 700; margin: 6px 0 0; text-align: center; }
.full-btn { width: 100%; justify-content: center; margin-top: 8px; }
.fbt-header-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.fbt-logout {
    border: 1.5px solid rgba(255,255,255,.45);
    background: rgba(255,255,255,.18);
    color: #fff;
    border-radius: 999px;
    padding: 9px 14px;
    font-weight: 900;
    cursor: pointer;
}
.fbt-logout:hover { background: rgba(255,255,255,.28); }
@media (max-width: 720px) {
    .fbt-header-right { justify-content: flex-start; width: 100%; }
    .fbt-logout { margin-top: 4px; }
}

.fbt-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.fbt-password-wrap .fbt-input {
    width: 100%;
    padding-right: 72px;
}
.fbt-pass-toggle {
    position: absolute;
    right: 8px;
    border: 0;
    background: #eef0ff;
    color: #4361ee;
    font-weight: 900;
    border-radius: 10px;
    padding: 7px 10px;
    cursor: pointer;
}
.fbt-pass-toggle:hover { background: #e2e7ff; }

/* ── Due date reminders ── */
.fbt-reminder-card {
    border: 1.5px solid #ffd166;
    background: linear-gradient(135deg, #fffaf0, #ffffff);
}
.fbt-reminder-list {
    display: grid;
    gap: 8px;
}
.fbt-reminder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e9edf7;
}
.fbt-reminder-item strong {
    display: block;
    font-size: .9rem;
    color: #20233a;
}
.fbt-reminder-item span {
    display: block;
    margin-top: 2px;
    font-size: .75rem;
    color: #7b8299;
    font-weight: 700;
}
.fbt-reminder-item b {
    font-size: .75rem;
    white-space: nowrap;
    padding: 5px 8px;
    border-radius: 999px;
}
.fbt-reminder-item.soon b { background: #eef0ff; color: #4361ee; }
.fbt-reminder-item.today b { background: #fff3cd; color: #a07000; }
.fbt-reminder-item.overdue b { background: #ffe8ee; color: #b5103a; }
.fbt-set-row .due-col { max-width: 110px; }
@media (max-width: 640px) {
    .fbt-set-row { flex-wrap: wrap; }
    .fbt-set-row .due-col { max-width: none; }
    .fbt-reminder-item { align-items: flex-start; flex-direction: column; }
}

/* ── Profile + password reset updates ── */
.fbt-link-btn {
    border: 0;
    background: transparent;
    color: #4361ee;
    font-weight: 900;
    cursor: pointer;
    margin: 10px auto 0;
    display: block;
    padding: 6px 8px;
}
.fbt-link-btn:hover { text-decoration: underline; }
.fbt-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.fbt-profile-grid > div:last-child { grid-column: 1 / -1; }
.fbt-label-mini {
    display: block;
    font-size: .78rem;
    font-weight: 900;
    color: #586079;
    margin-bottom: 6px;
}
.fbt-pass-toggle {
    min-width: 38px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}
.fbt-password-wrap .fbt-input { padding-right: 54px; }
@media (max-width: 720px) {
    .fbt-profile-grid { grid-template-columns: 1fr; }
}

.fbt-live-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 10px;
  border-radius:999px;
  background:#fff1f4;
  color:#b5103a;
  font-size:.76rem;
  font-weight:800;
  border:1px solid #ffd4dd;
}

/* ── Family member settings rows ── */
.fbt-member-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.fbt-member-row .member-name-col {
    flex: 1;
    min-width: 0;
}
@media (max-width: 560px) {
    .fbt-member-row {
        flex-wrap: wrap;
    }
    .fbt-member-row .fbt-btn {
        width: 100%;
    }
}
