:root {
    --app-bg: #f4f6f8;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-ink: #151b2d;
    --app-muted: #647084;
    --app-line: #dfe5ee;
    --app-line-strong: #c9d2df;
    --app-primary: #2563eb;
    --app-primary-dark: #1d4ed8;
    --app-sidebar: #101827;
    --app-sidebar-soft: #1c2636;
    --app-green: #0f9f6e;
    --app-yellow: #b7791f;
    --app-red: #dc3545;
    --app-cyan: #0891b2;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md: 0 14px 32px rgba(15, 23, 42, .08);
}

* {
    letter-spacing: 0;
}

body {
    min-height: 100vh;
    background: var(--app-bg);
    color: var(--app-ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    text-rendering: optimizeLegibility;
}

a {
    text-decoration: none;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 440px;
    background: var(--app-bg);
}

.auth-aside {
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 48px;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, .92), rgba(15, 24, 39, .96)),
        url("https://images.unsplash.com/photo-1497366811353-6870744d04b2?auto=format&fit=crop&w=1400&q=80") center/cover;
}

.auth-aside::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(9, 15, 28, .38);
}

.auth-aside-content {
    position: relative;
    max-width: 560px;
}

.auth-main {
    display: grid;
    place-items: center;
    padding: 32px;
}

.auth-card {
    width: min(100%, 390px);
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    padding: 30px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--app-primary);
    box-shadow: 0 10px 24px rgba(37, 99, 235, .22);
}

.brand-mark.small {
    width: 38px;
    height: 38px;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 20px;
    background: var(--app-sidebar);
    color: #e5e7eb;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 22px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    color: #cbd5e1;
    border-radius: 8px;
    padding: 11px 12px;
    font-weight: 700;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    color: #fff;
    background: var(--app-sidebar-soft);
}

.sidebar-user {
    margin-top: 22px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 8px;
    background: rgba(255, 255, 255, .05);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    background: #0f9f6e;
    font-weight: 800;
}

.main-panel {
    min-width: 0;
    padding: 30px;
}

.page-wrap {
    max-width: 1480px;
    margin: 0 auto;
}

.topbar,
.panel-card,
.todo-card,
.stat-card {
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.topbar {
    padding: 22px 24px;
    margin-bottom: 22px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--app-primary);
    font-size: .78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.panel-card {
    padding: 20px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
    min-height: 104px;
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--stat-color, var(--app-primary));
}

.stat-total {
    --stat-color: var(--app-primary);
}

.stat-completed {
    --stat-color: var(--app-green);
}

.stat-pending {
    --stat-color: #d89917;
}

.stat-overdue {
    --stat-color: var(--app-red);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--stat-color, var(--app-primary));
    background: color-mix(in srgb, var(--stat-color, var(--app-primary)) 12%, white);
    font-size: 1.08rem;
}

.progress-mini {
    height: 8px;
    border-radius: 999px;
    background: #e8edf4;
    overflow: hidden;
}

.progress-mini-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--app-green);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.sticky-panel {
    position: sticky;
    top: 24px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.completion-panel {
    padding: 14px;
    border: 1px solid var(--app-line);
    border-radius: 8px;
    background: var(--app-surface-soft);
}

.filter-card {
    margin-bottom: 16px;
}

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

.todo-card {
    position: relative;
    padding: 18px 18px 18px 20px;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.todo-card::before {
    content: "";
    position: absolute;
    inset: 16px auto 16px 0;
    width: 4px;
    border-radius: 0 8px 8px 0;
    background: var(--priority-color, var(--app-primary));
}

.todo-card:hover {
    border-color: var(--app-line-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.todo-card.completed {
    background: #fbfdfb;
}

.todo-title {
    font-size: 1.04rem;
    line-height: 1.35;
}

.todo-title.completed {
    color: var(--app-muted);
    text-decoration: line-through;
}

.priority-low {
    --priority-color: var(--app-cyan);
    background: var(--app-cyan);
}

.priority-medium {
    --priority-color: #d89917;
    background: #d89917;
}

.priority-high {
    --priority-color: #ef4444;
    background: #ef4444;
}

.priority-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.badge-soft {
    border: 1px solid transparent;
    font-weight: 800;
    padding: .42rem .58rem;
}

.badge-soft.success {
    color: #0f6b47;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.badge-soft.warning {
    color: #8a570d;
    background: #fff4cf;
    border-color: #f8d775;
}

.badge-soft.danger {
    color: #a51d2a;
    background: #fee2e2;
    border-color: #fecaca;
}

.badge-soft.neutral {
    color: #3e4b5d;
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
}

.btn-primary {
    background: var(--app-primary);
    border-color: var(--app-primary);
}

.btn-primary:hover {
    background: var(--app-primary-dark);
    border-color: var(--app-primary-dark);
}

.form-label {
    margin-bottom: 7px;
    color: #243044;
}

.form-control,
.form-select,
.input-group-text {
    border-color: var(--app-line);
    border-radius: 8px;
}

.form-control,
.form-select {
    min-height: 46px;
    padding: 10px 12px;
}

textarea.form-control {
    min-height: 106px;
}

.input-group .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.form-control:focus,
.form-select:focus {
    border-color: rgba(37, 99, 235, .55);
    box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}

.empty-state {
    border: 1px dashed var(--app-line-strong);
    border-radius: 8px;
    padding: 42px 22px;
    text-align: center;
    background: var(--app-surface);
}

.action-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    padding: 0;
}

.icon-btn {
    border-color: var(--app-line);
    background: var(--app-surface);
}

.icon-btn:hover {
    background: var(--app-surface-soft);
}

.todo-actions {
    display: flex;
    gap: 8px;
}

.pagination {
    margin-bottom: 0;
}

@media (max-width: 1199px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .sticky-panel {
        position: static;
    }
}

@media (max-width: 991px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        height: auto;
        padding: 16px;
    }

    .sidebar-brand {
        padding-bottom: 14px;
        margin-bottom: 12px;
    }

    .sidebar .nav {
        flex-direction: row;
    }

    .sidebar-user {
        display: none;
    }

    .main-panel {
        padding: 18px;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-aside {
        min-height: 260px;
        padding: 28px;
    }
}

@media (max-width: 575px) {
    .topbar,
    .panel-card,
    .todo-card,
    .stat-card,
    .auth-card {
        border-radius: 8px;
    }

    .topbar {
        padding: 18px;
    }

    .todo-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .auth-main {
        padding: 18px;
    }

    .auth-card {
        padding: 22px;
    }
}
