:root {
    --bg: #0f1419;
    --sidebar: #1a2332;
    --panel: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #059669;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: #f1f5f9;
}

.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a2332 0%, #0f1419 100%);
}
.login-card {
    background: var(--panel);
    padding: 2.5rem;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.4);
}
.login-card h1 { margin: 0 0 .25rem; font-size: 1.5rem; }
.subtitle { color: var(--muted); margin: 0 0 1.5rem; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px;
    background: var(--sidebar);
    color: #e2e8f0;
    flex-shrink: 0;
}
.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar nav { display: flex; flex-direction: column; padding: 1rem 0; }
.sidebar a {
    color: #94a3b8;
    text-decoration: none;
    padding: .65rem 1.5rem;
    font-size: .95rem;
}
.sidebar a:hover, .sidebar a.active { color: #fff; background: rgba(255,255,255,.06); }
.sidebar a.logout { margin-top: auto; color: #f87171; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar h1 { margin: 0; font-size: 1.25rem; }
.user-chip { text-align: right; font-size: .875rem; }
.user-chip span { display: block; color: var(--muted); font-size: .8rem; }
.content { padding: 1.5rem; flex: 1; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.card {
    background: var(--panel);
    border-radius: 10px;
    padding: 1.25rem;
    border: 1px solid var(--border);
}
.card-label { color: var(--muted); font-size: .85rem; display: block; }
.card-value { font-size: 2rem; display: block; margin-top: .25rem; }
.card-value-sm { font-size: 1rem; font-weight: 600; }

.panel {
    background: var(--panel);
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}
.panel-narrow { max-width: 520px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel h2 { margin: 0 0 1rem; font-size: 1.1rem; }

label { display: block; margin: .75rem 0 .35rem; font-size: .875rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .95rem;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.checkbox input { width: auto; }

.btn {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-size: .875rem;
    cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { padding: .35rem .65rem; font-size: .8rem; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.inline-form { display: inline; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.data-table thead { position: sticky; top: 0; background: #f8fafc; z-index: 1; }
.data-table th, .data-table td { padding: .65rem .75rem; text-align: left; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table .empty { text-align: center; color: var(--muted); }
.actions { white-space: nowrap; }
.badge {
    background: #e0e7ff;
    color: #3730a3;
    padding: .15rem .5rem;
    border-radius: 4px;
    font-size: .75rem;
}
.search-input { max-width: 260px; padding: .45rem .75rem; border: 1px solid var(--border); border-radius: 6px; }

.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .875rem; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 1rem; }
.log-preview { background: #f8fafc; padding: 1rem; border-radius: 6px; font-size: .8rem; overflow-x: auto; }

@media (max-width: 768px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
}
