/* ------------------------------------------------------------------ */
/* Variables                                                           */
/* ------------------------------------------------------------------ */

:root {
    --ink: #0a0a0a;
    --ink-soft: #2a2a2a;
    --ink-muted: #666666;
    --ink-faint: #999999;
    --paper: #f5f4f1;
    --paper-warm: #edeae2;
    --paper-card: #ffffff;
    --accent: #1a472a;
    --accent-hover: #15391f;
    --accent-light: #e6ede8;
    --accent-2: #b87320;
    --accent-2-light: #fdf0e0;
    --accent-3: #4a6fa5;
    --accent-4: #7b5ea7;
    --accent-5: #c0392b;
    --danger: #c0392b;
    --danger-light: #fdecea;
    --border: #e0ddd6;
    --border-soft: #eae7e0;

    --font: Helvetica, Arial, sans-serif;
    --font-display: Helvetica, Arial, sans-serif;
    --font-body: Helvetica, Arial, sans-serif;

    --max-width: 1200px;
    --auth-width: 420px;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;

    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 48px rgba(0,0,0,0.10), 0 4px 16px rgba(0,0,0,0.06);
}

/* ------------------------------------------------------------------ */
/* Reset                                                               */
/* ------------------------------------------------------------------ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ------------------------------------------------------------------ */
/* Navbar                                                              */
/* ------------------------------------------------------------------ */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(245, 244, 241, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
}

.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.brand-icon {
    color: var(--accent);
    font-size: 1.2rem;
}

.brand-name { color: var(--ink); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Regular nav links */
.nav-link {
    color: var(--ink-muted);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
    position: relative;
}
.nav-links a { color: var(--ink-muted); padding: 0.4rem 0.75rem; border-radius: var(--radius-sm); transition: color 0.15s, background 0.15s; }
.nav-links a:hover, .nav-link:hover { color: var(--ink); background: var(--paper-warm); }

/* Active nav link — green underline */
.nav-link--active {
    color: var(--ink) !important;
    font-weight: 700;
    background: transparent !important;
}
.nav-link--active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0.75rem;
    right: 0.75rem;
    height: 2px;
    background: var(--accent);
    border-radius: 999px;
}

/* Three-dot menu */
.nav-dots-wrap { position: relative; }

.nav-dots-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.nav-dots-btn:hover { border-color: var(--ink-muted); color: var(--ink); background: var(--paper-warm); }
.nav-dots--open .nav-dots-btn { border-color: var(--accent); color: var(--accent); }

.nav-dots-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 0.5rem;
    display: none;
    z-index: 200;
}
.nav-dots--open .nav-dots-panel { display: block; }

.nav-dots-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.nav-dots-item:hover { background: var(--paper-warm); }

.nav-dots-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid var(--border);
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent);
}
.nav-dots-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-dots-avatar span { color: #fff; font-size: 0.85rem; font-weight: 700; }

.nav-dots-info { overflow: hidden; }
.nav-dots-name  { font-size: 0.875rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-dots-email { font-size: 0.75rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-dots-divider { height: 1px; background: var(--border-soft); margin: 0.35rem 0; }

.nav-dots-link {
    display: block;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--ink-soft);
    border-radius: var(--radius-sm);
    transition: background 0.12s;
}
.nav-dots-link:hover { background: var(--paper-warm); color: var(--ink); }

.nav-cta {
    background: var(--ink) !important;
    color: var(--paper) !important;
    padding: 0.45rem 1.1rem !important;
    border-radius: var(--radius-sm) !important;
    transition: background 0.2s !important;
}
.nav-cta:hover { background: var(--accent) !important; color: var(--paper) !important; }

/* ------------------------------------------------------------------ */
/* Main                                                                */
/* ------------------------------------------------------------------ */

.main-content { min-height: calc(100vh - 62px - 110px); }

/* ------------------------------------------------------------------ */
/* Hero                                                                */
/* ------------------------------------------------------------------ */

.hero {
    padding: 4.5rem 2rem 4rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.hero-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    align-items: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(26, 71, 42, 0.15);
}

.hero-title {
    font-size: clamp(2.6rem, 5vw, 3.75rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.035em;
    color: var(--ink);
    margin-bottom: 1.25rem;
}
.hero-title em { font-style: normal; color: var(--accent); }

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--ink-muted);
    line-height: 1.75;
    max-width: 430px;
    margin-bottom: 2.25rem;
    font-weight: 400;
}

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

/* ------------------------------------------------------------------ */
/* Mock card                                                           */
/* ------------------------------------------------------------------ */

.hero-visual { display: flex; justify-content: center; align-items: flex-start; }

.mock-card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.mock-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-soft);
}

