/*
 * AI Mail design system
 * Branded, dependency-free presentation layer shared by every user and admin page.
 * Loaded after the legacy stylesheet so existing behavior and layout hooks remain intact.
 */

:root {
    --brand-navy-950: #041326;
    --brand-navy-900: #071d3a;
    --brand-navy-800: #0b2a52;
    --brand-navy-700: #123d70;
    --brand-blue-600: #1f5fae;
    --brand-blue-500: #2d73c8;
    --brand-blue-100: #e8f1fb;
    --brand-gold-600: #b88416;
    --brand-gold-500: #d5a62a;
    --brand-gold-400: #e7bf55;
    --brand-gold-100: #fff5d8;
    --surface-canvas: #f3f6fa;
    --surface-card: #ffffff;
    --surface-subtle: #f8fafc;
    --surface-muted: #eef3f8;
    --ink-strong: #10243e;
    --ink-default: #344a63;
    --ink-muted: #6b7d91;
    --line-default: #dce5ef;
    --line-strong: #c9d6e4;
    --success-700: #17613a;
    --success-100: #e9f8ef;
    --warning-700: #875b0a;
    --warning-100: #fff4d5;
    --danger-700: #a22a32;
    --danger-100: #fdf0f1;
    --info-700: #24578f;
    --info-100: #ebf4fd;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow-xs: 0 1px 2px rgba(4, 19, 38, 0.05);
    --shadow-sm: 0 7px 20px rgba(4, 19, 38, 0.07);
    --shadow-md: 0 18px 46px rgba(4, 19, 38, 0.1);
    --focus-ring: 0 0 0 3px rgba(45, 115, 200, 0.18);
    --content-max: 1380px;
    --font-sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html {
    color-scheme: light;
    scroll-behavior: smooth;
}

body {
    background: var(--surface-canvas);
    color: var(--ink-strong);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--brand-blue-600);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--brand-navy-800);
}

::selection {
    background: var(--brand-gold-100);
    color: var(--brand-navy-900);
}

:focus-visible {
    outline: 2px solid var(--brand-blue-500);
    outline-offset: 2px;
}

.muted {
    color: var(--ink-muted) !important;
}

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

.page-eyebrow {
    margin: 0 0 5px;
    color: var(--brand-gold-600);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.09em;
    line-height: 1.2;
    text-transform: uppercase;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
}

/* Application shell and navigation */
.dashboard-layout {
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% -12%, rgba(45, 115, 200, 0.08), transparent 30rem),
        var(--surface-canvas);
}

.app-topbar {
    position: sticky;
    z-index: 100;
    top: 0;
    display: block;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(112deg, var(--brand-navy-950), var(--brand-navy-900) 54%, #0d315d);
    box-shadow: 0 8px 30px rgba(4, 19, 38, 0.16);
}

.app-topbar .app-topbar-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    width: min(100%, 1560px);
    min-height: 72px;
    margin: 0 auto;
    padding: 9px 24px;
    gap: 22px;
}

.app-topbar .app-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #ffffff !important;
    text-decoration: none;
}

.app-brand img {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.2));
}

.app-brand-copy {
    display: grid;
    line-height: 1.12;
}

.app-brand-copy strong {
    color: #ffffff;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.app-brand-copy small {
    margin-top: 3px;
    color: #c8d7e8;
    font-size: 0.59rem;
    font-weight: 650;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.app-primary-nav,
.app-utility-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.app-primary-nav {
    min-width: 0;
}

.app-utility-nav {
    justify-content: flex-end;
}

.app-topbar .app-primary-nav > a,
.app-topbar .app-utility-nav > a,
.app-more-menu > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent !important;
    color: #d5e0ed !important;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.app-topbar .app-primary-nav > a:hover,
.app-topbar .app-utility-nav > a:hover,
.app-more-menu > summary:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

.app-topbar .app-primary-nav > a.is-active,
.app-topbar .app-utility-nav > a.is-active,
.app-more-menu > summary.is-active {
    border-color: rgba(231, 191, 85, 0.35);
    background: rgba(213, 166, 42, 0.14) !important;
    color: #ffe193 !important;
}

.app-topbar .app-logout-link {
    border-color: rgba(255, 255, 255, 0.13) !important;
}

.app-more-menu {
    position: relative;
}

.app-more-menu > summary {
    cursor: pointer;
    list-style: none;
    transition:
        color 150ms ease,
        background-color 150ms ease,
        border-color 150ms ease;
}

.app-more-menu > summary::-webkit-details-marker {
    display: none;
}

.app-more-menu > summary::after {
    width: 6px;
    height: 6px;
    margin: -3px 1px 0 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    content: "";
    transform: rotate(45deg);
    transition: transform 150ms ease;
}

.app-more-menu[open] > summary {
    border-color: rgba(231, 191, 85, 0.28);
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.app-more-menu[open] > summary::after {
    margin-top: 3px;
    transform: rotate(225deg);
}

.app-more-menu > summary:focus-visible {
    outline: 2px solid var(--brand-gold-400);
    outline-offset: 3px;
}

.app-more-popover {
    position: absolute;
    z-index: 110;
    top: calc(100% + 14px);
    right: 0;
    display: grid;
    box-sizing: border-box;
    width: min(500px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    padding: 18px;
    border: 1px solid rgba(184, 132, 22, 0.25);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 245, 216, 0.42), rgba(255, 255, 255, 0) 56px),
        var(--surface-card);
    box-shadow:
        0 28px 70px rgba(4, 19, 38, 0.28),
        0 7px 18px rgba(4, 19, 38, 0.12);
    gap: 16px;
    isolation: isolate;
}

.app-more-popover::before {
    position: absolute;
    z-index: -1;
    top: -7px;
    right: 18px;
    width: 13px;
    height: 13px;
    border-top: 1px solid rgba(184, 132, 22, 0.25);
    border-left: 1px solid rgba(184, 132, 22, 0.25);
    background: #fffaf0;
    content: "";
    transform: rotate(45deg);
}

.app-more-popover::after {
    position: absolute;
    top: 0;
    right: 22px;
    left: 22px;
    height: 2px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, transparent, var(--brand-gold-500), transparent);
    content: "";
    opacity: 0.72;
}

