/* WP-Admin-Dashboard — Theme & Layout */
:root {
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-2: #f0f3f8;
    --ink: #1a2435;
    --ink-soft: #4a5568;
    --muted: #94a3b8;
    --line: #e2e8f0;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --warn: #d97706;
    --warn-soft: #fef3c7;
    --error: #dc2626;
    --error-soft: #fee2e2;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.05);
}
[data-theme="dark"], html[data-theme="auto"] [data-theme="dark"] {
    --bg: #0b1220;
    --surface: #131c2f;
    --surface-2: #1a2540;
    --ink: #e6ecf5;
    --ink-soft: #b6c2d4;
    --muted: #6b7894;
    --line: #243049;
    --accent: #60a5fa;
    --accent-soft: #1e3a8a;
    --warn: #fbbf24;
    --warn-soft: #422006;
    --error: #f87171;
    --error-soft: #450a0a;
    --success: #4ade80;
    --success-soft: #052e16;
}
@media (prefers-color-scheme: dark) {
    html[data-theme="auto"] {
        --bg: #0b1220;
        --surface: #131c2f;
        --surface-2: #1a2540;
        --ink: #e6ecf5;
        --ink-soft: #b6c2d4;
        --muted: #6b7894;
        --line: #243049;
        --accent: #60a5fa;
        --accent-soft: #1e3a8a;
        --warn: #fbbf24;
        --warn-soft: #422006;
        --error: #f87171;
        --error-soft: #450a0a;
        --success: #4ade80;
        --success-soft: #052e16;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    min-height: 100vh;
}
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; color: var(--ink-soft); }
.muted { color: var(--muted); }
.small { font-size: .85em; }
code { background: var(--surface-2); padding: .15em .4em; border-radius: 4px; font-size: .9em; }
.hidden { display: none !important; }

/* === LOGIN === */
.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 2rem;
    background: linear-gradient(135deg, var(--bg) 0%, var(--surface-2) 100%);
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
}
.brand-logo {
    font-size: 3rem;
    margin-bottom: .5rem;
}
.login-footer { margin-top: 2rem; }