.mock-period {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
}
.mock-period svg { color: var(--ink-muted); }

.mock-header-stats { display: flex; align-items: flex-start; gap: 0.875rem; }

.mock-total-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.2rem;
    text-align: right;
}

.mock-total {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
    line-height: 1;
    text-align: right;
}

.mock-change {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    line-height: 1.2;
    white-space: nowrap;
}
.mock-change svg { margin-bottom: 1px; }
.mock-change-sub { font-size: 0.65rem; font-weight: 500; color: var(--ink-muted); }

/* Chart + bars layout */
.mock-chart-area {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* CSS donut chart */
.mock-donut-wrap { flex-shrink: 0; }

.mock-donut {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: conic-gradient(
        #1a472a   0deg   148deg,
        #e67e22 148deg   231deg,
        #2980b9 231deg   278deg,
        #8e44ad 278deg   321deg,
        #c0392b 321deg   360deg
    );
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mock-donut::before {
    content: '';
    position: absolute;
    inset: 28px;
    background: var(--paper-card);
    border-radius: 50%;
}

.mock-donut-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}
.mock-donut-total {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.mock-donut-sub {
    font-size: 0.65rem;
    color: var(--ink-faint);
    font-weight: 500;
}

/* Bars */
.mock-bars { display: flex; flex-direction: column; gap: 0.6rem; flex: 1; min-width: 0; }

.mock-bar-row {
    display: grid;
    grid-template-columns: 8px 64px 1fr 44px 28px;
    align-items: center;
    gap: 0.5rem;
}

.mock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mock-cat {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink-soft);
    white-space: nowrap;
}

.mock-bar-track {
    height: 5px;
    background: var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
}
.mock-bar {
    height: 100%;
    border-radius: 999px;
}

.mock-amt {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ink-muted);
    text-align: right;
    white-space: nowrap;
}

.mock-pct {
    font-size: 0.7rem;
    color: var(--ink-faint);
    text-align: right;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--ink);
    color: var(--paper);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
    letter-spacing: -0.01em;
}
.btn-primary:hover { background: var(--accent); transform: translateY(-1px); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    color: var(--ink-soft);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    transition: all 0.2s;
    text-decoration: none;
    letter-spacing: -0.01em;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); background: var(--paper-warm); }

/* ------------------------------------------------------------------ */
/* Features section                                                    */
/* ------------------------------------------------------------------ */

.features {
    background: var(--paper-warm);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 3.5rem 2rem;
}

.features-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.feature-card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 1.1rem;
    align-items: flex-start;
    transition: box-shadow 0.2s, transform 0.2s;
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-card:nth-child(2) { border-top-color: var(--accent-2); }
.feature-card:nth-child(3) { border-top-color: var(--accent-3); }

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.feature-icon--green { background: var(--accent-light); color: var(--accent); }
.feature-icon--orange { background: var(--accent-2-light); color: var(--accent-2); }
.feature-icon--blue { background: #e8edf5; color: var(--accent-3); }

.feature-text { flex: 1; }

.feature-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.45rem;
    letter-spacing: -0.02em;
}

.feature-body { font-size: 0.875rem; color: var(--ink-muted); line-height: 1.7; }

/* ------------------------------------------------------------------ */
/* CTA banner                                                          */
/* ------------------------------------------------------------------ */

.cta-section {
    position: relative;
    max-width: var(--max-width);
    margin: 3rem auto 3.5rem;
    padding: 0 2rem;
    overflow: hidden;
}

