:root {
    --bg: #1a1a2e;
    --panel: #16213e;
    --text: #e0e0e0;
    --muted: #aeb8d0;
    --accent: #2a6db5;
    --accent-hover: #3584d7;
    --border: #2a3a5c;
    --stripe: #1e2a45;
    --danger: #d95f5f;
    --success: #48a868;
    --warning: #d6a545;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { color: var(--accent-hover); text-decoration: underline; }

.top-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 1.5rem;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 700;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.main-nav a, .user-nav a { color: var(--text); }

.user-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: var(--muted);
}

.container {
    width: min(1180px, calc(100% - 2rem));
    margin: 2rem auto;
}

.card, .panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 14px 35px rgba(0, 0, 0, .18);
}

.auth-card {
    max-width: 420px;
    margin: 4rem auto;
}

.form-stack {
    display: grid;
    gap: .8rem;
}

input, select, textarea {
    width: 100%;
    padding: .7rem .85rem;
    color: var(--text);
    background: #101936;
    border: 1px solid var(--border);
    border-radius: 6px;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.button, button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .7rem 1rem;
    color: #fff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
}

.button:hover, button:hover { background: var(--accent-hover); text-decoration: none; }
.button-small { padding: .45rem .75rem; font-size: .9rem; }

.table-wrap { border: 1px solid var(--border); border-radius: 8px; }
.table-scroll { overflow-x: auto; }
.row-link-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 680px; }
.row-link-table th,
.row-link-table td { padding: .85rem 1rem; border-bottom: 1px solid var(--border); text-align: left; }
.row-link-table thead th { background: var(--panel); }
.row-link-table tbody tr { color: var(--text); }
.row-link-table tbody tr:nth-child(odd) { background: var(--stripe); }
.row-link-table tbody tr:nth-child(even) { background: var(--panel); }
.table-actions { white-space: nowrap; }
.table-actions a { display: inline-block; margin-right: .75rem; }
.table-actions a:last-child { margin-right: 0; }

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: .25rem .6rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #24365f;
    color: var(--text);
    font-size: .82rem;
    font-weight: 700;
}
.status-complete, .status-completed, .status-done, .status-active { background: rgba(72, 168, 104, .2); color: #8fe0aa; }
.status-pending, .status-open, .status-todo { background: rgba(42, 109, 181, .25); color: #9ec9f6; }
.status-blocked, .status-failed, .status-overdue { background: rgba(217, 95, 95, .22); color: #f0a0a0; }
.status-draft { background: rgba(100,100,120,.25); color: #c0c8e0; }
.status-sent { background: rgba(93,138,168,.25); color: #9ec9f6; }
.status-in-progress { background: rgba(214,165,69,.22); color: #f2cf80; }
.status-running { background: rgba(214, 165, 69, .22); color: #f2cf80; }
.status-ai-queue { background: rgba(142,68,173,.25); color: #d7a8f0; }
.status-jake-review { background: rgba(230,126,34,.22); color: #f5c07a; }
.status-ready-for-review { background: rgba(22,160,133,.22); color: #7fd8c8; }
.status-urgent { background: rgba(192,57,43,.25); color: #f0a0a0; }
.status-processed { background: rgba(72,168,104,.2); color: #8fe0aa; }
.status-archived { background: rgba(80,80,80,.25); color: #909090; }
.status-admin { background: rgba(42,109,181,.25); color: #9ec9f6; }

.alert { padding: .8rem 1rem; border-radius: 6px; margin-bottom: 1rem; border: 1px solid var(--border); }
.alert-error { background: rgba(217, 95, 95, .16); color: #ffb4b4; border-color: rgba(217, 95, 95, .5); }

.site-footer {
    width: min(1180px, calc(100% - 2rem));
    margin: 3rem auto 1.5rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    padding-top: 1rem;
}

@media (max-width: 768px) {
    .top-nav { align-items: flex-start; flex-direction: column; }
    .main-nav { flex-wrap: wrap; }
    .user-nav { width: 100%; justify-content: space-between; }
    .container { margin-top: 1rem; }
    .card, .panel { padding: 1rem; }
    .row-link-table thead th { top: 0; }
}

.main-nav a {
    border-radius: 6px;
    padding: .45rem .65rem;
}

.main-nav a.active,
.main-nav a[aria-current="page"] {
    background: rgba(42, 109, 181, .22);
    color: #fff;
    text-decoration: none;
}

.dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.dashboard-hero h1,
.dashboard-section h2 {
    margin: 0;
}

.eyebrow {
    margin: 0 0 .25rem;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.dashboard-section {
    margin-bottom: 1rem;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}

.metric-card,
.quick-link-card {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #101936;
    padding: 1rem;
}

.metric-card:hover,
.quick-link-card:hover {
    border-color: var(--accent);
    color: var(--text);
    text-decoration: none;
}

.metric-card span,
.quick-link-card span,
.muted {
    color: var(--muted);
}

.metric-card strong {
    font-size: 2rem;
    line-height: 1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1rem;
}

.quick-links {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.block {
    display: block;
    font-size: .85rem;
}

.empty-state {
    color: var(--muted);
    margin: 0;
}

.status-manager { background: rgba(214, 165, 69, .22); color: #f2cf80; }
.status-user { background: #24365f; color: var(--text); }

@media (max-width: 1024px) {
    .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .dashboard-hero,
    .section-header { align-items: flex-start; flex-direction: column; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin: 1rem 0;
}

.filter-bar a {
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    padding: .4rem .75rem;
}

.filter-bar a.active,
.filter-bar a[aria-current="page"] {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    text-decoration: none;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: center;
}

.button-danger {
    background: var(--danger);
    border-color: var(--danger);
}

.button-danger:hover {
    background: #ef7777;
}

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

.task-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: start;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin: 0;
}

.detail-list div,
.content-block {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #101936;
    padding: .85rem;
}

.detail-list dt {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 700;
    margin-bottom: .25rem;
    text-transform: uppercase;
}

.detail-list dd {
    margin: 0;
}

.task-actions {
    display: grid;
    gap: 1rem;
}

.task-actions h2,
.content-block h2 {
    margin-top: 0;
}

.content-block {
    margin-top: 1rem;
}

.row-link-table tbody tr[data-href] {
    cursor: pointer;
}

.row-link-table tbody tr[data-href]:hover {
    outline: 1px solid var(--accent);
}

@media (max-width: 900px) {
    .task-layout,
    .form-grid,
    .detail-list {
        grid-template-columns: 1fr;
    }
}
