/* ============================================================
   Hope's World Studio — Bookkeeping App
   styles.css — All styling, one file
   Palette: creamy white, warm rose, soft lavender, charcoal
   Font: Nunito (rounded, friendly, matches brand)
   ============================================================ */

/* ── IMPORTS ──────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;800&family=Nunito+Sans:wght@400;600&display=swap');

/* ── DESIGN TOKENS ────────────────────────────────────────── */
:root {
    /* Brand palette */
    --cream:          #fdf8f5;
    --cream-dark:     #f5ede6;
    --rose:           #e8a0b0;
    --rose-dark:      #d4788e;
    --rose-light:     #f5ccd7;
    --rose-pale:      #fce8ee;
    --lavender:       #c9b8d8;
    --lavender-light: #ede7f5;
    --lavender-dark:  #a590c0;
    --sage:           #b8d4c0;
    --sage-light:     #e4f0e7;
    --peach:          #f5c5a3;
    --peach-light:    #fde8d8;

    /* Text */
    --text-dark:      #2d2827;
    --text-mid:       #6b5c5a;
    --text-light:     #9e8c8a;
    --text-on-rose:   #fff;

    /* UI */
    --white:          #ffffff;
    --border:         #ecddd8;
    --border-light:   #f5edea;
    --shadow-sm:      0 1px 4px rgba(45,40,39,.07);
    --shadow-md:      0 4px 16px rgba(45,40,39,.10);
    --shadow-lg:      0 8px 32px rgba(45,40,39,.13);
    --radius-sm:      8px;
    --radius-md:      14px;
    --radius-lg:      20px;
    --radius-pill:    999px;

    /* Sidebar */
    --sidebar-w:      230px;
    --nav-h:          64px;

    /* Transitions */
    --ease:           cubic-bezier(.22,.68,0,1.2);
    --t-fast:         150ms;
    --t-med:          250ms;
}

