:root {
    --blue-700: #1d4ed8;
    --blue-600: #2563eb;
    --green-600: #16a34a;
    --red-600: #dc2626;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f8fafc;
    --bg-card: #ffffff;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--blue-600); }

.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: .8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.app-header h1 { font-size: 1.1rem; margin: 0; }
.app-header nav { display: flex; align-items: center; gap: 1rem; flex: 1; }
.app-header nav a { text-decoration: none; color: var(--text-muted); font-weight: 500; }
.app-header nav a.active, .app-header nav a:hover { color: var(--blue-700); }
.app-header .spacer { flex: 1; }
.app-header .whoami { font-size: .85rem; color: var(--text-muted); }

.app-main { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    margin-bottom: 1.2rem;
}
.card h2 { margin-top: 0; font-size: 1.05rem; }
.card-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.card-header-row h2 { margin: 0; }

.text-muted { color: var(--text-muted); }

.alert { padding: .7rem 1rem; border-radius: 8px; margin-bottom: .8rem; font-size: .92rem; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

.form-group { margin-bottom: .8rem; }
.form-group label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.form-control {
    width: 100%; padding: .5rem .6rem; border: 1px solid var(--border);
    border-radius: 6px; font-size: .92rem; font-family: inherit;
}

.btn {
    display: inline-block; padding: .5rem 1rem; border-radius: 6px; border: none;
    font-size: .88rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); }
.btn-secondary { background: #f3f4f6; color: var(--text); }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }

.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th, .admin-table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table th { color: var(--text-muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; }
.admin-table tr.row-archived { opacity: .6; }
.actions-cell { display: flex; gap: .4rem; flex-wrap: wrap; }
.notes-cell { max-width: 260px; }

.badge { display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; background: #f3f4f6; color: var(--text-muted); }
.badge-success { background: #f0fdf4; color: #166534; }

.cap-modal { border: none; border-radius: 12px; padding: 1.4rem; max-width: 480px; width: 92vw; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.cap-modal::backdrop { background: rgba(0,0,0,.4); }
.cap-modal h3 { margin-top: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin: .8rem 0; }
.recovery-codes code { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: .4rem .6rem; text-align: center; font-size: 1rem; letter-spacing: .05em; }

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.auth-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; width: 380px; max-width: 92vw; }
.auth-box h1 { margin: 0 0 .2rem; font-size: 1.3rem; text-align: center; }
.auth-subtitle { text-align: center; color: var(--text-muted); font-size: .85rem; margin-bottom: 1.2rem; }
