@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/inter/inter-latin-ext-400-700.woff2?v=a28eb6d3ccb534ae0c94') format('woff2');
    font-weight: 400 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Material Symbols Outlined';
    src: url('/assets/fonts/material-symbols-outlined-v1.woff2?v=bc8672e675585f032c5d') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

:root {
    color-scheme: light;
    --bg-main: #f8faff;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --text-main: #111827;
    --text-muted: rgba(17, 24, 39, .58);
    --accent: #2563eb;
    --accent-hover: #0e7490;
    --border: rgba(15, 23, 42, .12);
    --danger: #dc2626;
    --success: #15803d;
    --warning: #c2410c;
}

html[data-theme="light"] body { background: var(--bg-main); color: var(--text-main); }
.sidebar { background: #fff; border-right: 1px solid var(--border); }
.sidebar-brand, .sidebar-link { color: var(--text-main); }
.sidebar-link.active { background: #e0f2fe; color: #0e7490; }
.sidebar-link:hover { background: #e0f2fe; color: #0e7490; }
.main-content { background: var(--bg-main); }
.panel { background: var(--bg-card); border-color: var(--border); box-shadow: none; }
.form-control { background: var(--bg-input); color: var(--text-main); border-color: var(--border); }
.form-control:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
@media (max-width: 768px) { .sidebar { border-right: 0; border-bottom: 1px solid var(--border); } .main-content { padding: 20px 12px 48px; } .header { gap: 16px; flex-wrap: wrap; } }

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

.material-symbols-outlined {
    display: inline-block;
    overflow: hidden;
    font-family: 'Material Symbols Outlined';
    font-size: 20px;
    font-style: normal;
    font-weight: 400;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    letter-spacing: normal;
    line-height: 1;
    text-transform: none;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

.activity-page {
    max-width: 1480px;
    margin: 0 auto;
}

.activity-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 30px;
}

.activity-heading h1,
.activity-detail h2 {
    margin: 0;
    color: var(--text-main);
}

.activity-heading p:not(.activity-eyebrow) {
    margin: 8px 0 0;
    color: var(--text-muted);
}

.activity-eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.activity-filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: 14px;
    padding: 18px 0 24px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.activity-filters label {
    display: grid;
    gap: 7px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.activity-filter-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
}

.activity-feedback {
    min-height: 42px;
    padding: 14px 0 8px;
    color: var(--text-muted);
}

.activity-feedback[data-state="error"] {
    color: #dc2626;
}

.activity-feedback[data-state="warning"] {
    color: #b45309;
}

.activity-table-wrap {
    overflow-x: auto;
}

.activity-table {
    min-width: 1050px;
}

.activity-table td {
    vertical-align: top;
}

.activity-table td small {
    display: block;
    max-width: 260px;
    margin-top: 4px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-reason {
    max-width: 320px;
    color: var(--text-muted);
}

.activity-outcome {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.activity-outcome-success {
    color: #166534;
    background: #dcfce7;
}

.activity-outcome-failure {
    color: #991b1b;
    background: #fee2e2;
}

.activity-outcome-partial {
    color: #92400e;
    background: #fef3c7;
}

.activity-outcome-progress {
    color: #075985;
    background: #e0f2fe;
}

.activity-outcome-neutral {
    color: #475569;
    background: #e2e8f0;
}

.activity-open,
.activity-detail-close {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.activity-open:hover,
.activity-detail-close:hover {
    color: var(--accent);
    background: var(--bg-input);
}

.activity-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    color: var(--text-muted);
}

.activity-pagination div {
    display: flex;
    gap: 10px;
}

.activity-detail {
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    margin: auto 0 auto auto;
    padding: 28px;
    border: 0;
    border-left: 1px solid var(--border);
    color: var(--text-main);
    background: var(--bg-card);
}

.activity-detail::backdrop {
    background: rgba(15, 23, 42, 0.45);
}

.activity-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.activity-timeline {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 24px 0;
    list-style: none;
}

.activity-timeline li {
    position: relative;
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 14px;
    padding-bottom: 26px;
}

.activity-timeline li:not(:last-child)::before {
    position: absolute;
    top: 16px;
    bottom: 0;
    left: 6px;
    width: 1px;
    background: var(--border);
    content: '';
}

.activity-timeline-dot {
    position: relative;
    z-index: 1;
    width: 13px;
    height: 13px;
    margin-top: 4px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: #64748b;
    box-shadow: 0 0 0 1px #64748b;
}

.activity-timeline-success .activity-timeline-dot {
    background: #16a34a;
    box-shadow: 0 0 0 1px #16a34a;
}

.activity-timeline-failure .activity-timeline-dot {
    background: #dc2626;
    box-shadow: 0 0 0 1px #dc2626;
}

.activity-timeline-title {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.activity-timeline-title time,
.activity-timeline p {
    color: var(--text-muted);
}

.activity-timeline p {
    margin: 8px 0 12px;
}

.activity-timeline dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 18px;
    margin: 0;
}

.activity-timeline dl div {
    min-width: 0;
}

.activity-timeline dt {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
}

.activity-timeline dd {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}

.activity-empty,
.activity-no-results {
    padding: 72px 24px;
    text-align: center;
    color: var(--text-muted);
}

.activity-empty .material-symbols-outlined {
    font-size: 42px;
}

@media (max-width: 1180px) {
    .profile-analysis-admin__layout {
        grid-template-columns: 1fr;
    }

    .activity-filters {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }
}

.profile-analysis-admin__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.profile-analysis-admin__heading h1 {
    margin: 4px 0 8px;
}

.profile-analysis-admin__heading p:last-child {
    max-width: 760px;
    color: var(--text-muted);
}

.profile-analysis-admin__filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
    align-items: end;
    gap: 14px;
    margin-bottom: 24px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
}

.profile-analysis-admin__filters label,
.profile-analysis-admin__corrections label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
}

.profile-analysis-admin__layout {
    display: grid;
    grid-template-columns: minmax(620px, 1.35fr) minmax(380px, .85fr);
    gap: 24px;
    align-items: start;
}

.profile-analysis-admin__list,
.profile-analysis-admin__detail {
    margin: 0;
    min-width: 0;
}

.profile-analysis-admin__table-wrap {
    overflow-x: auto;
}

.profile-analysis-admin__table-wrap tr.is-selected td {
    background: rgba(245, 158, 11, .08);
}

.profile-analysis-admin__table-wrap a {
    color: var(--accent);
    font-weight: 700;
}

.profile-analysis-status {
    display: inline-flex;
    padding: 4px 9px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.profile-analysis-status--completed {
    background: #ecfdf3;
    color: #027a48;
}

.profile-analysis-status--failed {
    background: #fef3f2;
    color: #b42318;
}

.profile-analysis-status--processing,
.profile-analysis-status--queued {
    background: #eff8ff;
    color: #175cd3;
}

.profile-analysis-status--stale {
    background: #fffaeb;
    color: #b54708;
}

.profile-analysis-admin__empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 64px 24px;
    text-align: center;
    color: var(--text-muted);
}

.profile-analysis-admin__empty .material-symbols-outlined {
    font-size: 40px;
}

.profile-analysis-admin__detail-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.profile-analysis-admin__detail-heading h2 {
    margin: 2px 0 0;
    text-transform: capitalize;
}

.profile-analysis-admin__summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 0 0 18px;
}

.profile-analysis-admin__summary div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
}

.profile-analysis-admin__summary dt {
    color: var(--text-muted);
    font-size: 12px;
}

.profile-analysis-admin__summary dd {
    margin: 5px 0 0;
    font-size: 18px;
    font-weight: 700;
}

.profile-analysis-admin__alert {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 9px;
    background: #fef3f2;
    color: #b42318;
}

.profile-analysis-admin details {
    border-top: 1px solid var(--border);
}

.profile-analysis-admin details summary {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 0;
    cursor: pointer;
    font-weight: 700;
}

.profile-analysis-admin details summary span {
    color: var(--text-muted);
}

.profile-analysis-admin__details-body {
    display: grid;
    gap: 8px;
    padding: 0 0 16px;
}

.profile-analysis-admin__item {
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    border-radius: 8px;
    background: #f8fafc;
    overflow-wrap: anywhere;
}

.profile-analysis-admin__item span,
.profile-analysis-admin__item a {
    color: var(--text-muted);
    font-size: 12px;
}

.profile-analysis-admin__corrections {
    margin-top: 18px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.profile-analysis-admin__corrections > p {
    color: var(--text-muted);
    font-size: 13px;
}

.profile-analysis-admin__corrections form {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.profile-analysis-admin__feedback[data-state="error"] {
    color: #b42318;
}

@media (max-width: 900px) {
    .profile-analysis-admin__filters {
        grid-template-columns: repeat(2, minmax(140px, 1fr));
    }
}

@media (max-width: 760px) {
    .profile-analysis-admin__heading {
        flex-direction: column;
    }

    .profile-analysis-admin__filters,
    .profile-analysis-admin__summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .activity-heading,
    .activity-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    .activity-filters {
        grid-template-columns: 1fr;
    }

    .activity-detail {
        width: 100%;
        max-height: 90vh;
        margin: auto 0 0;
        border-top: 1px solid var(--border);
        border-left: 0;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-brand span {
    color: var(--accent);
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
}

.sidebar-link:hover {
    color: var(--text-main);
    background-color: var(--bg-input);
}

.sidebar-link.active {
    color: var(--text-main);
    background-color: var(--bg-input);
}

.sidebar-link.active {
    border-left: 3px solid var(--accent);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.header-title h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.header-title p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

.grid-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card-metric {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.card-metric-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-metric-value {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 8px;
    color: var(--text-main);
}

.card-metric-change {
    font-size: 0.875rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-metric-change.up {
    color: var(--success);
}

.card-metric-change.down {
    color: var(--danger);
}

.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.measurement-setting {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 32px;
    padding: 24px 0;
    margin-bottom: 32px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.measurement-setting__copy {
    max-width: 620px;
}

.measurement-setting__heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.measurement-setting__heading h2 {
    font-size: 1.125rem;
}

.measurement-setting__copy > p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.measurement-setting__status {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    background: var(--bg-input);
}

.measurement-setting__status[data-mode="excluded"] {
    color: var(--success);
    background: rgba(16, 185, 129, 0.1);
}

.measurement-setting__status[data-mode="debug"] {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.measurement-setting__form {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto;
    align-items: end;
    gap: 8px 12px;
}

.measurement-setting__form label {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

.measurement-setting__form select {
    min-height: 40px;
    padding: 8px 36px 8px 12px;
    color: var(--text-main);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
}

.measurement-setting__feedback {
    min-height: 20px;
    margin-top: 8px;
}

.measurement-setting__feedback[data-state="success"] {
    color: var(--success);
}

.measurement-setting__feedback[data-state="error"] {
    color: var(--danger);
}

@media (max-width: 760px) {
    .measurement-setting {
        align-items: stretch;
        flex-direction: column;
        gap: 20px;
    }

    .measurement-setting__form {
        grid-template-columns: 1fr;
    }

    .measurement-setting__form label {
        grid-column: auto;
  }
}

:where(h1) {
    font-size: clamp(1.5rem, 2vw, 1.75rem) !important;
}

:where(h2) {
    font-size: clamp(1.125rem, 1.5vw, 1.375rem) !important;
}

:where(h3) {
    font-size: clamp(1.125rem, 1.5vw, 1.5rem) !important;
}

:where(h4) {
    font-size: 1.05rem !important;
}

:where(h5) {
    font-size: 0.9375rem !important;
}

:where(h6) {
    font-size: 0.875rem !important;
}

.header-title p,
.activity-heading p,
.help-editor-heading p {
    font-size: 0.875rem !important;
}

p {
    font-size: 0.875rem !important;
}

:where(input, select, textarea, button, .btn, [role="button"], label) {
    font-size: 0.875rem !important;
}

:where(.badge, .tag, .pill, [class*="badge"], [class*="tag"], [class*="pill"], [class*="meta"], [class*="eyebrow"], [class*="caption"], [class*="hint"], [class*="helper"], [class*="notice"], [class*="status"], [class*="count"], [class*="counter"]) {
    font-size: 0.75rem !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .28);
    outline-offset: 2px;
}

.admin-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--border);
}

.admin-summary div {
    display: grid;
    gap: 4px;
    padding: 18px 20px;
    background: var(--bg-card);
}

.admin-summary strong {
    font-size: 1.55rem;
    line-height: 1.1;
}

.admin-summary span {
    color: var(--text-muted);
    font-size: .82rem;
}

.users-panel {
    padding: 0;
    overflow: hidden;
}

.users-filters {
    display: grid;
    grid-template-columns: minmax(240px, 1.7fr) repeat(4, minmax(130px, 1fr)) auto;
    align-items: end;
    gap: 12px;
    margin: 0;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.users-filter-actions {
    display: flex;
    gap: 8px;
}

.bulk-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(37, 99, 235, .16);
    background: rgba(37, 99, 235, .06);
}

.bulk-toolbar[hidden] {
    display: none;
}

.bulk-toolbar > div:first-child {
    display: grid;
    gap: 4px;
}

.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.bulk-link {
    width: max-content;
    padding: 0;
    border: 0;
    color: var(--accent);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
}

.users-table {
    margin: 0;
}

.users-table table {
    min-width: 1120px;
}

.users-table th:first-child,
.users-table td:first-child {
    padding-left: 20px;
}

.users-table th:last-child,
.users-table td:last-child {
    padding-right: 20px;
}

.selection-cell {
    width: 44px;
}

.selection-cell input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.user-identity {
    display: grid;
    gap: 3px;
    color: var(--text-main);
    text-decoration: none;
}

.user-identity:hover strong {
    color: var(--accent);
}

.user-identity span {
    color: var(--text-muted);
    font-size: .8rem;
}

.table-empty {
    padding: 32px;
    color: var(--text-muted);
    text-align: center;
}

.users-panel .pagination {
    margin: 0;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.btn-compact {
    min-height: 34px;
    padding: 6px 12px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: .85rem;
    text-decoration: none;
}

.back-link:hover {
    color: var(--accent);
}

.back-link .material-symbols-outlined {
    font-size: 18px;
}

.user-detail-header {
    align-items: flex-end;
}

.user-detail-header h1 {
    margin: 0;
}

.user-tabs {
    overflow-x: auto;
    scrollbar-width: thin;
}

.user-tabs .tab-btn {
    min-height: 48px;
    white-space: nowrap;
}

.panel-narrow {
    max-width: 900px;
}

.form-grid {
    display: grid;
    gap: 18px;
}

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

.form-grid-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.account-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin: 0;
}

.account-facts div {
    display: grid;
    gap: 6px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.account-facts div:nth-last-child(-n + 3) {
    border-bottom: 0;
}

.account-facts dt {
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 600;
}

.account-facts dd {
    margin: 0;
    font-weight: 600;
}

.sync-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.sync-main {
    max-width: 100%;
}

.sync-numbers {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--border);
}

.sync-numbers div {
    display: grid;
    gap: 7px;
    padding: 18px;
    background: var(--bg-card);
}

.sync-numbers span {
    color: var(--text-muted);
    font-size: .78rem;
}

.sync-numbers strong {
    font-size: 1.4rem;
}

.usage-bar {
    height: 10px;
    margin-bottom: 24px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.usage-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
}

.limit-field {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(150px, .7fr);
    gap: 12px;
}

.access-grid,
.history-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
}

.access-count {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 24px;
}

.access-count strong {
    font-size: 2rem;
}

.access-count span {
    color: var(--text-muted);
}

.stacked-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.discounts-table {
    margin-bottom: 24px;
}

.money-input {
    position: relative;
}

.money-input input {
    padding-right: 42px;
}

.money-input span {
    position: absolute;
    top: 50%;
    right: 14px;
    color: var(--text-muted);
    transform: translateY(-50%);
}

.integration-list {
    display: grid;
}

.integration-list > div {
    display: grid;
    grid-template-columns: minmax(140px, .6fr) minmax(180px, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.integration-list > div:last-child {
    border-bottom: 0;
}

.integration-list > div > span:not(.badge) {
    color: var(--text-muted);
}

.timeline-icon .material-symbols-outlined {
    font-size: 16px;
}

.note-form {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.notes-list {
    display: grid;
    gap: 12px;
    max-height: 520px;
    margin-top: 20px;
    overflow-y: auto;
}

.notes-list article {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-input);
}

.notes-list header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
    font-size: .76rem;
}

.notes-list p {
    margin: 10px 0 0;
    line-height: 1.5;
}

.centered-state {
    display: grid;
    justify-items: center;
    gap: 14px;
    padding: 48px;
    text-align: center;
}

.centered-state > .material-symbols-outlined {
    color: var(--danger);
    font-size: 44px;
}

.centered-state p {
    margin: 0;
    color: var(--text-muted);
}

.admin-toast-region {
    position: fixed;
    z-index: 1200;
    right: 24px;
    bottom: 24px;
    display: grid;
    width: min(420px, calc(100vw - 32px));
    gap: 10px;
}

.admin-toast {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--success);
    border-radius: 10px;
    color: var(--text-main);
    background: var(--bg-card);
    box-shadow: 0 14px 38px rgba(15, 23, 42, .16);
}

.admin-toast[data-state="error"] {
    border-left-color: var(--danger);
}

.admin-toast button {
    padding: 0;
    border: 0;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
}

.admin-confirm {
    margin: auto;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    width: min(480px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: 14px;
    color: var(--text-main);
    background: var(--bg-card);
    box-shadow: 0 22px 70px rgba(15, 23, 42, .24);
}

.admin-confirm::backdrop {
    background: rgba(15, 23, 42, .48);
}

.admin-confirm form {
    padding: 24px;
}

.admin-confirm h2 {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.admin-confirm p {
    margin: 0 0 22px;
    color: var(--text-muted);
    line-height: 1.5;
}

.admin-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (max-width: 1180px) {
    .users-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .users-search {
        grid-column: span 2;
    }

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

@media (max-width: 840px) {
    .admin-summary,
    .sync-numbers {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bulk-toolbar,
    .user-detail-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .bulk-actions {
        justify-content: flex-start;
    }

    .access-grid,
    .history-grid,
    .form-grid-two,
    .account-facts {
        grid-template-columns: 1fr;
    }

    .account-facts div:nth-last-child(-n + 3) {
        border-bottom: 1px solid var(--border);
    }

    .account-facts div:last-child {
        border-bottom: 0;
    }
}

@media (max-width: 620px) {
    .users-filters,
    .admin-summary,
    .sync-numbers,
    .form-grid-four {
        grid-template-columns: 1fr;
    }

    .users-search {
        grid-column: auto;
    }

    .users-filter-actions,
    .users-filter-actions .btn,
    .header-actions,
    .header-actions .btn,
    .header-actions form,
    .stacked-actions,
    .stacked-actions form,
    .stacked-actions .btn {
        width: 100%;
    }

    .header-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .bulk-actions {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .limit-field,
    .integration-list > div {
        grid-template-columns: 1fr;
    }

    .pagination {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .admin-confirm-actions {
        flex-direction: column-reverse;
    }

    .admin-confirm-actions .btn {
        width: 100%;
    }
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.panel-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.threads-connection-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 28px;
    margin: 0 0 24px;
}

.threads-connection-details div {
    display: grid;
    gap: 5px;
}

.threads-connection-details dt {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.threads-connection-details dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.threads-connection-warning {
    color: var(--warning);
}

.threads-scope-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-active {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-suspended {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-pending {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-secondary {
    background-color: var(--bg-input);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--border);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus-visible {
    border-color: var(--accent);
}

.filters-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filters-bar .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 200px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    gap: 8px;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--text-main);
}

.tab-btn.active {
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background-color: var(--border);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-icon {
    position: absolute;
    left: -32px;
    top: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.timeline-content {
    background-color: var(--bg-input);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border);
}

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.pagination-actions {
    display: flex;
    gap: 8px;
}

.material-icons-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 20px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
}

.email-preview-page {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.email-list-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: sticky;
    top: 24px;
    max-height: calc(100vh - 88px);
    display: flex;
    flex-direction: column;
}

.email-list-summary {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.email-list-summary strong {
    font-size: 1.5rem;
    line-height: 1;
}

.email-list-summary span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.email-list {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.email-list-item {
    display: grid;
    gap: 6px;
    padding: 14px 18px;
    color: var(--text-main);
    border-bottom: 1px solid rgba(55, 65, 81, 0.7);
}

.email-list-item:hover,
.email-list-item.active {
    background-color: var(--bg-input);
    color: var(--text-main);
}

.email-list-item.active {
    box-shadow: inset 3px 0 0 var(--accent);
}

.email-list-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.email-list-meta {
    display: flex;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.email-list-subject {
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.email-preview-detail {
    min-width: 0;
}

.email-preview-heading {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 24px;
}

.email-preview-heading h2 {
    font-size: 1.35rem;
    margin-bottom: 6px;
}

.email-preview-heading p {
    color: var(--text-muted);
}

.email-preview-kicker {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.email-preview-grid {
    display: grid;
    grid-template-columns: minmax(420px, 1fr) 390px;
    gap: 24px;
    align-items: start;
}

.email-preview-device {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    min-width: 0;
}

.email-device-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.email-device-header .material-symbols-outlined {
    font-size: 20px;
}

.email-preview-device iframe {
    width: 100%;
    height: 720px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background-color: #ffffff;
}

.email-mobile-shell {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

.email-preview-device-mobile iframe {
    height: 720px;
}

.email-text-preview {
    margin-top: 24px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
}

.email-text-preview summary {
    cursor: pointer;
    font-weight: 600;
}

.email-text-preview pre {
    margin-top: 16px;
    white-space: pre-wrap;
    color: var(--text-muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.85rem;
}

.header-actions,
.help-workflow,
.help-editor-heading {
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-admin-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.help-admin-nav a {
    color: var(--text-muted);
    padding: 9px 14px;
    border-radius: 999px;
    text-decoration: none;
}

.help-admin-nav a.active {
    color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
    font-weight: 700;
}

.help-admin-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 24px;
}

.help-admin-form,
.help-editor {
    display: grid;
    gap: 20px;
}

.help-category-list {
    display: grid;
    gap: 10px;
}

.help-category-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.help-category-list span {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.help-workflow {
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.help-workflow form {
    margin: 0;
}

.help-editor-heading {
    justify-content: space-between;
    align-items: flex-start;
}

.help-editor-heading p {
    color: var(--text-muted);
    margin-top: 4px;
}

.help-step-editor {
    position: relative;
    margin-top: 18px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.help-step-editor legend {
    padding: 0 8px;
    font-weight: 700;
}

.help-step-remove {
    position: absolute;
    top: 14px;
    right: 16px;
    border: 0;
    background: transparent;
    color: #b42318;
    cursor: pointer;
}

.help-admin-empty {
    text-align: center;
    padding: 36px;
    color: var(--text-muted);
}

@media (max-width: 1180px) {
    .email-preview-page,
    .email-preview-grid {
        grid-template-columns: 1fr;
    }

    .email-list-panel {
        position: static;
        max-height: 420px;
    }

    .email-preview-device-desktop iframe {
        height: 620px;
    }
}

@media (max-width: 760px) {
    .layout {
        min-height: calc(100vh - 56px);
    }

    .sidebar {
        position: fixed;
        inset: 56px auto 0 0;
        z-index: 50;
        width: min(300px, 88vw);
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 20px 0 40px rgba(15, 23, 42, .16);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
        padding: 24px 16px;
    }

    .header,
    .help-editor-heading,
    .help-category-list > div {
        align-items: flex-start;
        flex-direction: column;
    }

    .help-admin-grid {
        grid-template-columns: 1fr;
    }

    .threads-connection-details {
        grid-template-columns: 1fr;
    }

    .email-preview-heading,
    .email-preview-device,
    .email-text-preview {
        border-radius: 8px;
    }

    .email-preview-device iframe,
    .email-preview-device-mobile iframe {
        height: 560px;
    }
}

.admin-mobile-header {
    display: none;
}

.sidebar nav {
    flex: 1;
}

.sidebar-session {
    display: grid;
    gap: 12px;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

.sidebar-session div {
    display: grid;
    gap: 2px;
}

.sidebar-session span {
    color: var(--text-muted);
    font-size: .75rem;
}

.sidebar-logout {
    width: 100%;
    justify-content: center;
}

.admin-sidebar-backdrop {
    display: none;
}

.admin-inline-warning {
    padding: 14px 16px;
    margin-bottom: 20px;
    border: 1px solid #fdba74;
    border-radius: 10px;
    color: #9a3412;
    background: #fff7ed;
}

.admin-toast[data-state="warning"] {
    border-color: #fdba74;
    color: #9a3412;
    background: #fff7ed;
}

.admin-auth-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 20px;
}

.admin-auth-page .login-card,
body:not(.admin-auth-page) > .login-card {
    width: min(420px, 100%);
}

.otp-input {
    text-align: center;
    letter-spacing: .35em;
    font-size: 1.5rem !important;
}

.admin-auth-submit {
    width: 100%;
}

.admin-auth-back {
    margin-top: 20px;
    text-align: center;
}

@media (max-width: 760px) {
    .admin-mobile-header {
        position: sticky;
        top: 0;
        z-index: 60;
        display: grid;
        grid-template-columns: 40px 1fr auto;
        align-items: center;
        min-height: 56px;
        padding: 8px 12px;
        border-bottom: 1px solid var(--border);
        background: var(--bg-card);
    }

    .admin-mobile-header > span {
        max-width: 120px;
        overflow: hidden;
        color: var(--text-muted);
        font-size: .75rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .admin-menu-toggle {
        display: inline-grid;
        place-items: center;
        width: 40px;
        height: 40px;
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text-main);
        background: var(--bg-card);
    }

    .admin-sidebar-backdrop:not([hidden]) {
        position: fixed;
        inset: 56px 0 0;
        z-index: 40;
        display: block;
        width: 100%;
        border: 0;
        background: rgba(15, 23, 42, .4);
    }

    body.admin-menu-open {
        overflow: hidden;
    }

    .table-responsive table.mobile-rows,
    .table-responsive table.mobile-rows tbody,
    .table-responsive table.mobile-rows tr,
    .table-responsive table.mobile-rows td {
        display: block;
        width: 100%;
    }

    .table-responsive table.mobile-rows thead {
        display: none;
    }

    .table-responsive table.mobile-rows tr {
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
    }

    .table-responsive table.mobile-rows td[data-label] {
        display: grid;
        grid-template-columns: minmax(110px, 38%) 1fr;
        gap: 12px;
        padding: 7px 12px;
    }

    .table-responsive table.mobile-rows td[data-label]::before {
        color: var(--text-muted);
        font-size: .75rem;
        font-weight: 700;
        content: attr(data-label);
    }
}
