/* ═══════════════════════════════════════════════
   Lighthouse — Publifye Account Service
   Clean, professional, customer-facing design
   ═══════════════════════════════════════════════ */

@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;1,9..40,400&display=swap');

/* Cross-document view transitions: browsers that support it cross-fade between
   server-rendered page navigations (SPA-smooth feel, no SPA). Progressive
   enhancement — older browsers just navigate normally. */
@view-transition { navigation: auto; }

html {
    font-size: 19px;
}

/* ── Light theme (default) ── */
:root {
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #525d6b;
    --border: #e2e8f0;
    --border-input: #cbd5e1;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-text: #ffffff;
    --accent-soft: #eef2ff;
    --success: #059669;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --error-border: #fecaca;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --radius: 10px;
    --radius-lg: 0.75rem;
    --header-bg: rgba(255,255,255,0.85);
    --header-border: rgba(0,0,0,0.06);
}

/* ── Dark theme ── */
[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-input: #1e293b;
    --bg-hover: #334155;
    --text: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --border-input: #475569;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-text: #0f172a;
    --accent-soft: rgba(129,140,248,0.1);
    --success: #34d399;
    --success-bg: rgba(52,211,153,0.1);
    --success-border: rgba(52,211,153,0.3);
    --error: #f87171;
    --error-bg: rgba(248,113,113,0.1);
    --error-border: rgba(248,113,113,0.3);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.2);
    --header-bg: rgba(15,23,42,0.9);
    --header-border: rgba(255,255,255,0.06);
}

/* ── Pico.css overrides ── */
:root {
    --pico-font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --pico-font-size: 16px;
    --pico-background-color: var(--bg);
    --pico-color: var(--text-secondary);
    --pico-primary: var(--accent);
    --pico-primary-hover: var(--accent-hover);
    --pico-muted-color: var(--text-muted);
    --pico-border-color: var(--border);
    --pico-card-background-color: var(--bg-card);
    --pico-form-element-background-color: var(--bg-input);
    --pico-form-element-border-color: var(--border-input);
    --pico-form-element-focus-color: var(--accent);
}

[data-theme="dark"] {
    --pico-background-color: var(--bg);
    --pico-color: var(--text-secondary);
    --pico-primary: var(--accent);
    --pico-primary-hover: var(--accent-hover);
    --pico-muted-color: var(--text-muted);
    --pico-border-color: var(--border);
    --pico-card-background-color: var(--bg-card);
    --pico-form-element-background-color: var(--bg-input);
    --pico-form-element-border-color: var(--border-input);
    --pico-form-element-focus-color: var(--accent);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; font-size: 16px; }

body {
    min-height: 100vh;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    padding-top: 64px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: 'DM Sans', sans-serif;
    color: var(--text);
    font-weight: 800;
    letter-spacing: -0.02em;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

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

/* ── Header ── */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--header-border);
    z-index: 100;
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none !important;
    color: var(--text);
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    transition: opacity 0.15s;
}
.logo-link:hover { opacity: 0.7; color: var(--text); text-decoration: none !important; }

/* The tile takes the brand colour as a TINT and the letter takes the page's own
   text colour. It used to be a solid var(--accent) with a hardcoded white
   letter, which assumes every brand accent is dark enough to carry white — the
   same assumption that breaks a primary button. tbtm.sale sets a light sky
   accent and the mark measured 1.89. A tint plus --text is legible against any
   accent, in either theme, without needing to know the accent's luminance. */
.logo-mark {
    width: 28px;
    height: 28px;
    background: color-mix(in srgb, var(--accent) 26%, transparent);
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.header-version {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    background: var(--bg-hover);
    border-radius: 4px;
    letter-spacing: 0.01em;
}

.pubhub-link {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    transition: color 0.15s;
    margin-left: 0.25rem;
}
.pubhub-link:hover { color: var(--accent); }

.header-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.header-nav {
    display: flex;
    gap: 0.125rem;
    border: none;
    margin: 0;
    padding: 0;
}

.header-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4375rem 0.75rem;
    border-radius: 8px;
    transition: all 0.15s;
}
.header-nav a:hover {
    color: var(--text);
    background: var(--bg-hover);
    text-decoration: none;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    margin-left: 0.25rem;
    padding: 0;
}
.theme-toggle:hover {
    color: var(--text);
    border-color: var(--border-input);
    background: var(--bg-hover);
}

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.125rem;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ── Mobile nav ── */
.mobile-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem;
    z-index: 99;
    box-shadow: var(--shadow-lg);
}
.mobile-nav.show { display: block; }
.mobile-nav a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9375rem;
}
.mobile-nav a:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}

