/* ============================================
   WebhookVault — UptimeRobot-inspired theme
   Light/Dark mode, #1895f0 accent, glow FX
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- tokens ---------- */
:root {
    --accent: #1895f0;
    --accent-hover: #1280d4;
    --accent-subtle: rgba(24, 149, 240, .08);
    --accent-glow: 0 0 12px rgba(24, 149, 240, .15), 0 0 32px rgba(24, 149, 240, .06);
    --accent-glow-sm: 0 0 8px rgba(24, 149, 240, .12);
    --success: #2fcc71;
    --success-subtle: rgba(47, 204, 113, .1);
    --warning: #f5a623;
    --danger: #e74c3c;
    --danger-subtle: rgba(231, 76, 60, .08);
    --danger-hover: #c0392b;

    /* light mode (default) */
    --bg-root: #f4f6f9;
    --bg-surface: #ffffff;
    --bg-surface-raised: #ffffff;
    --bg-inset: #f0f2f5;
    --bg-overlay: rgba(0, 0, 0, .45);
    --border: #e2e5ea;
    --border-subtle: #eceef2;
    --text-primary: #1a1f36;
    --text-secondary: #5e6687;
    --text-tertiary: #8e94a8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.08);
    --shadow-card: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06);
    --input-bg: #ffffff;
    --code-bg: #f6f8fa;
    --nav-bg: #ffffff;
    --nav-border: #e8ebf0;

    --radius: 10px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
    --transition: 180ms ease;
}

[data-theme="dark"] {
    --bg-root: #0d1117;
    --bg-surface: #161b22;
    --bg-surface-raised: #1c2129;
    --bg-inset: #0d1117;
    --bg-overlay: rgba(0, 0, 0, .65);
    --border: #2a3140;
    --border-subtle: #222938;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-tertiary: #5d6675;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,.25);
    --shadow-lg: 0 8px 30px rgba(0,0,0,.35);
    --shadow-card: 0 1px 3px rgba(0,0,0,.15), 0 0 1px rgba(0,0,0,.3);
    --input-bg: #0d1117;
    --code-bg: #0d1117;
    --nav-bg: #161b22;
    --nav-border: #2a3140;
    --accent-subtle: rgba(24, 149, 240, .12);
    --success-subtle: rgba(47, 204, 113, .14);
    --danger-subtle: rgba(231, 76, 60, .12);
    --accent-glow: 0 0 14px rgba(24, 149, 240, .2), 0 0 40px rgba(24, 149, 240, .07);
    --accent-glow-sm: 0 0 10px rgba(24, 149, 240, .15);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    scroll-behavior: smooth;
    color-scheme: light dark;
}

body {
    font-family: var(--font);
    background: var(--bg-root);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition), color var(--transition);
}

/* ---------- navbar ---------- */
.navbar {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    transition: background var(--transition), border-color var(--transition);
}

[data-theme="dark"] .navbar {
    background: rgba(22, 27, 34, .85);
}

.nav-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.01em;
    transition: color var(--transition);
}

.nav-brand svg {
    color: var(--accent);
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    padding: .4rem .65rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--text-primary); background: var(--accent-subtle); }

.nav-user {
    color: var(--text-tertiary);
    font-size: .8rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-form { display: inline; }

/* theme toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: var(--accent-glow-sm);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .55rem 1.1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: .7rem 1.6rem; font-size: .95rem; }
.btn-block { width: 100%; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--accent-glow-sm);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: .4rem .6rem;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--accent-subtle); }

.btn-google {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-google:hover { border-color: var(--text-tertiary); background: var(--bg-inset); }
.google-icon { vertical-align: middle; flex-shrink: 0; }

.btn-group { display: flex; gap: .5rem; }

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- main content ---------- */
.main-content {
    max-width: 1180px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ---------- hero ---------- */
.hero {
    text-align: center;
    padding: 5rem 0 3rem;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(24, 149, 240, .05) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

[data-theme="dark"] .hero::before {
    background: radial-gradient(circle, rgba(24, 149, 240, .07) 0%, transparent 65%);
}

.hero > * { position: relative; z-index: 1; }

.hero h1 {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -.03em;
    line-height: 1.15;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto 2.25rem;
    line-height: 1.65;
}

.hero-actions {
    display: flex;
    gap: .75rem;
    justify-content: center;
}

.hero-actions .btn-primary {
    box-shadow: var(--accent-glow);
}
.hero-actions .btn-primary:hover {
    box-shadow: var(--accent-glow), var(--shadow-md);
}

/* ---------- features ---------- */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    padding: 1rem 0 3rem;
}

.feature-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all var(--transition);
    box-shadow: var(--shadow-card);
}

.feature-card:hover {
    border-color: var(--accent);
    box-shadow: var(--accent-glow-sm), var(--shadow-md);
    transform: translateY(-2px);
}

.feature-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--accent-subtle);
    color: var(--accent);
    margin-bottom: .85rem;
}
.feature-icon svg { width: 20px; height: 20px; }

