:root {
    --bg: #0f1419;
    --surface: #1a2332;
    --border: #2d3a4f;
    --text: #e8eef7;
    --muted: #8b9cb3;
    --accent: #3d8bfd;
    --success: #2ecc71;
    --warning: #f39c12;
    --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

.site-header {
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 3.5rem;
}

.brand {
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.02em;
}

nav a {
    color: var(--muted);
    text-decoration: none;
    margin-left: 1.25rem;
}

nav a:hover { color: var(--accent); }

main { padding: 2rem 0 3rem; }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.page-head h1 { margin: 0 0 0.25rem; font-size: 1.75rem; }
.muted { color: var(--muted); }
code { background: var(--surface); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }

.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.alert-warning { background: rgba(243, 156, 18, 0.12); border-color: var(--warning); }
.alert-success { background: rgba(46, 204, 113, 0.12); border-color: var(--success); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

.stat-label { display: block; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { display: block; font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; }
.stat-value small { font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.stat-sub { display: block; font-size: 0.75rem; color: var(--muted); margin-top: 0.25rem; }

.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 800px) {
    .panels { grid-template-columns: 1fr; }
}

.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.25rem;
}

.panel h2 { margin: 0 0 1rem; font-size: 1.1rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; }

.badge {
    display: inline-block;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: capitalize;
    background: var(--border);
}

.badge-active { background: rgba(61, 139, 253, 0.25); color: var(--accent); }
.badge-completed { background: rgba(46, 204, 113, 0.2); color: var(--success); }
.badge-abandoned { background: rgba(243, 156, 18, 0.2); color: var(--warning); }

.api-links ul { margin: 0; padding-left: 1.25rem; }
.api-links a { color: var(--accent); }

/* Admin layout (details in admin.css) */
.admin-body { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 1.25rem 1rem;
    overflow-y: auto;
}
.admin-sidebar .brand { display: block; margin-bottom: 1.25rem; font-size: 1.1rem; }
.sidebar-label { font-size: 0.7rem; text-transform: uppercase; color: var(--muted); margin: 1rem 0 0.35rem; letter-spacing: 0.06em; }
.nav-group { font-size: 0.75rem; color: var(--accent); margin: 0.75rem 0 0.25rem; font-weight: 600; }
.nav-item {
    display: block;
    color: var(--muted);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
}
.nav-item:hover { background: rgba(61, 139, 253, 0.12); color: var(--text); }
.admin-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.admin-topbar a { color: var(--muted); text-decoration: none; font-size: 0.875rem; }
.admin-content { padding: 1.5rem; flex: 1; overflow-x: auto; }

.crud-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; gap: 1rem; }
.crud-header h1 { margin: 0; font-size: 1.35rem; }

.btn {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.875rem;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }

.field { margin-bottom: 1rem; max-width: 520px; }
.field label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.25rem; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
}
.field-row { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.field-row label { font-size: 0.875rem; }

.form-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }

.actions { white-space: nowrap; }
.actions a { color: var(--accent); text-decoration: none; margin-right: 0.65rem; font-size: 0.85rem; }
.actions a.danger { color: #e74c3c; }
.truncate { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.quick-links a { display: block; color: var(--accent); text-decoration: none; font-size: 0.875rem; padding: 0.15rem 0; }
.quick-links strong { display: block; margin-bottom: 0.35rem; color: var(--text); }

@media (max-width: 900px) {
    .admin-body { flex-direction: column; }
    .admin-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
}