/* ── Main content ── */
main.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 4rem;
}

/* ── Auth pages (login, register, forgot-password, etc.) ── */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
    min-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header .auth-icon {
    width: 48px;
    height: 48px;
    background: var(--accent-soft);
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.auth-header .auth-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
    stroke: var(--accent);
    fill: none;
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.375rem;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin: 0;
}

.brand-logo { text-align: center; }
.brand-logo svg { height: 100%; width: auto; }

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.auth-card label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.375rem;
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
    border-radius: var(--radius);
    border: 1px solid var(--border-input);
    background: var(--bg-input);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    color: var(--text);
}

.auth-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

/* Cloudflare Turnstile on /register: flexible size stretches the widget to the
   input width (min 300px), the slot centres it and keeps the field rhythm. */
.auth-card .turnstile-slot {
    display: flex;
    justify-content: center;
    margin: 0.25rem 0 1.25rem;
}
.auth-card .turnstile-slot .cf-turnstile {
    width: 100%;
}
.auth-card .turnstile-slot iframe {
    max-width: 100%;
}

.auth-card button[type="submit"] {
    width: 100%;
    background: var(--accent);
    color: var(--accent-text);
    border: none;
    border-radius: var(--radius);
    padding: 0.6875rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    margin-top: 0.5rem;
}
.auth-card button[type="submit"]:hover {
    background: var(--accent-hover);
}
.auth-card button[type="submit"]:active {
    transform: scale(0.99);
}

.auth-card small {
    display: block;
    margin-top: -0.25rem;
    margin-bottom: 0.75rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.auth-footer a { font-weight: 500; }

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

/* Checkbox in auth */
.auth-card label:has(input[type="checkbox"]) {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 0.875rem;
    line-height: 1.5;
}

.auth-card label:has(input[type="checkbox"]) a {
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.15s;
}
.auth-card label:has(input[type="checkbox"]) a:hover {
    text-decoration-color: var(--accent-hover);
}

.auth-card label input[type="checkbox"] {
    margin: 0.1875rem 0 0 0;
    width: 1rem !important;
    height: 1rem !important;
    min-width: 1rem;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-input);
    border: 1.5px solid var(--border-input);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.auth-card label input[type="checkbox"]:hover {
    border-color: var(--accent);
}
.auth-card label input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
.auth-card label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0.5px;
    width: 5px;
    height: 9px;
    border: solid var(--accent-text);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.auth-card label input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}

/* ── Alerts ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid var(--error-border);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

/* Dynamic login-page notice (set via MCP set_login_notice): what + why */
.login-notice {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.55;
}
.login-notice-header {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}
.login-notice-body {
    color: var(--text-secondary);
    white-space: pre-line;
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.card h3 {
    font-size: 1.125rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent);
}

/* ── Page header ── */
.page-header {
    margin-bottom: 1.5rem;
}
.page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}
.page-header p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin: 0;
}
.page-header .breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.page-header .breadcrumb a {
    color: var(--text-muted);
    font-weight: 500;
}
.page-header .breadcrumb a:hover { color: var(--accent); }

/* ── Account nav grid ── */
.account-nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.account-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none !important;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}
.account-nav-item:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.account-nav-item svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
}