/* === TOPBAR === */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}
.brand-mini { display: flex; align-items: center; gap: .5rem; }
.brand-mini .logo { font-size: 1.4rem; }
.topnav { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* === LAYOUT === */
.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}
.sidebar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem;
    height: fit-content;
    position: sticky;
    top: 5rem;
}
.sidebar h3 { margin-bottom: .75rem; text-transform: uppercase; font-size: .7rem; letter-spacing: .05em; }
.nav-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    font-size: .9rem;
    margin-bottom: .25rem;
    transition: background .15s;
}
.nav-item:hover:not(.disabled) { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.disabled { color: var(--muted); cursor: not-allowed; }

.content > h1 { margin-top: 0; }

/* === CARDS === */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
}
.module-head { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.module-head p { margin: 0; }

/* === FORMS === */
.search-row {
    display: flex;
    gap: .5rem;
    align-items: stretch;
}
.search-row input {
    flex: 1;
    padding: .65rem .9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
}
.search-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .65rem 1.1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-warn { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn-warn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ms {
    width: 100%;
    padding: .85rem;
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
    font-weight: 500;
}
.btn-ms:hover { filter: brightness(1.1); }
.btn-sm { padding: .35rem .7rem; font-size: .85em; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 8px;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    cursor: pointer;
    color: var(--ink);
}
.icon-btn:hover { background: var(--surface-2); }

/* === ALERTS === */
.alert {
    padding: .8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid;
}
.alert-error { background: var(--error-soft); border-color: var(--error); color: var(--error); }
.alert-success { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.alert-warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }

/* === PROFILE CARD === */
.step { margin-top: 1.5rem; }
.profile-card {
    display: flex;
    gap: 1.5rem;
    padding: 1rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}
.avatar {
    width: 96px; height: 96px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--line);
    object-fit: cover;
    flex-shrink: 0;
}
.avatar:not([src]) , .avatar[src=""] {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
}
.profile-info { flex: 1; min-width: 0; }
.profile-info h3 { margin: 0 0 .25rem; }
table.kv {
    margin-top: .75rem;
    width: 100%;
    border-collapse: collapse;
    font-size: .9em;
}
table.kv th {
    text-align: left;
    color: var(--muted);
    font-weight: 500;
    padding: .25rem 1rem .25rem 0;
    white-space: nowrap;
    width: 1%;
    vertical-align: top;
}
table.kv td { padding: .25rem 0; word-break: break-word; }

/* === AUTH METHODS === */
.auth-methods {
    background: var(--surface-2);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.auth-methods ul { list-style: none; padding: 0; margin: .5rem 0 0; }
.auth-methods li {
    display: flex;
    justify-content: space-between;
    padding: .4rem 0;
    border-bottom: 1px solid var(--line);
    font-size: .9em;
}
.auth-methods li:last-child { border-bottom: none; }
.auth-methods li.method-authenticator { color: var(--accent); font-weight: 600; }
.method-info { color: var(--muted); font-family: ui-monospace, monospace; font-size: .85em; }

/* === ACTIONS ROW === */
.actions { display: flex; gap: .75rem; margin-top: 1rem; flex-wrap: wrap; }

/* === MFA SPINNER === */
.mfa-status {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    background: var(--warn-soft);
    border: 1px solid var(--warn);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.spinner {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 4px solid var(--line);
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    .profile-card { flex-direction: column; align-items: center; text-align: center; }
    .flow-cards { grid-template-columns: 1fr !important; }
}

/* === FLOW-CHOOSER === */
.flow-chooser { margin-top: 1.5rem; }
.flow-chooser h4 { margin-bottom: .75rem; }
.flow-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.flow-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
}
.flow-icon { font-size: 1.8rem; margin-bottom: .35rem; }
.flow-card h5 { margin: 0 0 .5rem; font-size: 1.05rem; }
.flow-card p { flex: 1; margin: 0 0 1rem; }
.flow-card .btn { width: 100%; }

/* === TAP-Anzeige === */
.tap-display {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
}
.tap-code {
    flex: 1;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: .15em;
    color: var(--accent);
    background: var(--surface);
    padding: .5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    text-align: center;
    word-break: break-all;
    user-select: all;
}
.tap-code.tap-hidden {
    color: transparent;
    text-shadow: 0 0 10px var(--ink);
    user-select: none;
}
.user-instructions {
    background: var(--surface-2);
    border-radius: 8px;
    padding: .75rem 1rem .75rem 2.2rem;
    margin: .5rem 0 1rem;
}
.user-instructions li { padding: .15rem 0; }

/* === Audit-Log === */
.audit-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.audit-filters label {
    display: flex;
    flex-direction: column;
    font-size: .8rem;
    color: var(--muted);
    gap: .25rem;
}
.audit-filters select {
    padding: .4rem .6rem;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 6px;
    font: inherit;
}
.audit-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}
.audit-table th {
    text-align: left;
    padding: .65rem .75rem;
    background: var(--surface-2);
    border-bottom: 2px solid var(--line);
    font-weight: 600;
    color: var(--ink-soft);
    white-space: nowrap;
}
.audit-table td {
    padding: .65rem .75rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
.audit-table tr:last-child td { border-bottom: none; }
.audit-table td.ts { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-table td.ip { font-family: ui-monospace, monospace; font-size: .8rem; }
.audit-table td.center { text-align: center; }
.audit-table tbody tr:hover td { background: var(--surface-2); }
.status-pill {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-ok        { background: var(--success-soft); color: var(--success); }
.status-cancelled { background: var(--warn-soft);    color: var(--warn); }
.status-denied    { background: var(--warn-soft);    color: var(--warn); }
.status-error     { background: var(--error-soft);   color: var(--error); }
.status-muted     { background: var(--surface-2);    color: var(--muted); }