.app-more-group {
    min-width: 0;
}

.app-more-group + .app-more-group {
    padding-top: 16px;
    border-top: 1px solid var(--line-default);
}

.app-more-group-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 9px;
    color: var(--ink-muted);
    font-size: 0.66rem;
    font-weight: 850;
    letter-spacing: 0.11em;
    line-height: 1.2;
    text-transform: uppercase;
}

.app-more-group-label::before {
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: var(--brand-gold-500);
    content: "";
}

.app-more-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.app-more-group--admin .app-more-item:last-child {
    grid-column: 1 / -1;
}

.app-topbar .app-more-popover .app-more-item {
    position: relative;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 7px;
    align-items: center;
    min-width: 0;
    min-height: 72px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: var(--surface-subtle) !important;
    color: var(--ink-strong) !important;
    gap: 10px;
    text-decoration: none;
    transition:
        background-color 150ms ease,
        border-color 150ms ease,
        box-shadow 150ms ease,
        transform 150ms ease;
}

.app-topbar .app-more-popover .app-more-item::after {
    width: 6px;
    height: 6px;
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    content: "";
    opacity: 0.42;
    transform: rotate(45deg);
}

.app-topbar .app-more-popover .app-more-item:hover {
    border-color: var(--line-strong);
    background: #ffffff !important;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.app-topbar .app-more-popover .app-more-item:focus-visible {
    border-color: var(--brand-gold-500);
    outline: 3px solid rgba(213, 166, 42, 0.22);
    outline-offset: 2px;
}

.app-topbar .app-more-popover .app-more-item.is-active {
    border-color: rgba(45, 115, 200, 0.3);
    background: var(--brand-blue-100) !important;
    box-shadow: inset 3px 0 0 var(--brand-gold-500);
}

.app-topbar .app-more-popover .app-more-item.is-active::after {
    color: var(--brand-blue-600);
    opacity: 0.8;
}

.app-more-icon {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(45, 115, 200, 0.15);
    border-radius: 10px;
    background: #ffffff;
    color: var(--brand-navy-700);
}

.app-more-icon svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.65;
}

.app-more-item.is-active .app-more-icon {
    border-color: rgba(184, 132, 22, 0.3);
    background: var(--brand-gold-100);
    color: var(--brand-gold-600);
}

.app-more-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.app-more-copy strong {
    color: var(--ink-strong);
    font-size: 0.79rem;
    font-weight: 800;
    line-height: 1.25;
}

.app-more-copy small {
    color: var(--ink-muted);
    font-size: 0.65rem;
    font-weight: 500;
    line-height: 1.35;
}

.dashboard-main {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 32px 24px 56px;
}

.dashboard-main > .dashboard-card,
.dashboard-card.ai-profile-card,
.dashboard-card.mailbox-page-card,
.dashboard-card.activity-page-card,
.dashboard-card.revenue-page-card,
.dashboard-card.ai-usage-page-card {
    width: 100%;
    max-width: none;
    margin: 0 auto;
}

.dashboard-card {
    border: 1px solid rgba(201, 214, 228, 0.88);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-sm);
}

.dashboard-main > .dashboard-card {
    padding: 30px;
}

/* Typography, headers, and general sections */
.dashboard-card h1,
.dashboard-card h2,
.dashboard-card h3,
.auth-card h1,
.auth-card h2 {
    color: var(--ink-strong);
    letter-spacing: -0.025em;
}

