/* ProfitScribe app styles: Phase 1 dark look.
   Tokens and components follow docs/design/app-interior-reference-v2.html.
   Order: tokens, Bootstrap mapping, base, shell, public pages, shared components, helpers. */

/* ---------- 1. Tokens ---------- */
:root {
    --bg: #040608;
    --sidebar: #060a0e;
    --panel: #070d12;
    --panel-2: #0b141a;
    --panel-raised: #0a1117;
    --field: #05090d;
    --line: rgba(148, 163, 184, 0.12);
    --line-soft: rgba(148, 163, 184, 0.08);
    --line-strong: rgba(148, 163, 184, 0.22);
    --line-button: rgba(148, 163, 184, 0.28);

    --text: #e2e8f0;
    --text-label: #c8d2de;
    --text-2: #a3b1c2;
    --text-3: #7d8ea3;
    --placeholder: #6f8197; /* the design used #56657a (about 3.3:1); this passes 4.5:1 on every field background */

    --brand: #38bdf8;
    --brand-hover: #7dd3fc;
    --brand-soft: rgba(56, 189, 248, 0.10);
    --on-brand: #04111c;
    --win: #34d399;
    --win-soft: rgba(52, 211, 153, 0.07);
    --loss: #fb7185;
    --loss-soft: rgba(251, 113, 133, 0.08);
    --loss-text: #fda4af;
    --warn: #f59e0b;
    --warn-soft: rgba(245, 158, 11, 0.07);
    --warn-text: #fcd34d;

    --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --font-wordmark: 'Inter', system-ui, sans-serif;

    --radius-sm: 6px;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --sidebar-width: 240px;
    --gutter: clamp(16px, 3vw, 36px);
    --phonebar-height: 56px;
    --tabs-height: calc(64px + env(safe-area-inset-bottom, 0px));
}

/* ---------- 2. Bootstrap mapped onto the tokens ---------- */
[data-bs-theme="dark"] {
    color-scheme: dark;
    --bs-body-bg: var(--bg);
    --bs-body-bg-rgb: 4, 6, 8;
    --bs-body-color: var(--text);
    --bs-body-color-rgb: 226, 232, 240;
    --bs-body-font-family: var(--font-sans);
    --bs-body-font-size: 0.875rem;
    --bs-body-line-height: 1.5;
    --bs-emphasis-color: var(--text);
    --bs-emphasis-color-rgb: 226, 232, 240;
    --bs-heading-color: var(--text);
    --bs-secondary-color: var(--text-3);
    --bs-secondary-color-rgb: 125, 142, 163;
    --bs-tertiary-color: var(--text-3);
    --bs-secondary-bg: var(--panel-2);
    --bs-tertiary-bg: var(--panel);
    --bs-border-color: var(--line);
    --bs-border-color-translucent: var(--line);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 56, 189, 248;
    --bs-link-hover-color: var(--brand-hover);
    --bs-link-hover-color-rgb: 125, 211, 252;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 56, 189, 248;
    --bs-success: var(--win);
    --bs-success-rgb: 52, 211, 153;
    --bs-danger: var(--loss);
    --bs-danger-rgb: 251, 113, 133;
    --bs-warning: var(--warn);
    --bs-warning-rgb: 245, 158, 11;
    --bs-info: var(--brand);
    --bs-info-rgb: 56, 189, 248;
    --bs-success-text-emphasis: var(--win);
    --bs-danger-text-emphasis: var(--loss-text);
    --bs-warning-text-emphasis: var(--warn-text);
    --bs-info-text-emphasis: var(--brand-hover);
    --bs-focus-ring-color: rgba(56, 189, 248, 0.35);
    --bs-form-valid-color: var(--win);
    --bs-form-valid-border-color: var(--win);
    --bs-form-invalid-color: var(--loss-text);
    --bs-form-invalid-border-color: var(--loss);
    --bs-code-color: var(--brand-hover);
    --bs-border-radius: var(--radius);
}

/* ---------- 3. Base ---------- */
html {
    -webkit-text-size-adjust: 100%;
}

body.ps-app {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text);
    font-weight: 500;
    letter-spacing: -0.01em;
}

a {
    color: var(--brand);
    text-decoration: none;
}

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

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

::selection {
    background: rgba(56, 189, 248, 0.28);
}

::placeholder {
    color: var(--placeholder) !important;
    opacity: 1;
}

strong, b {
    font-weight: 600;
}

small, .small {
    font-size: 12px;
}

code, kbd, pre, .mono, .is-mono {
    font-family: var(--font-mono);
}

.num, .mono, .is-mono {
    font-variant-numeric: tabular-nums;
}

hr {
    border-color: var(--line);
    opacity: 1;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 200;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 600;
}

.skip-link:focus {
    top: 12px;
    color: var(--on-brand);
}

main:focus {
    outline: none;
}

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

/* ---------- 4. Brand ---------- */
.shell-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
    color: var(--text);
}

.shell-brand:hover {
    color: var(--text);
}

.shell-brand-mark {
    display: inline-flex;
    flex: none;
    width: 28px;
    height: 28px;
}

.shell-brand-mark svg {
    width: 100%;
    height: 100%;
}

.shell-brand-mark.is-small {
    width: 22px;
    height: 22px;
}

.wordmark {
    font-family: var(--font-wordmark);
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1;
}

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

.shell-brand.is-public .wordmark {
    font-size: 20px;
}

/* ---------- 5. App shell ---------- */
.shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
    /* The sidebar column keeps its colour and edge below the sticky sidebar on long pages. */
    background: linear-gradient(to right, var(--sidebar) calc(var(--sidebar-width) - 1px), var(--line) calc(var(--sidebar-width) - 1px), var(--line) var(--sidebar-width), transparent var(--sidebar-width));
}

.shell-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 22px 14px;
    background: var(--sidebar);
    border-right: 1px solid var(--line);
}

.shell-nav {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.shell-nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shell-nav-group.is-admin {
    padding-top: 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.10);
}

.shell-nav-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-3);
}

.shell-nav-tag {
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid var(--line-strong);
    font-size: 9px;
    letter-spacing: 0.08em;
    color: var(--text-3);
}

.shell-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 38px;
    padding: 0 10px;
    border-radius: var(--radius);
    color: var(--text-2);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.shell-nav-link:hover {
    background: rgba(148, 163, 184, 0.06);
    color: var(--text);
}

.shell-nav-link.is-active {
    background: var(--brand-soft);
    color: var(--text);
    font-weight: 500;
}

.shell-nav-link.is-active .ui-icon {
    color: var(--brand);
}

