/* =========================================================
   Davila Accounting — accounting.css
   ========================================================= */

* { font-family: 'Inter', system-ui, sans-serif; }

/* ── Dark theme base ─────────────────────────────────────── */
.layout-main  { background: #111827; }
.layout-auth  { background: #0D1B2A; }
.main-content { padding: 24px 28px; }

/* ── Sidebar brand profile label ─────────────────────────── */
.sidebar__brand-profile {
    font-size: 10px;
    color: rgba(255,255,255,.38);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* ── Topnav ──────────────────────────────────────────────── */
.topnav {
    background: #1a2535;
    border-bottom: 1px solid rgba(255,255,255,.07);
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topnav__left  { display: flex; align-items: center; gap: 8px; flex: 1; }
.topnav__center { display: flex; align-items: center; justify-content: center; }
.topnav__right  { display: flex; align-items: center; gap: 10px; }

.topnav__app-name { font-size: 12px; font-weight: 700; color: rgba(255,255,255,.35); }
.topnav__sep      { font-size: 12px; color: rgba(255,255,255,.18); }
.topnav__page     { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.65); }

.topnav__menu-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; }
.topnav__menu-toggle span { display: block; width: 20px; height: 2px; background: rgba(255,255,255,.6); border-radius: 2px; }

.topnav__user-pill {
    display: flex; align-items: center; gap: 7px;
    padding: 4px 10px 4px 5px;
    background: rgba(255,255,255,.07);
    border-radius: 20px;
    font-size: 12px; font-weight: 600; color: rgba(255,255,255,.70);
}
.topnav__user-dot {
    width: 22px; height: 22px; border-radius: 50%;
    background: linear-gradient(135deg,#1D9E75,#1A4A3A);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 800; color: #fff;
}
.topnav__logout-btn {
    padding: 6px 14px;
    background: rgba(220,38,38,.15);
    border: 1px solid rgba(220,38,38,.30);
    border-radius: 8px;
    font-size: 12px; font-weight: 600; color: #F87171;
    text-decoration: none; transition: all .15s;
}
.topnav__logout-btn:hover { background: rgba(220,38,38,.28); color: #FCA5A5; text-decoration: none; }

/* ── Profile Switcher ────────────────────────────────────── */
.profile-switcher { position: relative; }

.profile-switcher__btn {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    font-size: 12px; font-weight: 600; color: rgba(255,255,255,.80);
    cursor: pointer; transition: all .15s;
    white-space: nowrap;
}
.profile-switcher__btn:hover { background: rgba(255,255,255,.14); }

.profile-switcher__dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.profile-switcher__arrow { font-size: 9px; color: rgba(255,255,255,.40); margin-left: 2px; }

.profile-switcher__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a2535;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.40);
    min-width: 220px;
    z-index: 100;
    overflow: hidden;
    display: none;
}
.profile-switcher__dropdown--open { display: block; }

.profile-switcher__option {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 16px;
    background: none; border: none;
    font-size: 13px; font-weight: 500; color: rgba(255,255,255,.65);
    cursor: pointer; text-align: left; transition: background .15s;
}
.profile-switcher__option:hover { background: rgba(255,255,255,.06); color: #fff; }
.profile-switcher__option--active { color: #fff; font-weight: 600; }
.profile-switcher__option-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.profile-switcher__check { margin-left: auto; color: #1D9E75; font-size: 14px; }

/* ── Auth page ───────────────────────────────────────────── */
.auth-bg { position: fixed; inset: 0; background: #0D1B2A; z-index: 0; overflow: hidden; }
.auth-bg__grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(29,158,117,.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(29,158,117,.06) 1px, transparent 1px);
    background-size: 40px 40px;
}
.layout-auth .auth-wrapper { position: relative; z-index: 1; width: 100%; max-width: 420px; }
.layout-auth .auth-footer  { position: relative; z-index: 1; }
.auth-card {
    background: #1a2535;
    border-radius: 20px;
    padding: 40px 36px;
    box-shadow: 0 24px 64px rgba(0,0,0,.50);
    border: 1px solid rgba(255,255,255,.07);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 28px; }
.auth-brand__icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg,#1D9E75,#1A4A3A);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.125rem; font-weight: 900; color: #fff; margin-bottom: 2px;
}
.auth-brand__name    { font-size: 1.25rem; font-weight: 800; color: #F1F5F9; letter-spacing: -.02em; }
.auth-brand__tagline { font-size: .6875rem; color: rgba(255,255,255,.35); letter-spacing: .08em; text-transform: uppercase; }
.auth-card__heading    { font-size: 1.125rem; font-weight: 700; color: #F1F5F9; margin-bottom: 4px; text-align: center; }
.auth-card__subheading { font-size: .875rem; color: rgba(255,255,255,.40); text-align: center; margin-bottom: 24px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: .8125rem; color: rgba(255,255,255,.25); }
.auth-footer a { color: rgba(255,255,255,.40); }

.auth-card .form-input, .auth-card .form-select {
    background: rgba(255,255,255,.07);
    border-color: rgba(255,255,255,.12);
    color: #F1F5F9;
}
.auth-card .form-input:focus { border-color: #1D9E75; box-shadow: 0 0 0 3px rgba(29,158,117,.18); }
.auth-card .form-input::placeholder { color: rgba(255,255,255,.25); }
.auth-card .form-label { color: rgba(255,255,255,.70); }
.auth-card .form-checkbox span { color: rgba(255,255,255,.50); }
.auth-card .btn--primary { background: #1D9E75; border-color: #1D9E75; }
.auth-card .btn--primary:hover { background: #17875f; border-color: #17875f; }

/* ── Main footer ─────────────────────────────────────────── */
.main-footer { padding: 14px 28px; border-top: 1px solid rgba(255,255,255,.06); font-size: .8rem; color: rgba(255,255,255,.25); background: #1a2535; }
.main-footer p { margin-bottom: 0; }
.main-footer a { color: rgba(255,255,255,.35); }

/* ── Page typography ─────────────────────────────────────── */
.welcome-block { margin-bottom: 24px; }
.welcome-block h1 { font-size: 1.75rem; font-weight: 900; color: #F1F5F9; letter-spacing: -.03em; line-height: 1.1; }
.welcome-block p  { font-size: .875rem; color: rgba(255,255,255,.40); margin-top: 4px; margin-bottom: 0; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header__text { flex: 1; min-width: 0; }
.page-title   { font-size: 1.5rem; font-weight: 800; color: #F1F5F9; letter-spacing: -.02em; margin-bottom: 3px; }
.page-subtitle { font-size: .875rem; color: rgba(255,255,255,.40); margin-bottom: 0; }

/* ── Stat cards ──────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { border-radius: 16px; padding: 20px 22px; position: relative; overflow: hidden; min-height: 108px; }
.stat-card--green  { background: linear-gradient(135deg,#1A4A3A 0%,#1D9E75 100%); }
.stat-card--blue   { background: linear-gradient(135deg,#1B3A5C 0%,#2E6DA4 100%); }
.stat-card--coral  { background: linear-gradient(135deg,#4A2A1A 0%,#D85A30 100%); }
.stat-card--purple { background: linear-gradient(135deg,#2A1A4A 0%,#7F77DD 100%); }
.stat-card__orb    { position: absolute; width: 140px; height: 140px; border-radius: 50%; background: rgba(255,255,255,.08); right: -30px; top: -30px; }
.stat-card__label  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.60); margin-bottom: 10px; }
.stat-card__value  { font-size: 1.875rem; font-weight: 900; color: #fff; line-height: 1; margin-bottom: 6px; letter-spacing: -.03em; }
.stat-card__change { font-size: .75rem; color: rgba(255,255,255,.55); margin-bottom: 0; }

/* ── Dashboard grid ──────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }
.dashboard-right { display: flex; flex-direction: column; gap: 16px; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: #1a2535; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.card--alert { border-color: rgba(220,38,38,.25); }
.card__header { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__title  { font-size: .9375rem; font-weight: 700; color: #F1F5F9; }
.card__title--alert { color: #F87171; }
.card__body   { padding: 18px; }
.card__footer { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.03); border-radius: 0 0 14px 14px; }
.card__subtitle { font-size: .8125rem; color: rgba(255,255,255,.40); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn--sm { padding: 5px 12px; font-size: .8125rem; }
.btn--primary { background: #1D9E75; border-color: #1D9E75; color: #fff; }
.btn--primary:hover { background: #17875f; border-color: #17875f; color: #fff; text-decoration: none; }
.btn--secondary { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.15); color: rgba(255,255,255,.75); }
.btn--secondary:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.btn--danger { background: rgba(220,38,38,.20); border-color: rgba(220,38,38,.35); color: #F87171; }
.btn--danger:hover { background: rgba(220,38,38,.30); color: #FCA5A5; text-decoration: none; }
.btn--full { width: 100%; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th, .table td { padding: 10px 16px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); }
.table th { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: rgba(255,255,255,.30); background: rgba(255,255,255,.03); }
.table td { color: rgba(255,255,255,.75); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255,255,255,.04); }
.table__empty { text-align: center; color: rgba(255,255,255,.30); padding: 32px; font-style: italic; }

/* ── Transaction amounts ─────────────────────────────────── */
.tx__amount { font-weight: 700; font-size: .9rem; }
.tx__amount--income  { color: #34D399; }
.tx__amount--expense { color: #F87171; }
.tx__date { color: rgba(255,255,255,.45); font-size: .8125rem; white-space: nowrap; }

/* ── Category pill ───────────────────────────────────────── */
.category-pill { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600; }

/* ── Accounts list ───────────────────────────────────────── */
.accounts-list { padding: 8px 0; }
.account-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,.05); }
.account-row:last-child { border-bottom: none; }
.account-row__icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .625rem; font-weight: 800; background: rgba(255,255,255,.08); color: rgba(255,255,255,.60); flex-shrink: 0; }
.account-row__info { flex: 1; min-width: 0; }
.account-row__name { display: block; font-size: .875rem; font-weight: 600; color: #F1F5F9; }
.account-row__type { display: block; font-size: .75rem; color: rgba(255,255,255,.35); text-transform: capitalize; }
.account-row__balance { font-size: .9375rem; font-weight: 700; color: #34D399; white-space: nowrap; }
.account-row__balance--debt { color: #F87171; }

/* ── Overdue invoices ────────────────────────────────────── */
.overdue-list { padding: 4px 0; }
.overdue-row { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,.05); }
.overdue-row:last-child { border-bottom: none; }
.overdue-row__client { flex: 1; font-size: .875rem; font-weight: 600; color: #F1F5F9; }
.overdue-row__due    { font-size: .75rem; color: #F87171; white-space: nowrap; }
.overdue-row__amount { font-size: .9375rem; font-weight: 700; color: #F87171; white-space: nowrap; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: .72rem; font-weight: 700; border-radius: 20px; }
.badge--success { background: rgba(22,163,74,.20); color: #86efac; }
.badge--danger  { background: rgba(220,38,38,.20); color: #fca5a5; }
.badge--warning { background: rgba(217,119,6,.20); color: #fcd34d; }
.badge--info    { background: rgba(37,99,235,.20); color: #93c5fd; }
.badge--neutral { background: rgba(255,255,255,.10); color: rgba(255,255,255,.60); }

/* ── Flash ───────────────────────────────────────────────── */
.flash--success { background: rgba(22,163,74,.18); color: #86efac; border-color: rgba(22,163,74,.30); }
.flash--error   { background: rgba(220,38,38,.18); color: #fca5a5; border-color: rgba(220,38,38,.30); }
.flash--warning { background: rgba(217,119,6,.18); color: #fcd34d; border-color: rgba(217,119,6,.30); }
.flash--info    { background: rgba(37,99,235,.18); color: #93c5fd; border-color: rgba(37,99,235,.30); }

/* ── Utilities ───────────────────────────────────────────── */
.text-muted   { color: rgba(255,255,255,.38) !important; }
.text-income  { color: #34D399 !important; }
.text-expense { color: #F87171 !important; }
.empty-state  { color: rgba(255,255,255,.38); font-style: italic; text-align: center; padding: 24px 0; }
.empty-state a { color: #1D9E75; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title  { font-size: .9375rem; font-weight: 700; color: rgba(255,255,255,.70); }

/* ── Form inputs dark ────────────────────────────────────── */
.card .form-input, .card .form-select, .card .form-textarea {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.10);
    color: #F1F5F9;
}
.card .form-input:focus { border-color: #1D9E75; box-shadow: 0 0 0 3px rgba(29,158,117,.15); }
.card .form-input::placeholder { color: rgba(255,255,255,.22); }
.card .form-label { color: rgba(255,255,255,.70); }
.card .form-hint  { color: rgba(255,255,255,.35); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .topnav__center { display: none; }
    .main-content { padding: 16px; }
}

/* ── Dashboard net worth ─────────────────────────────────── */
.dashboard-networth {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: rgba(255,255,255,.04);
    border-top: 1px solid rgba(255,255,255,.07);
    font-size: .875rem;
    font-weight: 700;
    color: rgba(255,255,255,.55);
}
.dashboard-networth span:last-child { font-size: 1rem; }

/* ── Quick Actions ───────────────────────────────────────── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
}
.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.07);
    text-decoration: none;
    transition: all .15s;
    text-align: center;
}
.quick-action:hover {
    background: rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.15);
    text-decoration: none;
    transform: translateY(-1px);
}
.quick-action__icon { font-size: 1.375rem; line-height: 1; }
.quick-action span:last-child { font-size: .75rem; font-weight: 600; color: rgba(255,255,255,.65); line-height: 1.3; }

/* ── Table actions ───────────────────────────────────────── */
.table-actions { display: flex; align-items: center; gap: 6px; }

/* ── Pagination (global) ─────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 6px; }
.pagination__link {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 8px;
    border-radius: 8px;
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.70);
    font-size: .875rem; font-weight: 600;
    text-decoration: none; transition: background .15s;
}
.pagination__link:hover { background: rgba(255,255,255,.14); color: #fff; text-decoration: none; }
.pagination__current {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px;
    border-radius: 8px;
    background: #1D9E75;
    color: #fff;
    font-size: .875rem; font-weight: 700;
}

/* ── Sidebar mobile ──────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; position: fixed; z-index: 200; height: 100vh; }
    .sidebar--open { transform: translateX(0); }
    .topnav__menu-toggle { display: flex; }
    .main-wrapper { margin-left: 0 !important; }
}

/* ── Form select dark ────────────────────────────────────── */
.form-select {
    display: block; width: 100%; height: 40px;
    padding: 0 36px 0 12px;
    font-size: .9375rem; font-family: var(--font-sans, 'Inter', sans-serif);
    color: #F1F5F9;
    background-color: rgba(255,255,255,.06);
    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 fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 8px;
    appearance: none; -webkit-appearance: none;
    cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.form-select:focus { outline: none; border-color: #1D9E75; box-shadow: 0 0 0 3px rgba(29,158,117,.15); }
.form-select option     { background-color: #1a2535; color: #F1F5F9; }
.form-select optgroup   { background-color: #0D1B2A; color: rgba(255,255,255,.50); font-weight: 700; }

/* ── Flash messages ──────────────────────────────────────── */
.flash {
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid;
    margin-bottom: 16px;
    font-size: .9375rem;
    font-weight: 500;
}

/* ── Btn full ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px 18px; border-radius: 8px; border: 1px solid transparent; font-size: .9375rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: all .15s; line-height: 1; }
.btn--full { width: 100%; }
.text-right { text-align: right; }
.card--mt   { margin-top: 16px; }