/* ── Account tab bar (top-of-account menu) ── */
.acct-tabs {
    display: flex;
    gap: 0.15rem;
    margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.acct-tabs::-webkit-scrollbar { display: none; }
.acct-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none !important;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.acct-tab svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.9; }
.acct-tab:hover { color: var(--text); }
.acct-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── Profile: identity hero + field grid ── */
.profile-hero {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    margin-bottom: 1.5rem;
}
.profile-avatar {
    flex: 0 0 auto;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent-text);
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    box-shadow: var(--shadow);
}
.profile-hero .ph-name { font-size: 1.5rem; font-weight: 800; line-height: 1.1; margin: 0; }
.profile-hero .ph-email { color: var(--text-muted); font-size: 0.9rem; margin-top: 0.2rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.form-grid .field.full { grid-column: 1 / -1; }
.form-grid .field label { display: block; font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text); margin-bottom: 0.35rem; }
.form-grid .field input { margin: 0; }
.form-grid .field small { display: block; color: var(--text-secondary); font-size: 0.8rem; margin-top: 0.3rem; }
.toggle-row { display: flex; align-items: center; gap: 0.6rem; margin: 1.4rem 0 0.25rem; color: var(--text); }
.toggle-row input { margin: 0; flex: 0 0 auto; width: 1.05rem; height: 1.05rem; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* Save changes: centered button + centered label, prominent (≈40% larger) */
.save-row { display: flex; justify-content: center; margin-top: 1.75rem; }

/* Shipping address card — deliberately distinct from the profile form: dashed
   accent border + tinted background + truck icon, so billing vs shipping can
   never be confused. Collapsed (toggle off) = parcels follow the main address. */
.shipping-card {
    margin-top: 1.6rem;
    border: 2px dashed var(--accent);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--accent) 6%, var(--bg-card));
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.shipping-card.open { border-style: solid; box-shadow: var(--shadow-sm); }
.shipping-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.25rem;
    cursor: pointer;
    user-select: none;
}
.shipping-head input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); margin: 0; }
.shipping-icon {
    display: flex; align-items: center; justify-content: center;
    width: 2.4rem; height: 2.4rem; border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
}
.shipping-headtext { display: flex; flex-direction: column; line-height: 1.3; }
.shipping-headtext strong { font-size: 1rem; color: var(--text); }
.shipping-headtext small { color: var(--text-muted); font-size: 0.8rem; }
.shipping-card.open .shipping-headtext small { display: none; }
.shipping-fields { display: none; padding: 0.25rem 1.25rem 1.25rem; }
.shipping-card.open .shipping-fields { display: block; }

.btn-save { width: auto; justify-content: center; text-align: center; font-size: 1.4rem; font-weight: 700; padding: 0.85rem 2.4rem; }

/* ── Stats grid ── */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.stat .label {
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.375rem;
}

.stat .value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* ── Tables ── */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

table th {
    background: var(--bg-hover);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--accent);
}

table td {
    padding: 0.625rem 1rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}
table tr { transition: background 0.15s ease; }
table tr:hover { background: var(--bg-hover); }
table tr:last-child td { border-bottom: none; }
table td a { font-weight: 500; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none !important;
    font-family: inherit;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-input); color: var(--text); }

.btn-primary {
    background: var(--accent);
    color: var(--accent-text);
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }

.btn-danger {
    color: var(--error);
    border-color: var(--error-border);
}
.btn-danger:hover { background: var(--error-bg); }

.btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.8125rem;
}

/* ── Info card (for status messages) ── */
.info-card {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.info-card .info-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.info-card .info-icon.success { background: var(--success-bg); color: var(--success); }
.info-card .info-icon.warning { background: var(--accent-soft); color: var(--accent); }
.info-card h2 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.info-card p { color: var(--text-muted); margin-bottom: 0.25rem; font-size: 0.9375rem; }

/* ── Session / detail cards ── */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .detail-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8125rem;
}
.detail-row .detail-value { color: var(--text); font-weight: 500; }

/* .session-card is the ADMIN customer-detail list (body.admin, below). The
   customer-facing Sessions page uses .sess-* and shares the .purchase visual
   language: avatar tile, title + badge, muted meta line, trailing action. */
.session-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
}
.session-card .session-info { flex: 1; }
.session-card .session-info strong { font-size: 0.875rem; color: var(--text); }
.session-card .session-info small { display: block; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Sessions (customer) ── */
.sess-section { margin-top: 1.75rem; }
.sess-heading {
    font-size: 0.8125rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.09em; color: var(--text-muted); margin: 0 0 0.3rem;
}
.sess-lede { color: var(--text-secondary); font-size: 0.875rem; line-height: 1.5; margin: 0 0 0.9rem; max-width: 46rem; }
.sess-list { display: flex; flex-direction: column; gap: 0.75rem; }
.sess {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.05rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.sess:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); border-color: var(--border-input); }
.sess--current { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--bg-card) 70%); }
.sess-avatar {
    flex-shrink: 0;
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 11px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 700; font-size: 1.0625rem; line-height: 1;
}
.sess-avatar--app { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.sess-body { flex: 1; min-width: 0; }
.sess-head { display: flex; align-items: center; gap: 0.55rem; flex-wrap: wrap; }
.sess-title { font-size: 1rem; font-weight: 650; line-height: 1.3; margin: 0; color: var(--text); overflow-wrap: anywhere; }
.sess-access { color: var(--text-secondary); font-size: 0.8125rem; margin: 0.3rem 0 0; }
.sess-scope {
    display: inline-block; margin-left: 0.4rem;
    font-size: 0.6875rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--text-muted); background: var(--bg-hover);
    border-radius: 5px; padding: 0.1rem 0.4rem; vertical-align: 0.05rem;
}
/* "Connected via Claude (claude.ai)" — the provenance line. Sits directly
   under the app name because WHO is holding the connection outranks what it can
   reach: two rows can grant identical access and still be Claude and ChatGPT. */