.shell-nav-text {
    flex: 1;
    min-width: 0;
}

.shell-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    background: var(--brand-soft);
    color: var(--brand-hover);
}

.shell-badge.is-warning {
    background: rgba(245, 158, 11, 0.16);
    color: #fbbf24;
}

/* Sidebar user block and its menu */
.shell-user {
    position: relative;
    margin-top: auto;
}

.shell-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.shell-user-card.is-open,
.shell-user-card.is-active {
    border-color: rgba(56, 189, 248, 0.35);
    background: var(--panel-raised);
}

.shell-avatar {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #0f2a3a;
    color: var(--brand-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.shell-avatar.is-large {
    width: 36px;
    height: 36px;
}

.shell-user-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.shell-user-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shell-user-role,
.shell-user-email {
    font-size: 12px;
    color: var(--text-3);
}

.shell-user-email {
    overflow-wrap: anywhere;
}

.shell-user-toggle {
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.shell-user-toggle:hover,
.shell-user-toggle[aria-expanded="true"] {
    background: rgba(56, 189, 248, 0.12);
    color: var(--text);
}

.shell-user-toggle[aria-expanded="true"] .ui-icon {
    transform: rotate(180deg);
}

.shell-user-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: var(--radius-md);
    background: var(--panel-2);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.shell-user-menu[hidden] {
    display: none;
}

.shell-user-menu-head {
    padding: 8px 10px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}

.shell-user-menu-head .shell-user-name {
    font-size: 13px;
}

.shell-user-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    text-align: left;
}

.shell-user-menu-item:hover,
.shell-user-menu-item:focus-visible {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text);
}

/* Main column */
.shell-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.shell-pagehead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px var(--gutter);
    border-bottom: 1px solid var(--line);
}

.shell-pagehead h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.shell-pagehead p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-3);
}

.shell-pagehead-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.shell-content {
    width: 100%;
    max-width: 1320px;
    padding: 24px var(--gutter) 48px;
}

.shell-phonebar {
    display: none;
}

.shell-icon-button {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.shell-icon-button:hover {
    background: rgba(148, 163, 184, 0.08);
    color: var(--text);
}

.shell-tabs,
.shell-more {
    display: none;
}

/* Phones and small tablets: top bar, bottom tabs, More screen */
@media (max-width: 899.98px) {
    .shell {
        display: block;
        background: none;
    }

    .shell-sidebar,
    .shell-pagehead {
        display: none;
    }

    .shell-phonebar {
        position: sticky;
        top: 0;
        z-index: 20;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        height: var(--phonebar-height);
        padding: 0 8px 0 16px;
        border-bottom: 1px solid var(--line);
        background: var(--sidebar);
    }

    .shell-phonebar-title {
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 0;
    }

    .shell-phonebar-heading {
        font-size: 17px;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .shell-content {
        padding: 14px 16px calc(var(--tabs-height) + 24px);
    }

    .shell-tabs {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        align-items: end;
        height: var(--tabs-height);
        padding: 6px 4px env(safe-area-inset-bottom, 0px);
        border-top: 1px solid rgba(148, 163, 184, 0.14);
        background: var(--sidebar);
    }

    .shell-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 52px;
        padding: 0;
        border: 0;
        background: transparent;
        color: var(--text-2);
        font: inherit;
        font-size: 11px;
    }

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

    .shell-tab.is-active,
    .shell-tab.is-open {
        color: var(--brand);
        font-weight: 500;
    }

    .shell-tab.is-log {
        gap: 3px;
        color: var(--text);
        font-weight: 500;
    }

    .shell-tab-log {
        width: 44px;
        height: 44px;
        margin-top: -14px;
        border-radius: var(--radius-lg);
        background: var(--brand);
        color: var(--on-brand);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 6px 18px rgba(56, 189, 248, 0.25);
    }

    body.has-more-open .shell-tab.is-active:not(.is-open) {
        color: var(--text-2);
        font-weight: 400;
    }

    .shell-more:not([hidden]) {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: var(--tabs-height);
        z-index: 40;
        display: flex;
        flex-direction: column;
        background: var(--bg);
    }

    body.has-more-open {
        overflow: hidden;
    }
}

.shell-more-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--phonebar-height);
    padding: 0 8px 0 16px;
    border-bottom: 1px solid var(--line);
    background: var(--sidebar);
}

.shell-more-head h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 500;
}

.shell-more-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.shell-more-account {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
}

.shell-more-account:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.shell-more-nav {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.shell-more-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shell-more-group .shell-nav-label {
    padding: 0 4px;
}

.shell-more-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    overflow: hidden;
}

.shell-more-list li + li .shell-more-link {
    border-top: 1px solid var(--line-soft);
}

.shell-more-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 0 14px;
    color: var(--text);
}

.shell-more-link:hover {
    color: var(--text);
    background: rgba(148, 163, 184, 0.05);
}

.shell-more-link > .ui-icon:first-child {
    color: var(--text-2);
}

.shell-more-chevron {
    color: var(--text-3);
}

.shell-more-trailing {
    font-size: 12px;
    color: var(--text-3);
}

.shell-more-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 12px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
}

.shell-more-logout:hover {
    background: rgba(148, 163, 184, 0.06);
}

/* ---------- 6. Signed-out pages ---------- */
body.is-public {
    display: flex;
    flex-direction: column;
}

.public-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px clamp(16px, 4vw, 48px);
}

.public-header .shell-brand {
    padding: 0;
}

.public-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.public-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 32px 16px 56px;
}

.public-main > .ui-messages {
    width: 100%;
    max-width: 440px;
    margin-bottom: 0;
}

/* Centred card: sign in, invite sign-up, forgot and reset password, beta apply, log out */
.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 32px clamp(20px, 5vw, 32px);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-card.is-wide {
    max-width: 440px;
}

.auth-card.is-form {
    max-width: 600px;
}

.auth-card.is-inline {
    max-width: 440px;
    padding: 24px;
}

.auth-card-head {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.auth-card-head h1,
.auth-card-head h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.02em;
}

.auth-card.is-inline .auth-card-head h2 {
    font-size: 18px;
}

.auth-card-head p {
    margin: 0;
    color: var(--text-2);
}

.auth-card .ui-messages {
    margin: 0;
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    background: rgba(56, 189, 248, 0.08);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-hover);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form .form-control,
.auth-form .form-select {
    min-height: 46px;
}

.auth-form textarea.form-control {
    min-height: 96px;
}

.auth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 16px;
}