/* ── RESET ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Nunito', sans-serif;
    background: var(--cream);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--rose-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── TYPOGRAPHY ───────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.4rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.1rem; font-weight: 700; }
h4 { font-size: .95rem; font-weight: 600; }
p  { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }
small { font-size: .8rem; color: var(--text-light); }

/* ── LOGIN PAGE ───────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--cream) 0%, var(--rose-pale) 50%, var(--lavender-light) 100%);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

/* Decorative blobs behind the card */
.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: .35;
}
.login-page::before {
    width: 420px; height: 420px;
    background: radial-gradient(circle, var(--rose-light), transparent 70%);
    top: -80px; right: -80px;
}
.login-page::after {
    width: 320px; height: 320px;
    background: radial-gradient(circle, var(--lavender-light), transparent 70%);
    bottom: -60px; left: -60px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2.75rem;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    border: 1px solid var(--border-light);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand .brand-icon {
    font-size: 2.8rem;
    display: block;
    margin-bottom: .5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

.login-brand h1 {
    font-size: 1.35rem;
    color: var(--text-dark);
    font-weight: 800;
    line-height: 1.2;
}

.login-brand .brand-sub {
    font-size: .85rem;
    color: var(--text-light);
    margin-top: .2rem;
    font-weight: 500;
}

/* ── FORMS ────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-mid);
    margin-bottom: .35rem;
}

.form-control {
    width: 100%;
    padding: .65rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .95rem;
    color: var(--text-dark);
    background: var(--cream);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--rose);
    box-shadow: 0 0 0 3px var(--rose-pale);
    background: var(--white);
}

.form-control::placeholder { color: var(--text-light); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239e8c8a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: .78rem;
    color: var(--text-light);
    margin-top: .25rem;
}

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .65rem 1.4rem;
    border-radius: var(--radius-pill);
    font-size: .9rem;
    font-weight: 700;
    border: 2px solid transparent;
    transition: all var(--t-fast) var(--ease);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--rose-dark);
    color: var(--white);
    border-color: var(--rose-dark);
    box-shadow: 0 2px 8px rgba(212,120,142,.30);
}
.btn-primary:hover {
    background: #c4687e;
    border-color: #c4687e;
    box-shadow: 0 4px 14px rgba(212,120,142,.40);
}

.btn-secondary {
    background: var(--white);
    color: var(--rose-dark);
    border-color: var(--rose);
}
.btn-secondary:hover {
    background: var(--rose-pale);
}

.btn-ghost {
    background: transparent;
    color: var(--text-mid);
    border-color: var(--border);
}
.btn-ghost:hover {
    background: var(--cream-dark);
    color: var(--text-dark);
}

.btn-danger {
    background: #e05555;
    color: var(--white);
    border-color: #e05555;
}
.btn-danger:hover { background: #cc4444; border-color: #cc4444; }

.btn-sm { padding: .4rem .9rem; font-size: .82rem; }
.btn-lg { padding: .85rem 2rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

/* ── ALERTS ───────────────────────────────────────────────── */
.alert {
    padding: .75rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: 1rem;
    border: 1.5px solid transparent;
}

.alert-error   { background: #fde8e8; border-color: #f5baba; color: #b83232; }
.alert-success { background: var(--sage-light); border-color: var(--sage); color: #2e6b3e; }
.alert-info    { background: var(--lavender-light); border-color: var(--lavender); color: #5a4075; }
.alert-warning { background: var(--peach-light); border-color: var(--peach); color: #8a5020; }
.alert-icon    { font-size: 1rem; flex-shrink: 0; margin-top: .05rem; }

/* ── APP SHELL (authenticated layout) ───────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--white);
    border-right: 1.5px solid var(--border-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--t-med) var(--ease);
    box-shadow: var(--shadow-sm);
}

.sidebar-brand {
    padding: 1.5rem 1.2rem 1rem;
    border-bottom: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: .7rem;
}

.sidebar-brand .brand-icon { font-size: 1.6rem; }

.sidebar-brand .brand-text { line-height: 1.2; }
.sidebar-brand .brand-text strong {
    display: block;
    font-size: .95rem;
    font-weight: 800;
    color: var(--text-dark);
}
.sidebar-brand .brand-text span {
    font-size: .72rem;
    color: var(--text-light);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: .75rem .75rem;
    overflow-y: auto;
}

.nav-section-label {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-light);
    padding: .8rem .5rem .35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    color: var(--text-mid);
    font-size: .88rem;
    font-weight: 600;
    transition: all var(--t-fast);
    text-decoration: none;
    margin-bottom: .1rem;
}

.nav-link:hover {
    background: var(--rose-pale);
    color: var(--rose-dark);
    text-decoration: none;
}

.nav-link.active {
    background: var(--rose-pale);
    color: var(--rose-dark);
}

.nav-link .nav-icon { font-size: 1.05rem; width: 1.2rem; text-align: center; }

.sidebar-footer {
    padding: 1rem .75rem;
    border-top: 1.5px solid var(--border-light);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .6rem;
    border-radius: var(--radius-sm);
    background: var(--cream);
    margin-bottom: .5rem;
}

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--rose), var(--lavender));
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    font-weight: 800;
    color: var(--white);
    flex-shrink: 0;
}

.user-info strong { display: block; font-size: .82rem; color: var(--text-dark); }
.user-info small  { font-size: .72rem; color: var(--text-light); }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    height: var(--nav-h);
    background: var(--white);
    border-bottom: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-dark);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.page-content {
    padding: 2rem;
    flex: 1;
}

/* ── CARDS ────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-header h2, .card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.card-body { padding: 1.4rem; }
.card-footer {
    padding: .9rem 1.4rem;
    border-top: 1.5px solid var(--border-light);
    background: var(--cream);
}

/* ── STAT CARDS (dashboard) ────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 1.3rem 1.4rem;
    border: 1.5px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

.stat-card.rose::before    { background: linear-gradient(90deg, var(--rose), var(--rose-dark)); }
.stat-card.lavender::before{ background: linear-gradient(90deg, var(--lavender), var(--lavender-dark)); }
.stat-card.sage::before    { background: linear-gradient(90deg, var(--sage), #7ab88a); }
.stat-card.peach::before   { background: linear-gradient(90deg, var(--peach), #e5956a); }

.stat-label {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-light);
    margin-bottom: .4rem;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1;
    margin-bottom: .3rem;
}

.stat-value.positive { color: #2e7d4f; }
.stat-value.negative { color: #c94040; }

.stat-sub {
    font-size: .78rem;
    color: var(--text-light);
}

.stat-icon {
    position: absolute;
    top: 1.1rem; right: 1.2rem;
    font-size: 1.6rem;
    opacity: .18;
}

/* ── PAY YOURSELF CARD ─────────────────────────────────────── */
.pay-card {
    background: linear-gradient(135deg, var(--rose-dark) 0%, var(--lavender-dark) 100%);
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(212,120,142,.30);
    margin-bottom: 1.5rem;
}

.pay-card::before {
    content: '✨';
    position: absolute;
    font-size: 6rem;
    top: -1rem; right: -1rem;
    opacity: .12;
}

.pay-card-label {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .8;
    margin-bottom: .4rem;
}

.pay-card-amount {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: .6rem;
}

.pay-card-breakdown {
    font-size: .82rem;
    opacity: .85;
    line-height: 1.7;
}

.pay-card-breakdown .line {
    display: flex;
    justify-content: space-between;
    max-width: 340px;
}

.pay-card-breakdown .line.total {
    border-top: 1px solid rgba(255,255,255,.3);
    margin-top: .3rem;
    padding-top: .3rem;
    font-weight: 700;
}

/* ── TABLES ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}

thead th {
    background: var(--cream);
    padding: .75rem 1rem;
    text-align: left;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-light);
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--t-fast);
}

tbody tr:hover { background: var(--cream); }
tbody tr:last-child { border-bottom: none; }

td {
    padding: .75rem 1rem;
    vertical-align: middle;
    color: var(--text-dark);
}

td.muted { color: var(--text-light); }
td.amount { font-weight: 700; font-variant-numeric: tabular-nums; }
td.positive { color: #2e7d4f; }
td.negative { color: #c94040; }

/* ── BADGES / TAGS ────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: .2rem .65rem;
    border-radius: var(--radius-pill);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-etsy     { background: var(--peach-light); color: #8a5020; }
.badge-shopify  { background: var(--sage-light); color: #1e5c2e; }
.badge-other    { background: var(--lavender-light); color: #5a4075; }
.badge-cogs     { background: var(--rose-pale); color: #a03050; }
.badge-operating{ background: var(--lavender-light); color: #5a4075; }
.badge-success  { background: var(--sage-light); color: #2e6b3e; }
.badge-warning  { background: var(--peach-light); color: #8a5020; }
.badge-neutral  { background: var(--cream-dark); color: var(--text-mid); }

/* ── GRID LAYOUT ──────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45,40,39,.45);
    backdrop-filter: blur(3px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-med);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(.96) translateY(8px);
    transition: transform var(--t-med) var(--ease);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

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

.modal-header h2 { font-size: 1.05rem; margin: 0; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-light);
    padding: .2rem .4rem;
    border-radius: var(--radius-sm);
    transition: all var(--t-fast);
    line-height: 1;
}
.modal-close:hover { background: var(--cream-dark); color: var(--text-dark); }

.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1.5px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    flex-shrink: 0;
    background: var(--white);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── DIVIDER ──────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1.5px solid var(--border-light);
    margin: 1.25rem 0;
}

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .75rem; opacity: .5; }
.empty-state p { margin: 0; font-size: .9rem; }

/* ── LOADING SPINNER ──────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2.5px solid var(--border);
    border-top-color: var(--rose-dark);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── SCROLLBAR (subtle) ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--rose-light); }

/* ── UTILITIES ────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-sm      { gap: .5rem; }
.gap-md      { gap: 1rem; }
.gap-lg      { gap: 1.5rem; }
.mt-sm       { margin-top: .5rem; }
.mt-md       { margin-top: 1rem; }
.mt-lg       { margin-top: 1.5rem; }
.mb-sm       { margin-bottom: .5rem; }
.mb-md       { margin-bottom: 1rem; }
.mb-lg       { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-light); }
.text-sm     { font-size: .85rem; }
.fw-bold     { font-weight: 700; }
.fw-800      { font-weight: 800; }
.hidden      { display: none !important; }
.w-full      { width: 100%; }

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
    .pay-card-amount {
        font-size: 2.2rem;
    }
    .topbar {
        padding: 0 1.25rem;
    }
    .page-content {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }
    .login-card {
        padding: 2rem 1.5rem;
    }
}

/* ── BATCH ENTRY ──────────────────────────────────────────── */
.mode-tabs {
    display: flex;
    gap: .35rem;
    background: var(--cream);
    border-radius: var(--radius-pill);
    padding: .25rem;
    margin-bottom: 1.1rem;
}

.mode-tab {
    flex: 1;
    padding: .45rem 1rem;
    border-radius: var(--radius-pill);
    border: none;
    background: transparent;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-mid);
    cursor: pointer;
    transition: all var(--t-fast);
    text-align: center;
}

.mode-tab.active-tab {
    background: var(--white);
    color: var(--rose-dark);
    box-shadow: var(--shadow-sm);
}

.batch-row {
    margin-bottom: .4rem;
}

.batch-row-inner {
    display: grid;
    grid-template-columns: 24px 130px 1fr 90px 130px 90px 32px;
    gap: .4rem;
    align-items: center;
}

.br-num {
    font-size: .75rem;
    color: var(--text-light);
    font-weight: 700;
    text-align: center;
}

.br-fee-preview {
    font-size: .82rem;
    font-weight: 600;
    text-align: right;
    padding-right: .2rem;
    white-space: nowrap;
}

.br-remove {
    padding: .25rem .4rem !important;
    font-size: .8rem !important;
    opacity: .5;
    border-radius: var(--radius-sm) !important;
}
.br-remove:hover { opacity: 1; color: #c94040 !important; }

.batch-header {
    display: grid;
    grid-template-columns: 24px 130px 1fr 90px 130px 90px 32px;
    gap: .4rem;
    padding-bottom: .4rem;
    border-bottom: 1.5px solid var(--border-light);
    margin-bottom: .5rem;
}

.batch-header span {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-light);
}

.batch-header .bh-fee { text-align: right; }

.batch-totals-bar {
    display: flex;
    gap: 1.5rem;
    padding: .75rem 1rem;
    background: var(--cream);
    border-radius: var(--radius-sm);
    margin-top: .75rem;
    font-size: .85rem;
    flex-wrap: wrap;
    align-items: center;
}

.batch-totals-bar .bt-item {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.batch-totals-bar .bt-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-light);
}

.batch-totals-bar .bt-val {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-dark);
}

.batch-totals-bar .bt-val.green { color: #2e7d4f; }
.batch-totals-bar .bt-val.red   { color: #c94040; }

.batch-totals-bar .bt-count {
    margin-left: auto;
    font-size: .8rem;
    color: var(--text-light);
    font-weight: 600;
}

/* Wider modal for batch entry */
.modal.modal-wide { max-width: 820px; }

@media (max-width: 860px) {
    .batch-row-inner {
        grid-template-columns: 24px 110px 1fr 80px 110px 70px 28px;
        gap: .3rem;
    }
    .modal.modal-wide { max-width: 98vw; }
}

@media (max-width: 600px) {
    .batch-row-inner {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    .br-num    { display: none; }
    .br-date   { grid-column: 1; }
    .br-amt    { grid-column: 2; }
    .br-desc   { grid-column: 1 / -1; }
    .br-cat    { grid-column: 1; }
    .br-fee-preview { grid-column: 2; text-align: right; }
    .br-remove { grid-column: 2; justify-self: end; }
    .batch-header { display: none; }
}

/* ── EXPENSE BATCH ROW (wider than income — has vendor + payment cols) ─── */
.expense-row-inner {
    grid-template-columns: 24px 115px 140px 1fr 170px 85px 80px 32px !important;
}

@media (max-width: 1000px) {
    .expense-row-inner {
        grid-template-columns: 24px 105px 120px 1fr 140px 75px 70px 28px !important;
    }
}

@media (max-width: 700px) {
    .expense-row-inner {
        grid-template-columns: 1fr 1fr !important;
        grid-template-rows: auto auto auto !important;
    }
    .expense-row-inner .br-num    { display: none; }
    .expense-row-inner .br-date   { grid-column: 1; }
    .expense-row-inner .br-amt    { grid-column: 2; }
    .expense-row-inner .br-vendor { grid-column: 1 / -1; }
    .expense-row-inner .br-desc   { grid-column: 1 / -1; }
    .expense-row-inner .br-cat    { grid-column: 1 / -1; }
    .expense-row-inner .br-pay    { grid-column: 1; }
    .expense-row-inner .br-remove { grid-column: 2; justify-self: end; }
}

/* Category type indicator badge in single form */
#cat-type-indicator {
    display: inline-block;
    margin-top: .35rem;
    font-size: .78rem;
    transition: all var(--t-fast);
}

/* ── PRICING / PRODUCT LIBRARY ────────────────────────────── */
.product-card {
    background: var(--white);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.2rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--t-fast), transform var(--t-fast);
}
.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.product-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .6rem;
}
.product-card-name {
    font-weight: 800;
    font-size: .95rem;
    color: var(--text-dark);
    line-height: 1.3;
}
.product-card-stats {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: .5rem;
    margin-bottom: .5rem;
    padding: .6rem .75rem;
    background: var(--cream);
    border-radius: var(--radius-sm);
    text-align: center;
}
.product-card-stats .stat-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.product-card-actions {
    display: flex;
    gap: .4rem;
    margin-top: .75rem;
    flex-wrap: wrap;
}

/* Margin pill */
.margin-pill {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: var(--radius-pill);
    font-size: .72rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}
.margin-good { background: var(--sage-light);    color: #2e6b3e; }
.margin-ok   { background: var(--peach-light);   color: #8a5020; }
.margin-low  { background: #fde8e8;              color: #b83232; }

/* Library grid */
#library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

/* Product editor modal — extra wide, flex column so footer always visible */
.modal.modal-xl {
    max-width: 860px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}
.modal.modal-xl .modal-body {
    overflow-y: auto;
    flex: 1;
}

/* Cost line rows */
.cost-line-row {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .4rem;
}

/* Variation blocks */
.variation-block {
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: .9rem;
    overflow: hidden;
}
.variation-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1rem;
    background: var(--cream);
    border-bottom: 1.5px solid var(--border-light);
}
.var-num {
    width: 22px; height: 22px;
    background: var(--rose);
    color: var(--white);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 800;
    flex-shrink: 0;
}
.variation-body {
    padding: .9rem 1rem;
}
.extra-cost-lines { margin-bottom: .4rem; }

/* Variation cost summary */
.variation-summary {
    background: var(--cream);
    border-radius: var(--radius-sm);
    padding: .7rem .9rem;
    margin-top: .6rem;
    font-size: .83rem;
}
.var-summary-row {
    display: flex;
    justify-content: space-between;
    padding: .2rem 0;
    color: var(--text-mid);
}
.var-summary-row.total {
    border-top: 1.5px solid var(--border);
    margin-top: .3rem;
    padding-top: .4rem;
    font-weight: 700;
    color: var(--text-dark);
    font-size: .9rem;
}
.var-summary-row.margin-row { font-weight: 700; }
.var-summary-row.warn-row {
    background: #fde8e8;
    border-radius: var(--radius-sm);
    padding: .4rem .6rem;
    margin-top: .3rem;
    font-size: .78rem;
    color: #b83232;
}

/* Price tester */
.tester-result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}
.tester-row {
    display: flex;
    justify-content: space-between;
    font-size: .85rem;
    padding: .3rem 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-mid);
}
.tester-row.total {
    font-weight: 800;
    font-size: .95rem;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border);
}
.tester-row:last-child { border-bottom: none; }

@media (max-width: 700px) {
    #library-grid { grid-template-columns: 1fr; }
    .modal.modal-xl { max-width: 98vw; }
    .tester-result-grid { grid-template-columns: 1fr; }
}

/* ── REPORTS ──────────────────────────────────────────────── */
.report-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: .45rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: .85rem;
}
.report-row:last-child { border-bottom: none; }

.tax-line {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: .5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: .85rem;
}
.tax-line:last-child { border-bottom: none; }

.tax-section {
    background: var(--white);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    overflow: hidden;
}
.tax-section-header {
    padding: .85rem 1.2rem;
    background: var(--cream);
    border-bottom: 1.5px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tax-section-header h3 { font-size: .9rem; margin: 0; }
.tax-section-body { padding: .75rem 1.2rem; }

.tax-summary-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
}

/* Quarter grid */
#quarters-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: .9rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    #quarters-grid { grid-template-columns: repeat(2,1fr); }
    .tax-summary-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 540px) {
    #quarters-grid { grid-template-columns: 1fr; }
    .tax-summary-grid { grid-template-columns: 1fr; }
    .tax-line { grid-template-columns: 1fr auto; }
    .tax-line .text-muted { display: none; }
}