.sess-via { color: var(--text-secondary); font-size: 0.8125rem; margin: 0.3rem 0 0; }
.sess-via-name { color: var(--text); font-weight: 650; }
/* An unrecognised origin prints as a bare hostname. Monospace says "this is a
   raw value we are repeating", not "this is a product we know". */
.sess-via-name--raw { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.78rem; font-weight: 600; }
.sess-via-note, .sess-via-unknown { color: var(--text-muted); cursor: help; }
.sess-authorized { color: var(--text-muted); font-size: 0.8125rem; margin: 0.25rem 0 0; }
.sess-meta { color: var(--text-muted); font-size: 0.8125rem; margin: 0.4rem 0 0; font-variant-numeric: tabular-nums; }
.sess-meta .dot { margin: 0 0.4rem; opacity: 0.5; }
.sess-meta [title] { cursor: help; border-bottom: 1px dotted transparent; }
.sess-meta [title]:hover { border-bottom-color: var(--border-input); }
.sess-ip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.75rem; opacity: 0.85; }
.sess-action { flex-shrink: 0; align-self: center; }
.sess-revoke-all { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

/* ── Connect an app (reference block) ── */
.connect-block { margin-top: 2rem; border-top: 1px solid var(--border); padding-top: 1.1rem; }
.connect-block > summary {
    cursor: pointer; color: var(--text-muted); font-size: 0.875rem; font-weight: 600;
    list-style: none; user-select: none; padding: 0.25rem 0;
}
/* Both halves are needed: ::-webkit-details-marker for older WebKit, ::marker
   for current Chrome/Firefox. Without the second, the UA still paints its own
   disclosure triangle next to the one this block draws. */
.connect-block > summary::-webkit-details-marker { display: none; }
.connect-block > summary::marker { content: ""; }
/* Pico (loaded from the CDN in base.html) draws its OWN right-aligned chevron on
   every <details> summary via ::after. Left unhidden, this block renders two
   disclosure markers — the one below on the left and Pico's on the right. */
.connect-block > summary::after { display: none; }
.connect-block > summary::before { content: "\25B8"; display: inline-block; margin-right: 0.5rem; transition: transform 0.15s ease; }
.connect-block[open] > summary::before { transform: rotate(90deg); }
.connect-block > summary:hover { color: var(--accent); }
.connect-note { color: var(--text-secondary); font-size: 0.8125rem; line-height: 1.55; margin: 0.5rem 0 0.9rem; max-width: 46rem; }
.connect-card:hover { transform: none; }
.connect-fields { margin: 0.55rem 0 0; display: grid; gap: 0.15rem; }
.connect-fields dt {
    font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--text-muted); margin-top: 0.5rem;
}
.connect-fields dt:first-child { margin-top: 0; }
.connect-fields dd { margin: 0; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.connect-hint { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: 0.8; }
.connect-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem; color: var(--text-secondary);
    background: var(--bg-hover); padding: 0.22rem 0.5rem; border-radius: 6px;
    overflow-wrap: anywhere;
}
.copy-btn {
    font: inherit; font-size: 0.72rem; font-weight: 650;
    color: var(--text-muted); background: transparent;
    border: 1px solid var(--border); border-radius: 6px;
    padding: 0.16rem 0.5rem; cursor: pointer;
    transition: all 0.15s ease;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.copy-btn.copied { color: var(--success); border-color: var(--success); background: transparent; }

/* ── Badge ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.15s ease;
}
.badge-success { background: rgba(5,150,105,0.2); color: var(--success); }
.badge-warning { background: rgba(79,70,229,0.2); color: var(--accent); }
.badge-error { background: rgba(220,38,38,0.2); color: var(--error); }
.badge-muted { background: rgba(100,116,139,0.2); color: var(--text-muted); }
[data-theme="dark"] .badge-success { background: rgba(52,211,153,0.2); color: var(--success); }
[data-theme="dark"] .badge-warning { background: rgba(129,140,248,0.2); color: var(--accent); }
[data-theme="dark"] .badge-error { background: rgba(248,113,113,0.2); color: var(--error); }
[data-theme="dark"] .badge-muted { background: rgba(148,163,184,0.2); color: var(--text-muted); }

/* ── Actions bar ── */
.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Home hero ── */
.home-hero {
    text-align: center;
    padding: 3rem 0 2rem;
    max-width: 480px;
    margin: 0 auto;
}
.home-hero .hero-icon {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}
.home-hero .hero-icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: white;
    stroke-width: 2;
}
.home-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.625rem;
    letter-spacing: -0.03em;
}
.home-hero p {
    color: var(--text-muted);
    font-size: 1.0625rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}