.ui-field-labelrow {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.auth-aside-link,
.auth-back-link {
    font-size: 13px;
    font-weight: 500;
}

.auth-back-link {
    align-self: center;
}

.auth-note {
    max-width: 440px;
    margin: 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-2);
}

.auth-note a {
    font-weight: 500;
}

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

.cf-turnstile {
    min-height: 65px;
}

.public-footer {
    padding: 20px clamp(16px, 4vw, 48px);
    border-top: 1px solid var(--line-soft);
    font-size: 12px;
    color: var(--text-3);
}

/* ---------- 7. Shared components ---------- */

/* Icons */
.ui-icon {
    flex: none;
    display: inline-block;
    vertical-align: middle;
}

.bi {
    line-height: 1;
}

/* Cards */
.card-soft,
.ui-card {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    color: var(--text);
}

.card {
    --bs-card-bg: var(--panel);
    --bs-card-border-color: var(--line);
    --bs-card-border-radius: var(--radius-lg);
    --bs-card-color: var(--text);
    --bs-card-cap-bg: transparent;
}

/* Headings inside pages */
.section-title {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

h1.section-title,
h2.section-title {
    font-size: 17px;
}

.section-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-2);
}

.section-icon {
    display: inline-flex;
    color: var(--text-3);
    font-size: 15px;
}

.ui-kicker,
.dashboard-kicker,
.dashboard-guidance-eyebrow,
.trade-view-kicker,
.app-topbar-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-3);
}

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

.text-secondary {
    color: var(--text-2) !important;
}

/* Wins and losses always carry a sign as well as colour (the templates print it). */
.text-success,
.is-positive,
.pnl-positive {
    color: var(--win) !important;
}

.text-danger,
.is-negative,
.pnl-negative {
    color: var(--loss) !important;
}

.text-warning {
    color: var(--warn-text) !important;
}

.text-info,
.text-primary {
    color: var(--brand) !important;
}

/* Buttons */
.btn {
    --bs-btn-font-family: var(--font-sans);
    --bs-btn-font-size: 14px;
    --bs-btn-font-weight: 500;
    --bs-btn-border-radius: var(--radius);
    --bs-btn-padding-x: 14px;
    --bs-btn-padding-y: 0;
    --bs-btn-focus-box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    white-space: nowrap;
}

.btn .bi,
.btn .ui-icon {
    font-size: 1em;
}

.btn-sm {
    --bs-btn-font-size: 13px;
    --bs-btn-padding-x: 12px;
    min-height: 34px;
    gap: 6px;
}

.btn-lg {
    --bs-btn-font-size: 15px;
    --bs-btn-padding-x: 18px;
    min-height: 46px;
}

.btn-brand,
.btn-primary {
    --bs-btn-color: var(--on-brand);
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: var(--on-brand);
    --bs-btn-hover-bg: var(--brand-hover);
    --bs-btn-hover-border-color: var(--brand-hover);
    --bs-btn-active-color: var(--on-brand);
    --bs-btn-active-bg: var(--brand-hover);
    --bs-btn-active-border-color: var(--brand-hover);
    --bs-btn-disabled-color: var(--on-brand);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-font-weight: 600;
}

.btn-ghost,
.btn-secondary,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-light,
.btn-light {
    --bs-btn-color: var(--text);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--line-button);
    --bs-btn-hover-color: var(--text);
    --bs-btn-hover-bg: rgba(148, 163, 184, 0.08);
    --bs-btn-hover-border-color: rgba(148, 163, 184, 0.4);
    --bs-btn-active-color: var(--text);
    --bs-btn-active-bg: rgba(148, 163, 184, 0.12);
    --bs-btn-active-border-color: rgba(148, 163, 184, 0.4);
    --bs-btn-disabled-color: var(--text-3);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--line);
}

.btn-danger {
    --bs-btn-color: #1a0509;
    --bs-btn-bg: var(--loss);
    --bs-btn-border-color: var(--loss);
    --bs-btn-hover-color: #1a0509;
    --bs-btn-hover-bg: #fda4af;
    --bs-btn-hover-border-color: #fda4af;
    --bs-btn-active-color: #1a0509;
    --bs-btn-active-bg: #fda4af;
    --bs-btn-active-border-color: #fda4af;
    --bs-btn-font-weight: 600;
}

/* Quiet destructive buttons in lists and tables */
.btn-delete-subtle,
.btn-outline-danger,
.admin-danger-action .btn {
    --bs-btn-color: var(--loss-text);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: rgba(251, 113, 133, 0.35);
    --bs-btn-hover-color: #1a0509;
    --bs-btn-hover-bg: var(--loss);
    --bs-btn-hover-border-color: var(--loss);
    --bs-btn-active-color: #1a0509;
    --bs-btn-active-bg: var(--loss);
    --bs-btn-active-border-color: var(--loss);
    --bs-btn-font-weight: 500;
}

.btn-warning {
    --bs-btn-color: #1a1003;
    --bs-btn-bg: var(--warn);
    --bs-btn-border-color: var(--warn);
    --bs-btn-hover-color: #1a1003;
    --bs-btn-hover-bg: #fbbf24;
    --bs-btn-hover-border-color: #fbbf24;
    --bs-btn-font-weight: 600;
}

.btn-success {
    --bs-btn-color: #03140d;
    --bs-btn-bg: var(--win);
    --bs-btn-border-color: var(--win);
    --bs-btn-hover-color: #03140d;
    --bs-btn-hover-bg: #6ee7b7;
    --bs-btn-hover-border-color: #6ee7b7;
    --bs-btn-font-weight: 600;
}

.btn-link {
    --bs-btn-color: var(--brand);
    --bs-btn-hover-color: var(--brand-hover);
    padding-left: 0;
    padding-right: 0;
}

/* Form fields */
.form-label {
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-label);
}

.form-control,
.form-select {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background-color: var(--field);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
}

.form-select {
    padding-right: 36px;
    background-position: right 12px center;
}

textarea.form-control {
    min-height: 96px;
    padding: 10px 12px;
    line-height: 1.5;
}

.form-control.is-mono,
.form-control[type="number"],
.form-control[inputmode="decimal"] {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    background-color: var(--field);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

.form-control:disabled,
.form-control[readonly],
.form-select:disabled {
    background-color: var(--panel-raised);
    border-color: rgba(148, 163, 184, 0.14);
    color: var(--text-2);
}

.form-control-sm,
.form-select-sm {
    min-height: 36px;
    font-size: 13px;
    border-radius: var(--radius);
}

.form-control[type="file"] {
    padding: 8px 12px;
    line-height: 1.6;
}

.form-control::file-selector-button {
    margin: -8px 12px -8px -12px;
    padding: 10px 12px;
    border: 0;
    border-right: 1px solid var(--line-strong);
    background: var(--panel-2);
    color: var(--text);
}

.form-control.is-invalid,
.form-select.is-invalid,
.was-validated .form-control:invalid {
    border-color: var(--loss);
    background-image: none;
    padding-right: 12px;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: var(--loss);
    box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.2);
}