.dashboard-card h1 {
    font-size: clamp(1.85rem, 3vw, 2.35rem);
    line-height: 1.12;
}

.dashboard-card h2 {
    font-size: 1.18rem;
}

.ai-profile-header,
.mailbox-page-header,
.activity-page-header,
.revenue-page-header {
    align-items: center;
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--line-default);
}

.ai-profile-header h1,
.mailbox-page-header h1,
.activity-page-header h1,
.revenue-page-header h1 {
    margin: 0 0 7px;
}

.ai-profile-header p,
.mailbox-page-header p,
.activity-page-header p,
.revenue-page-header p {
    max-width: 780px;
    margin: 0;
}

.ai-safety-badge,
.mailbox-usage-pill,
.activity-count-pill,
.revenue-hero-pill,
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid #c8daf0;
    border-radius: 999px;
    background: var(--brand-blue-100);
    color: var(--brand-navy-700);
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.ai-safety-badge::before,
.mailbox-usage-pill::before,
.activity-count-pill::before,
.revenue-hero-pill::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand-gold-500);
    box-shadow: 0 0 0 3px var(--brand-gold-100);
    content: "";
}

.ai-safety-badge,
.mailbox-usage-pill,
.activity-count-pill,
.revenue-hero-pill {
    padding: 9px 13px;
}

