:root {
    --bg: #050505;
    --bg-soft: #0b0b0d;
    --panel: rgba(18, 18, 20, 0.88);
    --panel-strong: rgba(28, 24, 16, 0.92);
    --line: rgba(212, 175, 55, 0.18);
    --line-soft: rgba(255, 255, 255, 0.08);
    --gold: #d4af37;
    --gold-bright: #f8d86b;
    --gold-dark: #8a6f18;
    --text: #fff9e8;
    --muted: #bdb8a8;
    --danger: #ff6b6b;
    --success: #48d597;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --sidebar-width: 290px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(212, 175, 55, 0.18), transparent 34%),
        radial-gradient(circle at 90% 15%, rgba(248, 216, 107, 0.08), transparent 28%),
        linear-gradient(135deg, #030303 0%, #0b0b0d 50%, #11100b 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent 72%);
}

.aurora {
    position: fixed;
    width: 340px;
    height: 340px;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.28;
    pointer-events: none;
}

.aurora-one {
    top: -110px;
    left: 22%;
    background: var(--gold);
}

.aurora-two {
    right: -120px;
    bottom: 8%;
    background: #775f18;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    min-height: 100vh;
    padding: 26px 18px;
    background: linear-gradient(180deg, rgba(0,0,0,0.86), rgba(18, 14, 6, 0.92));
    border-right: 1px solid var(--line);
    position: sticky;
    top: 0;
    box-shadow: 24px 0 70px rgba(0,0,0,0.35);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: var(--text);
    padding: 12px 10px 24px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold-dark));
    color: #111;
    font-weight: 950;
    font-size: 28px;
    box-shadow: 0 14px 38px rgba(212, 175, 55, 0.28);
}

.brand strong {
    display: block;
    font-size: 18px;
    letter-spacing: 0.2px;
}

.brand small {
    color: var(--muted);
}

.nav-menu {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    color: var(--muted);
    text-decoration: none;
    border-radius: 16px;
    border: 1px solid transparent;
    transition: 180ms ease;
}

.nav-link span {
    width: 22px;
    color: var(--gold-bright);
    text-align: center;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
    background: linear-gradient(135deg, rgba(212,175,55,0.17), rgba(212,175,55,0.05));
    border-color: var(--line);
    transform: translateX(3px);
}

.sidebar-card {
    margin-top: 24px;
    padding: 18px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: linear-gradient(135deg, rgba(212,175,55,0.12), rgba(255,255,255,0.03));
}

.sidebar-card p,
.sidebar-card small {
    color: var(--muted);
    margin: 0;
}

.sidebar-card strong {
    display: block;
    margin: 8px 0;
}

.main-content {
    padding: 28px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--gold-bright);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 12px;
    font-weight: 800;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(28px, 3vw, 42px);
    margin-bottom: 0;
    letter-spacing: -1px;
}

h2 {
    font-size: 22px;
    margin-bottom: 16px;
}

h3 {
    font-size: 17px;
    margin-bottom: 6px;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.pill,
.ghost-button,
.gold-button,
.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 999px;
    padding: 0 16px;
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
}

.pill {
    color: var(--gold-bright);
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid var(--line);
}

.ghost-button {
    color: var(--text);
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.04);
}

.gold-button {
    border: 0;
    cursor: pointer;
    color: #111;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    box-shadow: 0 14px 30px rgba(212,175,55,0.25);
}

.gold-button:hover,
.ghost-button:hover {
    transform: translateY(-1px);
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line-soft);
    background: rgba(255,255,255,0.06);
}

.flash.success {
    color: #ccffe6;
    border-color: rgba(72,213,151,0.35);
    background: rgba(72,213,151,0.1);
}

.flash.error {
    color: #ffe0e0;
    border-color: rgba(255,107,107,0.35);
    background: rgba(255,107,107,0.1);
}

.hero-panel,
.panel,
.form-panel,
.table-panel,
.metric-card {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 28px;
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
    background:
        linear-gradient(135deg, rgba(212,175,55,0.14), rgba(255,255,255,0.04)),
        var(--panel);
}

.hero-panel::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    border-radius: 999px;
    right: -90px;
    top: -120px;
    background: radial-gradient(circle, rgba(248,216,107,0.22), transparent 70%);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    position: relative;
    z-index: 1;
}

.hero-panel p {
    color: var(--muted);
    line-height: 1.65;
    max-width: 760px;
}

.hero-balance {
    display: grid;
    align-content: center;
    justify-items: end;
}

.hero-balance strong {
    font-size: clamp(32px, 4vw, 58px);
    background: linear-gradient(135deg, #fff4bf, var(--gold-bright), #b88d1c);
    -webkit-background-clip: text;
    color: transparent;
    letter-spacing: -2px;
}

.hero-balance span {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 12px;
    font-weight: 800;
}

.filter-bar {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr auto;
    gap: 12px;
    margin-top: 20px;
}

.grid {
    display: grid;
    gap: 18px;
}

.metric-grid {
    grid-template-columns: repeat(6, minmax(150px, 1fr));
    margin-bottom: 20px;
}

.metric-card {
    position: relative;
    overflow: hidden;
    min-height: 150px;
    padding: 20px;
    border-radius: var(--radius-lg);
    transition: 180ms ease;
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -50px;
    width: 130px;
    height: 130px;
    border-radius: 999px;
    background: rgba(212,175,55,0.11);
}

.metric-card:hover {
    transform: translateY(-4px);
    border-color: rgba(248,216,107,0.45);
}

.metric-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #111;
    background: linear-gradient(135deg, var(--gold-bright), var(--gold-dark));
    margin-bottom: 18px;
    font-weight: 950;
}