.form-check-input {
    --bs-form-check-bg: var(--field);
    border-color: var(--line-button);
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-check-label {
    color: var(--text-label);
}

.ui-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ui-field .form-label {
    margin: 0;
}

.ui-field-hint,
.field-helper,
.form-text {
    font-size: 12px;
    color: var(--text-3);
}

/* Field errors: an icon and words under the field */
.ui-field-error,
.invalid-feedback,
.form-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--loss-text);
}

.ui-field-error .ui-icon {
    margin-top: 2px;
}

.invalid-feedback::before,
.form-error::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    margin-top: 2px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5v.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5v.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.invalid-feedback {
    margin-top: 6px;
}

.is-invalid ~ .invalid-feedback,
.invalid-feedback.d-block {
    display: flex !important;
}

/* Page messages (flash) */
.ui-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
}

.ui-message,
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: var(--radius-md);
    background: rgba(56, 189, 248, 0.07);
    color: var(--text);
}

.ui-message-icon {
    color: var(--brand);
}

.shell-content > .alert {
    margin-bottom: 16px;
}

.ui-message-text {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.ui-message-dismiss {
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ui-message-dismiss:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text);
}

.ui-message.is-success,
.alert-success {
    border-color: rgba(52, 211, 153, 0.4);
    background: var(--win-soft);
}

.ui-message.is-success .ui-message-icon {
    color: var(--win);
}

.ui-message.is-danger,
.alert-danger {
    border-color: rgba(251, 113, 133, 0.45);
    background: var(--loss-soft);
}

.ui-message.is-danger .ui-message-icon {
    color: var(--loss);
}

.ui-message.is-warning,
.alert-warning {
    border-color: rgba(245, 158, 11, 0.45);
    background: var(--warn-soft);
}

.ui-message.is-warning .ui-message-icon {
    color: var(--warn);
}

/* Older .alert markup inside pages gets the same icon as a page message. */
.alert::before {
    content: "";
    flex: none;
    align-self: flex-start;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    background: var(--brand);
    -webkit-mask: var(--alert-icon) center / contain no-repeat;
    mask: var(--alert-icon) center / contain no-repeat;
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 7.5v.5'/%3E%3C/svg%3E");
}

.alert-success::before {
    background: var(--win);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12.5l2.5 2.5L16 9.5'/%3E%3C/svg%3E");
}

.alert-danger::before {
    background: var(--loss);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v6M12 16.5v.5'/%3E%3C/svg%3E");
}

.alert-warning::before {
    background: var(--warn);
    --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4l9 16H3z'/%3E%3Cpath d='M12 10v4M12 17v.5'/%3E%3C/svg%3E");
}

.alert > .bi:first-child {
    display: none;
}

/* Empty states */
.ui-empty,
.smart-empty-state,
.empty-state-compact,
.broker-empty-state,
.goals-empty-state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 28px 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    text-align: left;
}

.ui-empty.is-inline,
.empty-state-inline,
.chart-empty-state {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-2);
    font-size: 13px;
}

.chart-empty-state {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 160px;
}

.ui-empty-icon,
.empty-state-icon,
.empty-state-mini-icon {
    font-size: 26px;
    color: var(--text-3);
}

.ui-empty.is-inline .ui-empty-title {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-2);
}

.ui-empty.is-inline .ui-empty-icon {
    font-size: 18px;
}

.empty-state-inline .bi,
.chart-empty-state .bi {
    font-size: 18px;
    color: var(--text-3);
}

.ui-empty-title,
.ui-empty h3,
.ui-empty h4,
.smart-empty-state .section-title,
.empty-state-compact .section-title {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.ui-empty-text,
.ui-empty p,
.smart-empty-state p,
.empty-state-compact p,
.broker-empty-state p {
    margin: 0;
    font-size: 13px;
    color: var(--text-2);
}

.empty-state-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 4px;
}

/* Tables */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--line-soft);
    --bs-table-striped-bg: rgba(148, 163, 184, 0.03);
    --bs-table-hover-bg: rgba(148, 163, 184, 0.04);
    --bs-table-hover-color: var(--text);
    margin-bottom: 0;
    font-size: 14px;
    vertical-align: middle;
}

.table > :not(caption) > * > * {
    padding: 12px;
    border-bottom-color: var(--line-soft);
}

.table > thead > tr > th,
.table th[scope="col"] {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-3);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table > tbody > tr:last-child > * {
    border-bottom: 0;
}

.table-wrap,
.analytics-table-wrap,
.table-responsive {
    position: relative; /* keeps visually-hidden labels inside the scroll area */
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
}

.card-soft .table-wrap,
.card-soft .analytics-table-wrap,
.card-soft .table-responsive {
    border: 0;
    border-radius: 0;
    background: transparent;
}

/* Chips, pills and small labels */
.tag-chip,
.badge-soft,
.admin-status-badge,
.broker-status-badge,
.delivery-status,
.feedback-pill,
.filter-status-pill,
.active-filter-chip,
.setup-status-badge,
.weekday-status-badge,
.progress-status-badge,
.process-status-pill,
.screenshot-count-badge,
.feedback-count-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.badge {
    font-family: var(--font-sans);
    font-weight: 500;
}

:is(.admin-status-badge, .broker-status-badge, .delivery-status, .feedback-pill, .setup-status-badge,
    .weekday-status-badge, .progress-status-badge, .process-status-pill).is-success {
    border-color: rgba(52, 211, 153, 0.4);
    color: #bdf5dd;
}

:is(.admin-status-badge, .broker-status-badge, .delivery-status, .feedback-pill, .setup-status-badge,
    .weekday-status-badge, .progress-status-badge, .process-status-pill).is-danger {
    border-color: rgba(251, 113, 133, 0.45);
    color: var(--loss-text);
}

:is(.admin-status-badge, .broker-status-badge, .delivery-status, .feedback-pill, .setup-status-badge,
    .weekday-status-badge, .progress-status-badge, .process-status-pill):is(.is-warning, .is-pending) {
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--warn-text);
}