.cta-inner {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: var(--accent-light);
    border: 1px solid rgba(26,71,42,0.15);
    border-radius: var(--radius-lg);
    padding: 2.75rem 3rem;
    position: relative;
    overflow: hidden;
}

/* Leaf decorations */
.cta-leaf {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    opacity: 0.4;
    z-index: 1;
}
.cta-leaf--left  { left: 0; }
.cta-leaf--right { right: 0; transform: translateY(-50%) scaleX(-1); }

.cta-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cta-content { flex: 1; }

.cta-title {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 0.4rem;
    letter-spacing: -0.03em;
}

.cta-body {
    font-size: 0.95rem;
    color: var(--ink-muted);
    line-height: 1.6;
}

.cta-action { flex-shrink: 0; text-align: center; }

.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--accent);
    color: #fff;
    padding: 0.8rem 1.6rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}
.btn-cta:hover { background: var(--accent-hover); transform: translateY(-1px); }

.cta-fine {
    font-size: 0.75rem;
    color: var(--ink-muted);
    margin-top: 0.6rem;
    text-align: center;
}

/* ------------------------------------------------------------------ */
/* Flash messages                                                      */
/* ------------------------------------------------------------------ */

.flash-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flash {
    padding: 0.75rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.flash--success {
    background: #e6f4ea;
    color: #1a6b31;
    border: 1px solid #b7dfc2;
}

.flash--info {
    background: #e8f0fb;
    color: #1a4a8a;
    border: 1px solid #b8cff5;
}

.flash--error,
.flash--danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #f5c6c2;
}

/* ------------------------------------------------------------------ */
/* Dashboard                                                           */
/* ------------------------------------------------------------------ */

.dashboard {
    padding: 3rem 2rem 5rem;
}

.dashboard-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.dashboard-greeting {
    font-size: 0.85rem;
    color: var(--ink-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.2rem;
}

.dashboard-name {
    font-size: 2rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-sm);
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    margin-bottom: 0.6rem;
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
}

.stat-value--muted {
    color: var(--ink-faint);
    font-weight: 400;
}

.stat-card--owe  { border-top: 3px solid var(--danger); }
.stat-card--owed { border-top: 3px solid var(--accent); }
.stat-card--owe  .stat-value { color: var(--danger); }
.stat-card--owed .stat-value { color: var(--accent); }

.dashboard-empty {
    background: var(--paper-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 2rem;
    text-align: center;
}

.empty-icon {
    font-size: 2.5rem;
    color: var(--ink-faint);
    margin-bottom: 1.25rem;
}

.empty-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.empty-body {
    font-size: 0.95rem;
    color: var(--ink-muted);
    margin-bottom: 1.75rem;
}

@media (max-width: 1100px) {
    .dashboard-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .dashboard-stats { grid-template-columns: 1fr 1fr; }
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

@media (max-width: 600px) {
    .dashboard-stats { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Auth pages                                                          */
/* ------------------------------------------------------------------ */

.auth-section {
    min-height: calc(100vh - 62px - 110px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    background: radial-gradient(ellipse at 50% 0%, var(--accent-light) 0%, transparent 65%);
}

.auth-container {
    width: 100%;
    max-width: var(--auth-width);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-title {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 0.35rem;
    letter-spacing: -0.03em;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--ink-muted);
}

.auth-card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 2.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
}

.auth-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #f5c6c2;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
}

.form-group { margin-bottom: 1.1rem; }

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-soft);
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

.form-input {
    width: 100%;
    padding: 0.65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--paper);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
}

.form-input::placeholder { color: var(--ink-faint); }

/* Date input wrapper */
.date-input-wrap {
    position: relative;
}
.date-input-wrap .date-icon {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--ink-faint);
}
input[type="date"].form-input {
    cursor: pointer;
    color-scheme: light;
    appearance: none;
    -webkit-appearance: none;
    font-family: var(--font);
    font-size: 0.95rem;
    color: var(--ink);
    padding-right: 2.5rem; /* room for our icon */
}
input[type="date"].form-input::-webkit-calendar-picker-indicator {
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: 2.5rem;
    height: 100%;
    cursor: pointer;
}
input[type="date"].form-input::-webkit-datetime-edit-fields-wrapper { padding: 0; }
input[type="date"].form-input::-webkit-datetime-edit { color: var(--ink); }