.home-hero .hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}
.home-hero .hero-actions .btn-primary {
    padding: 0.625rem 1.5rem;
    font-size: 0.9375rem;
}
.home-hero .hero-actions .btn {
    padding: 0.625rem 1.5rem;
    font-size: 0.9375rem;
}

/* ── Footer ── */
footer {
    margin-top: 3rem;
    padding: 1.25rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}
footer a {
    color: var(--text-muted);
    font-weight: 500;
}
footer a:hover { color: var(--accent); text-decoration: none; }
.footer-sep { color: var(--text-muted); }

/* ── Legal pages ── */
.legal-page { max-width: 680px; margin: 0 auto; }
.legal-page h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.legal-page .legal-updated { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 2rem; }
.legal-page h2 { font-size: 1.125rem; margin-top: 2rem; margin-bottom: 0.75rem; }
.legal-page p, .legal-page li { color: var(--text-secondary); font-size: 0.9375rem; line-height: 1.7; }
.legal-page ul { padding-left: 1.25rem; }
.legal-page li { margin-bottom: 0.375rem; }

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ── Purchases ── */
.purchase-list { display: flex; flex-direction: column; gap: 0.75rem; }
.purchase {
    display: flex;
    gap: 1.15rem;
    padding: 1.1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.purchase:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); border-color: var(--border-input); }
.purchase-cover {
    width: 62px;
    height: 90px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.20);
    background: var(--bg-hover);
}
.purchase-cover--blank {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
    box-shadow: var(--shadow-sm);
}
.purchase-body { flex: 1; min-width: 0; }
.purchase-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.purchase-title { font-size: 1.0625rem; font-weight: 650; line-height: 1.3; margin: 0; color: var(--text); }
.purchase-summary {
    color: var(--text-secondary); font-size: 0.875rem; line-height: 1.45;
    margin: 0.25rem 0 0;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.purchase-meta { color: var(--text-muted); font-size: 0.8125rem; margin: 0.5rem 0 0; font-variant-numeric: tabular-nums; }
.purchase-meta .dot { margin: 0 0.45rem; opacity: 0.5; }
.purchase-price { color: var(--text-secondary); font-weight: 650; }
.purchase-actions { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; margin-top: 0.8rem; }
.purchase-actions .btn svg { margin-right: -0.1rem; }
.purchase-receipt { color: var(--accent); font-size: 0.8125rem; font-weight: 500; text-decoration: none; }
.purchase-receipt:hover { text-decoration: underline; }
.purchase-key {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.78rem; color: var(--text-muted);
    background: var(--bg-hover); padding: 0.2rem 0.5rem; border-radius: 6px;
}
.purchase-revoked { color: var(--error); background: rgba(220,38,38,0.10); }
.purchase--pending { opacity: 0.82; }
.purchase--pending .purchase-cover { width: 46px; height: 67px; box-shadow: var(--shadow-sm); }

.pending-block { margin-top: 1.75rem; border-top: 1px solid var(--border); padding-top: 1.1rem; }
.pending-block > summary {
    cursor: pointer; color: var(--text-muted); font-size: 0.875rem; font-weight: 600;
    list-style: none; user-select: none; padding: 0.25rem 0;
}
.pending-block > summary::-webkit-details-marker { display: none; }
.pending-block > summary::before { content: "\25B8\00a0"; }
.pending-block[open] > summary::before { content: "\25BE\00a0"; }
.pending-note { color: var(--text-muted); font-size: 0.8125rem; margin: 0.3rem 0 0.95rem; }

.reveal-key {
    display: block; margin-top: 0.6rem; padding: 0.6rem 0.7rem;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; word-break: break-all; user-select: all;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; color: var(--text);
}

/* ── Table responsive wrapper ── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}
.table-responsive table {
    min-width: 600px;
}

/* ── Admin user badge ── */
.admin-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 0 0.5rem;
}
.admin-user strong {
    color: var(--text-secondary);
    font-weight: 600;
}

/* ── Sticky footer ── */
body {
    display: flex;
    flex-direction: column;
}
main.container {
    flex: 1;
}

