:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --border: #e3e7ef;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 16px; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }

.muted { color: var(--muted); font-size: 13px; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* ===== AUTH ===== */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f7fb 100%);
}
.auth-wrap { width: 100%; max-width: 400px; padding: 24px; }
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow);
}
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-header h1 { font-size: 20px; margin-bottom: 4px; }
.auth-footer { text-align: center; margin-top: 16px; font-size: 12px; }

/* ===== APP ===== */
.app-body { min-height: 100vh; }
.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.app-header-inner {
    display: flex; align-items: center; gap: 32px;
    padding: 12px 24px;
}
.app-brand { font-weight: 600; color: var(--text); }
.app-nav { display: flex; gap: 24px; flex: 1; }
.app-nav a { color: var(--muted); font-weight: 500; }
.app-nav a:hover { color: var(--text); text-decoration: none; }
.app-user { display: flex; gap: 12px; align-items: center; }
.app-main { padding: 32px 24px; }

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

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 32px; font-weight: 600; margin: 8px 0 4px; }
.stat-foot { font-size: 12px; }

/* ===== FORMS ===== */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text); }
.field input, .field select, .field textarea {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: 14px;
    font-family: inherit;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.field-check { display: flex; gap: 8px; align-items: center; }

.form-actions { display: flex; gap: 12px; margin-top: 8px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: all .12s ease;
}
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger {
    background: white;
    color: var(--danger);
    border-color: #fecaca;
}
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link {
    background: none; border: none; color: var(--primary); cursor: pointer;
    padding: 0; font-size: 13px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }

/* ===== TABLES ===== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { margin-left: 4px; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.badge-admin { background: #ede9fe; color: #6d28d9; }
.badge-user { background: #e0f2fe; color: #0369a1; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.alert ul { margin: 0; padding-left: 20px; }
