/* ─────────────────────────────────────────────────────────────
   Evolved Sense Identity — UI Styles
   Auth pages, admin pages, account settings, header & footer.
   ───────────────────────────────────────────────────────────── */

/* 2026-11-24 — colours, type, radius and shadows come from EvolvedSense.Shared.Design
   (tokens.css + components.css, linked before this file). This file is layout only. */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--es-font);
    background: var(--es-bg);
    color: var(--es-text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

/* ─────────────────────────────────────────────────────────────
   Sidebar layout (Phase P-2 — 2026-05-23)
   Activated by `<body class="with-sidebar">` (signed-in surfaces only).
   ───────────────────────────────────────────────────────────── */

:root {
    --sidebar-width: var(--es-sidebar-w);
    --sidebar-collapsed-width: 68px;
    --topbar-height: var(--es-header-h);
    --sidebar-bg: var(--es-surface);
    --sidebar-border: var(--es-border);
    --sidebar-icon: var(--es-text-3);
    --sidebar-text: var(--es-text-2);
    --sidebar-label: var(--es-text-3);
    --sidebar-hover-bg: var(--es-surface-2);
    --sidebar-active-bg: var(--brand-soft);
    --sidebar-active-text: var(--brand);
    --sidebar-active-border: var(--brand);
}

body.with-sidebar {
    display: block;            /* override column-flex from default body */
    background: var(--es-bg);
}

/* ── Sidebar shell ─────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: width 200ms ease, transform 200ms ease;
    overflow: hidden;          /* children manage their own scroll */
}

/* Brand row */
.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--es-text);
    overflow: hidden;
}
.sidebar-logo img { width: 28px; height: 28px; flex-shrink: 0; }
.sidebar-brand-text {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.sidebar-collapse {
    background: transparent;
    border: 1px solid transparent;
    color: var(--es-text-3);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    transition: background 120ms ease, color 120ms ease;
}
.sidebar-collapse:hover { background: var(--sidebar-hover-bg); color: var(--es-text); }

/* Nav scroll area */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 10px 12px;
    /* Quieter scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--es-border-strong) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--es-border-strong); border-radius: 3px; }

/* Section group */
.sidebar-section { margin-bottom: 14px; }
.sidebar-section-label {
    padding: 8px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sidebar-label);
    white-space: nowrap;
}

/* Link row */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    margin: 1px 0;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.3;
    position: relative;
    transition: background 120ms ease, color 120ms ease;
    border-left: 3px solid transparent;
    margin-left: -3px;            /* compensate so non-active rows still align */
    padding-left: 9px;            /* 12 - 3 */
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-link i {
    font-size: 16px;
    color: var(--sidebar-icon);
    flex-shrink: 0;
    width: 18px;
    text-align: center;
    transition: color 120ms ease;
}
.sidebar-link span {
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-link:hover {
    background: var(--sidebar-hover-bg);
    color: var(--es-text);
}
.sidebar-link:hover i { color: var(--es-text); }
.sidebar-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left-color: var(--sidebar-active-border);
    font-weight: 600;
}
.sidebar-link.active i { color: var(--sidebar-active-text); }

/* Footer (user + sign out) */
.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 12px 10px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 8px;
    margin-bottom: 4px;
    overflow: hidden;
}
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--brand-contrast);
    font-weight: 600;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-meta { overflow: hidden; min-width: 0; }
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--es-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-role {
    font-size: 11px;
    color: var(--es-text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.sidebar-logout-form { margin: 0; }
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--es-text-3);
    padding: 8px 10px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 120ms ease, color 120ms ease;
}
.sidebar-logout:hover {
    background: var(--es-danger-soft);
    color: var(--es-danger);
}
.sidebar-logout i { font-size: 15px; }

/* ── App shell (content side of the split) ─────────────────── */
.app-shell {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 200ms ease;
}

.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--sidebar-border);
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}
.topbar-menu {
    display: none;                  /* shown on mobile */
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--es-text);
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 6px;
}
.topbar-menu:hover { background: var(--sidebar-hover-bg); }
.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--es-text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 6px;
    border: 1px solid var(--es-border);
    color: var(--es-text-3);
    background: var(--es-surface);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.topbar-action:hover {
    border-color: var(--brand);
    color: var(--brand);
    background: var(--brand-soft);
}

/* Adjust default page-content for sidebar layout */
body.with-sidebar .page-content {
    padding: 24px;
    flex: 1;
    background: var(--es-bg);
}