:is(.admin-status-badge, .broker-status-badge, .delivery-status, .feedback-pill, .setup-status-badge,
    .weekday-status-badge, .progress-status-badge, .process-status-pill).is-info {
    border-color: rgba(56, 189, 248, 0.35);
    color: var(--brand-hover);
}

.ui-sample-badge,
.small-sample-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 4px;
    color: var(--warn);
    font-size: 11px;
    white-space: nowrap;
}

/* Stat tiles */
.metric,
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label,
.stat-label {
    font-size: 12px;
    color: var(--text-3);
}

.metric-value,
.stat-value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

/* List groups */
.list-group {
    --bs-list-group-bg: transparent;
    --bs-list-group-color: var(--text);
    --bs-list-group-border-color: var(--line-soft);
}

/* Confirm dialog */
.ui-dialog {
    width: min(440px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: var(--radius-lg);
    background: var(--panel-2);
    color: var(--text);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.ui-dialog::backdrop {
    background: rgba(2, 4, 6, 0.8);
}

.ui-dialog-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
}

.ui-dialog-title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.ui-dialog-summary {
    margin: 0;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--panel);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-label);
}

.ui-dialog-body {
    margin: 0;
    color: var(--text-2);
}

.ui-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
}

.ui-dialog-actions .btn {
    min-height: 44px;
}

/* Goals modal (dashboard and goals page) */
.goal-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(2, 4, 6, 0.8);
}

.goal-modal.is-open {
    display: flex;
}

.goal-modal-panel {
    width: min(920px, 100%);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: var(--panel-2);
    border-color: rgba(148, 163, 184, 0.2);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

/* ---------- 7b. Page building blocks (dashboard first, reused by later pages) ---------- */
.page-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Flex children may shrink below their content, so wide tables scroll inside their own wrapper. */
.page-stack > *,
.page-section > * {
    min-width: 0;
}

.ui-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px 16px;
}

.ui-card-head-actions,
.ui-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ui-card-actions {
    margin-top: 16px;
}

.ui-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ui-card-title .bi {
    color: var(--text-3);
}

.ui-card-sub {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-3);
}

.ui-card-link {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

.btn-text {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
}

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

.split-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: stretch;
}

.split-row > * {
    flex: 1 1 300px;
    min-width: 0;
}

.split-row > .is-wide {
    flex: 2 1 480px;
}

.split-row.is-even > * {
    flex: 1 1 360px;
}

.page-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.page-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px 16px;
}

.page-section-title {
    margin: 0;
    font-size: 17px;
    font-weight: 500;
}

/* Stat strip: tiles separated by hairlines */
.stat-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.stat-tile {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 16px 18px;
    background: var(--panel);
}

.stat-tile-label {
    font-size: 12px;
    color: var(--text-3);
}

.stat-tile-value {
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-tile-value.is-pair {
    font-size: 18px;
    line-height: 1.35;
    padding-top: 6px;
    white-space: normal;
    overflow: visible;
}

.stat-tile-value.is-pair > span {
    white-space: nowrap;
}

.stat-tile-sep {
    color: var(--placeholder);
}

.stat-tile-note {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-3);
}

@media (max-width: 899.98px) {
    .stat-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-tile {
        padding: 12px 14px;
    }

    .stat-tile:last-child:nth-child(odd) {
        grid-column: span 2;
    }

    .stat-tile-value {
        font-size: 20px;
    }

    .stat-tile-value.is-pair {
        font-size: 16px;
        padding-top: 2px;
    }
}

/* Equity chart */
.chart-card {
    display: flex;
    flex-direction: column;
}

.equity-chart-wrap {
    position: relative;
    height: 240px;
    margin-top: 16px;
}

.equity-chart-wrap.is-empty canvas {
    display: none;
}

.equity-chart-wrap .chart-empty-state {
    height: 100%;
}

.chart-empty-state strong {
    font-weight: 500;
    color: var(--text);
}

/* Link list (Today's plan) */
.link-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    color: var(--text);
}

.link-list-item:hover {
    color: var(--text);
    border-color: var(--line-strong);
    background: rgba(148, 163, 184, 0.04);
}

.link-list-item .bi {
    margin-top: 2px;
    color: var(--text-3);
}

.link-list-item.is-primary .bi {
    color: var(--brand);
}

.link-list-item span {
    display: flex;
    flex-direction: column;
}

.link-list-item strong {
    font-weight: 500;
}

.link-list-item small {
    color: var(--text-3);
}

/* Process signals */
.process-body {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 16px;
}

.signal-list {
    flex: 2 1 380px;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.signal-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.signal-item > .bi {
    margin-top: 2px;
    color: var(--brand);
}

.signal-item:is(.is-gap, .is-warning, .is-review) > .bi {
    color: var(--warn);
}

.signal-item:is(.is-strong, .is-success) > .bi {
    color: var(--win);
}

.signal-item.is-neutral > .bi {
    color: var(--text-3);
}

/* Status names used by the process, setup, weekday and progress summaries */
:is(.process-status-pill, .setup-status-badge, .weekday-status-badge, .progress-status-badge):is(.is-strong-process, .is-strong) {
    border-color: rgba(52, 211, 153, 0.4);
    color: #bdf5dd;
}

:is(.process-status-pill, .setup-status-badge, .weekday-status-badge, .progress-status-badge):is(.is-review-gap, .is-review) {
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--warn-text);
}

:is(.process-status-pill, .setup-status-badge, .weekday-status-badge, .progress-status-badge):is(.is-low-data, .is-watchlist) {
    border-color: rgba(56, 189, 248, 0.35);
    color: var(--brand-hover);
}

.signal-item strong {
    font-weight: 500;
}

.signal-item p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--text-2);
}

.mini-stats {
    flex: 1 1 260px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    align-self: flex-start;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.mini-stats > div {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    background: var(--panel);
}

.mini-stats dt {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-3);
}

.mini-stats dd {
    margin: 2px 0 0;
    font-family: var(--font-mono);
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.mini-stats small {
    font-size: 11px;
    color: var(--text-3);
}

/* Filters */
.filter-card {
    padding: 0;
}

.filter-card-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    list-style: none;
}

.filter-card-summary::-webkit-details-marker {
    display: none;
}

.filter-card[open] .filter-card-summary {
    border-bottom: 1px solid var(--line);
}

.active-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 18px 0;
}

.filter-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 18px 18px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

fieldset.ui-field {
    margin: 0;
    padding: 0;
    border: 0;
}

fieldset.ui-field legend {
    float: none;
    width: auto;
    margin-bottom: 6px;
}