/* Split info tooltip */
.split-label-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.split-info {
    position: relative;
    display: inline-flex;
    color: var(--ink-faint);
    cursor: default;
}
.split-info:hover { color: var(--ink-muted); }
.split-info-tip {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--paper);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: nowrap;
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-sm);
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.split-info-tip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--ink);
}
.split-info:hover .split-info-tip { display: block; }

/* Paid-by toggle */
.paid-by-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.paid-toggle-group {
    display: flex;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
}
.paid-toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    background: var(--paper);
    border: none;
    font-family: var(--font);
    font-size: 0.875rem;
    color: var(--ink-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border-right: 1.5px solid var(--border);
}
.paid-toggle-btn:last-child { border-right: none; }
.paid-toggle-btn:hover { background: var(--paper-warm); color: var(--ink); }
.paid-toggle-btn--active {
    background: var(--accent);
    color: white;
}
.paid-toggle-btn--active:hover { background: var(--accent-hover); color: white; }
.paid-payer-field {
    flex: 1;
    min-width: 200px;
}
.paid-payer-field .form-input { margin: 0; }

/* Password show/hide wrapper */
.input-wrap {
    position: relative;
}

.input-wrap .form-input.has-toggle {
    padding-right: 2.8rem;
}

.pw-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--ink-faint);
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.pw-toggle:hover { color: var(--ink-muted); }

/* Password strength bar */
.pw-strength-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.pw-strength-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 100px;
    overflow: hidden;
}

.pw-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 100px;
    transition: width 0.25s, background 0.25s;
}

.pw-strength-label {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 56px;
    text-align: right;
}

/* Field hints (confirm password match) */
.field-hint {
    font-size: 0.78rem;
    margin-top: 0.35rem;
    min-height: 1.1em;
}

.field-hint--ok  { color: #1a7a3c; }
.field-hint--err { color: var(--accent-5); }

/* Google OAuth button */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--paper-card);
    color: var(--ink-soft);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    letter-spacing: -0.01em;
    margin-bottom: 1rem;
}
.btn-google:hover {
    border-color: #4285F4;
    background: #f8faff;
    box-shadow: 0 0 0 3px rgba(66,133,244,0.1);
}

/* Divider between OAuth and email form */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    color: var(--ink-faint);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-submit {
    width: 100%;
    padding: 0.75rem;
    background: var(--ink);
    color: var(--paper);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin-top: 0.5rem;
    letter-spacing: -0.01em;
}

.btn-submit:hover {
    background: var(--accent);
    transform: translateY(-1px);
}

.auth-switch {
    text-align: center;
    font-size: 0.875rem;
    color: var(--ink-muted);
}

.auth-switch a {
    color: var(--accent);
    font-weight: 700;
}

.auth-switch a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ */
/* Footer                                                              */
/* ------------------------------------------------------------------ */

.footer {
    background: var(--ink);
    color: var(--paper);
    padding: 2.75rem 2rem 0;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.footer-brand-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer .brand-icon { color: var(--accent-2); font-size: 1.4rem; }

.footer-name {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.footer-tagline {
    font-size: 0.8rem;
    color: var(--ink-faint);
    margin: 0;
}

.footer-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-nav-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    margin: 0;
}

/* ------------------------------------------------------------------ */
/* Footer links                                                        */
/* ------------------------------------------------------------------ */

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.footer-links a {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: var(--ink-faint);
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--paper);
}

/* ------------------------------------------------------------------ */
/* Footer bottom bar                                                   */
/* ------------------------------------------------------------------ */

.footer-bottom {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 0 2rem;
    gap: 1rem;
}

.footer-copy {
    font-size: 0.78rem;
    color: var(--ink-faint);
    margin: 0;
}

.footer-credit {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--ink-faint);
    margin: 0;
}