/* Footer */
.app-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
    color: var(--es-text-3);
    background: var(--sidebar-bg);
    flex-wrap: wrap;
}
.app-footer-links { display: flex; gap: 14px; }
.app-footer-links a { color: var(--es-text-3); text-decoration: none; }
.app-footer-links a:hover { color: var(--brand); }

/* ── Mobile overlay ─────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--es-gray-900) 45%, transparent);
    z-index: 150;
    opacity: 0;
    transition: opacity 200ms ease;
}

/* ── Collapsed (desktop, icons-only) ────────────────────────── */
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
body.sidebar-collapsed .app-shell { margin-left: var(--sidebar-collapsed-width); }
body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .sidebar-link span,
body.sidebar-collapsed .sidebar-user-meta,
body.sidebar-collapsed .sidebar-logout span {
    display: none;
}
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding-right: 16px; }
body.sidebar-collapsed .sidebar-link { justify-content: center; padding: 10px 0; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 4px 0; }
body.sidebar-collapsed .sidebar-logout { justify-content: center; padding: 8px 0; }
body.sidebar-collapsed .sidebar-collapse i {
    transform: rotate(180deg);
}
body.sidebar-collapsed .sidebar-section {
    margin-bottom: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--sidebar-border);
}
body.sidebar-collapsed .sidebar-section:first-child { border-top: none; padding-top: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1023px) {
    /* Tablet: auto-collapse for more content room */
    body.with-sidebar:not(.sidebar-open) .sidebar { width: var(--sidebar-collapsed-width); }
    body.with-sidebar:not(.sidebar-open) .app-shell { margin-left: var(--sidebar-collapsed-width); }
    body.with-sidebar:not(.sidebar-open) .sidebar-brand-text,
    body.with-sidebar:not(.sidebar-open) .sidebar-section-label,
    body.with-sidebar:not(.sidebar-open) .sidebar-link span,
    body.with-sidebar:not(.sidebar-open) .sidebar-user-meta,
    body.with-sidebar:not(.sidebar-open) .sidebar-logout span { display: none; }
    body.with-sidebar:not(.sidebar-open) .sidebar-brand { justify-content: center; }
    body.with-sidebar:not(.sidebar-open) .sidebar-link { justify-content: center; padding: 10px 0; }
    body.with-sidebar:not(.sidebar-open) .sidebar-user { justify-content: center; }
    body.with-sidebar:not(.sidebar-open) .sidebar-logout { justify-content: center; }
    .sidebar-collapse { display: none; }   /* desktop-only toggle */
}

@media (max-width: 767px) {
    /* Mobile: sidebar is off-canvas, topbar hamburger toggles it. */
    /* Selectors repeat the tablet rule's :not(.sidebar-open) so they outrank it (2026-11-24:
       at 375px the content kept a 68px gutter and ran off the right edge). */
    body.with-sidebar .sidebar,
    body.with-sidebar:not(.sidebar-open) .sidebar,
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-width);                /* full-width drawer */
        transform: translateX(-100%);
    }
    body.with-sidebar:not(.sidebar-open) .app-shell,
    body.sidebar-collapsed .app-shell { margin-left: 0; }
    body.with-sidebar:not(.sidebar-open) .sidebar-brand-text,
    body.with-sidebar:not(.sidebar-open) .sidebar-section-label,
    body.with-sidebar:not(.sidebar-open) .sidebar-link span,
    body.with-sidebar:not(.sidebar-open) .sidebar-user-meta,
    body.with-sidebar:not(.sidebar-open) .sidebar-logout span { display: revert; }
    body.with-sidebar.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: var(--es-shadow-lg);
    }
    body.with-sidebar .app-shell { margin-left: 0; }
    body.with-sidebar.sidebar-open .sidebar-overlay {
        display: block;
        opacity: 1;
    }
    .topbar-menu { display: inline-flex; }
    .topbar { padding: 0 16px; }
    body.with-sidebar .page-content { padding: 16px; }
    .topbar-action span { display: none; }       /* icon-only on small screens */

    /* When opened on mobile, restore full labels */
    body.with-sidebar.sidebar-open .sidebar-brand-text,
    body.with-sidebar.sidebar-open .sidebar-section-label,
    body.with-sidebar.sidebar-open .sidebar-link span,
    body.with-sidebar.sidebar-open .sidebar-user-meta,
    body.with-sidebar.sidebar-open .sidebar-logout span { display: inline; }
    body.with-sidebar.sidebar-open .sidebar-brand { justify-content: space-between; }
    body.with-sidebar.sidebar-open .sidebar-link { justify-content: flex-start; padding: 9px 12px; }
    body.with-sidebar.sidebar-open .sidebar-user { justify-content: flex-start; }
    body.with-sidebar.sidebar-open .sidebar-logout { justify-content: flex-start; padding: 8px 10px; }
}