/* ── Admin layout ── */
body.admin {
    --admin-heading: #d97706;
    --admin-heading-bg: rgba(217,119,6,0.08);
}
[data-theme="dark"] body.admin {
    --admin-heading: #fbbf24;
    --admin-heading-bg: rgba(251,191,36,0.1);
}
body.admin main.container {
    max-width: 1280px;
}
body.admin .header-inner {
    max-width: 1280px;
}
body.admin .page-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
}
body.admin .page-header p {
    font-size: 1.0625rem;
    color: var(--text-secondary);
}
body.admin .page-header .breadcrumb {
    font-size: 1rem;
}
body.admin .header-nav a {
    font-size: 1rem;
}
body.admin .admin-user {
    font-size: 0.9375rem;
}

/* ── Admin stat cards ── */
body.admin .stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
body.admin .stat {
    padding: 1.5rem;
    position: relative;
}
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.stat-icon svg {
    width: 20px;
    height: 20px;
}
.stat-icon-accent { background: var(--accent-soft); color: var(--accent); }
.stat-icon-warn { background: rgba(234,179,8,0.1); color: #b45309; }
.stat-icon-error { background: var(--error-bg); color: var(--error); }
[data-theme="dark"] .stat-icon-warn { background: rgba(234,179,8,0.12); color: #fbbf24; }
body.admin .stat .label {
    font-size: 0.8125rem;
    margin-bottom: 0.5rem;
}
body.admin .stat .value {
    font-size: 2.25rem;
    line-height: 1;
    letter-spacing: -0.03em;
}

/* ── Admin quick actions ── */
.admin-quick-actions {
    display: flex;
    gap: 0.75rem;
}
.admin-quick-actions .btn {
    font-size: 0.9375rem;
    padding: 0.625rem 1.25rem;
}

/* ── Admin table ── */
.admin-table-card {
    padding: 0;
    overflow: hidden;
}
.admin-table-card .table-responsive {
    border-radius: 0;
}
.admin-table-card table {
    border: none;
    border-radius: 0;
    box-shadow: none;
}
body.admin table th {
    font-size: 0.875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.875rem 1.25rem;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--accent);
}
body.admin table td {
    padding: 0.625rem 1rem;
    font-size: 1rem;
    color: var(--text);
}
.customer-cell {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}
.customer-email {
    font-weight: 600;
    color: var(--text);
}
.customer-id {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'DM Sans', monospace;
    letter-spacing: 0.01em;
}
.text-muted { color: var(--text-muted); }
.table-action {
    text-align: right;
    white-space: nowrap;
}

/* ── Admin detail layout ── */
.admin-detail-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.25rem;
    align-items: start;
}

/* Customer header card */
.customer-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.customer-avatar {
    width: 48px;
    height: 48px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    text-transform: uppercase;
    flex-shrink: 0;
}
.customer-headline {
    flex: 1;
    min-width: 0;
}
.customer-headline h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin: 0;
    word-break: break-all;
    color: var(--text);
}
.customer-headline .customer-id-accent {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    font-family: 'DM Sans', monospace;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.1875rem 0.625rem;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

/* Detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.detail-item {
    padding: 0.75rem;
    background: var(--bg-hover);
    border-radius: 8px;
}
.detail-item-full {
    grid-column: 1 / -1;
}
.detail-item .detail-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--admin-heading, var(--text-muted));
    margin-bottom: 0.375rem;
    display: block;
}
.detail-item .detail-value {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
}

/* ── Admin sidebar actions ── */
.admin-sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.admin-sidebar-actions form {
    margin: 0;
}
.btn-block {
    width: 100%;
    justify-content: center;
    height: 40px;
    font-size: 0.875rem;
    font-weight: 600;
    gap: 0.5rem;
}
.admin-lock-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.admin-lock-form input[type="text"] {
    height: 40px;
    margin: 0;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-input);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text);
    width: 100%;
}
.admin-lock-form input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    outline: none;
}
.admin-action-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}

/* ── Admin error ── */
.admin-error-card {
    text-align: center;
    padding: 3rem 2rem;
}
.admin-error-icon {
    width: 56px;
    height: 56px;
    background: var(--error-bg);
    color: var(--error);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.admin-error-msg {
    color: var(--text-muted);
    font-size: 1.0625rem;
    margin-bottom: 1.5rem;
}

/* ── Admin cards ── */
body.admin .card h3 {
    font-size: 1.125rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--admin-heading);
    border-bottom: 2px solid var(--admin-heading);
    padding-bottom: 0.625rem;
    margin-bottom: 1.125rem;
}
body.admin .badge {
    font-size: 0.875rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 700;
}
body.admin .empty-state {
    font-size: 1.0625rem;
    color: var(--text-secondary);
}