.footer-creator-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--paper);
    font-weight: 500;
    transition: color 0.2s;
}

.footer-creator-link:hover {
    color: var(--accent-2);
}

/* ------------------------------------------------------------------ */
/* Legal pages (Terms & Privacy)                                       */
/* ------------------------------------------------------------------ */

.legal-page {
    padding: 3.5rem 2rem 6rem;
    max-width: 1060px;
    margin: 0 auto;
}

/* Header */
.legal-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 3rem;
}

.legal-header-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--accent-light);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.legal-title {
    font-size: clamp(1.75rem, 3.5vw, 2.4rem);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
    margin: 0 0 0.4rem;
    line-height: 1.1;
}

.legal-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-muted);
    background: var(--paper-warm);
    border: 1px solid var(--border-soft);
    border-radius: 100px;
    padding: 0.2rem 0.75rem;
    letter-spacing: 0.01em;
}

/* Two-column layout */
.legal-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 3rem;
    align-items: start;
}

/* TOC sidebar */
.legal-toc {
    position: sticky;
    top: 5rem;
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.legal-toc-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink-faint);
    margin: 0 0 1rem;
}

.legal-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    counter-reset: toc-counter;
}

.legal-toc-list li {
    counter-increment: toc-counter;
}

.legal-toc-list a {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--ink-muted);
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
    line-height: 1.4;
}

.legal-toc-list a::before {
    content: counter(toc-counter, decimal-leading-zero);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--ink-faint);
    flex-shrink: 0;
}

.legal-toc-list a:hover {
    background: var(--accent-light);
    color: var(--accent);
}

/* Main content */
.legal-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.legal-section {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-soft);
}

.legal-section:first-child { padding-top: 0; }

.legal-section-head {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 0.9rem;
}

.legal-num {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--accent-light);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    flex-shrink: 0;
}

.legal-section h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
    letter-spacing: -0.01em;
}

.legal-section p {
    font-size: 0.95rem;
    color: var(--ink-muted);
    line-height: 1.8;
    margin: 0;
}

.legal-section p + p { margin-top: 0.75rem; }

.legal-section ul {
    margin-top: 0.75rem;
    padding-left: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legal-section ul li {
    font-size: 0.95rem;
    color: var(--ink-muted);
    line-height: 1.7;
    padding-left: 1.2rem;
    position: relative;
}

.legal-section ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.65em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.5;
}

.legal-section a {
    color: var(--accent);
    font-weight: 600;
}

.legal-section a:hover { text-decoration: underline; }

/* Contact card */
.legal-contact-card {
    margin-top: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--accent-light);
    border: 1px solid rgba(26,71,42,0.15);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.75rem;
}

.legal-contact-icon {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legal-contact-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 0.2rem;
}

.legal-contact-body {
    font-size: 0.83rem;
    color: var(--ink-muted);
    margin: 0;
}

.legal-contact-btn {
    margin-left: auto;
    flex-shrink: 0;
    background: var(--accent);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    white-space: nowrap;
}

.legal-contact-btn:hover {
    background: var(--accent-hover);
    color: white;
}

/* ------------------------------------------------------------------ */
/* Expenses list page                                                  */
/* ------------------------------------------------------------------ */

.expenses-page { padding: 2.5rem 2rem 5rem; }

.expenses-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

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

.expenses-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
}

/* Summary strip */
.expenses-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.xstat {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.3rem;
    box-shadow: var(--shadow-sm);
}

.xstat--owe  { border-top: 3px solid var(--danger); }
.xstat--owed { border-top: 3px solid var(--accent); }

.xstat-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    margin-bottom: 0.4rem;
}

.xstat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
}

.xstat-value--sm { font-size: 1rem; font-weight: 700; }

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.filter-select {
    padding: 0.5rem 0.875rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-soft);
    background: var(--paper-card);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

.filter-select:focus { border-color: var(--accent); }

.filter-clear {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--ink-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
    transition: color 0.15s;
}

.filter-clear:hover { color: var(--danger); }