.chip-toggle-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-toggle,
.tag-select-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line-button);
    border-radius: 999px;
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.chip-toggle:hover,
.tag-select-chip:hover {
    color: var(--text);
    border-color: rgba(148, 163, 184, 0.45);
}

.btn-check:checked + .chip-toggle,
.btn-check:checked + .tag-select-chip {
    border-color: rgba(56, 189, 248, 0.5);
    background: var(--brand-soft);
    color: var(--text);
}

.btn-check:focus-visible + .chip-toggle,
.btn-check:focus-visible + .tag-select-chip {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

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

/* Trade table */
.trade-ledger {
    min-width: 760px;
}

.trade-ledger > tbody > tr.trade-row-main > td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.trade-col-price,
.trade-col-pnl,
.trade-price-cell,
.trade-pnl-cell {
    text-align: right;
}

.trade-col-actions {
    width: 1%;
}

.trade-date-cell {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-2);
    white-space: nowrap;
}

.trade-symbol-cell {
    min-width: 150px;
}

.ticker-symbol {
    display: block;
    font-family: var(--font-mono);
    font-weight: 500;
}

.ticker-meta {
    display: block;
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
}

.trade-price-cell {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-label);
    white-space: nowrap;
}

.trade-pnl {
    font-family: var(--font-mono);
    font-weight: 500;
    white-space: nowrap;
}

.trade-pnl.is-win {
    color: var(--win);
}

.trade-pnl.is-loss {
    color: var(--loss);
}

.trade-null {
    color: var(--text-3);
    font-size: 13px;
}

.tag-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.trade-actions-stack {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.trade-details-toggle[aria-expanded="true"] .bi {
    transform: rotate(180deg);
}

.trade-row-details > td {
    background: rgba(148, 163, 184, 0.03);
}

.trade-details-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px 24px;
    padding: 6px 4px;
}

.trade-details-grid {
    flex: 1 1 480px;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px 20px;
}

.trade-details-grid dt {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-3);
}

.trade-details-grid dd {
    margin: 2px 0 0;
}

.trade-detail-notes {
    grid-column: span 2;
}

.trade-thumb {
    width: 72px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

.trade-delete-form {
    margin: 0;
}

/* Small labels in tables (shared states 05) */
.ui-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 1px 6px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 11px;
    color: var(--text-2);
}

.ui-label.is-open {
    border-color: rgba(56, 189, 248, 0.35);
    color: var(--brand-hover);
}

.ui-label.is-warning {
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--warn-text);
}

/* Pager */
.trade-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.trade-pager-size {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trade-pager-size .form-label {
    margin: 0;
    font-weight: 400;
    color: var(--text-3);
    white-space: nowrap;
}

.trade-pager-size .form-select {
    width: auto;
}

.trade-pager-pages {
    display: flex;
    align-items: center;
    gap: 10px;
}

.trade-pager-indicator {
    font-size: 13px;
    color: var(--text-2);
}

/* Segmented control (goal lists) */
.segmented {
    display: inline-flex;
    gap: 2px;
    margin: 14px 0 12px;
    padding: 3px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: var(--radius);
    background: var(--field);
}

.segmented button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
}

.segmented button.is-active {
    background: #14212c;
    color: var(--text);
    font-weight: 500;
}

.segmented .num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-3);
}

/* Goals */
.goals-list {
    display: flex;
    flex-direction: column;
}

.goal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    margin: 0;
    border-top: 1px solid var(--line-soft);
}

.goal-item:first-child {
    border-top: 0;
}

.goal-check-btn {
    flex: none;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1.5px solid rgba(148, 163, 184, 0.5);
    border-radius: 6px;
    background: transparent;
    color: var(--on-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.goal-check-btn:hover {
    border-color: var(--brand);
}

.goal-check-btn.is-done {
    border-color: var(--win);
    background: var(--win);
    color: #03140d;
}

.goal-text.is-done {
    color: var(--text-3);
    text-decoration: line-through;
}

.goals-empty {
    margin: 0;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-2);
}

.goal-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 18px;
}

.goal-form-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.goal-form-grid h3 {
    margin: 0 0 2px;
}

.goal-form-grid .btn {
    align-self: flex-start;
    margin-top: 6px;
}

/* Market snapshot */
.market-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.market-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 80px;
    align-items: baseline;
    gap: 12px;
    padding: 9px 0;
    border-top: 1px solid var(--line-soft);
}

.market-row:first-child {
    border-top: 0;
}

.market-name {
    color: var(--text-label);
}

.market-price,
.market-change {
    font-family: var(--font-mono);
    font-size: 13px;
    text-align: right;
}

.market-change {
    color: var(--text-3);
}

/* Onboarding (new users) */
.onboarding-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 20px 32px;
}

.onboarding-intro {
    flex: 1 1 260px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.onboarding-intro h2 {
    margin: 0;
    font-size: 20px;
}

.onboarding-intro p {
    margin: 0;
    color: var(--text-2);
}

.onboarding-steps {
    flex: 2 1 420px;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.onboarding-step {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}

.onboarding-step.is-current {
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.04);
}

.onboarding-step-icon {
    flex: none;
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
}

.onboarding-step.is-complete .onboarding-step-icon {
    background: rgba(52, 211, 153, 0.12);
    color: var(--win);
}

.onboarding-step strong {
    font-weight: 500;
}

.onboarding-step p {
    margin: 2px 0 6px;
    font-size: 13px;
    color: var(--text-2);
}

.onboarding-step a {
    font-size: 13px;
    font-weight: 500;
}

.onboarding-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.onboarding-actions .btn {
    color: var(--bs-btn-color);
}

/* Callout: a highlighted next step */
.ui-callout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 24px;
    padding: 16px 20px;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 12px;
    background: #07121a;
}

.ui-callout-text {
    flex: 1 1 360px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ui-callout-text h2 {
    margin: 0;
    font-size: 16px;
}

.ui-callout-text p {
    margin: 0;
    color: var(--text-2);
}

.ui-callout-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ---------- 7c. Journal, trade view and trade forms ---------- */

/* Notice: a highlighted region with a heading, words and one action (shared states 01) */
.ui-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    padding: 18px 20px;
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 12px;
    background: rgba(56, 189, 248, 0.06);
}

.ui-notice.is-warning {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.06);
}

.ui-notice-icon {
    color: var(--brand);
}

.ui-notice.is-warning .ui-notice-icon {
    color: var(--warn);
}

.ui-notice-text {
    flex: 1 1 420px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ui-notice-text h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.ui-notice.is-warning .ui-notice-text h2 {
    color: var(--warn-text);
}

.ui-notice-text p {
    margin: 0;
    color: var(--text-label);
}

.ui-notice .btn {
    min-height: 44px;
}

.active-filter-chip.is-warning {
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--warn-text);
}