.dashboard-section-title {
    margin: 30px 0 14px;
    padding: 0;
    border: 0;
    color: var(--brand-navy-800);
    font-size: 0.78rem !important;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Buttons and links */
button,
.button-link,
.secondary-button-link,
.button-secondary,
.support-submit-button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid var(--brand-blue-600);
    border-radius: 10px;
    background: linear-gradient(180deg, var(--brand-blue-500), var(--brand-blue-600));
    color: #ffffff;
    box-shadow: 0 5px 13px rgba(31, 95, 174, 0.18);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.2;
    text-decoration: none;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:hover,
.button-link:hover,
.support-submit-button:hover,
.button:hover {
    background: linear-gradient(180deg, #286abb, #174f95);
    color: #ffffff;
    box-shadow: 0 7px 17px rgba(31, 95, 174, 0.23);
    transform: translateY(-1px);
}

button:active,
.button-link:active,
.button:active {
    box-shadow: var(--shadow-xs);
    transform: translateY(0);
}

.dashboard-layout button {
    width: auto;
}

.secondary-button,
.button-secondary,
.secondary-button-link,
.secondary-link,
button.secondary,
.button.secondary {
    border-color: var(--line-strong);
    background: #ffffff;
    color: var(--brand-navy-700);
    box-shadow: var(--shadow-xs);
}

.secondary-button:hover,
.button-secondary:hover,
.secondary-button-link:hover,
.secondary-link:hover,
button.secondary:hover,
.button.secondary:hover {
    border-color: #a9bdd3;
    background: var(--surface-subtle);
    color: var(--brand-navy-900);
}

.button-danger,
button.danger,
.mailbox-delete-button,
.review-dismiss-button {
    border-color: #e9b8bc;
    background: #ffffff;
    color: var(--danger-700);
    box-shadow: none;
}

.button-danger:hover,
button.danger:hover,
.mailbox-delete-button:hover,
.review-dismiss-button:hover {
    border-color: #d88f96;
    background: var(--danger-100);
    color: #861e27;
}

button.warning {
    border-color: #e4b94d;
    background: var(--warning-100);
    color: var(--warning-700);
}

/* Forms */
label,
legend {
    color: #29435f;
    font-size: 0.84rem;
    font-weight: 750;
}

input,
select,
textarea {
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #ffffff;
    color: var(--ink-strong);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input::placeholder,
textarea::placeholder {
    color: #97a5b5;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand-blue-500);
    box-shadow: var(--focus-ring);
}

input[type="checkbox"],
input[type="radio"] {
    width: 18px;
    height: 18px;
    min-height: 0;
    accent-color: var(--brand-blue-600);
}

fieldset {
    border-color: var(--line-default);
    border-radius: var(--radius-md);
}

.ai-form,
.mailbox-form,
.support-request-form,
.ai-profile-form {
    gap: 16px;
}

.ai-form label,
.mailbox-form label,
.support-request-form label,
.ai-profile-form label {
    color: #29435f;
}

.ai-form input,
.ai-form textarea,
.mailbox-form input,
.mailbox-form select,
.support-request-form input,
.support-request-form select,
.support-request-form textarea,
.ai-profile-form input,
.ai-profile-form select,
.ai-profile-form textarea {
    background: #ffffff;
}

.form-grid-two {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid-two > label {
    display: grid;
    gap: 7px;
    margin: 0;
}

.form-grid-two input,
.form-grid-two select {
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 10px 12px;
}

.form-grid-two small,
.check-option small {
    color: var(--ink-muted);
    font-size: 0.7rem;
    font-weight: 500;
}

.check-option {
    display: flex !important;
    align-items: flex-start;
    gap: 9px !important;
    margin: 0;
    padding: 11px 12px;
    border: 1px solid var(--line-default);
    border-radius: 10px;
    background: var(--surface-subtle);
    cursor: pointer;
}

.check-option input {
    flex: 0 0 auto;
    margin: 2px 0 0;
}

.check-option span,
.check-option strong,
.check-option small {
    display: block;
}

/* Alerts, badges, and empty states */
.ai-notice,
.ai-alert,
.ai-empty-state,
.mailbox-safety-banner,
.trial-disclosure,
.error,
.message {
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    line-height: 1.5;
}

.ai-notice,
.mailbox-safety-banner,
.trial-disclosure {
    border: 1px solid #cbdff3;
    background: var(--info-100);
    color: var(--info-700);
}

.ai-alert-success,
.message {
    border-color: #bfe6cd;
    background: var(--success-100);
    color: var(--success-700);
}

.ai-alert-error,
.error {
    border-color: #f0c8cc;
    background: var(--danger-100);
    color: var(--danger-700);
}

.ai-empty-state,
.mailbox-empty-state,
.activity-empty-state,
.empty-state {
    position: relative;
    padding: 32px 24px;
    border: 1px dashed #c8d6e5;
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, #fbfcfe, #f4f8fc);
    color: var(--ink-muted);
    text-align: center;
}

.ai-empty-state::before,
.mailbox-empty-state::before,
.activity-empty-state::before,
.empty-state::before {
    display: grid;
    width: 42px;
    height: 42px;
    margin: 0 auto 12px;
    place-items: center;
    border: 1px solid #d5e0ec;
    border-radius: 13px;
    background: #ffffff;
    color: var(--brand-gold-600);
    box-shadow: var(--shadow-xs);
    content: "✦";
    font-size: 1.05rem;
}

.ai-status-pill,
.review-status-pill,
.mailbox-status-badge,
.activity-event-badge,
.bi-badge,
.usage-pill,
.badge {
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.ai-status-pill.active,
.mailbox-status-connected,
.badge.active,
.activity-event-sent,
.activity-event-approved {
    border-color: #bfe6cd;
    background: var(--success-100);
    color: var(--success-700);
}

.ai-status-pill.inactive,
.mailbox-status-not-connected {
    border-color: var(--line-default);
    background: var(--surface-muted);
    color: #63758a;
}

/* Cards, panels, and tables */
.ai-panel,
.account-management-panel,
.mailbox-panel,
.activity-detail-panel,
.support-form-card,
.support-info-card,
.review-card,
.revenue-opportunity-card,
.ai-knowledge-item,
.placeholder-box,
.filters,
.stat-card {
    border: 1px solid var(--line-default);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow-xs);
}

.ai-panel,
.account-management-panel,
.mailbox-panel,
.activity-detail-panel,
.support-form-card,
.support-info-card {
    padding: 22px;
}

.ai-panel h2,
.account-management-panel h2,
.mailbox-panel h2,
.activity-detail-panel h2,
.support-form-card h2,
.support-info-card h2 {
    margin: 0 0 8px;
}

.ai-knowledge-item,
.review-card,
.revenue-opportunity-card,
.activity-feed-card,
.mailbox-card {
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.ai-knowledge-item:hover,
.review-card:hover,
.revenue-opportunity-card:hover,
.activity-feed-card:hover,
.mailbox-card:hover {
    border-color: #c5d5e6;
    box-shadow: var(--shadow-sm);
}

.data-table,
.ai-usage-table,
.dashboard-card table,
.table-card table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-md);
    background: #ffffff;
}

.data-table th,
.ai-usage-table th,
.dashboard-card table th,
.table-card table th {
    padding: 11px 13px;
    border-bottom: 1px solid var(--line-default);
    background: #f2f6fa;
    color: #5e7187;
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.055em;
    text-align: left;
    text-transform: uppercase;
}

.data-table td,
.ai-usage-table td,
.dashboard-card table td,
.table-card table td {
    padding: 12px 13px;
    border-bottom: 1px solid #edf1f5;
    color: var(--ink-default);
    font-size: 0.8rem;
    vertical-align: top;
}

.data-table tr:last-child td,
.ai-usage-table tr:last-child td,
.dashboard-card table tr:last-child td,
.table-card table tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover td,
.ai-usage-table tbody tr:hover td,
.dashboard-card table tbody tr:hover td,
.table-card table tbody tr:hover td {
    background: #fbfdff;
}

/* Authentication and public states */
.auth-page {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    padding: 40px 20px;
    background:
        radial-gradient(circle at 18% 12%, rgba(45, 115, 200, 0.32), transparent 28rem),
        radial-gradient(circle at 86% 88%, rgba(213, 166, 42, 0.16), transparent 25rem),
        linear-gradient(145deg, var(--brand-navy-950), var(--brand-navy-800));
}

.auth-page::before,
.auth-page::after {
    position: fixed;
    width: 260px;
    height: 260px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    content: "";
    pointer-events: none;
}

.auth-page::before {
    top: -120px;
    right: -60px;
}

.auth-page::after {
    bottom: -150px;
    left: -90px;
}

.auth-card {
    position: relative;
    width: min(100%, 460px);
    max-width: 460px;
    padding: 34px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
}

.auth-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--brand-gold-600), #f5d675, var(--brand-gold-600));
    content: "";
}

.register-card {
    width: min(100%, 560px);
    max-width: 560px;
}

.terms-card {
    width: min(100%, 920px);
    max-width: 920px;
}

.logo-wrap {
    margin-bottom: 12px;
}

.logo-wrap img {
    max-width: 116px;
    max-height: 84px;
    object-fit: contain;
}

.auth-card .brand {
    margin: 0;
    color: var(--brand-navy-900);
    font-size: 1.8rem;
    letter-spacing: -0.045em;
}

.auth-card .brand::after {
    display: block;
    margin-top: 3px;
    color: var(--brand-gold-600);
    content: "by The Computer Specialists";
    font-size: 0.61rem;
    font-weight: 800;
    letter-spacing: 0.085em;
    text-transform: uppercase;
}

.auth-card .subtitle {
    margin: 14px 0 22px;
    color: var(--ink-muted);
    font-size: 0.9rem;
}

.auth-card label {
    margin: 0 0 7px;
}

.auth-card input:not([type="checkbox"]):not([type="radio"]) {
    min-height: 46px;
    margin: 0 0 16px;
    padding: 11px 13px;
}

.auth-card button {
    width: 100%;
    min-height: 46px;
}

.auth-link {
    margin-top: 20px;
    color: var(--ink-muted);
    font-size: 0.82rem;
}

.auth-link a {
    color: var(--brand-blue-600);
}

.auth-trust-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 14px;
    color: var(--ink-muted);
    font-size: 0.7rem;
    font-weight: 650;
}