/* ── PRICING LIST VIEW ────────────────────────────────────── */
.view-toggle {
    display: flex;
    gap: .25rem;
    background: var(--cream);
    border-radius: var(--radius-sm);
    padding: .2rem;
}
.view-toggle-btn {
    background: none;
    border: none;
    padding: .3rem .55rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-light);
    transition: all var(--t-fast);
    line-height: 1;
}
.view-toggle-btn.active {
    background: var(--white);
    color: var(--rose-dark);
    box-shadow: var(--shadow-sm);
}

/* Product list table */
#product-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .88rem;
}
#product-list-table thead th {
    background: var(--cream);
    padding: .65rem 1rem;
    text-align: left;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-light);
    border-bottom: 1.5px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}
#product-list-table thead th:hover { color: var(--rose-dark); }
#product-list-table thead th .sort-arrow { margin-left: .25rem; opacity: .4; }
#product-list-table thead th.sorted .sort-arrow { opacity: 1; color: var(--rose-dark); }
#product-list-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background var(--t-fast);
}
#product-list-table tbody tr:hover { background: var(--cream); }
#product-list-table tbody tr:last-child { border-bottom: none; }
#product-list-table td { padding: .65rem 1rem; vertical-align: top; }
#product-list-table td:last-child { vertical-align: top; padding-top: .55rem; }