.feature-card h3 {
    font-size: .95rem;
    font-weight: 600;
    margin-bottom: .4rem;
    letter-spacing: -.01em;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: .85rem;
    line-height: 1.55;
}

/* ---------- auth ---------- */
.auth-container {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: -.01em;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
    color: var(--text-tertiary);
    font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .85rem;
    color: var(--text-secondary);
}
.auth-footer a { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-footer a:hover { text-decoration: underline; }

/* ---------- forms ---------- */
.form-group { margin-bottom: .9rem; }

.form-group label {
    display: block;
    margin-bottom: .3rem;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: .01em;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: .55rem .75rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: .875rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(24, 149, 240, .12);
}

.form-group textarea {
    resize: vertical;
    font-family: var(--mono);
    font-size: .8rem;
    line-height: 1.5;
}

.form-hint {
    color: var(--text-tertiary);
    font-size: .75rem;
    margin-top: .2rem;
    display: block;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .875rem;
    color: var(--text-primary);
}

.toggle-label {
    display: flex !important;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    color: var(--text-primary) !important;
    font-size: .875rem !important;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}
.flex-1 { flex: 1; }

/* ---------- alert ---------- */
.alert {
    padding: .65rem .9rem;
    border-radius: var(--radius-xs);
    margin-bottom: 1rem;
    font-size: .85rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.alert-error {
    background: var(--danger-subtle);
    color: var(--danger);
    border: 1px solid rgba(231, 76, 60, .2);
}

/* ---------- badge ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .2rem .55rem;
    border-radius: 99px;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.badge-active {
    background: var(--success-subtle);
    color: var(--success);
}
.badge-inactive {
    background: var(--danger-subtle);
    color: var(--danger);
}

.badge-count {
    background: var(--accent-subtle);
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.badge-method {
    font-family: var(--mono);
    font-size: .65rem;
    letter-spacing: .04em;
    font-weight: 500;
    min-width: 48px;
    justify-content: center;
}
.badge-get { background: rgba(24, 149, 240, .1); color: #1895f0; }
.badge-post { background: var(--success-subtle); color: var(--success); }
.badge-put { background: rgba(245, 166, 35, .1); color: var(--warning); }
.badge-patch { background: rgba(155, 89, 182, .1); color: #9b59b6; }
.badge-delete { background: var(--danger-subtle); color: var(--danger); }
.badge-head { background: rgba(24, 149, 240, .1); color: #1895f0; }
.badge-options { background: rgba(142, 148, 168, .1); color: var(--text-secondary); }

/* ---------- dashboard ---------- */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.dashboard-header h1 {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -.02em;
}

.create-form {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-card);
}

/* endpoints list */
.endpoints-list {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

.endpoint-row {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    cursor: pointer;
    transition: all var(--transition);
    gap: 1rem;
    box-shadow: var(--shadow-card);
}
.endpoint-row:hover {
    border-color: var(--accent);
    box-shadow: var(--accent-glow-sm), var(--shadow-md);
}

.endpoint-info { flex: 1; min-width: 0; }
.endpoint-info h3 {
    font-size: .925rem;
    font-weight: 600;
    margin-bottom: .15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -.01em;
}
.endpoint-info code {
    font-family: var(--mono);
    font-size: .75rem;
    color: var(--text-tertiary);
    letter-spacing: -.01em;
}

.endpoint-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: .8rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
}
.endpoint-actions { flex-shrink: 0; }

.loading {
    text-align: center;
    color: var(--text-tertiary);
    padding: 2.5rem;
    font-size: .9rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 0;
    color: var(--text-secondary);
}
.empty-state .empty-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
}
.empty-state .empty-icon svg { width: 28px; height: 28px; }
.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: .35rem;
    font-size: 1.05rem;
    font-weight: 600;
}
.empty-state p { font-size: .9rem; }