.auth-trust-line span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #28a35d;
    box-shadow: 0 0 0 3px var(--success-100);
}

.password-rules {
    margin: -7px 0 15px;
    padding: 10px 12px;
    border-radius: 9px;
    background: var(--surface-subtle);
    color: var(--ink-muted);
    font-size: 0.73rem;
    line-height: 1.45;
}

.checkbox-row {
    padding: 12px;
    border: 1px solid var(--line-default);
    border-radius: 10px;
    background: var(--surface-subtle);
}

.terms-document {
    border-color: var(--line-default);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

/* Dashboard */
.dashboard-summary-grid {
    gap: 12px;
}

.dashboard-stat-card,
.revenue-stat-card,
.briefing-indicators > div,
.stat-card {
    position: relative;
    min-height: 118px;
    padding: 18px;
    overflow: hidden;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, #ffffff, #f8fbfe);
    box-shadow: var(--shadow-xs);
}

.dashboard-stat-card::before,
.revenue-stat-card::before,
.briefing-indicators > div::before,
.stat-card::before {
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: #cbd8e6;
    content: "";
}

.dashboard-stat-card.highlight::before,
.dashboard-stat-card.revenue-highlight::before,
.revenue-stat-card::before {
    background: linear-gradient(90deg, var(--brand-gold-500), #f0d27b);
}

.dashboard-stat-number,
.revenue-stat-number,
.stat-number,
.briefing-indicators strong {
    color: var(--brand-navy-800);
    font-size: clamp(1.65rem, 3vw, 2.15rem);
    font-weight: 850;
    letter-spacing: -0.04em;
}

.dashboard-stat-label,
.revenue-stat-label,
.stat-label,
.briefing-indicators span {
    color: var(--ink-muted);
    font-size: 0.73rem;
    font-weight: 750;
}

.dashboard-stat-link:hover {
    border-color: #b7cbe0;
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.dashboard-live-review-alert,
.dashboard-revenue-opportunity-alert,
.dashboard-briefing-card {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}

.dashboard-live-review-alert {
    border-color: #edcb77;
    background: linear-gradient(135deg, #fff9e8, #fffdf7);
}

.dashboard-help-panel {
    border-color: var(--line-default);
    border-radius: var(--radius-lg);
    background: var(--surface-subtle);
}

.dashboard-two-column .placeholder-box {
    margin-top: 0;
    border-style: solid;
}

.dashboard-account-card > p,
.dashboard-quick-links > p {
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid #edf1f5;
}

.dashboard-account-card > p:last-child,
.dashboard-quick-links > p:last-child {
    border-bottom: 0;
}

.dashboard-quick-links > p:not(:first-child) a,
.dashboard-quick-links > a:not(.support-button-link) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--brand-navy-700);
    font-size: 0.8rem;
    font-weight: 750;
    text-decoration: none;
}

.dashboard-quick-links > p:not(:first-child) a::after,
.dashboard-quick-links > a:not(.support-button-link)::after {
    color: var(--brand-gold-600);
    content: "→";
}

/* Mailboxes, AI profile, inbox, and review */
.mailbox-two-column-layout,
.ai-profile-grid,
.activity-detail-grid,
.support-request-layout,
.account-management-grid {
    gap: 20px;
}

.mailbox-card-grid,
.review-queue-list,
.revenue-opportunity-list,
.activity-feed,
.ai-knowledge-list {
    gap: 14px;
}

.mailbox-card,
.review-card,
.revenue-opportunity-card,
.activity-feed-card {
    border: 1px solid var(--line-default);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow-xs);
}

.mailbox-card,
.review-card,
.revenue-opportunity-card,
.activity-feed-card {
    padding: 18px;
}

.mailbox-card h3,
.review-subject,
.revenue-opportunity-card h2,
.activity-subject {
    color: var(--brand-navy-800);
}

.mailbox-meta-grid,
.review-meta-grid,
.revenue-meta-grid,
.activity-meta-grid {
    gap: 10px;
}

.mailbox-meta-grid > div,
.review-meta-grid > div,
.revenue-meta-grid > div,
.activity-meta-grid > div {
    padding: 10px 11px;
    border: 1px solid #e7edf4;
    border-radius: 10px;
    background: var(--surface-subtle);
}

.mailbox-meta-label,
.review-meta-label,
.activity-meta-label {
    color: #7b8b9e;
    font-size: 0.64rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mailbox-meta-value,
.review-meta-value,
.activity-meta-value {
    color: var(--ink-default);
    font-size: 0.79rem;
}

.review-queue-toolbar,
.ai-usage-filter-row {
    border: 1px solid var(--line-default);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.review-summary,
.revenue-summary,
.ai-knowledge-content,
.activity-message-copy,
.bi-detail-panel {
    border: 1px solid #e1e8f0;
    border-radius: var(--radius-md);
    background: #f8fafc;
    color: var(--ink-default);
}

.activity-message-copy {
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-inbox-grid,
.ai-review-grid {
    gap: 16px;
}

.inbox-scan-action {
    margin-bottom: 18px;
}

.inbox-item-action,
.inbox-item-notice {
    margin-top: 14px;
}

.inbox-meta-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin: 13px 0;
}

.inbox-meta-grid > div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid #e7edf4;
    border-radius: 10px;
    background: var(--surface-subtle);
}

.inbox-meta-grid span {
    color: #7b8b9e;
    font-size: 0.62rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.inbox-meta-grid strong {
    overflow-wrap: anywhere;
    color: var(--ink-default);
    font-size: 0.75rem;
}

/* Account, support, revenue, activity, and reporting */
.account-detail-row {
    padding: 11px 0;
    border-color: #e9eef4;
}

.account-detail-row span {
    color: var(--ink-muted);
}

.account-detail-row strong {
    color: var(--brand-navy-800);
}

.pause-preview-panel {
    margin-top: 20px;
}

.support-info-card,
.support-form-card {
    border-color: var(--line-default);
}

.support-reminder-card {
    border-color: #ead28e;
    background: #fffaf0;
}

.support-email-pill,
.support-subject-pill {
    border-color: #cbdff3;
    background: var(--brand-blue-100);
    color: var(--brand-navy-700);
}

.activity-provider-id,
.rule-value {
    border-radius: 8px;
    background: #eef3f8;
    color: #42566e;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ai-usage-table-wrap,
.table-card,
.placeholder-box[style*="overflow-x"] {
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

.ai-usage-filter-row a {
    border-color: var(--line-default);
    background: #ffffff;
    color: var(--ink-default);
}

.ai-usage-filter-row a.active {
    border-color: #c8a03c;
    background: var(--brand-gold-100);
    color: var(--brand-navy-800);
}

/* Connection and settings forms */
.connection-settings-page {
    max-width: 1120px !important;
}

.connection-status-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 20px 0;
    padding: 17px 19px;
    border: 1px solid #c7dced;
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, #f7fbff, #eef5fb);
}

.connection-status-card h2,
.connection-status-card p {
    margin: 0;
}

.connection-status-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.connection-status-meta span {
    display: grid;
    gap: 2px;
    min-width: 130px;
    color: var(--ink-muted);
    font-size: 0.67rem;
    text-transform: uppercase;
}

.connection-status-meta strong {
    color: var(--ink-default);
    font-size: 0.76rem;
    text-transform: none;
}

.connection-settings-form {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.connection-form-card {
    padding: 20px;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow-xs);
}

.connection-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.connection-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Daily Briefing */
.briefing-main {
    max-width: 1240px;
    gap: 18px;
}

.briefing-main > .dashboard-card {
    max-width: none;
}

.briefing-hero {
    position: relative;
    overflow: hidden;
    border-color: #c9d8e8;
    background:
        radial-gradient(circle at 93% 12%, rgba(213, 166, 42, 0.16), transparent 18rem),
        linear-gradient(135deg, #ffffff, #f3f7fc);
}

.briefing-hero::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 5px;
    background: linear-gradient(var(--brand-gold-400), var(--brand-gold-600));
    content: "";
}

.briefing-kicker {
    color: var(--brand-gold-600);
}

.briefing-indicators {
    gap: 12px;
}

.briefing-item {
    border: 1px solid var(--line-default);
    border-left: 4px solid #8ea6c0;
    border-radius: var(--radius-md);
    background: #ffffff;
}

.briefing-item.priority-high {
    border-left-color: #c64b55;
}

.briefing-item.priority-medium {
    border-left-color: var(--brand-gold-500);
}

.briefing-snooze-form {
    display: flex;
    align-items: center;
    gap: 7px;
}

.briefing-actions input[type="datetime-local"] {
    width: auto;
    min-height: 42px;
    margin: 0;
    padding: 9px 10px;
}

.briefing-focus-day {
    border-color: #bfe6cd;
    background: var(--success-100);
}

.executive-summary {
    border-color: #d8be72;
    background: linear-gradient(145deg, #fffdf7, #ffffff);
}

.briefing-history-list {
    display: grid;
    gap: 11px;
}

.briefing-history-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 16px;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-md);
    background: #ffffff;
    color: var(--ink-default);
    text-decoration: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.briefing-history-card:hover {
    border-color: #b8cce1;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.briefing-history-card strong {
    color: var(--brand-navy-800);
}

.briefing-history-card p {
    max-width: 880px;
    margin: 5px 0 0;
    color: var(--ink-muted);
    font-size: 0.8rem;
}

.briefing-settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 18px;
}

.briefing-settings-card {
    max-width: none !important;
    padding: 24px;
}

.briefing-settings-form {
    display: grid;
    gap: 16px;
}

.briefing-toggle-card {
    display: flex !important;
    align-items: flex-start;
    gap: 10px !important;
    margin: 0;
    padding: 14px;
    border: 1px solid #cbdff3;
    border-radius: var(--radius-md);
    background: var(--info-100);
}

.briefing-toggle-card input {
    flex: 0 0 auto;
    margin: 2px 0 0;
}

.briefing-toggle-card span,
.briefing-toggle-card strong,
.briefing-toggle-card small {
    display: block;
}

.briefing-toggle-card strong {
    color: var(--brand-navy-800);
}

.briefing-toggle-card small {
    margin-top: 2px;
    color: var(--ink-muted);
    font-size: 0.72rem;
    font-weight: 500;
}

.briefing-settings-form fieldset {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 13px;
}

.briefing-settings-form legend {
    padding: 0 5px;
}

.calendar-mailbox-list {
    display: grid;
    gap: 11px;
    margin-top: 16px;
}

.calendar-mailbox-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
}

.calendar-mailbox-card strong {
    display: inline-block;
    margin-right: 7px;
    color: var(--brand-navy-800);
}

.calendar-mailbox-card p {
    margin: 5px 0 0;
    font-size: 0.77rem;
}

/* Pause AI integration */
.pause-ai-page,
.pause-panel,
.pause-summary-card {
    border-color: var(--line-default);
}

.pause-page-eyebrow,
.pause-section-kicker {
    color: var(--brand-gold-600);
}

.pause-choice input:checked + .pause-choice-body,
.pause-duration-choice input:checked + span {
    border-color: #d6b55d;
    background: var(--brand-gold-100);
    color: var(--brand-navy-800);
    box-shadow: inset 0 0 0 1px #d6b55d, 0 0 0 3px rgba(213, 166, 42, 0.1);
}

.pause-ai-page .pause-primary-button {
    border-color: var(--brand-blue-600);
    background: linear-gradient(180deg, var(--brand-blue-500), var(--brand-blue-600));
}

/* Admin suppression page */
.admin-page-shell {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 32px 24px 56px;
}

.admin-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.admin-page-header h1 {
    margin: 3px 0 6px;
    color: var(--ink-strong);
    font-size: 2.1rem;
    letter-spacing: -0.035em;
}

.eyebrow {
    color: var(--brand-gold-600);
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.filters {
    margin-bottom: 18px;
    padding: 16px;
}

.filters form,
.actions,
.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.filters input,
.filters select {
    width: auto;
    min-height: 42px;
    margin: 0;
}

.filters input[type="text"] {
    min-width: min(360px, 100%);
    flex: 1;
}

/* User administration */
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line-default);
    border-radius: var(--radius-lg);
}

.admin-users-table {
    min-width: 1180px;
    border: 0 !important;
    border-radius: 0 !important;
}

.admin-users-table td > strong,
.admin-users-table td > small {
    display: block;
}

.admin-users-table td > small {
    margin-top: 4px;
    color: var(--ink-muted);
    font-size: 0.67rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 8px;
    border: 1px solid var(--line-default);
    border-radius: 999px;
    background: var(--surface-muted);
    color: #5c7087;
    font-size: 0.66rem;
    font-weight: 850;
    line-height: 1;
}

.status-success {
    border-color: #bfe6cd;
    background: var(--success-100);
    color: var(--success-700);
}

.status-info {
    border-color: #cbdff3;
    background: var(--info-100);
    color: var(--info-700);
}

.status-danger {
    border-color: #f0c8cc;
    background: var(--danger-100);
    color: var(--danger-700);
}

.status-gold {
    border-color: #ead28e;
    background: var(--brand-gold-100);
    color: var(--warning-700);
}

.admin-inline-form {
    margin-top: 7px;
}

.admin-user-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 360px;
}

