:root {
    --bg: #FAF9FE;
    --bg-soft: #F1EDFA;
    --surface: #FFFFFF;
    --surface-hover: #F5F2FC;
    --primary: #6236E0;
    --primary-hover: #5024C4;
    --primary-pressed: #4519A3;
    --secondary: #0891B2;
    --fg: #17151F;
    --fg-muted: #6B6577;
    --border: #E4E1EE;

    --success: #16a34a;
    --success-bg: rgba(22, 163, 74, 0.1);
    --danger: #DB2777;
    --danger-bg: rgba(219, 39, 119, 0.1);
    --warning: #B45309;
    --warning-bg: rgba(180, 83, 9, 0.1);

    --radius-sm: 0.375rem;
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-pill: 9999px;

    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--fg);
    position: relative;
}

.bg-glow {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(600px circle at 15% -10%, rgba(98, 54, 224, 0.10), transparent 60%),
        radial-gradient(500px circle at 100% 0%, rgba(8, 145, 178, 0.08), transparent 55%);
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.topbar {
    padding: 20px 0 8px;
}

.nav-pill {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(23, 21, 31, 0.05);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--fg);
    text-decoration: none;
}

.brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    font-family: "JetBrains Mono", monospace;
    font-weight: 600;
    font-size: 0.78rem;
    flex-shrink: 0;
}

main.container {
    padding-top: 28px;
    padding-bottom: 48px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
    color: var(--fg);
}

.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.filter {
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.filter:hover {
    border-color: var(--primary);
    color: var(--fg);
}

.filter.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Card used for the task table and the form */
.task-table, .task-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px rgba(23, 21, 31, 0.05);
}

.task-table {
    width: 100%;
    border-collapse: collapse;
    overflow: hidden;
}

.task-table th, .task-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: top;
}

.task-table tbody tr:last-child td {
    border-bottom: none;
}

.task-table th {
    color: var(--fg-muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: "JetBrains Mono", monospace;
}

.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: capitalize;
    font-family: "JetBrains Mono", monospace;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.priority-low { background: rgba(8, 145, 178, 0.1); color: var(--secondary); border-color: rgba(8, 145, 178, 0.25); }
.priority-medium { background: var(--warning-bg); color: var(--warning); border-color: rgba(180, 83, 9, 0.25); }
.priority-high { background: var(--danger-bg); color: var(--danger); border-color: rgba(219, 39, 119, 0.25); }

.status-pending { background: rgba(107, 101, 119, 0.1); color: var(--fg-muted); border-color: var(--border); }
.status-in_progress { background: rgba(8, 145, 178, 0.1); color: var(--secondary); border-color: rgba(8, 145, 178, 0.25); }
.status-done { background: var(--success-bg); color: var(--success); border-color: rgba(22, 163, 74, 0.25); }

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.actions form {
    display: inline;
}

.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--fg);
    text-decoration: none;
    cursor: pointer;
    font-size: 0.88rem;
    font-family: inherit;
    font-weight: 500;
    transition: border-color 0.15s ease, background 0.15s ease;
}

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

.btn-small {
    padding: 5px 12px;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

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

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

.btn-danger {
    color: var(--danger);
    border-color: rgba(219, 39, 119, 0.3);
}

.btn-danger:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
}

.empty-state {
    color: var(--fg-muted);
    text-align: center;
    padding: 48px 24px;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

.task-form {
    padding: 28px;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-form label {
    font-weight: 600;
    font-size: 0.82rem;
    margin-top: 12px;
    color: var(--fg-muted);
}

.task-form input, .task-form textarea, .task-form select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-soft);
    color: var(--fg);
}

.task-form input:focus, .task-form textarea:focus, .task-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(98, 54, 224, 0.15);
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row > div {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
}

.task-form button {
    margin-top: 20px;
    align-self: flex-start;
}

.flash-wrapper {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash {
    padding: 11px 16px;
    border-radius: var(--radius);
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(22, 163, 74, 0.25);
}

.flash-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(219, 39, 119, 0.25);
}

.footer {
    padding: 24px 0 40px;
    color: var(--fg-muted);
    text-align: center;
    font-size: 0.82rem;
}

/* Responsive: collapse the table into stacked cards below 700px */
@media (max-width: 700px) {
    .page-header h1 {
        font-size: 1.35rem;
    }

    .nav-pill {
        padding: 10px 16px;
    }

    .task-table thead {
        display: none;
    }

    .task-table, .task-table tbody, .task-table tr, .task-table td {
        display: block;
        width: 100%;
    }

    .task-table {
        border: none;
        background: transparent;
        box-shadow: none;
    }

    .task-table tbody tr {
        margin-bottom: 14px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: 0 1px 3px rgba(23, 21, 31, 0.05);
        overflow: hidden;
    }

    .task-table td {
        border-bottom: 1px solid var(--border);
        padding: 10px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        text-align: right;
    }

    .task-table td:last-child {
        border-bottom: none;
    }

    .task-table td::before {
        content: attr(data-label);
        font-family: "JetBrains Mono", monospace;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--fg-muted);
        text-align: left;
        flex-shrink: 0;
    }

    .task-table td.actions {
        justify-content: flex-start;
    }

    .task-table td.actions::before {
        display: none;
    }

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

    .task-form {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