/* Suppress the anonymous-fallback .site-header / .site-footer for signed-in pages. */
body.with-sidebar .site-header,
body.with-sidebar .site-footer { display: none; }

/* ── Site Header ─────────────────────────────────────────────── */

.site-header {
    background: var(--es-surface);
    border-bottom: 1px solid var(--es-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--es-shadow-xs);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.header-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.header-logo img {
    height: 32px;
    width: auto;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--es-text-3);
    text-decoration: none;
    border-radius: var(--es-radius-sm);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.header-link:hover {
    color: var(--es-text);
    background: var(--brand-soft);
    text-decoration: none;
}

.header-link.active {
    color: var(--brand);
    background: var(--brand-soft);
}

.header-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* ── Page Content ────────────────────────────────────────────── */

.page-content {
    flex: 1;
    padding: 2rem 1rem;
}

/* ── Page Container (centered content for admin/settings pages) */

.page-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 0.5rem;
}

.page-container.narrow {
    max-width: 560px;
}

/* ── Page Card ───────────────────────────────────────────────── */

.page-card {
    background: var(--es-surface);
    border-radius: var(--es-radius);
    box-shadow: var(--es-shadow-lg);
    padding: 2rem;
}

.page-card-header {
    margin-bottom: 1.5rem;
}

.page-card-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--es-text);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.page-card-header p {
    font-size: 0.875rem;
    color: var(--es-text-3);
}

/* ── Site Footer ─────────────────────────────────────────────── */

.site-footer {
    background: var(--es-text);
    color: var(--es-gray-300);
    padding: 2rem 1.5rem;
    margin-top: auto;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.footer-logo {
    height: 24px;
    width: auto;
    filter: brightness(0) invert(1) opacity(0.7);
}

.footer-brand span {
    font-weight: 600;
    color: var(--es-gray-0);
    font-size: 0.9375rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--es-gray-400);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 0.15s ease;
}

.footer-links a:hover {
    color: var(--es-gray-0);
    text-decoration: none;
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--es-gray-500);
}

/* ── Auth Container (Login, Register, etc.) ──────────────────── */

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;
    background: radial-gradient(1200px 600px at 10% -10%, var(--brand-soft), transparent 60%), var(--es-bg);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--es-surface);
    border-radius: var(--es-radius);
    box-shadow: var(--es-shadow-lg);
    padding: 2.5rem;
}

/* ── Auth Header ─────────────────────────────────────────────── */

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    height: 40px;
    width: auto;
    margin-bottom: 1.25rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--es-text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--es-text-3);
    line-height: 1.5;
}

/* ── Google OAuth Button ─────────────────────────────────────── */

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--es-border);
    border-radius: var(--es-radius-sm);
    background: var(--es-surface);
    color: var(--es-text);
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-google:hover {
    border-color: var(--es-border-strong);
    background: var(--es-surface-2);
    box-shadow: var(--es-shadow-xs);
}

.google-icon {
    width: 20px;
    height: 20px;
}

/* ── Divider ─────────────────────────────────────────────────── */

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--es-text-3);
    font-size: 0.8125rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--es-border);
}

/* ── Form Elements ───────────────────────────────────────────── */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--es-text);
    margin-bottom: 0.375rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: var(--es-font);
    color: var(--es-text);
    background: var(--es-surface);
    border: 1.5px solid var(--es-border);
    border-radius: var(--es-radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}

.form-control::placeholder {
    color: var(--es-text-3);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ── Checkbox ────────────────────────────────────────────────── */

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.form-check-input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--es-text-3);
    cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────── */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--es-font);
    color: var(--brand-contrast);
    background: var(--brand);
    border: none;
    border-radius: var(--es-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-primary:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--es-font);
    color: var(--brand);
    background: transparent;
    border: 1.5px solid var(--brand);
    border-radius: var(--es-radius-sm);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-outline:hover {
    background: var(--brand-soft);
    text-decoration: none;
}