/* ------------------------------------------------------------------ */
/* Expenses table — clean, open design                                 */
/* ------------------------------------------------------------------ */

.sheet-wrap {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.sheet {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

/* Header */
.sheet thead tr {
    border-bottom: 1px solid var(--border);
}

.sheet th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    white-space: nowrap;
    background: transparent;
}

/* Rows */
.sheet-row {
    border-bottom: 1px solid var(--border-soft);
    transition: background 0.12s;
}
.sheet-row:last-child { border-bottom: none; }
.sheet-row:hover { background: #f9f8f5; }
.sheet-row:hover .icon-btn { opacity: 1; }

.sheet td {
    padding: 0.9rem 1rem;
    color: var(--ink-soft);
    vertical-align: middle;
}

/* Cell helpers */
.cell-muted  { color: var(--ink-faint); font-size: 0.825rem; }
.cell-bold   { display: block; font-weight: 600; color: var(--ink); line-height: 1.3; }
.cell-desc   { display: block; font-size: 0.78rem; color: var(--ink-faint); margin-top: 1px; }
.cell-date   { font-size: 0.82rem; color: var(--ink-muted); white-space: nowrap; }
.cell-num    { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* Column widths */
.col-date    { width: 105px; }
.col-title   { min-width: 160px; }
.col-cat     { width: 140px; }
.col-mode    { width: 100px; }
.col-amount  { width: 95px; }
.col-split   { width: 85px; }
.col-context { width: 115px; }
.col-actions { width: 72px; text-align: right; white-space: nowrap; }

/* Category dot */
.cat-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: 1px;
    background: var(--ink-faint);
    flex-shrink: 0;
}
.cat-dot--eating-out      { background: #e67e22; }
.cat-dot--grocery         { background: #27ae60; }
.cat-dot--transport       { background: #2980b9; }
.cat-dot--rent            { background: #8e44ad; }
.cat-dot--entertainment   { background: #e91e8c; }
.cat-dot--shopping        { background: #c0392b; }

/* Mode badge */
.mode-badge {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--paper-warm);
    color: var(--ink-muted);
    letter-spacing: 0.01em;
}

/* Owe / Owed pills */
.pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.pill--owe  { background: var(--danger-light); color: var(--danger); }
.pill--owed { background: var(--accent-light);  color: var(--accent); }

/* Icon action buttons */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s, background 0.12s, color 0.12s;
    color: var(--ink-muted);
    text-decoration: none;
}
.icon-btn--edit:hover  { background: var(--accent-light); color: var(--accent); }
.icon-btn--delete:hover { background: var(--danger-light); color: var(--danger); }

/* Table footer */
.sheet-footer {
    background: #fafaf8;
    border-top: 1px solid var(--border);
}
.sheet tfoot td { padding: 0.75rem 1rem; }

.footer-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.07em;
}
.footer-total {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--ink);
    text-align: right;
}

/* ------------------------------------------------------------------ */
/* Navbar avatar                                                       */
/* ------------------------------------------------------------------ */

.nav-avatar-wrap { display: flex; align-items: center; }

.nav-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
    transition: border-color 0.15s;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-avatar:hover { border-color: var(--accent); }

.nav-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
}

/* ------------------------------------------------------------------ */
/* Profile page                                                        */
/* ------------------------------------------------------------------ */

.profile-page { padding: 2.5rem 2rem 5rem; }

.profile-inner {
    max-width: 680px;
    margin: 0 auto;
}

.profile-header { margin-bottom: 2rem; }

.profile-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
}

/* Hero block */
.profile-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.75rem;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 1.6rem;
    font-weight: 800;
}

.profile-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.2rem;
}

.profile-email {
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin-bottom: 0.65rem;
}

.profile-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
}

.profile-badge--google {
    background: #e8f0fe;
    color: #1a73e8;
}

.profile-badge--pw {
    background: var(--accent-light);
    color: var(--accent);
}

/* Section cards */
.profile-sections {
    display: grid;
    gap: 1.25rem;
}

.profile-card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
}

.profile-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 1.1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-soft);
}

