@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@600;700&family=Inter:wght@400;500;600;700&display=swap");

* { box-sizing: border-box; }

:root {
    --main-bg: #090C16;
    --sidebar: #0C101E;
    --card: #0F1424;
    --border: #1A1F33;
    --violet: #926FFA;
    --lavender: #C696F6;
    --deep-purple: #4B35B7;
    --blue: #4A80F0;
    --pink: #F4A4D8;
    --green: #28C98A;
    --text: #F5F2FF;
    --secondary: #A9AFCB;
}

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    grid-template-columns: 210px 1fr;
    background:
        radial-gradient(circle at 78% 8%, rgba(75,53,183,.12), transparent 24rem),
        radial-gradient(circle at 48% 100%, rgba(146,111,250,.07), transparent 28rem),
        var(--main-bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.dashboard-sidebar {
    min-height: 100vh;
    padding: 34px 16px 40px;
    background: rgba(12,16,30,.96);
    border-right: 1px solid var(--border);
}

.brand-row {
    height: 42px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 5px;
}

.brand {
    font-family: "Monarch", "Cinzel", Georgia, "Times New Roman", serif;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .2px;
    font-weight: 700;
}

.moon {
    width: 31px;
    height: 31px;
    background: linear-gradient(135deg, var(--lavender), var(--violet));
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 18px rgba(198,150,246,.18);
    flex: 0 0 auto;
}

.moon::after {
    content: "";
    width: 27px;
    height: 27px;
    background: var(--sidebar);
    border-radius: 50%;
    position: absolute;
    top: -5px;
    left: 9px;
}

.tab-grid {
    display: grid;
    gap: 7px;
    margin-top: 48px;
}

.tab {
    min-height: 48px;
    padding: 0 13px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .01em;
    text-align: left;
    transition: .22s ease;
}

.tab:hover { color: var(--text); background: rgba(146,111,250,.07); }
.tab.active {
    border-color: rgba(146,111,250,.28);
    background: linear-gradient(90deg, rgba(146,111,250,.18), rgba(75,53,183,.06));
    color: var(--lavender);
    box-shadow: inset 3px 0 0 var(--violet);
}

.dashboard-content {
    min-width: 0;
    padding: 36px 42px 48px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.eyebrow, .panel-kicker {
    margin: 0 0 7px;
    color: var(--secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.dashboard-content h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(30px, 3vw, 42px);
    line-height: 1;
    letter-spacing: -.035em;
}

.primary-button {
    min-height: 42px;
    border: 1px solid rgba(198,150,246,.38);
    border-radius: 9px;
    padding: 0 15px;
    background: linear-gradient(135deg, var(--violet), var(--deep-purple));
    color: white;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(75,53,183,.22);
    transition: transform .18s ease, box-shadow .18s ease;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 13px 30px rgba(75,53,183,.32); }
.primary-button span { margin-right: 5px; }
.primary-button.wide { width: 100%; margin-top: 8px; }

.view { display: none; animation: fadeIn .28s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.stats-grid, .insights-grid, .simulator-grid {
    display: grid;
    gap: 16px;
}
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.insights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.simulator-grid { grid-template-columns: minmax(300px, .7fr) minmax(0, 1.3fr); }

.stat-card, .panel {
    border: 1px solid var(--border);
    background: linear-gradient(145deg, rgba(15,20,36,.98), rgba(12,16,30,.98));
    box-shadow: 0 18px 45px rgba(0,0,0,.12);
}

.stat-card {
    min-height: 132px;
    border-radius: 14px;
    padding: 20px;
    overflow: hidden;
}

.stat-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--secondary);
    font-size: 12px;
}

.stat-card strong {
    display: block;
    margin-top: 13px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 29px;
}

.trend {
    border-radius: 20px;
    padding: 5px 8px;
    background: rgba(40,201,138,.09);
    color: var(--green);
    font-size: 10px;
}

.mini-bar {
    height: 6px;
    margin-top: 17px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}
.mini-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--deep-purple), var(--lavender));
    box-shadow: 0 0 12px rgba(198,150,246,.35);
}

.panel { border-radius: 14px; padding: 22px; }
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.panel-header h2, .dialog-header h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    letter-spacing: -.02em;
}

.spending-chart {
    height: 230px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 12px;
    border-bottom: 1px solid var(--border);
}
.chart-column {
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}
.chart-column-bar {
    width: min(34px, 70%);
    min-height: 3px;
    border-radius: 8px 8px 2px 2px;
    background: linear-gradient(180deg, var(--lavender), var(--deep-purple));
    box-shadow: 0 0 16px rgba(146,111,250,.16);
    transition: height .45s ease;
}
.chart-column span { color: var(--secondary); font-size: 9px; }

.growth-chart {
    height: 230px;
    margin-top: 20px;
    position: relative;
}
.growth-chart svg {
    width: 100%;
    height: 188px;
    overflow: visible;
}
.growth-grid line { stroke: var(--border); stroke-width: 1; }
.growth-labels {
    display: flex;
    justify-content: space-between;
    color: var(--secondary);
    font-size: 9px;
    padding: 2px 2.5% 0;
}
.growth-summary {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 4px;
}
.growth-summary span { color: var(--secondary); font-size: 10px; }
.growth-summary strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
    color: var(--lavender);
}

.category-layout {
    display: grid;
    grid-template-columns: 150px 1fr;
    align-items: center;
    gap: 20px;
    min-height: 230px;
}
.donut {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--violet) 0 25%, var(--pink) 25% 50%, var(--blue) 50% 75%, var(--green) 75% 100%);
    box-shadow: 0 0 25px rgba(146,111,250,.12);
}
.donut::after {
    content: "";
    width: 102px;
    height: 102px;
    border-radius: 50%;
    background: var(--card);
}
.category-list { display: grid; gap: 11px; }
.category-row { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 9px; font-size: 11px; }
.category-dot { width: 8px; height: 8px; border-radius: 50%; }
.category-row strong { font-size: 11px; }