.btn-full {
    width: 100%;
    margin-top: 0.5rem;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--es-font);
    color: var(--es-gray-0);
    background: var(--es-danger);
    border: none;
    border-radius: var(--es-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-danger:hover {
    background: color-mix(in srgb, var(--es-danger) 85%, black);
}

.btn-success {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--es-font);
    color: var(--es-gray-0);
    background: var(--es-success);
    border: none;
    border-radius: var(--es-radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-success:hover {
    background: color-mix(in srgb, var(--es-success) 85%, black);
}

/* ── Links ───────────────────────────────────────────────────── */

a {
    color: var(--brand);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--brand-hover);
    text-decoration: underline;
}

.forgot-link {
    font-size: 0.8125rem;
    font-weight: 400;
}

.auth-footer {
    text-align: center;
    font-size: 0.875rem;
    color: var(--es-text-3);
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--es-border);
}

/* ── Data Table ──────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead tr {
    border-bottom: 2px solid var(--es-border);
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 0.75rem 0.5rem;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--es-border);
    transition: background 0.1s ease;
}

.data-table tbody tr:hover {
    background: var(--brand-soft);
}

/* ── Status Badge ────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.badge-success { background: var(--es-success-soft); color: var(--es-success); }
.badge-danger  { background: var(--es-danger-soft); color: var(--es-danger); }
.badge-warning { background: var(--es-warning-soft); color: var(--es-warning); }
.badge-muted   { background: var(--es-surface-2); color: var(--es-text-3); }
.badge-primary { background: var(--brand-soft); color: var(--brand); }

/* ── Info Box ────────────────────────────────────────────────── */

.info-box {
    background: var(--es-surface-2);
    border: 1px solid var(--es-border);
    border-radius: var(--es-radius-sm);
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.8;
}

.info-box p {
    margin: 0;
}

.info-box strong {
    color: var(--es-text);
}

/* ── Alerts ──────────────────────────────────────────────────── */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--es-radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.alert ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
}

.alert ul li {
    margin-bottom: 0.25rem;
}

.alert-danger {
    background: var(--es-danger-soft);
    color: var(--es-danger);
    border: 1px solid color-mix(in srgb, var(--es-danger) 30%, transparent);
}

.alert-success {
    background: var(--es-success-soft);
    color: var(--es-success);
    border: 1px solid color-mix(in srgb, var(--es-success) 30%, transparent);
}

.alert-info {
    background: var(--es-info-soft);
    color: var(--es-info);
    border: 1px solid var(--es-border);
}

/* Hide empty validation summary */
.alert-danger:empty,
.alert-danger:not(:has(*)):not(:empty) {
    display: none;
}

/* ── Field Errors ────────────────────────────────────────────── */

.field-error {
    display: block;
    font-size: 0.8125rem;
    color: var(--es-danger);
    margin-top: 0.25rem;
    min-height: 0;
}

.field-error:empty {
    display: none;
}

.input-validation-error {
    border-color: var(--es-danger) !important;
}

.input-validation-error:focus {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--es-danger) 15%, transparent) !important;
}

/* ── Turnstile Widget ────────────────────────────────────────── */

.cf-turnstile {
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
    .header-inner {
        padding: 0 1rem;
        gap: 1rem;
    }

    .header-nav {
        display: none;
    }

    .header-actions .header-link span {
        display: none;
    }

    .page-content {
        padding: 1.5rem 0.75rem;
    }

    .page-card {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 1.75rem 1.25rem;
        box-shadow: var(--es-shadow-sm);
    }

    .auth-title {
        font-size: 1.25rem;
    }

    .page-card {
        padding: 1.25rem;
    }

    .page-card-header h1 {
        font-size: 1.25rem;
    }

    .data-table {
        font-size: 0.8rem;
    }
}

/* ═════════════════════════════════════════════════════════════
   2026-11-24 — portal places, theme switch, auth polish, dashboard,
   workspace, admin console, sign-up stepper. Shared tokens only.
   ═════════════════════════════════════════════════════════════ */
.sidebar-brand-text small { display: block; font-size: var(--es-text-xs); font-weight: 500; color: var(--es-text-3); letter-spacing: 0; }

.place-switcher { display: flex; gap: var(--es-space-1); padding: var(--es-space-2) var(--es-space-3); border-bottom: 1px solid var(--sidebar-border); }
.place-switcher__item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--es-space-2) var(--es-space-1);
    border-radius: var(--es-radius-sm); color: var(--es-text-2); text-decoration: none; font-size: var(--es-text-xs); font-weight: 600; text-align: center; line-height: 1.2; }
