* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --text: #202238;
    --muted: #85889d;
    --line: #ececf3;
    --purple: #7768e8;
    --purple-dark: #6252d5;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: 0.3s;
}

body.dark {
    --bg: #111326;
    --surface: #1b1e36;
    --text: #f1f1fa;
    --muted: #a0a2b8;
    --line: #30334c;
}

button, input, select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app {
    min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
    width: 248px;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 29px 18px;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font: 800 23px 'Manrope', sans-serif;
    padding: 0 8px 45px;
    letter-spacing: -1px;
}

.brand > span:last-child {
    color: var(--purple);
}

.brand-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #9384ff, #6354d7);
    color: white;
    border-radius: 11px;
    font-size: 22px;
}

.menu-label {
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 1.5px;
    margin: 0 10px 15px;
}

.sidebar nav {
    display: grid;
    gap: 7px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.nav-link:hover,
.nav-link.active {
    background: #f0eeff;
    color: var(--purple);
}

.dark .nav-link.active {
    background: #302c55;
}

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-card {
    background: linear-gradient(145deg, #f2efff, #f8f6ff);
    padding: 18px;
    border-radius: 14px;
    margin-bottom: 20px;
    color: #353052;
}

.dark .sidebar-card {
    background: #302b50;
    color: white;
}

.sparkle {
    font-size: 22px;
    color: var(--purple);
    margin-bottom: 10px;
}

.sidebar-card h3 {
    font-size: 13px;
}

.sidebar-card p {
    font-size: 11px;
    color: #88839f;
    line-height: 1.6;
    margin: 8px 0 12px;
}

.sidebar-card button {
    border: none;
    background: transparent;
    color: var(--purple);
    font-size: 11px;
    font-weight: 700;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 17px;
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e6e1ff;
    color: #6556d6;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.profile strong {
    font-size: 11px;
    display: block;
}

.profile small {
    font-size: 10px;
    color: var(--muted);
}

/* MAIN */

.main {
    margin-left: 248px;
    padding: 0 43px;
}

.topbar {
    height: 82px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.breadcrumb {
    font-size: 12px;
    color: var(--muted);
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 17px;
    font-size: 11px;
    color: var(--muted);
}

.top-actions .avatar {
    width: 30px;
    height: 30px;
}

.theme-btn,
.mobile-menu {
    width: 35px;
    height: 35px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-size: 18px;
}

.mobile-menu {
    display: none;
}

/* PAGE */

.page {
    padding: 35px 0 20px;
}

.hidden {
    display: none !important;
}

.welcome,
.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.welcome h1,
.page-heading h1 {
    font: 800 29px 'Manrope', sans-serif;
    margin: 7px 0;
    letter-spacing: -1px;
}

.eyebrow {
    font-size: 10px;
    letter-spacing: 1.4px;
    color: #999ab0;
    font-weight: 700;
}

.muted {
    font-size: 12px;
    color: var(--muted);
}

.primary-btn {
    background: var(--purple);
    color: white;
    border: none;
    border-radius: 9px;
    padding: 12px 17px;
    font-size: 12px;
    font-weight: 700;
    transition: 0.2s;
}

.primary-btn:hover {
    background: var(--purple-dark);
    transform: translateY(-2px);
}

/* HERO */

.hero {
    min-height: 230px;
    background: linear-gradient(110deg, #222447, #302d62, #51469c);
    border-radius: 17px;
    color: white;
    padding: 30px 34px;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-tag {
    font-size: 10px;
    letter-spacing: 1.4px;
    color: #c9c5ff;
}

.hero h2 {
    font: 800 34px/1.1 'Manrope', sans-serif;
    margin: 16px 0 9px;
}

.hero h2 span {
    color: #a99fff;
}

.hero p {
    color: #c5c3e2;
    font-size: 11px;
    margin-bottom: 17px;
}

.hero-btn {
    background: #ffffff15;
    border: 1px solid #7771b2;
    color: white;
    border-radius: 8px;
    padding: 10px 13px;
    font-size: 11px;
}

.hero-decoration {
    position: absolute;
    right: 5%;
    top: 0;
    width: 40%;
    height: 100%;
}

.hero-circle {
    width: 205px;
    height: 205px;
    border-radius: 50%;
    position: absolute;
    right: 15%;
    top: 15px;
    border: 1px solid #ffffff30;
    box-shadow: 0 0 0 25px #ffffff08,
                0 0 0 50px #ffffff05;
}

.hero-floating-card {
    position: absolute;
    top: 85px;
    right: 12%;
    background: white;
    color: #30304f;
    padding: 13px 16px;
    border-radius: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    transform: rotate(-5deg);
    box-shadow: 0 15px 35px #10102a55;
}

.hero-floating-card > span {
    background: #e4f8f0;
    color: #2dba8a;
    padding: 8px;
    border-radius: 8px;
}

.hero-floating-card strong,
.hero-floating-card small {
    display: block;
    font-size: 10px;
}

.hero-floating-card small {
    color: #999;
    margin-top: 4px;
}

/* STATS */

.stats,
.finance-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 18px;
    box-shadow: 0 12px 35px #25274e08;
}

.stat-heading {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 11px;
}

.stat-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
}

.purple {
    background: #f0edff;
    color: #7869e8;
}

.green {
    background: #e4f8f1;
    color: #36b88d;
}

.orange {
    background: #fff0e6;
    color: #e59b63;
}

.stat-card h2 {
    font: 800 25px 'Manrope', sans-serif;
    margin: 11px 0 3px;
}

.stat-card small {
    color: var(--muted);
    font-size: 10px;
}

.progress {
    height: 4px;
    background: var(--bg);
    margin-top: 13px;
    border-radius: 5px;
    overflow: hidden;
}

.progress div {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #8d7cff, #60d5b2);
    transition: 0.3s;
}

/* PANELS */

.content-grid {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 16px;
    margin-bottom: 17px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 20px;
    margin-bottom: 17px;
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 17px;
}

.panel-heading h3,
.panel > h3 {
    font: 700 14px 'Manrope', sans-serif;
    margin-bottom: 5px;
}

.panel-heading p {
    color: var(--muted);
    font-size: 10px;
}

.text-btn,
.add-inline {
    border: none;
    background: transparent;
    color: var(--purple);
    font-size: 11px;
    font-weight: 700;
}

.add-inline {
    margin-top: 14px;
}

.task-list,
.habit-list,
.expense-list {
    display: grid;
    gap: 9px;
}

.task-row,
.habit-row,
.expense-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px;
    background: var(--bg);
    border-radius: 9px;
    margin-bottom: 9px;
}

.check-box {
    width: 18px;
    height: 18px;
    border: 1.5px solid #c9c7dc;
    border-radius: 5px;
    background: transparent;
    color: white;
    flex-shrink: 0;
}

.check-box.checked {
    background: var(--purple);
    border-color: var(--purple);
}

.task-info,
.habit-info,
.expense-info {
    flex: 1;
    min-width: 0;
}

.task-info strong,
.habit-info strong,
.expense-info strong {
    display: block;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-info small,
.habit-info small,
.expense-info small {
    display: block;
    color: var(--muted);
    font-size: 9px;
    margin-top: 4px;
}

.task-row.done .task-info strong {
    text-decoration: line-through;
    color: var(--muted);
}

.priority {
    font-size: 9px;
    padding: 5px 7px;
    border-radius: 5px;
    background: #f1efff;
    color: #796be2;
}

.priority.High {
    background: #fff0ed;
    color: #df826e;
}

.priority.Low {
    background: #e8f7f1;
    color: #3aaf89;
}

.row-delete {
    border: none;
    background: transparent;
    color: #aaa;
    font-size: 17px;
}

.habit-icon,
.expense-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: #eeebff;
    color: var(--purple);
}

.habit-check {
    margin-left: auto;
}

.expense-icon {
    background: #fff0e6;
    color: #df9a66;
}

.expense-amount {
    font-size: 11px;
    font-weight: 700;
}

.empty-state {
    text-align: center;
    padding: 23px 10px;
    background: var(--bg);
    border-radius: 9px;
    color: var(--muted);
    font-size: 11px;
}

.empty-state strong {
    display: block;
    color: var(--text);
    margin-bottom: 5px;
}

/* HABITS */

.habit-banner {
    background: linear-gradient(110deg, #e9e5ff, #f5f1ff);
    padding: 23px;
    border-radius: 14px;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dark .habit-banner {
    background: #302b50;
}

.habit-banner h2 {
    font: 800 21px 'Manrope', sans-serif;
    margin: 9px 0;
}

.habit-banner p:not(.eyebrow) {
    font-size: 11px;
    color: var(--muted);
}

.habit-banner > strong {
    font: 800 30px 'Manrope', sans-serif;
    color: var(--purple);
}

/* SELECT */

select {
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 10px;
}

/* MODAL */

.modal {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 28px;
    width: min(440px, calc(100% - 30px));
    background: var(--surface);
    color: var(--text);
    margin: auto;
}

.modal::backdrop {
    background: #14152b88;
    backdrop-filter: blur(3px);
}

.modal form {
    display: grid;
    gap: 16px;
}

.modal h2 {
    font: 800 23px 'Manrope', sans-serif;
}

.modal label {
    display: grid;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
}

.modal input,
.modal select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    font-size: 12px;
}

.modal input:focus,
.modal select:focus {
    border-color: var(--purple);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.secondary-btn {
    padding: 10px 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
}

.close-btn {
    position: absolute;
    right: 17px;
    top: 12px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
}

/* FOOTER */

footer {
    padding: 20px 0;
    color: var(--muted);
    font-size: 10px;
}

footer > span {
    float: right;
}

.fine-print {
    font-size: 10px;
    color: var(--muted);
}

.toast {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translate(-50%, 20px);
    opacity: 0;
    background: #252747;
    color: white;
    padding: 12px 18px;
    border-radius: 9px;
    font-size: 11px;
    transition: .25s;
    pointer-events: none;
    z-index: 20;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* MOBILE */

@media(max-width: 1050px) {
    .main {
        padding: 0 25px;
    }
}

@media(max-width: 760px) {

    .sidebar {
        transform: translateX(-100%);
        transition: .3s;
        width: 255px;
        box-shadow: 10px 0 30px #15152a12;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
        padding: 0 16px;
    }

    .mobile-menu {
        display: block;
        margin-right: 10px;
    }

    .topbar {
        height: 65px;
    }

    .top-actions {
        gap: 8px;
    }

    #todayDate {
        display: none;
    }

    .welcome h1,
    .page-heading h1 {
        font-size: 24px;
    }

    .hero {
        min-height: 220px;
        padding: 24px;
    }

    .hero-decoration {
        right: -70px;
        opacity: .6;
        width: 60%;
    }

    .stats,
    .finance-stats {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .stats .stat-card:last-child {
        grid-column: span 2;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .welcome,
    .page-heading {
        align-items: flex-end;
    }

    .welcome .primary-btn,
    .page-heading .primary-btn {
        padding: 10px;
        font-size: 10px;
    }
}

@media(max-width: 420px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .hero h2 {
        font-size: 28px;
    }

    .stat-card {
        padding: 13px;
    }
}