/* ---------- endpoint page ---------- */
.endpoint-page { max-width: 100%; }

.endpoint-header { margin-bottom: 1.25rem; }

.back-link {
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: .8rem;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-bottom: .5rem;
    transition: color var(--transition);
}
.back-link svg { width: 14px; height: 14px; }
.back-link:hover { color: var(--accent); }

.endpoint-header h1 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: .6rem;
    letter-spacing: -.02em;
}

.endpoint-url-bar {
    display: flex;
    align-items: center;
    gap: .65rem;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .85rem;
    margin-bottom: .65rem;
}
.endpoint-url-bar code {
    flex: 1;
    font-family: var(--mono);
    font-size: .85rem;
    color: var(--accent);
    word-break: break-all;
    font-weight: 500;
}

.endpoint-meta {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .8rem;
    color: var(--text-tertiary);
}

/* endpoint layout */
.endpoint-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.25rem;
}
@media (max-width: 900px) {
    .endpoint-layout { grid-template-columns: 1fr; }
}

.endpoint-settings {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1.15rem;
    align-self: start;
    position: sticky;
    top: 72px;
    box-shadow: var(--shadow-card);
}

.endpoint-settings h2 {
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .9rem;
    letter-spacing: -.01em;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.endpoint-settings h2 svg { width: 16px; height: 16px; color: var(--text-tertiary); }

.danger-zone {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.danger-zone h3 {
    font-size: .75rem;
    font-weight: 600;
    color: var(--danger);
    margin-bottom: .65rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.danger-zone .btn { margin-bottom: .4rem; }

/* request log */
.request-log-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .85rem;
}

.request-log-header h2 {
    font-size: .85rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .7rem;
    font-weight: 600;
    color: var(--success);
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px rgba(47, 204, 113, .35);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(47, 204, 113, .35); }
    50% { opacity: .4; box-shadow: 0 0 3px rgba(47, 204, 113, .15); }
}

.live-indicator.disconnected { color: var(--danger); }
.live-indicator.disconnected .live-dot {
    background: var(--danger);
    box-shadow: none;
    animation: none;
}

/* requests list */
.requests-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.request-row {
    display: flex;
    align-items: center;
    gap: .65rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: .6rem .85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-size: .825rem;
    box-shadow: var(--shadow-sm);
}
.request-row:hover {
    border-color: var(--accent);
    box-shadow: var(--accent-glow-sm);
}

.request-row.new-request {
    animation: flashIn .5s ease-out;
}
@keyframes flashIn {
    from {
        background: var(--accent-subtle);
        border-color: var(--accent);
        box-shadow: var(--accent-glow-sm);
    }
    to {
        background: var(--bg-surface);
        border-color: var(--border-subtle);
        box-shadow: var(--shadow-sm);
    }
}

.request-time {
    color: var(--text-tertiary);
    font-family: var(--mono);
    font-size: .7rem;
    flex-shrink: 0;
    min-width: 72px;
}

.request-path {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--mono);
    font-size: .75rem;
    color: var(--text-secondary);
}

.request-ip {
    color: var(--text-tertiary);
    font-size: .7rem;
    flex-shrink: 0;
    font-family: var(--mono);
}