.place-switcher__item i { font-size: 1rem; }
.place-switcher__item:hover { background: var(--es-surface-2); color: var(--es-text); }
.place-switcher__item.is-current { background: var(--brand-soft); color: var(--brand); }
body.sidebar-collapsed .place-switcher { flex-direction: column; }
body.sidebar-collapsed .place-switcher__item span { display: none; }
@media (max-width: 1023px) {
    body.with-sidebar:not(.sidebar-open) .place-switcher { flex-direction: column; }
    body.with-sidebar:not(.sidebar-open) .place-switcher__item span { display: none; }
}

.sidebar-link:focus-visible, .place-switcher__item:focus-visible, .topbar-action:focus-visible, .theme-toggle:focus-visible,
.sidebar-logout:focus-visible, .topbar-menu:focus-visible, .sidebar-collapse:focus-visible, .es-btn:focus-visible, .es-card--link:focus-visible,
.password-toggle:focus-visible, .auth-body a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
#main:focus { outline: none; }

.theme-toggle { display: inline-flex; align-items: center; gap: var(--es-space-2); min-height: 36px; padding: 0 var(--es-space-3);
    border: 1px solid var(--es-border); border-radius: var(--es-radius); background: var(--es-surface); color: var(--es-text-2);
    font: 500 var(--es-text-sm)/1 var(--es-font); cursor: pointer; text-transform: capitalize; }
.theme-toggle:hover { background: var(--es-surface-2); color: var(--es-text); }
@media (max-width: 767px) { .theme-toggle span { display: none; } }

.page-breadcrumb { margin-bottom: var(--es-space-4); }
.page-breadcrumb [aria-current="page"] { color: var(--es-text-2); }

/* Auth pages */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--es-bg); color: var(--es-text); }
.auth-body main { flex: 1; }
.auth-body .auth-container { min-height: calc(100vh - 120px); }
.auth-topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--es-space-3); padding: var(--es-space-3) var(--es-space-4); }
.auth-topbar__back { display: inline-flex; align-items: center; gap: var(--es-space-2); color: var(--brand); text-decoration: none; font-size: var(--es-text-sm); font-weight: 600; }
.auth-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--es-space-4); padding: var(--es-space-4); font-size: var(--es-text-xs); color: var(--es-text-3); }
.auth-legal a { color: inherit; }
.auth-card { border: 1px solid var(--es-border); border-radius: var(--es-radius-xl); }
.auth-card--wide { max-width: 560px; }
.auth-card .es-alert { margin-bottom: var(--es-space-4); }
.auth-card .es-alert p + p { margin-top: var(--es-space-1); }
.btn-google { gap: var(--es-space-3); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--es-space-2); }
.forgot-link { font-size: var(--es-text-xs); font-weight: 600; color: var(--brand); text-decoration: none; }
.password-field { position: relative; }
.password-field .es-input { padding-right: 44px; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: var(--es-radius-sm);
    background: transparent; color: var(--es-text-3); cursor: pointer; display: grid; place-items: center; }
.password-toggle:hover { color: var(--es-text); background: var(--es-surface-2); }
.resend-row { display: flex; align-items: center; justify-content: center; gap: var(--es-space-2); margin-top: var(--es-space-3); font-size: var(--es-text-sm); }
.auth-steps { justify-content: center; margin-bottom: var(--es-space-6); }
.auth-done-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto var(--es-space-4);
    background: var(--es-success-soft); color: var(--es-success); font-size: 1.75rem; }
.tips { display: grid; gap: var(--es-space-3); margin: var(--es-space-6) 0; padding: 0; list-style: none; }
.tips li { display: flex; gap: var(--es-space-3); align-items: flex-start; font-size: var(--es-text-sm); color: var(--es-text-2); }
.tips i { color: var(--brand); font-size: 1.1rem; }