/* ── Admin sessions in detail ── */
body.admin .session-card {
    background: var(--bg-hover);
    border: none;
    box-shadow: none;
}
body.admin .session-card strong {
    font-size: 1rem;
    color: var(--text);
}
body.admin .session-card small {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ── Activity log ── */
.activity-log {
    font-family: 'DM Sans', monospace;
    font-size: 0.9375rem;
    border-radius: var(--radius);
    overflow: hidden;
}
.log-entry {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.log-entry:last-child { border-bottom: none; }
.log-entry:hover { background: var(--bg-hover); }
.log-ts {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.log-level {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}
.log-level-info { background: var(--accent-soft); color: var(--accent); }
.log-level-warn { background: rgba(234,179,8,0.12); color: #b45309; }
.log-level-error { background: var(--error-bg); color: var(--error); }
[data-theme="dark"] .log-level-warn { background: rgba(234,179,8,0.15); color: #fbbf24; }
.log-event {
    color: var(--text);
    font-weight: 700;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}
.log-msg {
    color: var(--text);
    font-weight: 500;
    flex: 1;
    word-break: break-word;
}
.log-ip {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    flex-shrink: 0;
}
.log-count {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

/* ── App Detail Page ── */
.app-detail-layout {
    max-width: 960px;
    margin: 0 auto;
}

.app-hero {
    text-align: center;
    padding: 2.5rem 1.5rem 2rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.app-hero-icon {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 12px rgba(79,70,229,0.25);
}
.app-hero-icon svg {
    width: 28px;
    height: 28px;
    stroke: white;
}

.app-hero-name {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.375rem;
    letter-spacing: -0.03em;
}

.app-hero-id {
    display: inline-block;
    font-size: 0.8125rem;
    font-family: 'DM Sans', monospace;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

.app-hero-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    flex-wrap: wrap;
}

.app-meta-sep {
    color: var(--border-input);
    font-size: 0.8rem;
}

.app-meta-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.app-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.875rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.app-status-approved { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.app-status-pending { background: rgba(234,179,8,0.1); color: #b45309; border: 1px solid rgba(234,179,8,0.3); }
.app-status-disabled { background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border); }
.app-status-revoked { background: var(--error-bg); color: var(--error); border: 1px solid var(--error-border); }
[data-theme="dark"] .app-status-pending { color: #fbbf24; }

.app-detail-grid {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 1.25rem;
    align-items: start;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.app-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.875rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--admin-heading-bg, var(--border));
}
.app-card-header svg {
    color: var(--admin-heading, var(--accent));
    flex-shrink: 0;
}
.app-card-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--admin-heading, var(--text));
    margin: 0;
    padding: 0;
    border: none;
}

.app-info-rows {
    display: flex;
    flex-direction: column;
}

.app-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.app-info-row:last-child { border-bottom: none; }

.app-info-row-stack {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.app-info-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.app-info-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    text-align: right;
}
.app-info-row-stack .app-info-value {
    text-align: left;
}

.app-info-value code {
    font-family: 'DM Sans', monospace;
    font-size: 0.8125rem;
    background: var(--bg-hover);
    padding: 0.1875rem 0.5rem;
    border-radius: 4px;
    color: var(--text);
    font-weight: 500;
}

.app-info-value-action {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.app-info-hint {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.app-code-block {
    display: block;
    font-family: 'DM Sans', monospace;
    font-size: 0.8125rem;
    background: var(--bg-hover);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: var(--text);
    font-weight: 500;
    width: 100%;
}
.app-code-wrap {
    word-break: break-all;
    line-height: 1.6;
}
.app-code-block em {
    color: var(--accent);
    font-style: normal;
    font-weight: 700;
}

.app-uri-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
}
.app-uri {
    display: block;
    font-family: 'DM Sans', monospace;
    font-size: 0.8125rem;
    background: var(--bg-hover);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    color: var(--text);
    font-weight: 500;
    word-break: break-all;
}

/* Branding grid */
.app-branding-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
}
.app-branding-item {
    padding: 0.625rem 0.75rem;
    background: var(--bg-hover);
    border-radius: 8px;
}
.app-branding-key {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.app-branding-val {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
}
.app-branding-val code {
    font-family: 'DM Sans', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    background: none;
    padding: 0;
    color: var(--text);
}
.app-branding-color {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.app-color-swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

/* App detail sidebar */
.app-detail-sidebar .app-card {
    position: sticky;
    top: 80px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .header-nav { display: none; }
    .menu-toggle { display: flex; }
    main.container { padding: 1.5rem 1rem 3rem; }
    .auth-container { min-height: calc(100vh - 2rem); padding: 1rem 0; }
    .home-hero { padding: 1.5rem 0; }
    .home-hero h1 { font-size: 1.5rem; }
    .home-hero .hero-actions { flex-direction: column; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    body.admin .stats { grid-template-columns: 1fr; }
    .account-nav { grid-template-columns: repeat(2, 1fr); }
    .session-card { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .sess { flex-wrap: wrap; gap: 0.85rem; padding: 0.95rem 1rem; }
    .sess-action { width: 100%; align-self: stretch; }
    .sess-action .btn { width: 100%; justify-content: center; }
    .connect-fields dd { gap: 0.4rem; }
    .table-responsive table td:first-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .admin-detail-grid { grid-template-columns: 1fr; }
    .admin-detail-sidebar { order: -1; }
    .detail-grid { grid-template-columns: 1fr; }
    .customer-header { flex-direction: column; align-items: flex-start; }
    .app-detail-grid { grid-template-columns: 1fr; }
    .app-detail-sidebar { order: -1; }
    .app-branding-grid { grid-template-columns: 1fr; }
    .app-hero { padding: 1.5rem 1rem; }
    .app-hero-name { font-size: 1.375rem; }
}

@media (max-width: 480px) {
    .auth-card { padding: 1.25rem; }
    .stats { grid-template-columns: 1fr; }
}

/* ── Confirmation Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.modal-overlay.show { opacity: 1; }

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.1);
    padding: 1.75rem;
    max-width: 400px;
    width: 100%;
    transform: scale(0.95) translateY(8px);
    transition: transform 0.15s ease;
}
.modal-overlay.show .modal-card {
    transform: scale(1) translateY(0);
}

.modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.modal-icon-danger {
    background: var(--error-bg);
    color: var(--error);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.5rem;
}

.modal-message {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.625rem;
    justify-content: flex-end;
}
.modal-actions .btn {
    min-width: 90px;
    justify-content: center;
}

/* ── Table inline delete button ── */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.btn-icon:hover {
    background: var(--error-bg);
    color: var(--error);
    border-color: var(--error-border);
}
.btn-icon svg {
    width: 15px;
    height: 15px;
}

/* ---- Signup: the "what are you looking for?" chips ---------------------- */
/*
   The chip look lives ENTIRELY here, on the label of a real
   <input type="radio">. Remove this stylesheet and the group degrades to a
   plain radio list that still works, still validates, and is still announced
   correctly by a screen reader — which is the reason it is not a set of
   buttons with click handlers.
*/
.interest-group {
    border: none;
    padding: 0;
    margin: 0 0 var(--pico-spacing, 1rem) 0;
}
.interest-group legend {
    padding: 0;
    margin-bottom: .5rem;
    font-weight: 600;
}
.interest-chips {
    display: grid;
    /* Two columns where there is room, stacked on a phone. */
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}
@media (max-width: 640px) {
    .interest-chips { grid-template-columns: 1fr; }
}
.interest-chip {
    display: flex;
    align-items: center;
    gap: .55rem;
    margin: 0;
    padding: .6rem .8rem;
    border: 1px solid var(--pico-form-element-border-color, #cfd5e0);
    border-radius: .6rem;
    cursor: pointer;
    line-height: 1.25;
    transition: border-color .12s ease, background-color .12s ease;
}
.interest-chip:hover {
    border-color: var(--pico-primary, #3b5bdb);
}
/* The visible selected state follows the radio's own :checked, so it can never
   disagree with what will actually be submitted. */
.interest-chip:has(input:checked) {
    border-color: var(--pico-primary, #3b5bdb);
    background: var(--pico-primary-focus, rgba(59, 91, 219, .08));
}
/* Keyboard focus must be visible on the CHIP, not just on the 1em radio. */
.interest-chip:has(input:focus-visible) {
    outline: 2px solid var(--pico-primary, #3b5bdb);
    outline-offset: 2px;
}
.interest-chip input[type="radio"] {
    margin: 0;
    flex: 0 0 auto;
}
.interest-chip span { flex: 1 1 auto; }
.interest-note-count {
    display: block;
    margin-top: -.4rem;
    opacity: .7;
}