.admin-user-actions form {
    margin: 0;
}

.admin-user-actions button,
.admin-inline-form button {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 0.68rem;
}

.admin-control-form {
    display: flex;
    gap: 5px;
}

.admin-control-form input {
    width: 112px;
    min-height: 34px;
    margin: 0;
    padding: 7px 8px;
    font-size: 0.72rem;
}

/* Responsive system */
@media (max-width: 1180px) {
    .app-topbar .app-topbar-inner {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px 18px;
    }

    .app-primary-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .app-utility-nav {
        grid-column: 2;
        grid-row: 1;
    }

    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .briefing-settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .app-topbar {
        padding: 0;
    }

    .app-topbar .app-topbar-inner {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        width: 100%;
        padding: 8px 12px 7px;
        gap: 7px 10px;
    }

    .app-brand img {
        width: 36px;
        height: 36px;
    }

    .app-brand-copy small {
        display: none;
    }

    .app-primary-nav {
        display: flex !important;
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        gap: 4px;
        overflow-x: auto;
        padding: 1px 0 3px;
        -webkit-overflow-scrolling: touch;
    }

    .app-topbar .app-primary-nav > a {
        width: auto !important;
        min-height: 34px;
        padding: 7px 9px;
        font-size: 0.72rem;
    }

    .app-utility-nav {
        display: flex !important;
        grid-column: 2;
        grid-row: 1;
        width: auto;
    }

    .app-topbar .app-utility-nav > a,
    .app-more-menu > summary {
        width: auto !important;
        min-height: 34px;
        padding: 7px 9px;
        font-size: 0.71rem;
    }

    .app-more-popover {
        position: fixed;
        top: 94px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        max-height: calc(100vh - 106px);
        max-height: calc(100dvh - 106px);
        padding: 14px;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .app-more-popover::before {
        display: none;
    }

    .app-more-links {
        grid-template-columns: minmax(0, 1fr);
    }

    .app-more-group--admin .app-more-item:last-child {
        grid-column: auto;
    }

    .app-topbar .app-more-popover .app-more-item {
        width: 100%;
        min-height: 62px;
        padding: 9px 10px;
    }

    .dashboard-main,
    .admin-page-shell {
        padding: 16px 12px 40px;
    }

    .dashboard-main > .dashboard-card {
        padding: 20px;
        border-radius: var(--radius-lg);
    }

    .ai-profile-header,
    .mailbox-page-header,
    .activity-page-header,
    .revenue-page-header,
    .admin-page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .ai-safety-badge,
    .mailbox-usage-pill,
    .activity-count-pill,
    .revenue-hero-pill {
        white-space: normal;
    }

    .dashboard-card table,
    .data-table,
    .ai-usage-table,
    .table-card table {
        min-width: 720px;
        white-space: normal;
    }

    .dashboard-card table th,
    .dashboard-card table td {
        white-space: normal;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid-two,
    .connection-check-grid {
        grid-template-columns: 1fr;
    }

    .connection-status-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .connection-status-meta {
        justify-content: flex-start;
    }

    .inbox-meta-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .auth-card {
        padding: 28px 22px;
    }
}

@media (max-width: 520px) {
    .dashboard-main > .dashboard-card {
        padding: 17px;
    }

    .dashboard-card h1 {
        font-size: 1.7rem;
    }

    .dashboard-summary-grid,
    .revenue-stats-grid,
    .briefing-indicators,
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .dashboard-stat-card,
    .revenue-stat-card,
    .briefing-indicators > div,
    .stat-card {
        min-height: 100px;
        padding: 14px;
    }

    .filters form,
    .filters input,
    .filters select,
    .filters .button,
    .filters button {
        width: 100%;
    }

    .inbox-meta-grid {
        grid-template-columns: 1fr;
    }

    .briefing-history-card {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
