:root {
    --bg: #151619;
    --panel: rgba(255, 255, 255, .09);
    --panel-strong: rgba(255, 255, 255, .14);
    --border: rgba(255, 255, 255, .16);
    --text: #f4f4f5;
    --muted: #b9bcc3;
    --soft: #8f949d;
    --accent: #9bd4d6;
    --danger: #ff8f8f;
    --success: #a7e3bd;
    --shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

@font-face {
    font-family: Vazirmatn;
    src: url("../fonts/Vazirmatn.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: Vazirmatn, Tahoma, Arial, sans-serif;
    background:
        radial-gradient(circle at 15% 10%, rgba(255, 255, 255, .14), transparent 28%),
        linear-gradient(135deg, #0d0e10 0%, #202226 48%, #111214 100%);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }

.app-shell {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    background: rgba(18, 19, 22, .72);
    border-left: 1px solid var(--border);
    backdrop-filter: blur(22px);
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 26px;
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--panel-strong);
    border: 1px solid var(--border);
    font-weight: 800;
}

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

.sidebar nav {
    display: grid;
    gap: 8px;
}

.sidebar nav a, .logout-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 16px;
    color: #e8e8ea;
    transition: .2s ease;
}

.sidebar nav a:hover, .logout-link:hover {
    background: var(--panel);
}

.logout-link {
    margin-top: 26px;
    color: var(--danger);
}

.content {
    padding: 28px;
    max-width: 1500px;
    width: 100%;
}

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

.topbar h1, .topbar p { margin: 0; }

.menu-toggle { display: none; }

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

.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.card, .table-wrap, .form-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
}

.card { padding: 20px; }

.stat-value {
    font-size: 28px;
    font-weight: 800;
    margin-top: 10px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

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

.btn, button, input[type="submit"] {
    border: 0;
    border-radius: 14px;
    padding: 10px 14px;
    font-family: inherit;
    cursor: pointer;
    color: #101113;
    background: linear-gradient(180deg, #f4f4f5, #cdd0d4);
    font-weight: 700;
}

.btn.secondary {
    color: var(--text);
    background: var(--panel-strong);
    border: 1px solid var(--border);
}

.btn.danger {
    color: #2d0d0d;
    background: linear-gradient(180deg, #ffd1d1, #ff9c9c);
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #f4f4f5;
    font-size: 12px;
    border: 1px solid var(--border);
}

.badge.danger { color: var(--danger); }
.badge.success { color: var(--success); }
.badge.accent { color: var(--accent); }

.date-tip {
    cursor: help;
    border-bottom: 1px dotted rgba(255, 255, 255, .38);
}

.done-toggle {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    color: var(--text);
    background: rgba(255, 255, 255, .08);
    border: 1px solid var(--border);
}

.done-toggle.is-done {
    color: #102016;
    background: var(--success);
}

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

.subtask-item,
.subtask-form {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
    align-items: center;
}

.subtask-form {
    grid-template-columns: 1fr auto;
}

.subtask-meta {
    color: var(--muted);
    font-size: 12px;
}

.table-wrap { overflow-x: auto; }

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

th, td {
    padding: 14px;
    text-align: right;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    vertical-align: top;
}

th {
    color: #e2e3e6;
    font-weight: 700;
    background: rgba(255, 255, 255, .05);
}

.form-card {
    padding: 20px;
    margin-bottom: 18px;
}

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

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

label {
    display: block;
    margin-bottom: 7px;
    color: #e9eaec;
    font-size: 14px;
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 11px 13px;
    background: rgba(255, 255, 255, .1);
    color: var(--text);
    outline: none;
    font-family: inherit;
}

.jalali-picker {
    position: absolute;
    z-index: 50;
    width: 290px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(25, 26, 30, .96);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(24px);
}

.jalali-picker-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.jalali-picker-head button,
.jalali-day {
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
}

.jalali-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.jalali-weekday,
.jalali-day {
    text-align: center;
    font-size: 12px;
}

.jalali-weekday { color: var(--muted); }

.jalali-day {
    color: var(--text);
    background: rgba(255, 255, 255, .08);
    border: 1px solid transparent;
    border-radius: 10px;
}

.jalali-day:hover,
.jalali-day.is-selected {
    color: #101113;
    background: var(--accent);
}

.jalali-day.is-today {
    border-color: var(--accent);
}

.jalali-picker-foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

.jalali-picker-foot button {
    flex: 1;
    color: var(--text);
    background: rgba(255, 255, 255, .1);
    border: 1px solid var(--border);
}

select option { color: #111; }
textarea { min-height: 110px; resize: vertical; }

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.alert {
    padding: 12px 14px;
    border-radius: 16px;
    margin-bottom: 14px;
    background: rgba(155, 212, 214, .12);
    border: 1px solid rgba(155, 212, 214, .28);
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(430px, 100%);
}

.sensitive-content.is-hidden {
    filter: blur(6px);
    user-select: none;
}

@media (max-width: 1000px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        z-index: 20;
        right: -290px;
        width: 280px;
        transition: right .2s ease;
    }
    body.menu-open .sidebar { right: 0; }
    .menu-toggle {
        display: inline-grid;
        place-items: center;
        width: 44px;
        height: 44px;
        color: var(--text);
        background: var(--panel);
        border: 1px solid var(--border);
    }
    .grid.stats, .grid.two, .form-grid, .filters {
        grid-template-columns: 1fr;
    }
    .content { padding: 18px; }
}