.profile-card-hint {
    font-size: 0.85rem;
    color: var(--ink-muted);
    margin-bottom: 1.1rem;
    line-height: 1.5;
}

.btn-submit-sm {
    padding: 0.55rem 1.25rem;
    background: var(--ink);
    color: var(--paper);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 0.25rem;
}

.btn-submit-sm:hover { background: var(--accent); }

/* ------------------------------------------------------------------ */
/* Add Expense form page                                               */
/* ------------------------------------------------------------------ */

.form-page { padding: 2.5rem 2rem 5rem; }

.form-page-inner {
    max-width: 720px;
    margin: 0 auto;
}

.form-page-breadcrumb {
    font-size: 0.82rem;
    color: var(--ink-muted);
    margin-bottom: 0.25rem;
}

.form-page-breadcrumb a {
    color: var(--accent);
    font-weight: 600;
}

.form-page-breadcrumb a:hover { text-decoration: underline; }

.form-page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.03em;
    margin-bottom: 2rem;
}

/* Form card wrapper */
.expense-form-card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-md);
}


/* ------------------------------------------------------------------ */
/* Custom select dropdown (cselect)                                    */
/* ------------------------------------------------------------------ */

.cselect { position: relative; }

.cselect-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: var(--paper-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.9rem;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cselect-trigger:focus,
.cselect--open .cselect-trigger {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 71, 42, 0.1);
    outline: none;
}

.cselect-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    overflow: hidden;
}

.cselect-preview-icon {
    color: var(--accent);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.cselect-preview-text {
    color: var(--ink-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cselect-preview-text--filled { color: var(--ink); }

.cselect-chevron {
    color: var(--ink-faint);
    flex-shrink: 0;
    transition: transform 0.2s;
}
.cselect--open .cselect-chevron { transform: rotate(180deg); }

/* Dropdown panel */
.cselect-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--paper-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 300;
    overflow: hidden;
}
.cselect--open .cselect-panel { display: block; }

.cselect-search {
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--font);
    font-size: 0.875rem;
    color: var(--ink);
    background: var(--paper-card);
    outline: none;
}
.cselect-search::placeholder { color: var(--ink-faint); }

.cselect-list {
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.35rem 0;
}

.cselect-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--ink-soft);
    transition: background 0.1s;
}
.cselect-option:hover { background: var(--paper-warm); color: var(--ink); }
.cselect-option--selected { color: var(--accent); font-weight: 600; }
.cselect-option--selected .cselect-option-check { opacity: 1; }

.cselect-option-icon {
    color: var(--accent);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    opacity: 0.8;
}
.cselect-option:hover .cselect-option-icon { opacity: 1; }

.cselect-option-label { flex: 1; }

.cselect-option-check {
    opacity: 0;
    color: var(--accent);
    flex-shrink: 0;
    transition: opacity 0.1s;
}

.expense-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 1.5rem;
}

.form-group--full { grid-column: 1 / -1; }

.req { color: var(--danger); margin-left: 1px; }

.split-hint {
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    color: var(--ink-faint);
}

.split-hint--owe  { color: var(--danger); }
.split-hint--owed { color: var(--accent); }

.expense-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-soft);
}

.expense-form-submit-group {
    display: flex;
    gap: 0.75rem;
}

.dashboard-actions { margin-top: 1.5rem; }

/* Dashboard section header (month title + link) */
.dashboard-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 2rem 0 0.875rem;
}

.dashboard-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.dashboard-section-link {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
}
.dashboard-section-link:hover { text-decoration: underline; }

/* Filter bar period selectors */
.filter-select--period {
    font-weight: 700;
    color: var(--ink);
}

.filter-divider {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 0.25rem;
    vertical-align: middle;
}

/* ------------------------------------------------------------------ */
/* Breakdown / Charts section                                          */
/* ------------------------------------------------------------------ */

.breakdown-section {
    margin-top: 2.5rem;
}

.breakdown-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.25rem;
}

.breakdown-card {
    background: var(--paper-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem 1.5rem;
}

.breakdown-card-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    margin-bottom: 1rem;
}