.trade-cues {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.chip-examples {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chip-examples li {
    padding: 2px 8px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-2);
}

/* Trade view */
.trade-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 32px;
}

.trade-hero-main {
    flex: 1 1 260px;
    min-width: 0;
}

.trade-hero-symbol {
    margin: 2px 0 0;
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.trade-hero-meta {
    margin: 2px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    color: var(--text-2);
}

.trade-hero-result {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.trade-hero-pnl {
    font-family: var(--font-mono);
    font-size: 26px;
    font-weight: 500;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.trade-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-grid {
    margin: 14px 0 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1px;
    background: var(--line-soft);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.detail-grid > div {
    padding: 12px 14px;
    background: var(--panel);
}

.detail-grid dt {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-3);
}

.detail-grid dd {
    margin: 2px 0 0;
}

.trade-notes {
    margin: 12px 0 0;
    white-space: pre-wrap;
    color: var(--text-label);
}

/* Screenshots */
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.screenshot-item {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.screenshot-link {
    display: block;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
}

.screenshot-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: var(--field);
}

.screenshot-upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.screenshot-upload-form .form-control {
    flex: 1 1 260px;
    width: auto;
}

/* Trade forms */
.trade-entry-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
    gap: 16px;
    margin-top: 16px;
}

.trade-form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.trade-form-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13px;
    color: var(--text-2);
}

.trade-form-note .ui-icon {
    color: var(--brand);
}

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

/* ---------- 7d. Analytics and goals ---------- */
.mini-stats.is-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-stats.is-row {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    align-self: stretch;
}

.mini-stats dd.is-text {
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
}

.mini-stats dd.is-positive {
    color: var(--win);
}

.mini-stats dd.is-negative {
    color: var(--loss);
}

.analytics-table th.is-num,
.analytics-table td.is-num {
    text-align: right;
}

.analytics-table td {
    white-space: nowrap;
}

.analytics-table td:first-child {
    white-space: normal;
    min-width: 140px;
}

.analytics-table strong {
    font-weight: 500;
}

.cell-note {
    display: block;
    font-size: 12px;
    color: var(--text-3);
}

.is-muted-row td {
    color: var(--text-2);
}

.analytics-muted-value {
    font-size: 12px;
    color: var(--text-3);
}

.ui-progress {
    height: 6px;
    margin-top: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    overflow: hidden;
}

.ui-progress > span {
    display: block;
    height: 100%;
    background: var(--brand);
}

.goals-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 8px 28px;
    margin-top: 14px;
}

.goals-list-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-label);
}

.goals-list-head small {
    font-weight: 400;
    color: var(--text-3);
}

.goals-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.goals-input-number {
    flex: none;
    width: 18px;
    font-size: 12px;
    color: var(--text-3);
    text-align: right;
}

.prompt-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-list li {
    padding: 10px 12px;
    border-left: 2px solid rgba(56, 189, 248, 0.5);
    background: rgba(56, 189, 248, 0.04);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-label);
}

.guidance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.guidance-card ul {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--text-label);
    font-size: 13px;
}

.guidance-card li + li {
    margin-top: 4px;
}

/* ---------- 7e. Import, feedback and account ---------- */
.narrow-page {
    max-width: 760px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.form-stack > .form-grid {
    margin-top: 0;
}

.form-grid.is-two {
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
}

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

.form-actions.is-start {
    justify-content: flex-start;
}

.stat-tile-value.is-text {
    font-family: var(--font-sans);
    font-size: 20px;
}

/* A list of rows with actions (broker connections, import runs) */
.row-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.row-list > li + li,
.row-list > .row-list-item + .row-list-item {
    border-top: 1px solid var(--line-soft);
}

.row-list-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 12px 0;
    color: var(--text);
}

.row-list-item.is-link:hover {
    color: var(--text);
    background: rgba(148, 163, 184, 0.04);
}

.row-list-main {
    flex: 1 1 220px;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.row-list-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.row-list-sub {
    margin: 2px 0 0;
    color: var(--text-2);
}

.row-list-meta {
    color: var(--text-3);
}

.row-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.row-list-actions form {
    margin: 0;
}

.broker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 14px;
}

.broker-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.broker-card .ui-card-sub {
    margin: 0;
}

.broker-card.is-featured {
    border-color: rgba(56, 189, 248, 0.35);
}

.broker-auth {
    margin: 0;
    font-size: 12px;
    color: var(--text-3);
}

.broker-card-actions {
    margin-top: auto;
    padding-top: 4px;
}

.broker-status-badge:is(.is-active, .is-connected, .is-ready, .is-completed, .is-previewed, .is-filled) {
    border-color: rgba(52, 211, 153, 0.4);
    color: #bdf5dd;
}

.broker-status-badge:is(.is-needs-credentials, .is-needs-mapping, .is-possible-manual-duplicate, .is-open-position-preview) {
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--warn-text);
}

.broker-status-badge:is(.is-error, .is-failed) {
    border-color: rgba(251, 113, 133, 0.45);
    color: var(--loss-text);
}

.broker-status-badge:is(.is-mock, .is-new) {
    border-color: rgba(56, 189, 248, 0.35);
    color: var(--brand-hover);
}

.broker-preview-table th.is-num,
.broker-preview-table td.is-num {
    text-align: right;
}

.broker-preview-table td {
    white-space: nowrap;
}

.broker-preview-table td.cell-wrap {
    white-space: normal;
    min-width: 220px;
}

.warning-list {
    margin: 0;
    padding-left: 16px;
    color: var(--warn-text);
    font-size: 13px;
}

/* ---------- 7f. Admin pages ---------- */
.admin-workspace {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.admin-workspace > * {
    min-width: 0;
}

.admin-command-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 20px;
}

.segmented > a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: 13px;
    white-space: nowrap;
}

.segmented > a:hover {
    color: var(--text);
}

.segmented > a.is-active {
    background: #14212c;
    color: var(--text);
    font-weight: 500;
}

.admin-tab-group {
    margin: 0;
    flex-wrap: wrap;
}

.admin-summary-grid,
.metric-grid,
.admin-user-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1px;
    margin-top: 16px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}

.admin-summary-card,
.metric-grid > .metric,
.admin-user-detail-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    background: var(--panel);
}

.admin-summary-card span,
.admin-user-detail-item span {
    font-size: 12px;
    color: var(--text-3);
}

.admin-summary-card strong {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 500;
}