.empty-requests {
    text-align: center;
    color: var(--text-tertiary);
    padding: 3rem 1rem;
    background: var(--bg-surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
}
.empty-requests svg {
    display: block;
    margin: 0 auto .75rem;
    color: var(--text-tertiary);
    opacity: .5;
}

/* pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: .85rem;
    font-size: .8rem;
    color: var(--text-tertiary);
}

/* ---------- modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 92%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.97) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .85rem 1.15rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: .925rem;
    font-weight: 600;
    font-family: var(--mono);
    letter-spacing: -.01em;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition);
}
.modal-close:hover {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--bg-inset);
}
.modal-close svg { width: 16px; height: 16px; }

.modal-body {
    padding: 1.15rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: .65rem 1.15rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.detail-section { margin-bottom: 1.15rem; }
.detail-section:last-child { margin-bottom: 0; }

.detail-section h4 {
    font-size: .7rem;
    color: var(--text-tertiary);
    margin-bottom: .45rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .3rem .65rem;
    font-size: .825rem;
}
.detail-grid .label { color: var(--text-secondary); font-weight: 500; }

.detail-table {
    font-family: var(--mono);
    font-size: .78rem;
    width: 100%;
}

.detail-table .header-row {
    display: flex;
    gap: .5rem;
    padding: .25rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.detail-table .header-name {
    color: var(--accent);
    min-width: 170px;
    flex-shrink: 0;
    font-weight: 500;
}

.detail-table .header-value {
    color: var(--text-primary);
    word-break: break-all;
}

.code-block {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: .65rem .85rem;
    font-family: var(--mono);
    font-size: .78rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 280px;
    overflow-y: auto;
    line-height: 1.5;
    color: var(--text-primary);
}

/* ---------- toast ---------- */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .65rem 1rem;
    font-size: .825rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    animation: toastIn .25s ease-out;
    display: flex;
    align-items: center;
    gap: .45rem;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

@keyframes toastIn {
    from { transform: translateY(16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
    .hero h1 { font-size: 2rem; }
    .hero-subtitle { font-size: 1rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .nav-user { display: none; }
    .form-row { flex-direction: column; }
    .endpoint-stats { display: none; }
}

/* ---------- root console (admin) ---------- */
.admin-page { max-width: 100%; }

.admin-subtitle {
    font-size: .825rem;
    color: var(--text-secondary);
    margin-top: .15rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

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

/* stat tiles */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .65rem;
    margin-bottom: 1.15rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: .8rem .95rem;
    box-shadow: var(--shadow-card);
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: .7rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}

.stat-card.is-loading .stat-value { color: var(--text-tertiary); }

/* toolbar */
.admin-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .85rem;
    flex-wrap: wrap;
}

.search-group { margin-bottom: 0; min-width: 260px; flex: 1; max-width: 420px; }

.search-input { position: relative; display: flex; align-items: center; }

.search-input svg {
    position: absolute;
    left: .6rem;
    width: 15px;
    height: 15px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.search-input input[type="search"] {
    width: 100%;
    padding: .5rem .7rem .5rem 2rem;
    font-family: inherit;
    font-size: .85rem;
    color: var(--text-primary);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input input[type="search"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--accent-glow-sm);
}

.toolbar-status {
    font-size: .78rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    padding-bottom: .4rem;
}

/* accounts table */
.table-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .825rem;
    min-width: 640px;
}

.admin-table th {
    text-align: left;
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-tertiary);
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: .65rem .85rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--accent-subtle); }

.admin-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.admin-table .col-activity,
.admin-table .col-registered {
    color: var(--text-secondary);
    white-space: nowrap;
}

.user-cell { display: flex; align-items: center; gap: .6rem; min-width: 0; }

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .02em;
}

.user-ident { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-email {
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge-stack { display: flex; flex-wrap: wrap; gap: .25rem; }

.badge-root {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    background: var(--accent-subtle);
    color: var(--accent);
    box-shadow: var(--accent-glow-sm);
}
.badge-root svg { width: 13px; height: 13px; }

.badge-root-sm { background: var(--accent-subtle); color: var(--accent); }
.badge-ok { background: var(--success-subtle); color: var(--success); }
.badge-locked { background: var(--danger-subtle); color: var(--danger); }
.badge-unverified { background: rgba(245, 166, 35, .12); color: var(--warning); }
.badge-provider { background: var(--bg-inset); color: var(--text-secondary); }

.admin-page .alert-error {
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.admin-page .pagination .btn:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 720px) {
    .admin-table .col-registered { display: none; }
    .admin-toolbar { align-items: stretch; }
    .search-group { max-width: none; }
    .toolbar-status { padding-bottom: 0; }
}

@media (max-width: 560px) {
    .admin-table .col-activity { display: none; }
    .admin-table { min-width: 460px; }
}

.nav-link-root {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--accent);
}
.nav-link-root:hover { color: var(--accent-hover); background: var(--accent-subtle); }

/* ── Request forwarding ─────────────────────────────────────────────────── */

.config-section {
    margin-top: 1.35rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--border-subtle);
    transition: opacity var(--transition);
}