.chart-wrap {
    width: 100%;
    max-width: 180px;
    margin: 0 auto 1rem;
    aspect-ratio: 1;
}

/* Chart legend */
.breakdown-legend {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.legend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-label { flex: 1; }

.legend-value {
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.legend-pct {
    font-size: 0.72rem;
    color: var(--ink-faint);
    min-width: 36px;
    text-align: right;
}

/* Split summary card */
.breakdown-card--split { display: flex; flex-direction: column; }

.split-stat { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }

.split-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.split-stat-label { color: var(--ink-muted); font-weight: 500; }

.split-stat-value {
    font-weight: 700;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
}
.split-stat-value--owe  { color: var(--danger); }
.split-stat-value--owed { color: var(--accent); }

.split-stat-bar {
    display: flex;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: var(--paper-warm);
}
.split-stat-bar-owe  { background: var(--danger); transition: width 0.4s; }
.split-stat-bar-owed { background: var(--accent);  transition: width 0.4s; }

.split-stat-empty {
    font-size: 0.82rem;
    color: var(--ink-faint);
    text-align: center;
    margin-top: 1rem;
}

/* ------------------------------------------------------------------ */
/* Responsive — expenses                                               */
/* ------------------------------------------------------------------ */

@media (max-width: 1100px) {
    .expenses-summary { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 700px) {
    .expenses-summary { grid-template-columns: 1fr 1fr; }
    .sheet-wrap { overflow-x: auto; }
    .expense-form-grid { grid-template-columns: 1fr; }
    .form-group--full { grid-column: 1; }
    .expense-form-actions { flex-direction: column; gap: 1rem; align-items: stretch; }
    .expense-form-submit-group { flex-direction: column; }
    .breakdown-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Video Modal                                                         */
/* ------------------------------------------------------------------ */

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop.is-open { display: flex; }

.modal-box {
    position: relative;
    width: 100%;
    max-width: 820px;
    background: var(--ink);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 32px 100px rgba(0, 0, 0, 0.6);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    width: 2.1rem;
    height: 2.1rem;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover { background: rgba(255, 255, 255, 0.25); }

.modal-video-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
}

.modal-video-wrap iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

/* Tablet landscape / small desktop */
@media (max-width: 1024px) {
    .hero { padding: 3.5rem 2rem 3rem; }
    .hero-inner { gap: 3rem; }
    .mock-card { max-width: 360px; }
    .cta-inner { gap: 1.5rem; padding: 2.25rem 2rem; }
}

/* Tablet portrait */
@media (max-width: 900px) {
    .hero { padding: 3rem 2rem 2.5rem; }
    .hero-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2.5rem;
    }
    .hero-subtitle { max-width: 100%; }
    .hero-actions { justify-content: center; }
    .hero-visual { display: none; }

    .features { padding: 3rem 2rem; }
    .features-inner { grid-template-columns: 1fr 1fr; }

    .cta-section { margin: 2rem auto 2.5rem; }
    .cta-inner { flex-direction: column; text-align: center; gap: 1.5rem; padding: 2rem; }
    .cta-action { width: 100%; }
    .btn-cta { width: 100%; justify-content: center; }
    .cta-leaf { display: none; }
}

/* Mobile */
@media (max-width: 600px) {
    .nav-link { display: none; }
    .nav-cta { display: inline-flex; }

    .hero { padding: 2.5rem 1.25rem 2rem; }
    .hero-title { font-size: 2.4rem; }

    .features { padding: 2.5rem 1.25rem; }
    .features-inner { grid-template-columns: 1fr; }

    .cta-section { margin: 1.5rem auto 2rem; padding: 0 1.25rem; }
    .cta-inner { padding: 1.75rem 1.5rem; }
    .cta-icon { width: 48px; height: 48px; }

    .legal-layout { grid-template-columns: 1fr; }
    .legal-toc { position: static; }
    .legal-contact-card { flex-wrap: wrap; }
    .legal-contact-btn { margin-left: 0; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
    .footer-bottom { flex-direction: column; align-items: center; text-align: center; gap: 0.5rem; }
}