/* Variation lines on card */
.variation-price-list {
    margin: .5rem 0 .4rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}
.variation-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .78rem;
    gap: .5rem;
}
.variation-price-row .var-label {
    color: var(--text-mid);
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.variation-price-row .var-price-val {
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
}

/* ── SETTINGS PAGE ────────────────────────────────────────── */
.settings-section {
    background: var(--white);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.settings-section-header {
    padding: 1rem 1.4rem;
    border-bottom: 1.5px solid var(--border-light);
    background: var(--cream);
    display: flex;
    align-items: center;
    gap: .6rem;
}
.settings-section-header h2 {
    font-size: 1rem;
    margin: 0;
    font-weight: 700;
}
.settings-section-header .section-icon { font-size: 1.2rem; }
.settings-section-body { padding: 1.4rem; }

.settings-field-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.settings-preview {
    background: var(--lavender-light);
    border: 1.5px solid var(--lavender);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    font-size: .82rem;
    color: var(--text-mid);
    margin-top: .75rem;
    line-height: 1.8;
}
.settings-preview strong { color: var(--text-dark); }

/* Password strength meter */
.strength-wrap {
    margin-top: .4rem;
}
.strength-track {
    height: 5px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: .25rem;
}
.strength-bar {
    height: 100%;
    border-radius: 99px;
    width: 0;
    transition: width .3s, background-color .3s;
}
.strength-label {
    font-size: .75rem;
    font-weight: 700;
}

/* Password field with toggle */
.pw-field-wrap {
    position: relative;
}
.pw-field-wrap .form-control {
    padding-right: 2.5rem;
}
.toggle-pw {
    position: absolute;
    right: .6rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: .2rem;
    color: var(--text-light);
}
.toggle-pw:hover { color: var(--text-dark); }

/* Admin user rows */
.settings-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 0;
    border-bottom: 1px solid var(--border-light);
}
.settings-user-row:last-child { border-bottom: none; }

@media (max-width: 640px) {
    .settings-field-group { grid-template-columns: 1fr; }
}

/* ── FINAL POLISH ─────────────────────────────────────────── */

/* Smooth page load */
.main-content {
    animation: fadeIn .18s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Better focus rings for accessibility */
:focus-visible {
    outline: 2.5px solid var(--rose-dark);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Make empty states feel warmer */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-light);
}
.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: .6rem;
    opacity: .6;
    display: block;
}
.empty-state p {
    margin: 0;
    font-size: .9rem;
    line-height: 1.6;
}
.empty-state a {
    color: var(--rose-dark);
    font-weight: 600;
}

/* Subtle page footer */
.page-footer {
    text-align: center;
    padding: 2rem 1rem 1rem;
    font-size: .72rem;
    color: var(--text-light);
    border-top: 1px solid var(--border-light);
    margin-top: 2rem;
}

/* Alert close animations */
.alert {
    transition: opacity .2s;
}

/* Table amount column always right-aligned */
td.amount { text-align: right; font-variant-numeric: tabular-nums; }
th:last-of-type, td:last-of-type { white-space: nowrap; }

/* Topbar action button group spacing */
.topbar-actions { flex-wrap: wrap; gap: .5rem; }

/* Prevent modal content overflow on very small screens */
@media (max-width: 400px) {
    .modal { margin: .5rem; max-width: calc(100vw - 1rem); }
    .modal-header, .modal-body, .modal-footer { padding: .9rem 1rem; }
    .login-card { padding: 1.5rem 1.1rem; }
}