.insight {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.insight:last-child { border-bottom: 0; }
.insight-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(146,111,250,.12);
    color: var(--lavender);
}
.insight strong { font-size: 12px; }
.insight p { margin: 5px 0 0; color: var(--secondary); font-size: 11px; line-height: 1.5; }

.transaction-toolbar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}
.search-input, .settings-card input, .settings-card select, dialog input, dialog select {
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0B0F1B;
    color: var(--text);
    outline: none;
}
.search-input { width: 240px; padding: 0 12px; }
.search-input:focus, dialog input:focus, dialog select:focus { border-color: var(--violet); }

.transaction-table { width: 100%; border-collapse: collapse; }
.transaction-table th {
    height: 40px;
    color: var(--secondary);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    text-align: left;
}
.transaction-table td { height: 58px; border-top: 1px solid var(--border); font-size: 12px; }
.transaction-table td:nth-child(2) { color: var(--secondary); }
.amount-income { color: var(--green); }
.amount-expense { color: var(--text); }
.delete-button {
    border: 0;
    background: transparent;
    color: var(--secondary);
    opacity: 0;
    transition: opacity .15s;
}
.transaction-table tr:hover .delete-button { opacity: 1; }
.empty-state { padding: 44px 20px; color: var(--secondary); text-align: center; }

.simulator-form label, dialog label, .settings-card label {
    display: grid;
    gap: 8px;
    color: var(--secondary);
    font-size: 11px;
}
.simulator-form input, .simulator-form select {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0B0F1B;
    color: var(--text);
    padding: 0 12px;
    outline: none;
}
.simulator-form .form-grid { margin: 14px 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.sim-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.time-result { border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.time-result span { color: var(--secondary); font-size: 10px; }
.time-result strong { display: block; margin-top: 8px; font-family: Georgia, serif; font-size: 22px; }
.saved-comparison {
    min-height: 210px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 20px;
    padding: 18px 20px 8px;
    border-top: 1px solid var(--border);
}
.compare-column { width: 35%; height: 160px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.compare-bar { width: 100%; min-height: 8px; border-radius: 8px 8px 2px 2px; transition: height .45s ease; }
.spending-bar { background: linear-gradient(180deg, var(--pink), rgba(244,164,216,.25)); }
.saved-bar { background: linear-gradient(180deg, var(--lavender), var(--deep-purple)); box-shadow: 0 0 18px rgba(146,111,250,.18); }
.compare-column strong { font-size: 13px; }
.compare-column span { color: var(--secondary); font-size: 10px; }

dialog {
    width: min(520px, calc(100vw - 28px));
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    color: var(--text);
    box-shadow: 0 30px 100px rgba(0,0,0,.55);
}
dialog::backdrop { background: rgba(5,7,13,.72); backdrop-filter: blur(5px); }
dialog form { display: grid; gap: 15px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--secondary); font-size: 20px; }
dialog label { display: grid; gap: 8px; color: var(--secondary); font-size: 11px; }
dialog input, dialog select { width: 100%; padding: 0 11px; }

.settings-card { max-width: 520px; display: grid; gap: 16px; }
.settings-card input { width: 100%; padding: 0 12px; }
.settings-divider { height: 1px; background: var(--border); margin: 4px 0; }
.settings-description { margin: -4px 0 2px; color: var(--secondary); font-size: 12px; line-height: 1.6; }
.settings-actions { display: flex; gap: 10px; }
.secondary-button, .danger-button {
    min-height: 40px;
    border-radius: 8px;
    padding: 0 13px;
    font-size: 12px;
    font-weight: 700;
}
.secondary-button { border: 1px solid var(--border); background: var(--card); color: var(--text); }
.danger-button { border: 1px solid rgba(244,164,216,.24); background: rgba(244,164,216,.08); color: var(--pink); }

.finances-card { max-width: 900px; }
.finance-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 22px 0 16px;
}
.finance-form label {
    display: grid;
    gap: 7px;
    min-height: 94px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(9,12,22,.48);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}
.finance-form input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #0B0F1B;
    color: var(--text);
    padding: 0 11px;
    outline: none;
}
.finance-form input:focus { border-color: var(--violet); }
.finance-form label span {
    color: var(--secondary);
    font-size: 10px;
    font-weight: 400;
}

@media (max-width: 950px) {
    body { grid-template-columns: 170px 1fr; }
    .dashboard-content { padding: 32px 24px; }
    .insights-grid, .simulator-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    body { grid-template-columns: 1fr; }
    .dashboard-sidebar { min-height: auto; padding: 18px 14px 10px; }
    .brand-row { justify-content: center; }
    .tab-grid { grid-template-columns: repeat(2, 1fr); margin-top: 20px; }
    .tab { min-height: 42px; text-align: center; padding: 6px; }
    .tab.active { box-shadow: inset 0 -3px 0 var(--violet); }
    .dashboard-content { padding: 24px 14px 40px; }
    .page-header { align-items: flex-end; }
    .primary-button { padding: 0 11px; }
    .stats-grid { grid-template-columns: 1fr; }
    .finance-form { grid-template-columns: 1fr; }
    .category-layout { grid-template-columns: 120px 1fr; }
    .donut { width: 120px; height: 120px; }
    .donut::after { width: 82px; height: 82px; }
    .sim-results { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .search-input { width: 180px; }
}
