:root {
    --bg-0: #07070A;
    --bg-1: #0C0C10;
    --bg-2: #111116;
    --bg-3: #19191F;
    --bg-4: #222229;
    --border: rgba(255,255,255,0.06);
    --border-hover: rgba(255,255,255,0.12);
    --text-1: #F0F0F2;
    --text-2: #A0A0AB;
    --text-3: #62626B;
    --accent: #F59E0B;
    --accent-dim: rgba(245,158,11,0.15);
    --accent-glow: rgba(245,158,11,0.08);
    --red: #EF4444;
    --red-dim: rgba(239,68,68,0.12);
    --green: #22C55E;
    --green-dim: rgba(34,197,94,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-1);
    background: var(--bg-0);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ---- GRAIN OVERLAY ---- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.3;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 128px 128px;
}

/* ---- TOP BAR ---- */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
}

.topbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-dim) 50%, transparent);
    opacity: 0.5;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    margin-right: 32px;
    flex-shrink: 0;
}

.brand-mark {
    width: 30px;
    height: 30px;
    background: var(--accent);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 11px;
    color: var(--bg-0);
    letter-spacing: -0.02em;
    box-shadow: 0 0 16px var(--accent-dim), 0 2px 4px rgba(0,0,0,0.3);
    transition: box-shadow 0.3s ease;
    flex-shrink: 0;
}

.topbar-brand:hover .brand-mark {
    box-shadow: 0 0 24px var(--accent-dim), 0 2px 8px rgba(0,0,0,0.4);
}

.brand-text {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-1);
    letter-spacing: -0.01em;
}

/* ---- TOP NAV ---- */
.topbar-nav {
    display: flex;
    align-items: center;
    gap: 2px;
}

.topbar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-3);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.topbar-nav a:hover {
    color: var(--text-2);
    background: rgba(255,255,255,0.04);
}

.topbar-nav a.active {
    color: var(--text-1);
    background: rgba(255,255,255,0.06);
}

.topbar-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
}

.topbar-nav a svg {
    width: 16px;
    height: 16px;
    opacity: 0.45;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.topbar-nav a:hover svg { opacity: 0.7; }
.topbar-nav a.active svg { opacity: 0.9; }

/* ---- MOBILE TOGGLE ---- */
.mobile-toggle {
    display: none;
    margin-left: auto;
    width: 36px;
    height: 36px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    transition: all 0.2s;
}

.mobile-toggle:hover { background: var(--bg-3); color: var(--text-1); }
.mobile-toggle svg { width: 18px; height: 18px; }

/* ---- TASK TABS ---- */
.task-tabs {
    display: flex;
    gap: 2px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 32px;
    width: fit-content;
}

.task-tabs a {
    padding: 7px 18px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-3);
    text-decoration: none;
    transition: all 0.2s ease;
}

.task-tabs a:hover {
    color: var(--text-2);
}

.task-tabs a.active {
    background: var(--bg-4);
    color: var(--text-1);
}

/* ---- MAIN ---- */
main {
    margin-top: 56px;
    min-height: calc(100vh - 56px);
    position: relative;
}

.page {
    max-width: 1040px;
    margin: 0 auto;
    padding: 48px 48px 120px;
}

.page--wide {
    max-width: 1200px;
}

/* ---- TYPOGRAPHY ---- */
h1 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 36px;
    line-height: 1.15;
    letter-spacing: -0.035em;
    color: var(--text-1);
}

h2 {
    font-family: 'Syne', sans-serif;
    font-weight: 600;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--text-1);
}

.label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* ---- FORM ---- */
textarea, input[type="text"], input[type="number"] {
    width: 100%;
    padding: 12px 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    color: var(--text-1);
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}

textarea:focus, input[type="text"]:focus, input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

textarea::placeholder, input::placeholder {
    color: var(--text-3);
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn--primary {
    background: var(--accent);
    color: var(--bg-0);
}

.btn--primary:hover {
    background: #D97706;
    box-shadow: 0 0 24px var(--accent-dim);
}

.btn--ghost {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}

.btn--ghost:hover {
    border-color: var(--border-hover);
    color: var(--text-1);
    background: var(--bg-3);
}

.btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ---- GLASS CARD ---- */
.card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: var(--border-hover);
}

.card-body { padding: 24px; }

/* ---- LOADING ---- */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(7,7,10,0.85);
    backdrop-filter: blur(8px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.loading-overlay.active { display: flex; }

.loading-text {
    font-family: 'Syne', sans-serif;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-1);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--bg-4);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- FADE ---- */
.fade-in {
    opacity: 0;
    transform: translateY(8px);
    animation: fadeUp 0.4s ease forwards;
}

.fade-in-1 { animation-delay: 0.05s; }
.fade-in-2 { animation-delay: 0.1s; }
.fade-in-3 { animation-delay: 0.15s; }
.fade-in-4 { animation-delay: 0.2s; }
.fade-in-5 { animation-delay: 0.25s; }

@keyframes fadeUp {
    to { opacity: 1; transform: translateY(0); }
}

/* ---- TOAST ---- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    padding: 10px 20px;
    background: var(--bg-4);
    color: var(--text-1);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10001;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- FOOTER ---- */
.site-footer {
    padding: 24px 48px;
    text-align: center;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-3);
    letter-spacing: 0.02em;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---- RESPONSIVE ---- */
@media (max-width: 860px) {
    .mobile-toggle { display: flex; }

    .topbar-nav {
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--bg-1);
        border-bottom: 1px solid var(--border);
        padding: 8px 12px;
        flex-direction: column;
        gap: 2px;
        display: none;
    }

    .topbar-nav.open { display: flex; }

    .topbar-nav a {
        width: 100%;
        padding: 10px 14px;
    }

    .brand-text { display: none; }

    .page { padding: 24px 20px 80px; }
}