/* Product choice (sign-up step 1) */
.choice-grid { display: grid; gap: var(--es-space-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); border: 0; padding: 0; margin: 0 0 var(--es-space-6); }
.choice-grid legend { font-weight: 600; font-size: var(--es-text-sm); margin-bottom: var(--es-space-2); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice__body { display: block; height: 100%; padding: var(--es-space-4); border: 1.5px solid var(--es-border); border-radius: var(--es-radius-lg); background: var(--es-surface); }
.choice__title { display: block; font-weight: 700; }
.choice__text { display: block; font-size: var(--es-text-xs); color: var(--es-text-3); margin-top: var(--es-space-1); }
.choice input:checked + .choice__body { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 1px var(--brand); }
.choice input:focus-visible + .choice__body { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Dashboard, Workspace home, Admin console */
.dash-hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--es-space-4); margin-bottom: var(--es-space-6); }
.dash-hero h1 { font-size: var(--es-text-2xl); font-weight: 700; line-height: var(--es-leading-tight); }
.dash-hero p { color: var(--es-text-2); margin-top: var(--es-space-1); }
.dash-stats { display: grid; gap: var(--es-space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); margin-bottom: var(--es-space-6); }
.dash-stats .es-card__body { padding: var(--es-space-5); }
.dash-cols { display: grid; gap: var(--es-space-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); margin-bottom: var(--es-space-6); }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--es-space-3); padding: var(--es-space-3) var(--es-space-6); border-bottom: 1px solid var(--es-border); font-size: var(--es-text-sm); }
.dash-list li:last-child { border-bottom: 0; }
.dash-list .meta { color: var(--es-text-3); font-size: var(--es-text-xs); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: var(--es-space-3); padding: var(--es-space-3) var(--es-space-6); border-bottom: 1px solid var(--es-border); font-size: var(--es-text-sm); }
.checklist li:last-child { border-bottom: 0; }
.checklist .done { color: var(--es-success); }
.checklist .todo { color: var(--es-text-3); }
.checklist li.is-done a { color: var(--es-text-3); text-decoration: line-through; }
.tile-grid { display: grid; gap: var(--es-space-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.tile { padding: var(--es-space-5); display: flex; gap: var(--es-space-3); align-items: flex-start; }
.tile i { font-size: 1.25rem; color: var(--brand); background: var(--brand-soft); width: 40px; height: 40px; border-radius: var(--es-radius); display: grid; place-items: center; flex: none; }
.tile strong { display: block; font-size: var(--es-text-md); }
.tile span { display: block; font-size: var(--es-text-sm); color: var(--es-text-3); margin-top: 2px; }
.tile .es-badge { margin-top: var(--es-space-2); }
.console-group { margin-bottom: var(--es-space-8); }
.console-group h2 { font-size: var(--es-text-lg); font-weight: 650; margin-bottom: var(--es-space-3); }
.console-search { max-width: 480px; margin-bottom: var(--es-space-6); }
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--es-space-3); align-items: flex-end; margin-bottom: var(--es-space-6); }
.filter-bar .es-field { min-width: 160px; flex: 1 1 160px; }
.mono { font-family: var(--es-font-mono); font-size: var(--es-text-xs); }

/* Hidden means hidden, even on flex/block components (search filters, toggles). */
[hidden] { display: none !important; }
.auth-done-icon--warn { background: var(--es-warning-soft); color: var(--es-warning); }
.recovery-codes { background: var(--es-surface-2); border: 1px solid var(--es-border); border-radius: var(--es-radius); padding: var(--es-space-4); white-space: pre-wrap; }
.setup-steps { padding-left: var(--es-space-5); display: grid; gap: var(--es-space-3); font-size: var(--es-text-sm); }
.setup-key { display: block; margin-top: var(--es-space-2); padding: var(--es-space-2) var(--es-space-3); background: var(--es-surface-2); border-radius: var(--es-radius-sm); letter-spacing: 0.05em; word-break: break-all; }

/* 2026-11-24 accessibility pass (portal layouts).
   1. Muted text: the shared --es-text-3 (#64748B) is 4.34:1 on --es-surface-2 (#F1F5F9) in the light theme, under
      WCAG AA 4.5:1 for body text; #5B6B80 is 4.96:1 there and 5.5:1 on white. Light theme only: the dark rules in
      tokens.css (:root[data-theme="dark"], and :root[data-theme="auto"] under prefers-color-scheme: dark) are more
      specific and keep #7F8DA3, which already passes (4.7:1 on the dark surface-2). Kept here, not in Shared.Design,
      so the other products are untouched.
   2. Focus ring: the design system's default ring is the brand colour at 45% alpha; on light surfaces that can fall
      under the 3:1 non-text contrast minimum, so the portal draws it solid.
   3. Reduced motion: tokens.css zeroes --es-fast/--es-normal, but literal durations and keyframe animations
      (spinners, sidebar slide) ignore those; stop them all. */
:root { --es-text-3: #5B6B80; }
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline-color: var(--brand); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* "Test as" banner (2026-11-24) */
.tp-banner { align-items: center; flex-wrap: wrap; }
.tp-banner > div { flex: 1 1 18rem; min-width: 0; }
.tp-banner__stop { margin-left: auto; }