/* Dimmed while forwarding is off — the fields stay usable so a URL can be
   prepared before switching it on. */
.config-section.is-disabled {
    opacity: .62;
}

.config-section-title {
    display: flex;
    align-items: center;
    gap: .45rem;
    margin: 0 0 .3rem;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .01em;
    color: var(--text-primary);
}

.config-section-title svg {
    color: var(--accent);
    flex-shrink: 0;
}

.config-section-hint {
    margin: 0 0 .9rem;
    font-size: .74rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.form-error {
    display: block;
    margin-top: .35rem;
    font-size: .74rem;
    line-height: 1.45;
    color: var(--danger);
}

.form-error[hidden] {
    display: none;
}

input[aria-invalid="true"] {
    border-color: var(--danger);
}

input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px var(--danger-subtle);
}

/* Forward outcome badge on a request row. Each state has distinct text as well
   as colour, so it never depends on colour alone to be understood. */
.fwd-slot {
    display: inline-flex;
    flex-shrink: 0;
}

.fwd-badge {
    display: inline-flex;
    align-items: center;
    padding: .12rem .4rem;
    border-radius: var(--radius-xs);
    font-family: var(--mono);
    font-size: .68rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}

.fwd-ok {
    background: var(--success-subtle);
    color: var(--success);
}

.fwd-fail {
    background: rgba(245, 166, 35, .12);
    color: var(--warning);
}

.fwd-error {
    background: var(--danger-subtle);
    color: var(--danger);
}

.fwd-pending {
    background: var(--accent-subtle);
    color: var(--accent);
    animation: fwdPulse 1.4s ease-in-out infinite;
}

@keyframes fwdPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .45; }
}

.fwd-detail-error {
    color: var(--danger);
    word-break: break-word;
}

.btn.is-busy {
    cursor: progress;
}

.btn.is-busy svg {
    animation: fwdSpin .9s linear infinite;
}

@keyframes fwdSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Respect users who have asked for reduced motion. */
@media (prefers-reduced-motion: reduce) {
    .fwd-pending,
    .btn.is-busy svg {
        animation: none;
    }
}

@media (max-width: 640px) {
    /* The source IP is the least useful column on a narrow screen; the forward
       outcome earns the space more. */
    .request-row .request-ip {
        display: none;
    }
}

/* ── Impersonation banner ───────────────────────────────────────────────── */

/* Deliberately loud and amber rather than brand blue: an impersonated session
   must never be mistakable for a normal one at a glance. */
.impersonation-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .6rem;
    padding: .5rem 1.25rem;
    background: var(--warning);
    color: #1a1200;
    font-size: .8rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.impersonation-text {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
}

.impersonation-text svg {
    flex-shrink: 0;
}

.impersonation-sub {
    opacity: .78;
    font-weight: 500;
}

.impersonation-bar .btn {
    background: #1a1200;
    color: var(--warning);
    border: none;
    flex-shrink: 0;
}

.impersonation-bar .btn:hover:not(:disabled) {
    background: #000;
}

@media (max-width: 560px) {
    .impersonation-sub {
        display: none;
    }
}

/* ── Account actions ────────────────────────────────────────────────────── */

.badge-disabled {
    background: var(--danger-subtle);
    color: var(--danger);
}

.col-actions {
    width: 1%;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    gap: .3rem;
    justify-content: flex-end;
}

.btn-xs {
    padding: .22rem .5rem;
    font-size: .7rem;
    border-radius: var(--radius-xs);
    line-height: 1.4;
}

.actions-note {
    font-size: .72rem;
    white-space: nowrap;
}

/* A row mid-action is dimmed and its buttons disabled, so a double click cannot
   fire the same destructive request twice. */
tr.is-busy {
    opacity: .55;
    pointer-events: none;
}

@media (max-width: 860px) {
    .row-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }
}