.admin-user-detail-item strong {
    font-weight: 500;
    overflow-wrap: anywhere;
}

.admin-summary-card.is-caution strong,
.admin-summary-card.is-danger strong {
    color: var(--warn-text);
}

.admin-summary-card.is-active {
    background: #0c1820;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
}

.admin-toolbar-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 160px;
    min-width: 0;
}

.admin-toolbar-group .form-label {
    margin: 0;
}

.admin-toolbar-search,
.admin-toolbar-wide {
    flex: 2 1 260px;
}

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

.admin-search-control {
    position: relative;
}

.admin-search-control .bi {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-3);
    pointer-events: none;
}

.admin-search-control .form-control {
    padding-left: 34px;
}

.admin-filter-pills,
.feedback-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.feedback-count-pill.is-active {
    border-color: rgba(56, 189, 248, 0.5);
    background: var(--brand-soft);
    color: var(--text);
}

.admin-record-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-record-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
    gap: 18px 24px;
}

.admin-record-card.is-flagged {
    border-color: rgba(245, 158, 11, 0.45);
}

.admin-record-card.is-pending-delete {
    border-color: rgba(251, 113, 133, 0.4);
}

@media (max-width: 899.98px) {
    .admin-record-card {
        grid-template-columns: minmax(0, 1fr);
    }
}

.admin-record-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.admin-record-identity,
.admin-record-headline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px 14px;
}

.admin-record-identity {
    justify-content: flex-start;
}

.admin-avatar-soft {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #0f2a3a;
    color: var(--brand-hover);
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-record-title-group h3,
.feedback-item-subject {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.admin-record-title-group p,
.feedback-item-meta {
    margin: 0 0 6px;
    color: var(--text-3);
    overflow-wrap: anywhere;
}

.admin-record-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.admin-status-badge.is-caution,
.admin-status-badge.is-pending {
    border-color: rgba(245, 158, 11, 0.45);
    color: var(--warn-text);
}

.admin-status-badge.is-approved {
    border-color: rgba(52, 211, 153, 0.4);
    color: #bdf5dd;
}

.delivery-status.is-sent {
    border-color: rgba(52, 211, 153, 0.4);
    color: #bdf5dd;
}

.delivery-status.is-failed {
    border-color: rgba(251, 113, 133, 0.45);
    color: var(--loss-text);
}

.delivery-status.is-missing {
    color: var(--text-3);
}

.admin-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px 18px;
}

.admin-meta-grid > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-meta-grid span {
    font-size: 12px;
    color: var(--text-3);
}

.admin-meta-grid strong {
    font-weight: 500;
    font-family: var(--font-mono);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.admin-meta-grid em {
    font-style: normal;
    font-size: 12px;
    color: var(--warn-text);
}

.admin-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.admin-detail-block span,
.admin-review-notes span {
    font-size: 12px;
    color: var(--text-3);
}

.admin-detail-block p,
.admin-review-notes p,
.feedback-item-message {
    margin: 2px 0 0;
    color: var(--text-label);
    white-space: pre-wrap;
}

.admin-disclosure {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 10px 14px;
}

.admin-disclosure > summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-label);
}

.admin-disclosure[open] > summary {
    margin-bottom: 10px;
}

.admin-disclosure ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-label);
}

.admin-actions-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 24px;
    border-left: 1px solid var(--line-soft);
}

@media (max-width: 899.98px) {
    .admin-actions-panel {
        padding: 16px 0 0;
        border-left: 0;
        border-top: 1px solid var(--line-soft);
    }
}

.admin-actions-heading {
    display: flex;
    flex-direction: column;
}

.admin-actions-heading strong {
    font-weight: 500;
}

.admin-actions-heading span {
    font-size: 12px;
    color: var(--text-3);
}

.admin-decision-form,
.admin-feedback-form,
.admin-danger-action {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.admin-feedback-form {
    gap: 12px;
}

.admin-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.admin-action-row form,
.admin-action-full-form {
    margin: 0;
}

.admin-action-row .btn {
    width: 100%;
}

.admin-inline-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-action-inline-form {
    display: flex;
    gap: 8px;
    margin: 0;
}

.admin-danger-disclosure {
    border-color: rgba(251, 113, 133, 0.3);
}

.admin-danger-disclosure .admin-danger-action + .admin-danger-action {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line-soft);
}

.admin-danger-action-row {
    display: flex;
    gap: 8px;
}

.admin-delete-meta {
    font-size: 12px;
    color: var(--loss-text);
}

.admin-filter-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.admin-audit-table td {
    vertical-align: top;
}

.admin-audit-metadata {
    min-width: 220px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-2);
}

/* ---------- 7g. Setups and behaviour tags (Phase 2 stage 1) ---------- */
.setup-picker {
    margin-top: 14px;
}

.chip-toggle.is-add {
    border-style: dashed;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: var(--brand);
}

.chip-toggle.is-add.is-active {
    border-style: solid;
    border-color: rgba(56, 189, 248, 0.5);
    background: var(--brand-soft);
    color: var(--text);
}

.new-setup-field {
    margin-top: 12px;
    max-width: 420px;
}

.ticker-setup {
    color: var(--text-2);
}

.tag-chip.is-old,
.old-tags .ui-label {
    border-style: dashed;
    color: var(--text-3);
}

.old-tags {
    margin: 8px 0 0;
}

.setups-card {
    margin-top: 18px;
}

.setup-add-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    max-width: 520px;
}

.setup-add-form .form-control {
    flex: 1 1 220px;
    width: auto;
}

.setup-list .row-list-item {
    flex-wrap: wrap;
}

.setup-rename-form {
    display: flex;
    gap: 8px;
    flex: 1 1 260px;
    margin: 0;
}

.setup-rename-form .form-control {
    flex: 1 1 auto;
    width: auto;
    max-width: 320px;
}

.setup-list .row-list-item > form:not(.setup-rename-form) {
    margin: 0;
}

.setup-list .is-archived .setup-rename-form .form-control {
    color: var(--text-2);
}

/* ---------- 8. Helpers that carry behaviour ---------- */
.is-hidden,
.trade-row-details.is-hidden,
.goals-list.is-hidden,
[data-admin-filter-item].is-hidden,
.admin-filter-empty.is-hidden {
    display: none !important;
}

/* Spam trap: present for bots, never visible or reachable for people. */
.honeypot-field {
    position: absolute !important;
    left: -10000px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

.pnl-hidden {
    letter-spacing: 0;
    color: var(--text-3);
}

[hidden] {
    display: none !important;
}