.metric-card p {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 13px;
}

.metric-card strong {
    display: block;
    font-size: 25px;
    letter-spacing: -0.5px;
}

.metric-card small {
    color: var(--muted);
}

.two-col {
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

.three-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.form-panel,
.table-panel {
    border-radius: var(--radius-xl);
    padding: 22px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.panel-header p,
.section-subtitle {
    color: var(--muted);
    margin: 4px 0 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 14px;
}

.form-grid.compact {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
}

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

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 44px;
    color: var(--text);
    background: rgba(0,0,0,0.32);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    padding: 11px 13px;
    outline: 0;
    font: inherit;
}

textarea {
    min-height: 90px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(248,216,107,0.6);
    box-shadow: 0 0 0 4px rgba(212,175,55,0.1);
}

select option {
    background: #111;
    color: var(--text);
}

.form-actions {
    display: flex;
    align-items: end;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 18px;
    border: 1px solid var(--line-soft);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

th,
td {
    padding: 14px 15px;
    text-align: left;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}

th {
    color: var(--gold-bright);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(212,175,55,0.08);
}

td {
    color: #f4edda;
}

tbody tr:hover {
    background: rgba(255,255,255,0.035);
}

tfoot td {
    font-weight: 900;
    color: var(--gold-bright);
    background: rgba(212,175,55,0.08);
}

.status,
.type-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(212,175,55,0.1);
    color: var(--gold-bright);
    font-size: 12px;
    font-weight: 800;
}

.status.inactive,
.status.pending {
    color: #ffd0d0;
    border-color: rgba(255,107,107,0.32);
    background: rgba(255,107,107,0.08);
}

.status.paid,
.status.active {
    color: #d8ffe8;
    border-color: rgba(72,213,151,0.32);
    background: rgba(72,213,151,0.08);
}

.status.partial {
    color: #fff1c6;
    border-color: rgba(248,216,107,0.32);
    background: rgba(248,216,107,0.08);
}

.chart-list {
    display: grid;
    gap: 14px;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(140px, 0.35fr) 1fr minmax(110px, auto);
    align-items: center;
    gap: 12px;
}

.bar-label {
    color: var(--muted);
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bar-track {
    height: 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.04);
}

.bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-bright));
    box-shadow: 0 0 20px rgba(248,216,107,0.32);
}

.bar-fill.expense {
    background: linear-gradient(90deg, #8a3a22, #ffb36d);
}

.bar-fill.sales {
    background: linear-gradient(90deg, #786112, var(--gold-bright));
}

.bar-fill.collections {
    background: linear-gradient(90deg, #1f7a4a, #83ffc0);
}

.bar-fill.net {
    background: linear-gradient(90deg, #9d8126, #fff2aa);
}

.bar-value {
    text-align: right;
    font-weight: 900;
}

.trend-row {
    padding: 15px;
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    background: rgba(255,255,255,0.03);
}

.trend-row + .trend-row {
    margin-top: 12px;
}

.trend-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.trend-head strong {
    color: var(--gold-bright);
}

.trend-bars {
    display: grid;
    gap: 9px;
}

.mini-bar {
    display: grid;
    grid-template-columns: 90px 1fr 95px;
    gap: 10px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.activity-list {
    display: grid;
    gap: 12px;
}

.activity-item {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 13px;
    border-radius: 18px;
    border: 1px solid var(--line-soft);
    background: rgba(255,255,255,0.03);
}

.activity-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(212,175,55,0.12);
    color: var(--gold-bright);
    border: 1px solid var(--line);
}

.activity-item p {
    margin: 0;
    font-weight: 900;
}

.activity-item small {
    color: var(--muted);
}

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 14px;
}

.kpi-mini {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid var(--line-soft);
    background: rgba(255,255,255,0.035);
}

.kpi-mini span {
    color: var(--muted);
    display: block;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.kpi-mini strong {
    display: block;
    margin-top: 8px;
    font-size: 22px;
}

.empty-state {
    padding: 28px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 20px;
}

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

    .two-col,
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-balance {
        justify-items: start;
    }
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        min-height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .nav-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .main-content {
        padding: 20px;
    }

    .topbar,
    .panel-header {
        flex-direction: column;
    }

    .top-actions {
        justify-content: flex-start;
    }

    .filter-bar,
    .form-grid,
    .form-grid.compact,
    .three-col,
    .kpi-strip {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .metric-grid,
    .filter-bar,
    .form-grid,
    .form-grid.compact,
    .three-col,
    .kpi-strip,
    .nav-menu {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 16px;
    }

    .panel,
    .form-panel,
    .table-panel,
    .hero-panel {
        padding: 18px;
        border-radius: 22px;
    }

    .bar-row,
    .mini-bar {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .bar-value {
        text-align: left;
    }
}
