@import url("./o24-motion-config.css");

/* Source-owned appointments without an Account: Home and record calendars. */
.o24-meeting-orphan { background: color-mix(in srgb, var(--color-text-secondary, #596170) 12%, var(--color-surface, #ffffff)) !important; border-color: var(--color-border, #d5d9de) !important; color: var(--color-text-secondary, #596170) !important; }
.o24-meeting-orphan .o24-meeting-event, .o24-meeting-orphan .fc-event-main, .o24-meeting-orphan small { color: inherit !important; }

/* Buttons */
button {
    font-family: inherit;
}

/* Quiet content arrival.
 * The semantic content is present throughout; these opt-in classes only shape
 * its first visual paint. Flow: docs/agent/flows/features/idea-397-quiet-content-arrival.mmd
 */
.o24-arrival-table > tbody > tr > *,
.o24-arrival-list > *,
.o24-arrival-sequence > button {
    animation: o24-arrival-from-left calc(420ms * var(--o24-motion-scale, 1)) cubic-bezier(.22, 1, .36, 1) backwards;
    animation-delay: calc((var(--o24-widget-delay, 0ms) + var(--o24-arrival-delay, 0ms) * 6 + var(--o24-cell-delay, 0ms)) * var(--o24-motion-scale, 1));
}

.o24-arrival-widget {
    animation: o24-arrival-widget calc(200ms * var(--o24-motion-scale, 1)) cubic-bezier(.22, 1, .36, 1) backwards;
    animation-delay: calc(var(--o24-arrival-delay, 0ms) * var(--o24-motion-scale, 1));
}
.home-grid[data-arrival-ready="false"] > .o24-arrival-widget {
    visibility: hidden;
}
.home-grid[data-arrival-ready="false"] .o24-arrival-widget,
.home-grid[data-arrival-ready="false"] .o24-arrival-forecast,
.home-grid[data-arrival-ready="false"] .o24-arrival-table > tbody > tr > *,
.home-grid[data-arrival-ready="false"] .o24-arrival-list > * {
    animation: none;
}

.o24-arrival-sequence {
    /* Rising children must not create vertical scrolling; retain horizontal access. */
    overflow-y: hidden;
}
.o24-arrival-sequence > button {
    animation: o24-stage-rise calc(360ms * var(--o24-motion-scale, 1)) linear backwards;
    animation-delay: calc(180ms * var(--o24-stage-progress, 0) * var(--o24-motion-scale, 1));
}
.o24-arrival-sequence > .record-stage__highlight {
    animation: o24-stage-rise calc(360ms * var(--o24-motion-scale, 1)) linear backwards;
    animation-delay: calc(180ms * var(--o24-stage-progress, 0) * var(--o24-motion-scale, 1));
}
@keyframes o24-stage-rise {
    from { opacity: 0; filter: blur(6px); translate: 0 24px; }
    50% { opacity: .5; filter: blur(3px); translate: 0 12px; }
    to { opacity: 1; filter: blur(0); translate: 0 0; }
}
.o24-arrival-table > tbody > tr > :nth-child(2) { --o24-cell-delay: 35ms; }
.o24-arrival-table > tbody > tr > :nth-child(3) { --o24-cell-delay: 70ms; }
.o24-arrival-table > tbody > tr > :nth-child(4) { --o24-cell-delay: 105ms; }
.o24-arrival-table > tbody > tr > :nth-child(5) { --o24-cell-delay: 140ms; }
.o24-arrival-table > tbody > tr > :nth-child(6) { --o24-cell-delay: 175ms; }
.o24-arrival-table > tbody > tr > :nth-child(7) { --o24-cell-delay: 210ms; }
.o24-arrival-table > tbody > tr > :nth-child(8) { --o24-cell-delay: 245ms; }
/* ponytail: cap the column wave after eight cells; revisit for wider visible tables. */
.o24-arrival-table > tbody > tr > :nth-child(n+9) { --o24-cell-delay: 280ms; }
.o24-arrival-forecast {
    animation: o24-arrival-bar calc(800ms * var(--o24-motion-scale, 1)) cubic-bezier(.22, 1, .36, 1) backwards;
    animation-delay: calc((var(--o24-widget-delay, 0ms) + 200ms) * var(--o24-motion-scale, 1));
}
@keyframes o24-arrival-bar {
    from { clip-path: inset(0 100% 0 0); opacity: .25; }
    to { clip-path: inset(0); opacity: 1; }
}
@keyframes o24-arrival-from-left {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: none; }
}

/* Shared active dictation state: recording only, with a static reduced-motion cue. */
.icon-btn:is(.record-quick-create__microphone, .quick-create-microphone, .record-note-microphone)[aria-pressed="true"] {
    color: var(--color-danger);
    background: var(--color-surface);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-danger) 24%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
    .icon-btn:is(.record-quick-create__microphone, .quick-create-microphone, .record-note-microphone)[aria-pressed="true"] {
        animation: o24-dictation-capture 1.8s ease-in-out infinite;
    }
}
@keyframes o24-dictation-capture {
    0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-danger) 24%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--color-danger) 8%, transparent); }
}

@keyframes o24-arrival-widget {
    from { opacity: 0; filter: blur(2px); transform: translate(-14px, -10px) scale(.985); }
    to { opacity: 1; filter: none; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .o24-arrival-table > tbody > tr > *,
    .o24-arrival-list > *,
    .o24-arrival-sequence > button,
    .o24-arrival-widget,
    .o24-arrival-sequence > .record-stage__highlight,
    .o24-arrival-forecast {
        animation: none;
    }
}

/* Message-only validation feedback.
 * Rule identity remains available to diagnostic surfaces but is intentionally
 * absent here so record editors can focus on the corrective message.
 */
.validation-feedback-stack {
    display: grid;
    gap: 8px;
}

.validation-feedback {
    --validation-feedback-accent: var(--color-primary-green);
    margin: 0;
    padding: 12px 14px;
    border: 1px solid color-mix(in srgb, var(--validation-feedback-accent) 24%, var(--color-border));
    border-left: 4px solid var(--validation-feedback-accent);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--validation-feedback-accent) 6%, var(--color-surface));
    box-shadow: 0 1px 2px color-mix(in srgb, var(--validation-feedback-accent) 8%, transparent);
    color: var(--color-text-primary);
    font-size: .9rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: validation-feedback-in .18s ease-out both;
}

.validation-feedback__icon {
    display: grid;
    flex: 0 0 18px;
    place-items: center;
    margin-top: 2px;
    color: var(--validation-feedback-accent);
}

.validation-feedback__icon svg { width: 18px; height: 18px; }

.validation-feedback--warning {
    --validation-feedback-accent: #b56b00;
    background: color-mix(in srgb, var(--color-primary-yellow) 10%, var(--color-surface));
}

.validation-feedback--blocker {
    --validation-feedback-accent: var(--color-danger);
    background: color-mix(in srgb, var(--color-danger) 8%, var(--color-surface));
    font-weight: 650;
}

.validation-feedback--notification {
    --validation-feedback-accent: var(--color-primary-green);
}

.validation-save-notice {
    position: fixed;
    top: 76px;
    left: 50%;
    z-index: 1250;
    width: min(540px, calc(100vw - 32px));
    padding: 13px 16px;
    border: 1px solid color-mix(in srgb, var(--color-danger) 30%, var(--color-border));
    border-top: 4px solid var(--color-danger);
    border-radius: 12px;
    background: color-mix(in srgb, var(--color-danger) 6%, var(--color-surface));
    box-shadow: 0 18px 48px rgba(17, 42, 52, .2);
    color: var(--color-text-primary);
    font-size: .9rem;
    font-weight: 650;
    line-height: 1.45;
    transform: translateX(-50%);
    animation: validation-save-notice-life 5s ease both;
}

@keyframes validation-feedback-in {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes validation-save-notice-life {
    0% { opacity: 0; transform: translate(-50%, -8px); }
    5%, 88% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -6px); }
}

@media (prefers-reduced-motion: reduce) {
    .validation-feedback,
    .validation-save-notice {
        animation: none;
    }
}

/* Shared passive-file upload surface. */
.upload-dropzone {
    display: grid;
    place-items: center;
    gap: 5px;
    min-height: 132px;
    padding: 20px;
    border: 1px dashed color-mix(in srgb, var(--color-primary-green) 48%, var(--color-border));
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--color-primary-green) 4%, var(--color-surface));
    color: var(--color-text-primary);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus-visible,
.upload-dropzone.is-dragging {
    border-color: var(--color-primary-green);
    background: color-mix(in srgb, var(--color-primary-green) 9%, var(--color-surface));
    box-shadow: var(--shadow-sm);
    outline: none;
}

.upload-dropzone > span {
    color: var(--color-text-secondary);
    font-size: .78rem;
}

/* Shared edit-heavy admin drag and drop primitives.
 * Payload owners decide which zones accept each typed element; these classes own
 * the common drag-start highlight, precise hover target, and direct remove affordance.
 */
.admin-drop-zone {
    position: relative;
    transition: min-height .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease, color .14s ease;
}

.admin-drag-surface.is-dragging .admin-drop-zone.is-available {
    border-color: color-mix(in srgb, var(--color-primary-green) 72%, var(--color-border));
    background: color-mix(in srgb, var(--color-primary-green) 7%, var(--color-surface));
    color: var(--color-text-primary);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-primary-green) 22%, transparent);
}

.admin-drag-surface.is-dragging .admin-drop-zone.is-available.is-over {
    border-color: var(--color-primary-green);
    background: color-mix(in srgb, var(--color-primary-green) 13%, var(--color-surface));
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--color-primary-green) 36%, transparent), var(--shadow-sm);
}

.admin-drop-zone__label {
    display: grid;
    min-height: 42px;
    place-items: center;
    padding: 8px 12px;
    color: var(--color-text-secondary);
    font-size: .76rem;
    font-weight: 600;
    text-align: center;
}

.admin-draggable-item {
    position: relative;
}

.admin-remove-control {
    position: absolute;
    top: 6px;
    right: 6px;
    bottom: auto;
    z-index: 3;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--color-danger) 26%, var(--color-border));
    border-radius: 50%;
    background: color-mix(in srgb, var(--color-surface) 94%, var(--color-danger) 6%);
    box-shadow: var(--shadow-sm);
    color: var(--color-danger);
    cursor: pointer;
    line-height: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px) scale(.86);
    transition: opacity .12s ease, transform .12s ease, border-color .12s ease, background .12s ease, box-shadow .12s ease, color .12s ease;
}

.admin-remove-control svg {
    display: block;
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    pointer-events: none;
    stroke-linecap: round;
    stroke-width: 2.25;
}

.admin-draggable-item:hover > .admin-remove-control,
.admin-draggable-item:focus-within > .admin-remove-control,
.admin-remove-control:focus-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.admin-remove-control:hover,
.admin-remove-control:focus-visible {
    border-color: var(--color-danger);
    background: var(--color-danger);
    box-shadow: 0 3px 10px color-mix(in srgb, var(--color-danger) 25%, transparent);
    color: #fff;
}

.admin-remove-control:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-danger) 42%, transparent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .admin-drop-zone,
    .admin-remove-control {
        transition: none;
    }
}

/* Native CRM record-page primitives.
 * Flow: docs/agent/flows/features/idea-234-crm-object-record-layout-builder.mmd
 */
/* Personal record panes: flow idea-385-personal-record-tabs.mmd. */
.record-tab-workspace { position: relative; min-width: 0; }
.record-tab-workspace__bar { position: sticky; top: calc(var(--o24-nav-height, 48px) + var(--record-command-height, 64px)); z-index: 30; display: flex; align-items: stretch; gap: 12px; margin-top: 25px; background: var(--color-bg-cream); border-bottom: 1px solid var(--color-border); }
.record-tab-workspace__bar .record-tabs { position: relative; top: auto; flex: 1; min-width: 0; margin-top: 0; border-bottom: 0; box-shadow: none; }
.record-tab-arrange { gap: 6px; }
.record-tab-workspace__body { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; min-height: 300px; }
.record-tab-workspace__body.is-split { grid-template-columns: minmax(0, calc(var(--record-split, 50%) - 7px)) 14px minmax(0, 1fr); }
.record-tab-pane { grid-row: 1; min-width: 0; container-type: inline-size; }
.record-tab-pane--main { grid-column: 1; }
.record-tab-pane--dock { grid-column: 3; }
.record-tab-pane[hidden], .record-tab-pane__heading[hidden] { display: none; }
.record-tab-workspace__body.is-split > .record-tab-pane { max-height: calc(100dvh - 150px); overflow: auto; scrollbar-gutter: stable; }
.record-tab-pane__heading { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 8px 12px 14px; border-bottom: 1px solid var(--color-border); background: var(--color-bg-cream); }
.record-tab-pane__heading h2 { margin: 0; font-size: .9rem; color: var(--color-text-primary); }
.record-tab-pane--dock .record-tab-pane__content { padding-left: 14px; }
.record-tab-pane--dock .record-content__header { display: none; }
.record-tab-pane__content { min-width: 0; }
.record-tab-divider { grid-column: 2; grid-row: 1; align-self: stretch; min-height: 300px; background: linear-gradient(to right, transparent 6px, var(--color-border) 6px, var(--color-border) 7px, transparent 7px); cursor: col-resize; touch-action: none; }
.record-tab-divider:hover, .record-tab-divider:focus-visible { background: color-mix(in srgb, var(--color-primary-red) 15%, transparent); outline: 2px solid var(--color-primary-red); outline-offset: -3px; }
.record-tab-drop { position: absolute; top: 8px; right: 0; bottom: 0; z-index: 10; display: grid; place-items: center; width: 50%; min-height: 280px; border: 2px dashed var(--color-primary-red); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--color-surface) 92%, transparent); color: var(--color-text-primary); font-weight: 600; pointer-events: auto; }
.record-tab-drop.is-over { background: color-mix(in srgb, var(--color-primary-red) 12%, var(--color-surface)); border-style: solid; }
.record-tab-workspace [data-insert="before"] { box-shadow: inset 3px 0 var(--color-primary-red); }
.record-tab-workspace [data-insert="after"] { box-shadow: inset -3px 0 var(--color-primary-red); }
.record-tab-workspace__mobile { display: none; }
.record-tab-saving { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@container (max-width: 580px) {
    .record-tab-pane__content .record-section__fields .record-field { width: 100%; flex-basis: 100%; }
    .record-tab-pane__content .record-audit__filters { flex-wrap: wrap; }
    .record-tab-pane__content .record-content__compose { grid-template-columns: minmax(0, 1fr); }
    .record-tab-pane__content .record-email-toolbar form { flex-wrap: wrap; min-width: 0; }
}
@media (max-width: 900px) {
    .record-tab-workspace__mobile { display: flex; gap: 8px; padding-top: 12px; }
    .record-tab-workspace__mobile button { min-width: 0; white-space: normal; }
    .record-tab-workspace__mobile [aria-pressed="true"] { border-color: var(--color-primary-red); }
    .record-tab-workspace__body.is-split { grid-template-columns: minmax(0, 1fr); }
    .record-tab-workspace__body.is-split > .record-tab-pane { grid-column: 1; max-height: none; overflow: visible; }
    .record-tab-workspace__body.is-split .record-tab-pane--dock { display: none; }
    .record-tab-workspace__body.is-split.show-dock .record-tab-pane--main { display: none; }
    .record-tab-workspace__body.is-split.show-dock .record-tab-pane--dock { display: block; }
    .record-tab-divider, .record-tab-drop { display: none; }
    .record-tab-pane--dock .record-tab-pane__content { padding-left: 0; }
}
/* Object identity: decoration only, independent of status and action colors.
 * Flow: docs/agent/flows/features/idea-368-crm-object-colors.mmd
 */
.crm-object-accent {
    border-top: 3px solid var(--crm-object-color);
}

.crm-object-badge,
.crm-object-marker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 9px;
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--crm-object-color) 10%, var(--color-surface) 90%);
    color: var(--color-text-primary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    vertical-align: middle;
}

.crm-object-badge::before,
.crm-object-marker::before {
    content: "";
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--crm-object-color);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-text-primary) 15%, transparent);
}

.crm-object-marker { padding:6px 9px; color:var(--crm-object-strong, var(--crm-object-color, var(--color-text-secondary))); background:color-mix(in srgb, var(--crm-object-color, var(--color-text-secondary)) 10%, var(--color-surface) 90%); letter-spacing:.08em; }
.crm-object-marker::before { content:none; }

.record-stage {
    padding: 24px 0 18px;
    border-bottom: 1px solid var(--color-border);
}

.record-stage__primary {
    display: flex;
    align-items: stretch;
    gap: 3px;
    overflow-x: auto;
    padding: 10px 1px 5px;
    scrollbar-width: thin;
}

.record-stage__primary button {
    --record-stage-fill: color-mix(in srgb, var(--color-primary-blue) 8%, var(--color-surface) 92%);
    position: relative;
    flex: 1 0 150px;
    min-height: 48px;
    padding: 10px 26px 10px 31px;
    border: 0;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%, 16px 50%);
    background: var(--record-stage-fill);
    color: var(--color-text-secondary);
    font: inherit;
    text-align: center;
    cursor: pointer;
    transition: background .14s ease, color .14s ease, transform .14s ease;
}

.record-stage__primary button:first-child {
    padding-left: 18px;
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%);
}

.record-stage__primary button:is(:hover, :focus-visible):not(:disabled) {
    --record-stage-fill: var(--record-stage-option-fill, var(--crm-object-strong, var(--color-primary-red)));
    color: var(--record-stage-option-ink, var(--crm-object-on-strong, var(--color-text-inverse)));
}

.record-stage__primary button:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--color-primary-blue);
}

.record-stage__primary button:active:not(:disabled) {
    transform: translateY(1px);
}

.record-stage__primary button:disabled {
    cursor: not-allowed;
    opacity: .62;
}

.record-stage__primary button span {
    margin-right: 7px;
    color: currentColor;
    font-size: .7rem;
    font-variant-numeric: tabular-nums;
    opacity: .78;
}

.record-stage__primary button.is-current {
    --record-stage-fill: var(--color-primary-red);
    color: #fff;
    font-weight: 700;
}

.record-stage__primary button.is-draft {
    --record-stage-fill: color-mix(in srgb, var(--color-primary-red) 13%, var(--color-surface) 87%);
    color: var(--color-primary-red);
}

.record-stage__primary button.is-current.is-draft { color: #fff; }

.record-stage__primary button.is-current:hover:not(:disabled) {
    --record-stage-fill: color-mix(in srgb, var(--color-primary-red) 88%, #000 12%);
    color: #fff;
}

.record-stage__primary button.is-draft:hover:not(:disabled) {
    --record-stage-fill: color-mix(in srgb, var(--color-primary-red) 18%, var(--color-surface) 82%);
    color: var(--color-primary-red);
}

.record-stage__primary button.is-current.is-draft:hover:not(:disabled) { color: #fff; }

.record-stage__primary button.is-draft::after {
    content: "Draft";
    position: absolute;
    top: -7px;
    right: 14px;
    z-index: 3;
    padding: 2px 5px;
    border: 1px solid color-mix(in srgb, var(--crm-object-strong, var(--color-primary-red)) 32%, #fff);
    border-radius: 3px;
    background: #fff;
    color: color-mix(in srgb, var(--crm-object-strong, var(--color-primary-red)) 68%, #111827);
    font-size: .64rem;
    font-weight: 700;
    line-height: 1;
    text-transform: none;
    transform: rotate(20deg);
    transform-origin: center;
    box-shadow: 0 1px 4px rgb(15 23 42 / 14%);
}

/* The selected value color, or object fallback, moves beneath the stage labels. */
.record-stage__primary--glide { position: relative; isolation: isolate; }
:root .record-stage__primary--glide button { clip-path: none; background: transparent; transform: none; }
.record-stage__primary--glide button::before {
    content: ""; position: absolute; inset: 0; z-index: -2;
    background: var(--record-stage-fill);
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%, 16px 50%);
    transition: background 180ms ease;
}
.record-stage__primary--glide button:first-child::before { clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%); }
:root .crm-object-theme .record-stage__primary.record-stage__primary--glide button.is-current,
:root .crm-object-theme .record-stage__primary.record-stage__primary--glide button.is-current:hover:not(:disabled) { background: transparent; }
.record-stage__primary--glide[data-motion-ready="true"] button.is-current::before { background: transparent; }
.record-stage__primary--glide button span.record-stage__label { font: inherit; margin: 0; opacity: 1; }
.record-stage__highlight {
    position: absolute; top: 0; left: 0; z-index: -1; pointer-events: none;
    background: var(--record-stage-current-fill, var(--crm-object-strong, var(--color-primary-red)));
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%, 16px 50%);
    transition: transform 420ms cubic-bezier(.22, 1, .36, 1), width 420ms cubic-bezier(.22, 1, .36, 1), height 180ms ease, clip-path 420ms ease;
    overflow: hidden;
}
.record-stage__highlight[data-first="true"] { clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 0 100%, 0 50%); }
.record-stage__shine { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgb(255 255 255 / 28%) 48%, transparent 66%); animation: record-stage-arrive 560ms ease-out both; }
@keyframes record-stage-arrive { from { transform: translateX(-110%); opacity: 0; } 30% { opacity: 1; } to { transform: translateX(110%); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .record-stage__highlight, .record-stage__primary--glide button::before { transition: none; }
    .record-stage__shine { animation: none; display: none; }
}
@media (forced-colors: active) {
    .record-stage__highlight { display: none; }
    .record-stage__primary--glide button::before { border: 1px solid ButtonText; }
}

.record-stage__secondary {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.record-stage__secondary button {
    padding: 5px 9px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: .72rem;
    cursor: pointer;
}

.record-stage__secondary button.is-current {
    border-color: var(--color-primary-red);
    color: var(--color-primary-red);
}

.record-stage__secondary button:is(:hover, :focus-visible):not(:disabled) {
    background: var(--record-stage-option-fill, var(--crm-object-strong, var(--color-primary-red)));
    border-color: var(--record-stage-option-fill, var(--crm-object-strong, var(--color-primary-red)));
    color: var(--record-stage-option-ink, var(--crm-object-on-strong, var(--color-text-inverse)));
}

.record-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 38px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}

.record-metric {
    min-width: 130px;
}

.record-metric > span,
.record-metric > strong,
.record-metric > small {
    display: block;
}

.record-metric > span {
    color: var(--color-text-secondary);
    font-size: .74rem;
    font-weight: 600;
}

.record-metric > strong {
    display: flex;
    align-items: center;
    min-height: 3rem;
    margin-top: 0;
    font-size: 1.7rem;
    font-weight: 600;
    letter-spacing: -.025em;
}

.record-metric--small > strong { font-size: 1.1rem; font-weight: 400; }
.record-metric--standard > strong { font-size: 1.5rem; font-weight: 400; }
.record-metric--medium > strong { font-size: 1.7rem; font-weight: 600; }
.record-metric--large > strong { font-size: 2.1rem; font-weight: 600; }
.record-metric--xl > strong { font-size: 2.5rem; font-weight: 700; }
.record-metric--accent > strong { color: var(--color-primary-red); }
.record-metric--positive > strong { color: var(--color-primary-green); }
.record-metric--warning > strong { color: var(--color-primary-yellow); }
.record-metric--critical > strong { color: var(--color-danger); }

.record-metric > small {
    max-width: 260px;
    margin-top: 4px;
    color: var(--color-text-secondary);
    font-size: .68rem;
}

/* Brand names keep their canonical casing inside uppercase utility labels. */
.o24-brand-name {
    text-transform: none;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
    min-height: 32px;
    white-space: nowrap;
}

.btn-primary {
    border: none;
    background: var(--color-primary-red);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s;
    gap: 8px;
    text-decoration: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    border: 1px solid var(--color-primary-red);
    background: var(--color-surface);
    color: var(--color-primary-red);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.1s;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-cream);
}

tr:hover td {
    background: var(--color-surface-active);
    color: var(--color-text-primary);
}

.btn-secondary:disabled {
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
    filter: grayscale(1);
    box-shadow: inset 4px 0 0 rgba(245, 67, 47, 0.35);
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-text-primary);
}

.icon-btn.danger:hover {
    background: rgba(217, 48, 37, 0.1);
    color: var(--color-danger);
}

.icon-btn.transcript-jump-btn {
    color: var(--color-primary-red);
}

.icon-btn.transcript-jump-btn:disabled {
    color: var(--color-text-secondary);
}

/* Forms (Inputs, Selects, Textareas) */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text-body);
}

.form-input,
.form-select,
.form-textarea,
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--color-surface-input);
    color: var(--color-text-primary);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary-green);
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder,
input[type="text"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
textarea::placeholder,
.select-search-input::placeholder,
.chip-input::placeholder,
.search-input::placeholder {
    color: var(--color-text-placeholder);
    opacity: 1;
}

/* Checkboxes */
input[type="checkbox"] {
    accent-color: var(--color-primary-green);
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

/* Shared CRM multiple choice */
.crm-multi-choice-control, .record-multi-choice { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.crm-multi-choice-control label, .record-multi-choice label { display: flex; align-items: center; gap: 7px; }

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-switch input {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.toggle-track {
    flex-shrink: 0;
    width: 40px;
    height: 22px;
    background: #ccc;
    border-radius: 999px;
    position: relative;
    transition: background 0.2s;
}

.toggle-track::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked+.toggle-track {
    background: var(--color-primary-green);
}

.toggle-switch input:checked+.toggle-track::after {
    transform: translateX(18px);
}

.toggle-switch input:focus-visible + .toggle-track {
    outline: 2px solid var(--color-focus-ring, var(--color-primary-blue));
    outline-offset: 2px;
}

.toggle-switch input:disabled + .toggle-track {
    cursor: wait;
    opacity: .55;
}

/* Custom Select Styling Override */
select,
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-body) 50%),
        linear-gradient(135deg, var(--color-text-body) 50%, transparent 50%),
        linear-gradient(to right, #d0d7de, #d0d7de);
    background-position: calc(100% - 22px) 50%, calc(100% - 14px) 50%, calc(100% - 2.8em) 50%;
    background-size: 7px 7px, 7px 7px, 1px 40%;
    background-repeat: no-repeat;
    cursor: pointer;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    overflow: auto;
    border-color: var(--color-border);
    padding-bottom: 14px;
    background-image: linear-gradient(-45deg,
            transparent 0 53%,
            var(--color-border-light) 53% 59%,
            transparent 59% 69%,
            var(--color-border) 69% 75%,
            transparent 75%);
    background-size: 14px 14px;
    background-repeat: no-repeat;
    background-position: right 6px bottom 6px;
}

.crm-choice-picker { width: 100%; min-width: 0; }
.crm-choice-picker__trigger { display: block; min-width: 0; height: 40px; overflow: hidden; font: inherit; font-size: .95rem; font-weight: 400; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.crm-choice-picker__trigger:disabled { opacity: .55; cursor: default; }
.crm-choice-picker__menu { position: fixed; inset: auto; margin: 0; z-index: 1600; box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; padding: 5px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); box-shadow: var(--shadow-lg); }
.crm-choice-picker__option { display: block; width: 100%; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 5px; background: transparent; color: var(--color-text-primary); font: inherit; font-size: .9rem; text-align: left; white-space: normal; overflow-wrap: anywhere; cursor: pointer; }
.crm-choice-picker__option:hover:not(:disabled), .crm-choice-picker__option:focus-visible { background: var(--color-surface-alt); }
.crm-choice-picker__option[aria-selected="true"] { color: var(--color-primary-blue); font-weight: 600; }
.crm-choice-picker__option:disabled { color: var(--color-text-secondary); cursor: default; }
.crm-choice-picker__option:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: -2px; }
.crm-date-picker { position: relative; width: 100%; min-width: 0; }
.crm-date-picker > input { width: 100%; padding-right: 42px; }
.crm-date-picker > input::-webkit-calendar-picker-indicator { display: none; }
.crm-date-picker__trigger { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 38px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); color: var(--color-text-secondary); background: transparent; cursor: pointer; }
.crm-date-picker__trigger:disabled { opacity: .5; cursor: default; }
.crm-date-picker__calendar { position: fixed; inset: auto; margin: 0; box-sizing: border-box; padding: 12px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); color: var(--color-text-primary); box-shadow: var(--shadow-lg); font: inherit; }
.crm-date-picker__heading { display: grid; grid-template-columns: 28px minmax(0, 1fr) 72px 28px; gap: 4px; align-items: center; }
.crm-date-picker__heading .form-input, .crm-date-picker__heading .form-select { min-width: 0; width: 100%; height: 34px; padding: 4px; font-size: .85rem; }
.crm-date-picker__calendar table { width: 100%; margin: 10px 0; border-collapse: collapse; table-layout: fixed; }
.crm-date-picker__calendar th { color: var(--color-text-secondary); font-size: .75rem; font-weight: 500; padding: 4px 0; text-align: center; }
.crm-date-picker__calendar td { padding: 1px; text-align: center; border: 0; }
.crm-date-picker__calendar td button, .crm-date-picker__heading > button { width: 100%; min-height: 32px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.crm-date-picker__calendar button:hover:not(:disabled) { background: var(--color-surface-alt); }
.crm-date-picker__calendar button:focus-visible, .crm-date-picker__trigger:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: -2px; }
.crm-date-picker__calendar .is-adjacent { color: var(--color-text-secondary); }
.crm-date-picker__calendar [aria-current="date"] { text-decoration: underline; text-underline-offset: 4px; font-weight: 600; }
.crm-date-picker__calendar [aria-selected="true"] button { background: var(--color-primary-blue); color: #fff; }
.crm-date-picker__calendar button:disabled { opacity: .35; cursor: default; }
.crm-date-picker__footer { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid var(--color-border); padding-top: 10px; }
.crm-date-picker__announcement { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* === AI Improve Field === */
.ai-improve-field {
    position: relative;
}

.ai-improve-field__control--with-action {
    position: relative;
}

/* Scanning beam overlay — sits above the control, lets clicks through */
.ai-improve-field__overlay {
    position: absolute;
    inset: 1px;
    border-radius: 5px;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ai-improve-field.is-improving .ai-improve-field__overlay {
    opacity: 1;
}

/* Wide soft glow body */
.ai-improve-field__overlay::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 52px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        rgba(139, 92, 246, 0.10) 30%,
        rgba(167, 139, 250, 0.22) 50%,
        rgba(139, 92, 246, 0.10) 70%,
        transparent 100%
    );
    animation: ai-improve-scan 1.7s ease-in-out infinite;
}

/* Thin bright scan line */
.ai-improve-field__overlay::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1.5px;
    background: linear-gradient(90deg, transparent 0%, rgba(192, 132, 252, 0.8) 20%, rgba(216, 180, 254, 1) 50%, rgba(192, 132, 252, 0.8) 80%, transparent 100%);
    box-shadow: 0 0 8px rgba(192, 132, 252, 0.55);
    animation: ai-improve-scan 1.7s ease-in-out infinite;
}

@keyframes ai-improve-scan {
    0% { top: -60px; }
    100% { top: calc(100% + 60px); }
}

/* Border glow during improvement */
.ai-improve-field.is-improving .ai-improve-field__control {
    border-color: rgba(139, 92, 246, 0.35);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.08);
    color: rgba(15, 23, 42, 0.55);
}

/* Button container — bottom-right of the field */
.ai-improve-field__actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    z-index: 2;
}

/* Pill button — hidden by default, revealed on hover/focus */
.ai-improve-field__action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 10px 0 7px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    background: rgba(255, 255, 255, 0.95);
    color: #6d28d9;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.015em;
    box-shadow: 0 1px 5px rgba(109, 40, 217, 0.1);
    cursor: pointer;
    opacity: 0;
    transform: translateY(3px);
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.ai-improve-field:hover .ai-improve-field__action:not(:disabled):not(.is-busy),
.ai-improve-field:focus-within .ai-improve-field__action:not(:disabled):not(.is-busy) {
    opacity: 1;
    transform: translateY(0);
}

.ai-improve-field__action:hover:not(:disabled):not(.is-busy) {
    background: rgba(237, 233, 254, 0.97);
    border-color: rgba(109, 40, 217, 0.4);
    box-shadow: 0 2px 10px rgba(109, 40, 217, 0.18);
}

/* Busy state: animated purple gradient */
.ai-improve-field__action.is-busy {
    opacity: 1 !important;
    transform: translateY(0) !important;
    border-color: transparent;
    background: linear-gradient(270deg, #6d28d9, #9333ea, #7c3aed, #a855f7, #6d28d9);
    background-size: 300% 100%;
    color: #fff;
    box-shadow: 0 2px 12px rgba(109, 40, 217, 0.3);
    cursor: default;
    animation: ai-improve-gradient-slide 2.4s linear infinite;
}

.ai-improve-field__action:disabled {
    cursor: default;
}

/* Sparkle pop on hover */
.ai-improve-field__action:hover:not(.is-busy) svg {
    animation: ai-improve-sparkle-pop 0.38s ease-out forwards;
}

/* Sparkle orbit while busy */
.ai-improve-field__action.is-busy svg {
    animation: ai-improve-sparkle-orbit 1.5s ease-in-out infinite;
}

@keyframes ai-improve-sparkle-orbit {
    0%,
    100% { transform: scale(1) rotate(0deg); }
    33% { transform: scale(1.25) rotate(14deg); }
    66% { transform: scale(1.25) rotate(-14deg); }
}

@keyframes ai-improve-sparkle-pop {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.35) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

@keyframes ai-improve-gradient-slide {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

.ai-improve-field__error {
    margin-top: 6px;
    color: var(--color-danger);
    font-size: 0.85rem;
}

/* Custom Select & Multi-Pick */
.custom-select {
    position: relative;
    width: 100%;
}

.select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: var(--color-surface-input);
    color: var(--color-text-primary);
    cursor: pointer;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.select-trigger.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.select-trigger:focus,
.select-trigger.open {
    outline: none;
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    margin-top: 4px;
    background: var(--color-surface-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    z-index: 50;
    /* Expand to fit the longest option when space allows (prevents cut-off labels). */
    min-width: 100%;
    width: max-content;
    max-width: calc(100vw - 24px);
    max-height: 200px;
    overflow-y: auto;
    overflow-x: auto;
    display: none;
}

.select-dropdown.open {
    display: block;
}

.select-search {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--color-surface-panel);
    border-bottom: 1px solid var(--color-border);
    padding: 8px 12px;
}

.select-search-input {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.95rem;
    background: var(--color-surface-input);
    color: var(--color-text-primary);
}

.select-search-input:focus {
    outline: none;
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

.select-option {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--color-text-primary);
    transition: background 0.1s;
}

.select-option:hover {
    background: var(--color-surface-alt);
}

.select-option.selected {
    background: var(--color-surface-active);
    color: var(--color-text-primary);
    font-weight: 700;
    box-shadow: inset 3px 0 0 var(--color-primary-green);
}

.select-empty,
.select-overflow-hint {
    padding: 8px 12px;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
}

.select-overflow-hint {
    border-top: 1px dashed var(--color-border);
}

/* Input Wrapper (Search, Chip Inputs) */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface-input);
    padding: 4px 12px;
    transition: box-shadow 0.2s;
    gap: 8px;
}

.input-wrapper:focus-within {
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
}

:root[data-ui-style="quiet"] .input-wrapper .chip-input:focus-visible {
    outline: none;
    outline-offset: 0;
}

.input-wrapper.multiline {
    align-items: flex-end;
}

.chip-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 120px;
    padding: 4px;
    font-family: inherit;
    font-size: 0.95rem;
    background: transparent;
    color: var(--color-text-primary);
    box-shadow: none !important;
    /* override default input focus */
}

textarea.chip-input.chip-textarea {
    resize: none;
    overflow-y: hidden;
    min-height: 34px;
    max-height: 180px;
    padding: 6px 4px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

textarea.chip-input.chip-textarea.form-input,
textarea.chip-input.chip-textarea.form-textarea {
    width: 100%;
    flex: initial;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-input);
    resize: vertical;
    overflow-y: auto;
    min-height: 120px;
    max-height: none;
    padding: 8px 12px 14px;
    background-image: linear-gradient(-45deg,
            transparent 0 53%,
            var(--color-border-light) 53% 59%,
            transparent 59% 69%,
            var(--color-border) 69% 75%,
            transparent 75%);
    background-size: 14px 14px;
    background-repeat: no-repeat;
    background-position: right 6px bottom 6px;
}

textarea.chip-input.chip-textarea.form-input:focus,
textarea.chip-input.chip-textarea.form-textarea:focus {
    border-color: var(--color-primary-green);
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1) !important;
}

.search-wrapper {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
}

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 4px;
    margin-bottom: 2px;
}

.chip.tool,
.function-chip {
    background: var(--color-surface-active);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.function-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 4px;
}

.chip.kb {
    background: #fff4e0;
    color: #d68b00;
}

.chip.more {
    background: #eee;
    color: #666;
}

/* Authorization chips: compact, color-coded grants and visibility tags. */
.authorization-chip {
    --chip-color: var(--color-primary-blue);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid color-mix(in srgb, var(--chip-color) 25%, var(--color-border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--chip-color) 9%, var(--color-surface));
    color: var(--color-text-primary);
    font-size: 0.78rem;
    font-weight: 600;
}

.authorization-chip--blue { --chip-color: #2563eb; }
.authorization-chip--cyan { --chip-color: #0891b2; }
.authorization-chip--green { --chip-color: #16a34a; }
.authorization-chip--amber { --chip-color: #d97706; }
.authorization-chip--red { --chip-color: #dc2626; }
.authorization-chip--violet { --chip-color: #7c3aed; }
.authorization-chip--slate { --chip-color: #64748b; }

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.status-badge.published {
    background: #e6f4ea;
    color: #137333;
}

.status-badge.draft {
    background: #f1f3f4;
    color: #5f6368;
}

.status-badge.deprecated {
    background: #fce8e6;
    color: #c5221f;
}

.status-badge.sync-completed {
    background: #e6f4ea;
    color: #0c5c20;
}

.status-badge.sync-in_progress {
    background: #fff4e0;
    color: #b15e0f;
}

.status-badge.sync-failed {
    background: #fbe4e2;
    color: #c5221f;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}

.status-dot.active {
    background: var(--color-primary-green);
    box-shadow: 0 0 0 4px rgba(13, 102, 107, 0.15);
}

/* Chat UI */
.chat-wrapper {
    display: flex;
    flex: 0 1 auto;
    width: var(--chat-width, 800px);
    max-width: 100%;
    min-width: 480px;
    height: 100%;
    margin: 0 auto;
    position: relative;
    transition: width 0.1s;
    gap: 8px;
    min-height: 0;
}

.chat-shell {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100%;
    max-height: 100%;
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.chat-header {
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-surface-alt);
    font-weight: 600;
}

.chat-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-height: 0;
    color: var(--color-text-primary);
}

.chat-footer {
    padding: 16px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.attachment-preview,
.message-attachment {
    display: flex;
    gap: 12px;
    align-items: center;
}

.attachment-preview {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-input);
    margin-bottom: 10px;
}

.message-attachment {
    align-items: flex-start;
    margin-bottom: 8px;
}

.attachment-thumb {
    width: 72px;
    height: 72px;
    border: 1px dashed var(--color-border-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    overflow: hidden;
    flex-shrink: 0;
}

.message-attachment .attachment-thumb {
    width: 140px;
    height: 96px;
}

.attachment-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.attachment-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.attachment-name {
    font-weight: 700;
    color: var(--color-text-primary);
}

.attachment-meta {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

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

.attachment-link {
    color: var(--color-primary-blue);
    font-weight: 600;
    text-decoration: none;
}

.attachment-link:hover {
    text-decoration: underline;
}

.message {
    max-width: 85%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.message.user {
    align-self: flex-end;
    background-color: var(--color-user-bubble-bg);
    color: var(--color-text-inverse);
    border-bottom-right-radius: 4px;
}

.message.user * {
    color: var(--color-text-inverse) !important;
}

.message.bot {
    align-self: flex-start;
    background-color: var(--color-bot-bubble-bg);
    color: var(--color-text-primary);
    border-bottom-left-radius: 4px;
}

.message.source-summary {
    max-width: min(760px, 92%);
    padding: 12px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.source-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.source-summary-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.source-summary-count {
    min-width: 24px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    background: color-mix(in srgb, var(--color-primary-blue) 11%, var(--color-surface) 89%);
    color: var(--color-text-secondary);
}

/* Inline evidence previews, shared by desktop and mobile chat. */
.kb-citation { position: relative; display: inline; }
.kb-citation-link { color: var(--color-text-link); font-size: 0.85em; cursor: pointer; }
.kb-citation-preview {
    display: none;
    position: fixed;
    z-index: 80;
    max-height: min(400px, 60vh);
    overflow-y: auto;
    width: min(320px, 75vw);
    padding: 12px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text-primary);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    font-size: 0.85rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: normal;
    text-align: left;
}
.kb-citation-preview > * { display: block; margin: 0 0 6px; }
.kb-citation:hover .kb-citation-preview,
.kb-citation:focus-within .kb-citation-preview { display: block; }
.kb-citation-link:focus-visible { outline: 2px solid var(--color-primary-green); outline-offset: 3px; }

.source-summary-list {
    display: grid;
    gap: 8px;
}

.source-summary-item {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-surface) 92%, var(--color-primary-green) 8%);
}

.source-summary-rank {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: #0d5558;
    background: color-mix(in srgb, var(--color-primary-green) 16%, var(--color-surface) 84%);
}

.source-summary-body {
    min-width: 0;
}

.source-summary-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.source-summary-link {
    display: inline-block;
    min-width: 0;
    max-width: 100%;
    flex: 0 1 auto;
    color: var(--color-text-link);
    font-weight: 400;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.source-summary-link:hover {
    text-decoration: underline;
}

.source-summary-link-muted {
    color: var(--color-text-primary);
}

.source-summary-quality {
    flex: 0 0 auto;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
}

.source-summary-extract-btn {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    min-width: 26px;
    color: var(--color-text-secondary);
}

.source-summary-extract-btn[aria-expanded="true"] {
    color: var(--color-text-link);
    background: color-mix(in srgb, var(--color-text-link) 10%, var(--color-surface) 90%);
}

.source-summary-meta {
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
}

.source-summary-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border-light);
    line-height: 1.4;
}

.source-summary-excerpt {
    margin: 6px 0 0;
    padding: 6px 8px;
    border-left: 3px solid color-mix(in srgb, var(--color-primary-green) 38%, var(--color-border) 62%);
    border-radius: 0 6px 6px 0;
    background: color-mix(in srgb, var(--color-surface) 86%, var(--color-primary-blue) 14%);
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
}

.source-summary-actions {
    opacity: 0;
}

.message.support {
    align-self: flex-start;
    background: color-mix(in srgb, #6d28d9 9%, var(--color-surface) 91%);
    color: var(--color-text-primary);
    border: 1px solid rgba(109, 40, 217, 0.24);
    border-bottom-left-radius: 4px;
    box-shadow: 0 6px 18px rgba(109, 40, 217, 0.10);
}

.message.support .message-author {
    color: #6d28d9;
}

.message.support.support-admin {
    background: color-mix(in srgb, #4c1d95 17%, var(--color-surface) 83%);
    border-color: rgba(76, 29, 149, 0.36);
    box-shadow: 0 7px 20px rgba(76, 29, 149, 0.15);
}

.message.support.support-admin .message-author {
    color: #4c1d95;
}

.message-author {
    margin-bottom: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
}

.message.tool {
    align-self: center;
    background-color: #e7f2f5;
    color: #0d666b;
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #b5dfe2;
    width: auto;
    max-width: 90%;
}

.message.tool-progress {
    align-self: center;
    max-width: min(720px, 92%);
    padding: 7px 11px;
    border-radius: 8px;
    box-shadow: none;
    font-size: 0.82rem;
    line-height: 1.35;
    overflow: visible;
    transform-origin: center center;
    transition:
        transform 0.14s cubic-bezier(0.2, 0, 0.2, 1),
        opacity 0.1s ease;
    will-change: transform, opacity;
}

.message.tool-progress-collapsing,
.message.tool-progress-expanding {
    overflow: hidden;
}

.message.tool-progress-collapsing {
    opacity: 0.72;
    transform: scaleX(0.06);
}

.message.tool-progress-expanding {
    opacity: 1;
    transform: scaleX(1);
}

.message.tool-progress .tool-progress-content {
    transition: opacity 0.08s ease;
}

.message.tool-progress .tool-progress-content p {
    margin: 0;
}

.message.tool-progress-collapsing .tool-progress-content {
    opacity: 0;
}

.message.tool-progress-expanding .tool-progress-content {
    animation: tool-progress-content-in 0.14s ease-out both;
}

@keyframes tool-progress-content-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.message.tool-progress-transient {
    background: color-mix(in srgb, var(--color-surface) 90%, var(--color-primary-blue) 10%);
    border-color: color-mix(in srgb, var(--color-border) 72%, var(--color-primary-blue) 28%);
    color: var(--color-text-secondary);
}

.message.tool-progress-milestone {
    background: color-mix(in srgb, var(--color-surface) 88%, var(--color-primary-green) 12%);
    border-color: color-mix(in srgb, var(--color-border) 68%, var(--color-primary-green) 32%);
    color: #0d5558;
}

.message.tool-progress-decision {
    background: color-mix(in srgb, var(--color-surface) 88%, #c97a00 12%);
    border-color: color-mix(in srgb, var(--color-border) 62%, #c97a00 38%);
    color: #704a00;
}

.message.tool-progress-diagnostic {
    background: #f4f7fa;
    border-color: #d6dde6;
    color: #274055;
    font-family: Consolas, "Courier New", monospace;
}

@media (prefers-reduced-motion: reduce) {
    .message.tool-progress,
    .message.tool-progress .tool-progress-content {
        animation: none;
        opacity: 1;
        transform: none;
        transition: none;
    }
}

.message-feedback-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-surface-pilled);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.message-feedback-badge svg {
    width: 16px;
    height: 16px;
}

.message-feedback-badge.thumbs_up {
    color: var(--color-primary-green);
}

.message-feedback-badge.thumbs_down {
    color: var(--color-primary-red);
}

.message-actions {
    position: absolute;
    bottom: -16px;
    right: 0;
    background: var(--color-surface-pilled);
    border-radius: 20px;
    padding: 2px;
    box-shadow: var(--shadow-sm);
    display: flex;
    opacity: 0;
    transition: opacity 0.2s;
    border: 1px solid var(--color-border);
}

.message-actions .icon-btn.active.thumbs-up {
    color: var(--color-primary-green);
}

.message-actions .icon-btn.active.thumbs-down {
    color: var(--color-primary-red);
}

.message:hover .message-actions {
    opacity: 1;
}

.chat-pending-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* The assistant owns one execution disclosure; the answer remains primary. */
.chat-execution {
    max-width: 34rem;
    margin: 0 0 0.75rem;
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
}

.chat-execution summary {
    cursor: pointer;
    width: fit-content;
    padding: 0.25rem 0;
}

.chat-execution summary:focus-visible {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 3px;
}

.chat-execution ol {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
}

.chat-execution li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0;
}

.chat-execution li[data-state="running"] {
    color: var(--color-text-primary);
}

.chat-execution__state {
    flex-shrink: 0;
}

.typing-indicator span {
    display: inline-block;
    width: 5px;
    height: 5px;
    background: #aaa;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

.btn-primary .typing-indicator span,
.btn-secondary .typing-indicator span {
    background: currentColor;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .typing-indicator span {
        animation: none;
        transform: none;
    }
}

/* Saving feedback */
.o24-record-save__image { display: inline-flex; flex: 0 0 18px; width: 18px; height: 18px; vertical-align: middle; }
.o24-record-save__image img { display: block; width: 18px; height: 18px; }
.o24-saving-indicator { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 12px; }
.o24-saving-indicator > img { display: block; width: 144px; height: 144px; }
.o24-saving-indicator__label { display: flex; align-items: baseline; gap: 2px; font-size: 1rem; font-weight: 500; }
.o24-saving-indicator .typing-indicator { display: inline-flex; gap: 3px; }
.o24-saving-indicator .typing-indicator span { width: 3px; height: 3px; margin: 0; background: currentColor; }

/* Chat Overlays */
.chat-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: var(--color-text-primary);
}

:root[data-theme="dark"] .chat-overlay {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
}

.chat-overlay.unauth {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75), rgba(255, 243, 236, 0.9));
    backdrop-filter: blur(8px) saturate(115%);
    border: 1px solid rgba(217, 48, 37, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

:root[data-theme="dark"] .chat-overlay.unauth {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.9), rgba(28, 28, 28, 0.92));
    border: 1px solid rgba(110, 204, 223, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.chat-overlay .chat-overlay-card {
    background: var(--color-surface);
    border-radius: 18px;
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 260px;
    max-width: 340px;
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

:root[data-theme="dark"] .chat-overlay .chat-overlay-card {
    background: var(--color-surface-panel);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.chat-overlay .chat-overlay-headline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-overlay .chat-overlay-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(217, 48, 37, 0.1);
    color: var(--color-primary-red);
}

:root[data-theme="dark"] .chat-overlay .chat-overlay-icon {
    background: rgba(245, 67, 47, 0.16);
}

.chat-overlay .chat-overlay-title {
    font-weight: 700;
    color: var(--color-text-primary);
}

.chat-overlay .chat-overlay-subtitle {
    font-size: 0.95rem;
    color: var(--color-text-secondary);
}

.chat-overlay .chat-overlay-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.chat-overlay .chat-overlay-actions .btn-secondary {
    padding: 6px 12px;
}

.chat-blur-target {
    filter: blur(3px);
    pointer-events: none;
    user-select: none;
}

.drag-overlay {
    position: absolute;
    inset: 0;
    background: rgba(13, 102, 107, 0.1);
    border: 2px dashed var(--color-primary-green);
    border-radius: var(--radius-lg);
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-green);
}

.drag-overlay.active {
    opacity: 1;
    background: radial-gradient(circle at 50% 30%, rgba(13, 102, 107, 0.15), rgba(13, 102, 107, 0.05));
    box-shadow: 0 12px 32px rgba(13, 102, 107, 0.12);
}

.drag-overlay .drag-overlay-card {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 18px;
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(13, 102, 107, 0.15);
}

.drag-overlay .drag-overlay-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 102, 107, 0.1);
    color: var(--color-primary-green);
}

.drag-overlay .drag-overlay-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

.drag-overlay .drag-overlay-text .title {
    font-weight: 700;
    color: var(--color-text-primary);
}

.drag-overlay .drag-overlay-text .subtitle {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
}

/* Slash Menu */
.slash-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 240px;
    overflow-y: auto;
    margin-bottom: 8px;
    z-index: 20;
}

.slash-item {
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-border-light);
}

.slash-item:last-child {
    border-bottom: none;
}

.slash-item .small {
    color: var(--color-text-secondary);
}

.slash-item.active {
    background: var(--color-surface-active);
}

.slash-item:hover {
    background: color-mix(in srgb, var(--color-surface-active) 70%, var(--color-surface) 30%);
}

/* Side Panel (Chat Context) */
.side-panel {
    background: var(--color-surface);
    /* Width is handled inline by JS for resizing */
    border-left: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    z-index: 20;
    height: calc(100% - 32px);
    /* Vertical float */
    color: var(--color-text-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    margin: 16px;
    /* Fully floating */
    transition: opacity 0.2s;
    position: relative;
    min-width: 300px;
    max-width: 800px;
}

.side-panel.inactive {
    border-color: var(--color-border-light);
    box-shadow: inset 0 0 0 1px var(--color-border-light);
    background: var(--color-surface-alt);
}

/* Disabled state applies to the body content wrapper, not the whole panel */
.sp-content-wrapper.disabled {
    pointer-events: none;
    opacity: 0.6;
    filter: grayscale(1);
}

.sp-content-wrapper.inactive {
    pointer-events: none;
    opacity: 0.8;
    filter: grayscale(0.2);
}

.side-panel.inactive .sp-header h3 {
    color: var(--color-text-secondary);
}

.side-panel.inactive .sp-field input,
.side-panel.inactive .sp-field select,
.side-panel.inactive .sp-field textarea {
    pointer-events: none;
    background: var(--color-surface);
    border-color: var(--color-border-light);
    color: var(--color-text-secondary);
}

.side-panel.inactive .sp-actions,
.side-panel.inactive .sp-body .btn-primary,
.side-panel.inactive .sp-body .btn-secondary {
    display: none !important;
}

.sp-record-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 12px;
}

.sp-record-link,
.sp-record-link:link,
.sp-record-link:visited,
.markdown-content .sp-record-link,
.markdown-content .sp-record-link:visited {
    color: var(--color-primary-red) !important;
    text-decoration: none;
}

.sp-record-link:hover {
    text-decoration: underline;
}

.deep-dive-table td {
    vertical-align: top;
}

.sp-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    word-break: break-word;
}

.sp-truncate.sp-value {
    color: var(--color-text-body);
}

.panel-rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 8px;
    border-left: 1px solid transparent;
    /* Placeholder for alignment */
    height: 100%;
}

.panel-rail.disabled {
    pointer-events: none;
    opacity: 0.6;
    filter: grayscale(1);
}

.panel-chip {
    min-width: 44px;
    max-width: 132px;
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid var(--color-primary-red);
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-primary-red);
    text-align: center;
    line-height: 1.15;
    padding: 8px 10px;
    white-space: normal;
    word-break: break-word;
    transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}

.panel-chip:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--color-bg-cream);
}

:root[data-theme="dark"] .panel-chip {
    background: var(--color-surface-panel);
    border-color: var(--color-primary-red);
    color: var(--color-primary-red);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.panel-chip.disabled {
    border-color: var(--color-border);
    color: var(--color-text-secondary);
    background: var(--color-surface-alt);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

:root[data-theme="dark"] .panel-chip.disabled {
    background: var(--color-surface);
}


.sp-header {
    min-height: 64px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    gap: 16px;
}

.sp-body {
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sp-grid {
    display: grid;
    gap: 12px;
}

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

@media (max-width: 720px) {
    .sp-grid.two-col {
        grid-template-columns: 1fr;
    }
}

.sp-field label {
    font-size: 0.8rem;
    color: var(--color-text-body);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.sp-field input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
}

/* Tables */
.table-container {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    /* Enable vertical scrolling for CRUD/admin tables inside fixed-height shells */
    overflow: auto;
    background: var(--color-surface);
    flex: 1 1 auto;
    min-height: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    color: var(--color-text-primary);
}

th {
    text-align: left;
    padding: 12px 16px;
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

th.sortable-th {
    cursor: pointer;
    user-select: none;
}

th.sortable-th:hover {
    background: var(--color-surface-active);
}

th.sortable-th:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(13, 102, 107, 0.25);
}

.th-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.th-indicator {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    transform: translateY(-1px);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

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

tr:hover td {
    background-color: var(--color-surface-active);
    cursor: pointer;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: var(--color-surface);
    padding: 24px;
    border-radius: 16px;
    width: 400px;
    max-width: 90%;
    box-shadow: var(--shadow-lg);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

dialog.modal {
    margin: auto;
}

/* Shared Quick Create attachment review: home, object lists and related records. */
.quick-create-files { display: grid; gap: 12px; min-width: 0; margin-top: 12px; }
.quick-create-files > .btn-secondary { justify-self: start; }
.quick-create-files > small { color: var(--color-text-secondary); overflow-wrap: anywhere; }
.quick-create-files__item { display: grid; gap: 10px; min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--color-border); border-radius: 8px; }
.quick-create-files__item legend { max-width: 100%; padding: 0 4px; overflow-wrap: anywhere; font-size: .85rem; }
.quick-create-files__item p { margin: 0; font-size: .85rem; color: var(--color-text-secondary); overflow-wrap: anywhere; }
.quick-create-files__item .form-label { display: grid; gap: 6px; margin: 0; }
.quick-create-files__item button { justify-self: start; }

:root[data-theme="dark"] .modal {
    background: var(--color-surface-panel);
}

.floating-table-overlay {
    position: fixed;
    inset: 0;
    z-index: 260;
    background: rgba(0, 0, 0, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.floating-table-dialog {
    position: relative;
    width: min(1100px, calc(100vw - 48px));
    max-height: calc(100vh - 56px);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.floating-table-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 14px;
    cursor: ew-resize;
    z-index: 2;
    touch-action: none;
}

.floating-table-resize-handle--left {
    left: -7px;
}

.floating-table-resize-handle--right {
    right: -7px;
}

.floating-table-dialog__header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.floating-table-dialog__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.floating-table-dialog__body {
    padding: 16px;
    overflow: auto;
    min-height: 180px;
}

.o24-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.o24-tooltip__trigger {
    display: inline-flex;
    align-items: center;
    outline: none;
}

.o24-tooltip__bubble {
    position: absolute;
    z-index: 420;
    width: max-content;
    max-width: min(320px, calc(100vw - 32px));
    padding: 8px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    background: var(--color-surface-elevated, var(--color-surface));
    box-shadow: var(--shadow-lg);
    color: var(--color-text-primary);
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.o24-tooltip:hover .o24-tooltip__bubble,
.o24-tooltip:focus-within .o24-tooltip__bubble {
    opacity: 1;
    transform: translateY(0);
}

.o24-tooltip--top .o24-tooltip__bubble {
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, 4px);
}

.o24-tooltip--top:hover .o24-tooltip__bubble,
.o24-tooltip--top:focus-within .o24-tooltip__bubble {
    transform: translate(-50%, 0);
}

.o24-tooltip--right .o24-tooltip__bubble {
    left: calc(100% + 8px);
    top: 50%;
    transform: translate(0, -50%);
}

.o24-tooltip--bottom .o24-tooltip__bubble {
    top: calc(100% + 8px);
    left: 50%;
    transform: translate(-50%, -4px);
}

.o24-tooltip--bottom:hover .o24-tooltip__bubble,
.o24-tooltip--bottom:focus-within .o24-tooltip__bubble {
    transform: translate(-50%, 0);
}

.o24-tooltip--left .o24-tooltip__bubble {
    right: calc(100% + 8px);
    top: 50%;
    transform: translate(0, -50%);
}

@media (max-width: 720px) {
    .floating-table-overlay {
        padding: 12px;
    }

    .floating-table-dialog {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
    }

    .floating-table-dialog__body {
        padding: 12px;
    }
}

/* Typography Utilities */
.text-h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text-link);
    margin-bottom: 1rem;
}

.text-h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text-link);
    margin-bottom: 0.75rem;
}

.text-body {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text-primary);
}

.text-meta {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.o24-origin-cue {
    color: var(--color-text-secondary);
    font-size: inherit;
    font-weight: 400;
    white-space: nowrap;
}

.text-link,
a {
    color: var(--color-text-link);
    text-decoration: none;
    font-weight: inherit;
    cursor: pointer;
}

.text-link:hover,
a:hover {
    text-decoration: underline;
}

.text-link:visited,
a:visited {
    color: var(--color-text-link);
}

.link-button {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    color: var(--color-text-link);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.link-button:hover {
    color: var(--color-primary-red);
}

/* Tabs */
.tabs {
    --tabs-accent: color-mix(in srgb, var(--color-primary-blue) 55%, var(--color-primary-green) 45%);

    display: flex;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    max-width: 100%;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 78%, transparent 22%), transparent),
        color-mix(in srgb, var(--color-surface-alt) 78%, var(--color-surface) 22%);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--color-surface) 80%, transparent 20%);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 10px;
    appearance: none;
    background: transparent;
    cursor: pointer;
    color: color-mix(in srgb, var(--color-text-secondary) 86%, var(--color-text-primary) 14%);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    user-select: none;
    transition:
        background 0.16s ease,
        border-color 0.16s ease,
        box-shadow 0.16s ease,
        color 0.16s ease,
        transform 0.16s ease;
}

.tab .atlas-inline-icon,
.tab .tab__icon,
.tab svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.tab .atlas-inline-icon svg,
.tab .tab__icon svg {
    width: 16px;
    height: 16px;
}

.tab:hover:not(:disabled):not([aria-disabled="true"]) {
    background: color-mix(in srgb, var(--color-surface) 72%, var(--color-surface-active) 28%);
    color: var(--color-text-primary);
}

.tab:focus-visible {
    outline: none;
    border-color: color-mix(in srgb, var(--tabs-accent) 42%, var(--color-border) 58%);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tabs-accent) 16%, transparent 84%);
}

.tab.active,
.tab.is-active,
.tab[aria-selected="true"] {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--color-surface-active) 76%, var(--color-surface) 24%), var(--color-surface-active));
    border-color: color-mix(in srgb, var(--tabs-accent) 24%, var(--color-border) 76%);
    color: var(--color-text-primary);
    box-shadow:
        0 1px 2px rgba(17, 42, 52, 0.08),
        inset 0 1px 0 color-mix(in srgb, var(--color-surface) 78%, transparent 22%);
}

.tab.active::after,
.tab.is-active::after,
.tab[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -1px;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: var(--tabs-accent);
}

.tab:disabled,
.tab[aria-disabled="true"] {
    cursor: not-allowed;
    color: var(--color-text-secondary);
    opacity: 0.48;
}

@media (max-width: 640px) {
    .tabs {
        border-radius: 12px;
    }

    .tab {
        min-height: 38px;
        padding: 9px 14px;
        font-size: 0.84rem;
    }
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-body);
    text-align: center;
    padding: 40px;
}

/* Markdown Styles */
.markdown-content p {
    margin-bottom: 0.5em;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

.markdown-content pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}

.markdown-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
    font-size: 0.9em;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid #ddd;
    padding: 6px 10px;
    text-align: left;
}

.markdown-content th {
    background: rgba(0, 0, 0, 0.05);
}

/* Conversation List Item (Left Panel) */
.conv-item {
    padding: 12px;
    border-bottom: 1px solid var(--color-border-light);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    color: var(--color-text-primary);
}

.conv-item:hover {
    background: var(--color-surface-alt);
}

.conv-item.active {
    background: var(--color-surface-active);
    border-left: 3px solid var(--color-primary-green);
    color: var(--color-text-primary);
}

.conv-date {
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Spinner */
.o24-page-loading {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.o24-page-loading::before {
    content: "";
    display: block;
    width: 112px;
    height: 112px;
    background: url("/frontend/assets/brand/o24-loading-orb.svg") center / contain no-repeat;
    animation: spin 2.4s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .o24-page-loading::before { animation: none; }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-left-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 3px solid var(--color-border-light);
    border-top-color: var(--color-primary-blue);
    animation: spin 0.9s linear infinite;
}

.loading-spinner.sm {
    width: 18px;
    height: 18px;
    border-width: 2px;
}

.loading-spinner.lg {
    width: 44px;
    height: 44px;
    border-width: 4px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.loading-spinner-wrap {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text-secondary);
}

.loading-spinner-wrap .loading-label {
    font-weight: 600;
    color: var(--color-text-primary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Utilities */
.small {
    font-size: 0.85rem;
    color: #666;
}

.flex-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Top Nav - Dropdown (Reusable) */
.nav-group {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nav-dropdown {
    position: relative;
}

/* Shared-record inbox: navigation disclosure and Recent-record identity. */
.nav-dropdown .nav-menu.o24-record-notifications {
    width: min(360px, calc(100vw - 32px));
    min-width: 0;
    max-height: min(70vh, 600px);
    bottom: auto;
    overflow-y: auto;
    padding: 16px;
}
.o24-record-notifications ul { margin: 12px 0; padding: 0; list-style: none; }
.o24-record-notifications li + li { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.o24-record-notifications .toolbar-actions { justify-content: flex-start; flex-wrap: wrap; }
.o24-shared-record-link, .o24-shared-record-link:visited { display: flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 8px; color: var(--crm-object-strong, var(--qa-ink)); font-size: .86rem; line-height: 1.5; }
.o24-shared-record-link > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.o24-shared-record-link:hover { background: var(--qa-soft); text-decoration: none; }
.o24-shared-record-link:focus-visible { outline: 2px solid var(--qa-blue); outline-offset: 2px; }
@media (max-width: 768px) {
    .top-nav .nav-dropdown .nav-menu.o24-record-notifications { left: auto; right: 16px; }
}

.nav-dropdown > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.nav-dropdown > summary:hover {
    background: var(--color-surface-alt);
}

.nav-summary-content {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-dropdown > summary::-webkit-details-marker {
    display: none;
}

.nav-dropdown[open] > summary {
    box-shadow: 0 0 0 3px rgba(13, 102, 107, 0.1);
    border-color: rgba(13, 102, 107, 0.35);
}

.nav-dropdown .nav-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    min-width: 220px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: visible;
    padding: 6px;
    z-index: 60;
}

.nav-menu-cascade {
    position: relative;
}

.nav-menu .nav-menu-item {
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    cursor: pointer;
    border-radius: 10px;
    padding: 10px 10px;
    font-weight: 600;
}

.nav-menu-item__content,
.nav-menu-item__with-chevron {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-menu-item__with-chevron {
    width: 100%;
    justify-content: space-between;
}

.nav-menu-item__chevron {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-menu .nav-menu-item.nav-menu-item--danger {
    color: var(--color-primary-red);
}

.nav-menu .nav-menu-item.nav-menu-item--active {
    background: var(--color-surface-alt);
}

.nav-menu .nav-menu-item.nav-menu-item--highlight {
    background: var(--color-primary-red);
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.nav-menu .nav-menu-item.nav-menu-item--muted {
    color: var(--color-text-secondary);
}

.nav-menu .nav-menu-item.nav-menu-item--highlight:hover {
    background: var(--color-primary-light, #e04130);
    color: #fff;
}

.nav-menu .nav-menu-item.nav-menu-item--disabled,
.nav-menu .nav-menu-item:disabled {
    color: var(--color-text-secondary);
    cursor: not-allowed;
    opacity: 0.55;
    filter: grayscale(0.6);
}

.nav-menu .nav-menu-item.nav-menu-item--disabled:hover,
.nav-menu .nav-menu-item:disabled:hover {
    background: transparent;
}

.nav-menu .nav-menu-item:hover {
    background: var(--color-surface-alt);
}

.nav-menu .nav-menu-cascade:hover > .nav-menu-item,
.nav-menu .nav-menu-cascade:focus-within > .nav-menu-item,
.nav-menu .nav-menu-cascade--open > .nav-menu-item {
    background: var(--color-surface-alt);
}

.nav-submenu {
    position: absolute;
    top: 0;
    right: calc(100% + 8px);
    min-width: 242px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    padding: 6px;
    z-index: 70;
}

.nav-menu-cascade:hover > .nav-submenu,
.nav-menu-cascade:focus-within > .nav-submenu,
.nav-menu-cascade--open > .nav-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.nav-menu .nav-menu-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 2px;
}

.nav-menu-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 10px;
    color: var(--color-text-primary);
    font-size: 0.9rem;
    line-height: 1.2;
}

.nav-menu-row__label {
    font-weight: 600;
}

.nav-menu-row--theme .toggle-switch {
    flex-shrink: 0;
}

.nav-menu-row--release {
    width: 100%;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: left;
    color: var(--color-text-secondary);
}

.nav-menu-row--release:hover,
.nav-menu-row--release:focus-visible {
    background: var(--color-surface-alt);
    color: var(--color-text-primary);
    outline: none;
}

.nav-menu-row__value {
    color: var(--color-text-placeholder);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.release-history-overlay {
    z-index: 320;
    padding: 20px;
}

.user-profile-overlay {
    z-index: 330;
    padding: 20px;
}

.user-profile-modal {
    width: min(720px, calc(100vw - 40px));
    max-width: min(720px, calc(100vw - 40px));
    height: min(900px, calc(100dvh - 40px));
    max-height: calc(100dvh - 40px);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
}

.user-profile-modal__header,
.user-profile-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
}

.user-profile-modal__header {
    border-bottom: 1px solid var(--color-border);
}

.user-profile-modal__header h2,
.user-profile-section h3 {
    margin: 0;
    color: var(--color-text-primary);
}

.user-profile-modal__header h2 {
    font-size: 1.08rem;
}

.user-profile-modal__header p,
.user-profile-section__heading p {
    margin: 4px 0 0;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

.user-profile-form {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.user-profile-form[hidden] { display: none; }
.user-profile-modal > [role="tabpanel"] { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

.user-profile-modal__body {
    overflow: auto;
    padding: 18px;
}

.user-profile-section + .user-profile-section {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid var(--color-border);
}

.user-profile-section h3 {
    font-size: 0.92rem;
}

.user-profile-feed-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.user-profile-feed-heading .toggle-switch input {
    display: block;
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.user-profile-feed-heading .toggle-switch input:disabled + .toggle-track {
    cursor: not-allowed;
}

.user-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    margin-top: 12px;
}

.user-profile-grid .form-group {
    margin: 0;
}

.user-profile-grid--identity {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}

.user-profile-grid input[readonly] {
    color: var(--color-text-secondary);
    background: var(--color-surface-alt);
    cursor: default;
}

.crm-lookup-picker { min-width: 0; width: 100%; }
.crm-lookup-picker__selected { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 52px; padding: 7px 9px 7px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); }
.crm-lookup-picker__link { display: block; min-width: 0; flex: 1; overflow: hidden; color: var(--color-primary-blue); text-overflow: ellipsis; white-space: nowrap; text-decoration: underline; text-underline-offset: 2px; }
.crm-lookup-picker__actions { display: flex; flex: 0 0 auto; gap: 2px; opacity: 0; pointer-events: none; transition: opacity 120ms ease; }
.crm-lookup-picker__selected:hover .crm-lookup-picker__actions, .crm-lookup-picker__selected:focus-within .crm-lookup-picker__actions { opacity: 1; pointer-events: auto; }
.crm-lookup-picker__action, .crm-lookup-picker__clear { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; border: 0; border-radius: 5px; background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.crm-lookup-picker__action:hover, .crm-lookup-picker__clear:hover, .crm-lookup-picker__action:focus-visible, .crm-lookup-picker__clear:focus-visible { background: var(--color-surface-alt); color: var(--color-primary-blue); }
.crm-lookup-picker__action:disabled, .crm-lookup-picker__clear:disabled { opacity: .45; cursor: default; }
.crm-lookup-picker__action svg, .crm-lookup-picker__clear svg { width: 16px; height: 16px; }
.crm-lookup-picker__control { display: flex; min-width: 0; }
.crm-lookup-picker__control .form-input { min-width: 0; flex: 1; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.crm-lookup-picker__control .crm-lookup-picker__clear { flex-basis: 40px; width: 40px; height: auto; border: 1px solid var(--color-border); border-left: 0; border-radius: 0; }
.crm-lookup-picker__browse, .crm-lookup-picker__create { display: grid; flex: 0 0 48px; place-items: center; border: 1px solid var(--color-border); border-left: 0; background: var(--color-surface); color: var(--color-text-primary); cursor: pointer; }
.crm-lookup-picker__browse { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.crm-lookup-picker__browse:hover, .crm-lookup-picker__browse:focus-visible, .crm-lookup-picker__create:hover, .crm-lookup-picker__create:focus-visible { color: var(--color-primary-blue); background: var(--color-surface-alt); }
.crm-lookup-picker__browse:disabled, .crm-lookup-picker__create:disabled { opacity: .45; cursor: default; }
.crm-lookup-picker__browse svg, .crm-lookup-picker__create svg { width: 19px; height: 19px; }
.crm-lookup-picker__choices { position: fixed; z-index: 1300; overflow: auto; padding: 4px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); box-shadow: var(--shadow-lg); }
.crm-lookup-picker__choices button { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 5px; background: transparent; color: var(--color-text-primary); font: inherit; text-align: left; cursor: pointer; }
.crm-lookup-picker__choices button:hover, .crm-lookup-picker__choices button:focus-visible { background: var(--color-surface-alt); }
.crm-lookup-picker__choices p { margin: 8px 10px; color: var(--color-text-secondary); }
.crm-lookup-picker__dialog { position: fixed; inset: 0; width: min(1080px, calc(100vw - 32px)); max-height: min(800px, calc(100dvh - 32px)); margin: auto; padding: 20px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface); color: var(--color-text-primary); }
.crm-lookup-picker__dialog::backdrop { background: rgb(20 29 42 / 55%); }
.crm-lookup-picker__dialog header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px; }
.crm-lookup-picker__dialog h2 { margin: 0; font-size: 1.15rem; }
.crm-lookup-picker__dialog > .form-input { width: 100%; }
.crm-lookup-picker__table-scroll { max-height: min(55dvh, 520px); overflow: auto; margin: 14px 0; border: 1px solid var(--color-border); border-radius: 8px; }
.crm-lookup-picker__table-scroll table { width: 100%; min-width: max-content; }
.crm-lookup-picker__table-scroll th, .crm-lookup-picker__table-scroll td { max-width: 260px; overflow-wrap: anywhere; white-space: normal; }
.crm-lookup-picker__table-scroll thead th { position: sticky; top: 0; z-index: 1; background: var(--color-surface-alt); }
.crm-lookup-picker__select { padding: 0; border: 0; background: transparent; color: var(--color-primary-blue); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.crm-lookup-picker__select:hover { text-decoration: underline; }
.crm-lookup-picker__select:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: 3px; }
@media (hover: none) { .crm-lookup-picker__actions { opacity: 1; pointer-events: auto; } }

.user-profile-error {
    margin: 16px 0 0;
    color: var(--color-danger);
    font-size: 0.86rem;
}

.user-profile-modal__footer {
    justify-content: flex-end;
    border-top: 1px solid var(--color-border);
}

@media (max-width: 640px) {
    .user-profile-overlay {
        padding: 10px;
    }

    .user-profile-modal {
        width: 100%;
        max-width: 100%;
        height: min(900px, calc(100dvh - 20px));
        max-height: calc(100dvh - 20px);
    }

    .user-profile-grid,
    .user-profile-grid--identity {
        grid-template-columns: 1fr;
    }
}

.release-history-modal {
    width: min(760px, calc(100vw - 40px));
    max-width: min(760px, calc(100vw - 40px));
    max-height: calc(100vh - 40px);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
}

.release-history-modal__header,
.release-history-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--color-border);
}

.release-history-modal__header h2 {
    margin: 0 0 4px;
    color: var(--color-text-primary);
    font-size: 1.05rem;
}

.release-history-current {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

.release-history-modal__body {
    overflow: auto;
    padding: 16px 18px;
}

.release-history-modal__footer {
    justify-content: flex-end;
    border-top: 1px solid var(--color-border);
    border-bottom: 0;
}

.release-history-table-wrap {
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: auto;
    background: var(--color-surface);
}

.release-history-table {
    width: 100%;
    border-collapse: collapse;
}

.release-history-table th,
.release-history-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
    font-size: 0.86rem;
}

.release-history-table th {
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.release-history-table tr:hover td {
    background: transparent;
    cursor: default;
}

.release-history-highlights {
    margin: 0;
    padding-left: 18px;
    color: var(--color-text-primary);
}

.release-history-highlights li + li {
    margin-top: 4px;
}

.release-history-empty,
.release-history-unavailable {
    color: var(--color-text-secondary);
}

@media (max-width: 640px) {
    .nav-submenu {
        top: calc(100% + 6px);
        right: 0;
    }

    .release-history-modal__header,
    .release-history-modal__body,
    .release-history-modal__footer {
        padding-left: 14px;
        padding-right: 14px;
    }
}

/*
========================================
   Forecast Target Coverage
========================================
*/

.forecast-widget {
    --forecast-won: #0d666b;
    --forecast-commit: #147a92;
    --forecast-stretch: #fbae0f;
    --forecast-best-case: #6d5bd0;
    --forecast-over: color-mix(in srgb, var(--color-primary-green) 12%, var(--color-surface) 88%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    color: var(--color-text-primary);
    overflow: hidden;
}

.forecast-widget__header,
.forecast-widget__controls,
.forecast-widget__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.forecast-widget__header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--color-border);
}

.forecast-widget__title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.forecast-widget__title h3 {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.forecast-widget__subtitle,
.forecast-widget__meta,
.forecast-control__label,
.forecast-chart__label,
.forecast-summary-item__label {
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    line-height: 1.35;
}

.forecast-widget__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.forecast-widget__body {
    padding: 18px 20px 20px;
    display: grid;
    gap: 18px;
}

.forecast-widget__controls {
    align-items: flex-end;
    flex-wrap: wrap;
}

.forecast-refresh-button--spinning svg {
    animation: spin 0.8s linear infinite;
}

.forecast-control {
    display: grid;
    gap: 6px;
}

.forecast-control--filters {
    flex: 1 1 360px;
    min-width: 260px;
}

.forecast-control--target {
    flex: 0 1 220px;
    min-width: 180px;
}

.forecast-control__label,
.forecast-chart__label,
.forecast-summary-item__label {
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.forecast-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.forecast-filter-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.forecast-filter-selects {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}

.forecast-filter-select {
    display: grid;
    gap: 5px;
    min-width: 180px;
}

.forecast-filter-select span {
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
}

.forecast-modal-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.forecast-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--color-primary-green) 20%, var(--color-border) 80%);
    border-radius: var(--radius-full);
    background: color-mix(in srgb, var(--color-primary-green) 9%, var(--color-surface) 91%);
    color: var(--color-primary-green);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
}

.forecast-filter-chip:not(.forecast-filter-chip--active) {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-body);
}

.forecast-filter-chip--active {
    border-color: color-mix(in srgb, var(--color-primary-green) 35%, var(--color-border) 65%);
    background: color-mix(in srgb, var(--color-primary-green) 12%, var(--color-surface) 88%);
    color: var(--color-primary-green);
}

.forecast-control__empty {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.forecast-control--target input {
    height: 38px;
    padding: 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font: inherit;
    font-weight: 700;
}

.forecast-filter-chip svg {
    width: 14px;
    height: 14px;
}

.forecast-filter-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.forecast-filter-add:hover,
.forecast-filter-add:focus-visible {
    border-color: var(--color-primary-green);
    color: var(--color-primary-green);
    outline: none;
}

.forecast-target-input {
    position: relative;
    display: block;
    width: 100%;
}

.forecast-target-input input {
    box-sizing: border-box;
    width: 100%;
    height: 38px;
    padding-left: 10px;
    padding-right: 58px;
    font-weight: 700;
}

.forecast-target-input__prefix,
.forecast-target-input__action,
.forecast-target-input__currency {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-secondary);
}

.forecast-target-input__prefix {
    left: 11px;
    font-weight: 700;
}

.forecast-target-input__action {
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    cursor: pointer;
}

.forecast-target-input__action:hover {
    background: color-mix(in srgb, var(--color-surface-active) 82%, transparent 18%);
    color: var(--color-text-primary);
}

.forecast-target-input__currency {
    right: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    pointer-events: none;
}

.forecast-control__error,
.forecast-refresh-error {
    color: var(--color-danger, #b42318);
    font-size: 0.78rem;
    line-height: 1.35;
}

.forecast-refresh-error {
    padding: 9px 11px;
    border: 1px solid color-mix(in srgb, var(--color-danger, #b42318) 24%, var(--color-border) 76%);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--color-danger, #b42318) 7%, var(--color-surface) 93%);
}

.forecast-initial-state {
    display: grid;
    place-items: center;
    gap: 5px;
    min-height: 76px;
    padding: 16px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    text-align: center;
}

.forecast-initial-state strong {
    color: var(--color-text-primary);
}

.forecast-chart {
    display: grid;
    gap: 10px;
}

.forecast-chart__topline {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.forecast-chart__metric {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.forecast-chart__total {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}

.forecast-chart__amount {
    color: var(--color-text-primary);
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1;
}

.forecast-chart__target {
    color: var(--color-text-secondary);
    font-size: 1.05rem;
    font-weight: 700;
}

.forecast-chart__coverage {
    color: var(--color-primary-green);
    font-size: 0.88rem;
    font-weight: 700;
}

.forecast-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 750;
    line-height: 1;
    white-space: nowrap;
}

.forecast-pill--success {
    border-color: color-mix(in srgb, var(--color-primary-green) 24%, transparent 76%);
    background: color-mix(in srgb, var(--color-primary-green) 10%, var(--color-surface) 90%);
    color: var(--color-primary-green);
}

.forecast-pill--missing {
    border-color: color-mix(in srgb, #F5432F 35%, var(--color-border) 65%);
    background: color-mix(in srgb, #F5432F 7%, var(--color-surface) 93%);
    color: var(--color-text-secondary);
}

.forecast-target-rail {
    position: relative;
    min-height: 30px;
}

.forecast-target-rail__anchor {
    position: absolute;
    left: var(--target-position, 68%);
    bottom: 0;
    transform: translateX(calc(0% - var(--target-position, 68%)));
    max-width: 100%;
    pointer-events: none;
    z-index: 2;
}

.forecast-target-rail__anchor::after {
    content: "";
    position: absolute;
    left: var(--target-position, 68%);
    top: 100%;
    width: 2px;
    height: 11px;
    background: #F5432F;
    transform: translateX(-50%);
}

.forecast-target-rail__anchor--start {
    transform: none;
}

.forecast-target-rail__anchor--start::after {
    left: 0;
}

.forecast-target-rail__anchor--end {
    transform: translateX(-100%);
}

.forecast-target-rail__anchor--end::after {
    left: 100%;
}

.forecast-target-rail__label {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid #F5432F;
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-sm);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.forecast-bar {
    position: relative;
    display: flex;
    min-height: 92px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--color-surface-alt);
}

.forecast-segment {
    --segment-color: var(--color-primary-green);
    position: relative;
    display: flex;
    min-width: 32px;
    min-height: 92px;
    flex: var(--segment-weight, 1) 1 0;
    align-items: flex-end;
    border: none;
    border-right: 1px solid color-mix(in srgb, white 28%, transparent 72%);
    background: var(--segment-color);
    color: #fff;
    cursor: pointer;
    container-type: inline-size;
    overflow: hidden;
    text-align: left;
    transition: filter 0.15s ease, transform 0.15s ease;
}

.forecast-segment:last-child {
    border-right: none;
}

.forecast-segment:hover,
.forecast-segment:focus-visible {
    filter: brightness(1.06);
    outline: none;
}

.forecast-segment__body {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 13px 12px 12px;
    min-width: 0;
}

.forecast-segment__value {
    overflow: hidden;
    font-size: 0.98rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forecast-segment__label,
.forecast-segment__percent {
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forecast-segment__percent {
    opacity: 0.82;
}

.forecast-segment--over {
    border-left: 1px dashed color-mix(in srgb, var(--color-primary-green) 42%, var(--color-border) 58%);
    background: var(--forecast-over);
    color: var(--color-primary-green);
}

.forecast-segment--target-gap {
    min-width: 18px;
    cursor: default;
    background:
        repeating-linear-gradient(
            135deg,
            var(--color-surface) 0,
            var(--color-surface) 8px,
            color-mix(in srgb, var(--color-text-secondary) 34%, var(--color-surface) 66%) 8px,
            color-mix(in srgb, var(--color-text-secondary) 34%, var(--color-surface) 66%) 10px
        );
}

.forecast-segment--target-gap:hover,
.forecast-segment--target-gap:focus-visible {
    filter: none;
}

.forecast-segment--missing-target {
    min-width: 100%;
    flex: 1 1 100%;
    align-items: stretch;
    border-right: 0;
    background:
        repeating-linear-gradient(
            135deg,
            color-mix(in srgb, var(--color-surface-alt) 92%, var(--color-surface) 8%) 0,
            color-mix(in srgb, var(--color-surface-alt) 92%, var(--color-surface) 8%) 12px,
            color-mix(in srgb, var(--color-text-secondary) 18%, var(--color-surface) 82%) 12px,
            color-mix(in srgb, var(--color-text-secondary) 18%, var(--color-surface) 82%) 16px
        );
    box-shadow: inset 0 0 0 1px color-mix(in srgb, #F5432F 22%, transparent 78%);
    color: var(--color-text-primary);
    cursor: default;
}

.forecast-segment--missing-target:hover,
.forecast-segment--missing-target:focus-visible {
    filter: none;
}

.forecast-segment--missing-target .forecast-segment__body {
    align-content: center;
    justify-items: center;
    text-align: center;
}

.forecast-segment__missing-copy {
    display: grid;
    gap: 4px;
    justify-items: center;
    max-width: calc(100% - 24px);
    padding: 8px 14px;
    border: 1px solid color-mix(in srgb, var(--color-border) 72%, transparent 28%);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--color-surface) 92%, transparent 8%);
    box-shadow: var(--shadow-sm);
}

.forecast-segment--missing-target .forecast-segment__value,
.forecast-segment--missing-target .forecast-segment__label {
    max-width: 100%;
}

.forecast-segment--missing-target .forecast-segment__label {
    color: var(--color-text-secondary);
}

.forecast-segment--empty {
    min-width: 100%;
}

.forecast-segment--non-counting {
    box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.45);
}

.forecast-target-marker {
    position: absolute;
    left: var(--target-position, 68%);
    top: 0;
    bottom: 0;
    width: 3px;
    background: #F5432F;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-surface) 88%, transparent 12%);
    pointer-events: none;
    transform: translateX(-50%);
    z-index: 3;
}

.forecast-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
    gap: 2px 18px;
}

.forecast-legend__item {
    display: grid;
    grid-template-columns: 9px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 6px 4px;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    text-align: left;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.forecast-legend__item:hover,
.forecast-legend__item:focus-visible {
    background: color-mix(in srgb, var(--color-surface-alt) 82%, transparent 18%);
    color: var(--color-text-primary);
    outline: none;
}

.forecast-legend__dot {
    width: 9px;
    height: 9px;
    border-radius: var(--radius-full);
    background: var(--legend-color, var(--color-primary-green));
}

.forecast-legend__label {
    overflow: hidden;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forecast-legend__value {
    color: var(--color-text-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

@container (max-width: 118px) {
    .forecast-segment__body {
        padding-inline: 8px;
    }

    .forecast-segment__label {
        display: none;
    }
}

@container (max-width: 64px) {
    .forecast-segment__body {
        display: none;
    }
}

.forecast-widget__summary {
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--color-surface-alt) 72%, var(--color-surface) 28%);
    flex-wrap: wrap;
}

.forecast-summary-item {
    display: grid;
    gap: 2px;
    min-width: 118px;
}

.forecast-summary-item__value {
    color: var(--color-text-primary);
    font-size: 1rem;
    font-weight: 700;
}

@media (max-width: 860px) {
    .forecast-widget__header,
    .forecast-widget__controls,
    .forecast-widget__summary,
    .forecast-chart__topline {
        align-items: flex-start;
        flex-direction: column;
    }

    .forecast-widget__meta {
        white-space: normal;
    }

    .forecast-control--filters,
    .forecast-control--target {
        width: 100%;
        min-width: 0;
    }

    .forecast-bar {
        min-height: 80px;
    }

    .forecast-segment {
        min-width: 28px;
        min-height: 80px;
    }

    .forecast-chart__amount {
        font-size: 1.55rem;
    }

    .forecast-legend {
        grid-template-columns: 1fr;
    }
}

.forecast-admin-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.forecast-admin-settings {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(180px, 1fr) auto auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-alt);
}

.forecast-admin-toggle,
.forecast-admin-checks label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-body);
    font-weight: 600;
}

.forecast-admin-help {
    display: block;
    margin-top: 6px;
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    line-height: 1.35;
}

.forecast-admin-modal {
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-radius: var(--radius-sm);
}

.forecast-admin-modal__header,
.forecast-admin-modal__actions,
.forecast-admin-checks {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.forecast-admin-modal__header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.forecast-admin-modal__actions {
    justify-content: flex-end;
    margin-top: 16px;
}

.forecast-admin-color-field {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.forecast-admin-color-field input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 2px;
}

.forecast-admin-swatch {
    width: 22px;
    height: 22px;
    display: inline-block;
    border-radius: var(--radius-full);
    border: 1px solid var(--color-border);
}

.forecast-admin-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 860px) {
    .forecast-admin-settings {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

.admin-page-shell {
    min-height: 100vh;
    background: var(--color-page-bg);
}

.admin-layout-shell {
    display: flex;
    align-items: stretch;
    height: calc(100vh - var(--o24-nav-height, 48px));
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

.admin-content-card {
    flex: 1 1 auto;
    min-width: 0;
    margin: 24px;
    overflow: auto;
}

@media (max-width: 720px) {
    .admin-layout-shell {
        gap: 0;
    }

    .admin-console.admin-console--docked {
        width: 196px;
        flex-basis: 196px;
    }

    .admin-content-card {
        margin: 12px;
    }
}

/* Admin Console */
.admin-console-scrim {
    position: fixed;
    top: var(--o24-nav-height, 48px);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 12, 20, 0.45);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 120;
}

.admin-console-scrim.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.admin-console {
    position: fixed;
    top: var(--o24-nav-height, 48px);
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 80vw;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.2s ease;
    z-index: 130;
    display: flex;
    flex-direction: column;
}

.admin-console.open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.admin-console__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
}

.admin-console__title {
    font-size: 1rem;
    color: var(--color-text-primary);
}

.admin-console__toggle {
    margin-left: auto;
    flex-shrink: 0;
}

.admin-console__body {
    padding: 10px 0 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-console__section {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-console__section + .admin-console__section {
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
}

.admin-console__section-title {
    display: inline-flex;
    align-self: flex-start;
    margin: 0 14px 4px;
    padding: 5px 10px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.1;
    text-transform: uppercase;
    cursor: default;
    user-select: none;
    pointer-events: none;
}

.admin-console__item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    border: none;
    background: transparent;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: 9px 20px;
    font-weight: 600;
    transition: background 0.1s;
}

.admin-console__item:hover {
    background: var(--color-surface-alt);
}

.admin-console__item-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    opacity: 0.55;
    transition: opacity 0.1s, color 0.1s;
}

.admin-console__item-icon svg {
    width: 15px;
    height: 15px;
}

.admin-console__item:hover .admin-console__item-icon,
.admin-console__item--active .admin-console__item-icon {
    opacity: 1;
    color: var(--color-primary-red);
}

.admin-console.admin-console--docked {
    position: relative;
    top: 0;
    left: 0;
    bottom: auto;
    height: 100%;
    width: 240px;
    max-width: none;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    box-shadow: none;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    flex: 0 0 240px;
    overflow: hidden;
}

.admin-console--docked .admin-console__body {
    flex: 1;
    min-height: 0;
}

.admin-console.admin-console--docked.admin-console--collapsed {
    width: 50px;
    min-width: 50px;
    flex-basis: 50px;
}

.admin-console--docked.admin-console--collapsed .admin-console__header {
    justify-content: center;
    padding: 12px 7px;
}

.admin-console__item--active {
    background: var(--color-surface-alt);
    box-shadow: inset 3px 0 0 var(--color-primary-red);
}

/*
========================================
   Mobile Components (Drawer & Sheet)
========================================
*/

/* Drawer (Side Menu) */
.drawer-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    backdrop-filter: blur(2px);
}

.drawer-scrim.open {
    opacity: 1;
    visibility: visible;
}

.drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 280px;
    max-width: 80%;
    background: var(--color-surface);
    z-index: 950;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
}

.drawer.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-surface);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Bottom Sheet */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.sheet-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-surface);
    z-index: 950;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.sheet.open {
    transform: translateY(0);
}

:root[data-theme='dark'] .sheet {
    border-top: 1px solid var(--color-border);
}

.sheet-handle-bar {
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--color-border);
    border-radius: 4px;
}

.sheet-header {
    padding: 0 20px 12px 20px;
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--color-border-light);
}

.sheet-body {
    padding: 16px 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sheet-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid var(--color-border-light);
}

.sheet-item:last-child {
    border-bottom: none;
}

.sheet-item:active {
    background: var(--color-surface-active);
}

.sheet-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--color-surface-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
}

.sheet-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sheet-item-title {
    font-weight: 600;
    color: var(--color-text-primary);
}

.sheet-item-subtitle {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

/* Manager Workspace: full-width team table with the canonical forecast bar. */
.manager-workspace {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 20px clamp(16px, 2vw, 32px) 40px;
    overflow: auto;
    background: var(--color-page-bg);
}

.manager-workspace__toolbar,
.manager-pagination,
.forecast-modal-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.manager-workspace__heading {
    margin-bottom: 16px;
}

.manager-workspace__toolbar {
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 12px 0;
    border-block: 1px solid var(--color-border);
}

.manager-workspace__controls {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
}

.manager-workspace__actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    align-self: end;
    gap: 4px;
    min-height: 38px;
}

.manager-workspace__actions .icon-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
}

.manager-workspace__actions .icon-btn:hover,
.manager-workspace__actions .icon-btn:focus-visible {
    border-color: var(--color-primary-green);
    background: var(--color-surface-active);
    color: var(--color-primary-green);
    outline: none;
}

.manager-control {
    display: grid;
    gap: 5px;
    min-width: 150px;
}

.manager-control--sort {
    min-width: 170px;
}

.manager-control .form-select {
    min-height: 38px;
}

.manager-refresh--busy svg {
    animation: spin 0.8s linear infinite;
}

.manager-refresh-status {
    margin: 0 0 12px;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

.manager-refresh-status--failed,
.manager-refresh-status--partial {
    color: var(--color-danger);
}

.manager-forecast-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
}

.manager-forecast-table {
    width: 100%;
    min-width: 1080px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.manager-col-name {
    width: 150px;
}

.manager-col-target {
    width: 240px;
}

.manager-col-coverage {
    width: 125px;
}

.manager-col-percent {
    width: 100px;
}

.manager-col-forecast {
    width: auto;
}

.manager-forecast-table th,
.manager-forecast-table td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-primary);
    text-align: left;
    vertical-align: middle;
}

.manager-forecast-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

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

.manager-forecast-table tbody tr:hover > * {
    background: color-mix(in srgb, var(--color-surface-active) 46%, var(--color-surface) 54%);
}

.manager-forecast-table__row--error > :first-child {
    box-shadow: inset 3px 0 0 var(--color-danger);
}

.manager-seller-link {
    display: inline-block;
    max-width: 100%;
    color: var(--color-primary-blue);
    font-weight: 700;
    overflow: hidden;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.manager-seller-link:hover,
.manager-seller-link:focus-visible {
    text-decoration: underline;
}

.manager-forecast-table__number {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    white-space: nowrap;
}

.manager-forecast-table__bar {
    min-width: 0;
}

.forecast-chart--manager-row {
    min-width: 0;
}

.forecast-chart--manager-row .forecast-bar,
.forecast-chart--manager-row .forecast-segment {
    min-height: 56px;
}

.forecast-chart--manager-row .forecast-target-marker {
    bottom: 0;
}

.forecast-chart--manager-row .forecast-segment__body {
    gap: 2px;
    padding: 9px 10px;
}

.forecast-chart--manager-row .forecast-segment__value {
    font-size: 0.88rem;
}

.forecast-chart--manager-row .forecast-segment__label {
    font-size: 0.72rem;
}

.manager-target-editor {
    display: grid;
    gap: 4px;
}

.manager-target-editor__control {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    align-items: center;
}

.manager-target-save {
    min-height: 38px;
    padding-inline: 10px;
}

.manager-target-editor__error {
    color: var(--color-danger);
    font-size: 0.72rem;
    line-height: 1.25;
}

.manager-target-readonly {
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.manager-row-empty {
    display: flex;
    min-height: 56px;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

.manager-pagination {
    margin: 18px 0 0;
    justify-content: flex-end;
}

.forecast-modal-actions {
    margin-bottom: 10px;
}

.forecast-modal-warning {
    margin-top: 10px;
}

@media (max-width: 880px) {
    .manager-workspace {
        padding-inline: 16px;
    }

    .manager-workspace__toolbar {
        align-items: end;
    }

    .manager-workspace__controls {
        flex-basis: calc(100% - 92px);
    }

    .manager-control {
        min-width: min(170px, 100%);
    }
}

/*
 * Quiet shared component skin.
 * Flow: docs/agent/flows/features/idea-197-admin-ui-style-switch.mmd
 */
:root[data-ui-style="quiet"] .btn-primary,
:root[data-ui-style="quiet"] .btn-secondary {
    min-height: 30px;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

:root[data-ui-style="quiet"] .btn-primary:hover:not(:disabled) {
    filter: brightness(0.96);
    transform: none;
}

:root[data-ui-style="quiet"] .btn-secondary {
    border-color: var(--color-primary-blue);
    background: transparent;
    color: var(--color-primary-blue);
}

:root[data-ui-style="quiet"] .btn-secondary:hover:not(:disabled) {
    border-color: var(--quiet-navy-hover);
    background: var(--quiet-surface-active);
    color: var(--quiet-navy-hover);
}

:root[data-ui-style="quiet"] .btn-prominent-secondary {
    border-color: var(--quiet-coral);
    background: color-mix(in srgb, var(--quiet-coral) 10%, var(--quiet-surface) 90%);
    color: var(--quiet-ink);
}

:root[data-ui-style="quiet"] .btn-prominent-secondary:hover:not(:disabled) {
    border-color: var(--quiet-coral);
    background: color-mix(in srgb, var(--quiet-coral) 18%, var(--quiet-surface) 82%);
    color: var(--quiet-ink);
}

:root[data-ui-style="quiet"] .icon-btn {
    border-radius: 6px;
    color: var(--color-primary-blue);
}

:root[data-ui-style="quiet"] .icon-btn:hover {
    background: var(--quiet-surface-active);
    color: var(--quiet-navy-hover);
}

:root[data-ui-style="quiet"] .form-group {
    margin-bottom: 12px;
}

:root[data-ui-style="quiet"] .form-label,
:root[data-ui-style="quiet"] .sp-field label {
    margin-bottom: 5px;
    font-size: 0.76rem;
    font-weight: 600;
}

:root[data-ui-style="quiet"] .form-input,
:root[data-ui-style="quiet"] .form-select,
:root[data-ui-style="quiet"] .form-textarea,
:root[data-ui-style="quiet"] .search-input,
:root[data-ui-style="quiet"] .input-wrapper,
:root[data-ui-style="quiet"] .select-trigger {
    border-color: var(--quiet-line-strong);
    border-radius: 6px;
}

:root[data-ui-style="quiet"] .form-input,
:root[data-ui-style="quiet"] .form-select,
:root[data-ui-style="quiet"] .search-input,
:root[data-ui-style="quiet"] .select-trigger {
    min-height: 36px;
    padding-top: 7px;
    padding-bottom: 7px;
}

:root[data-ui-style="quiet"] .form-input:focus,
:root[data-ui-style="quiet"] .form-select:focus,
:root[data-ui-style="quiet"] .form-textarea:focus,
:root[data-ui-style="quiet"] .search-input:focus,
:root[data-ui-style="quiet"] .input-wrapper:focus-within,
:root[data-ui-style="quiet"] .select-trigger:focus,
:root[data-ui-style="quiet"] .select-trigger.open {
    border-color: var(--color-primary-blue);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary-blue) 12%, transparent 88%);
}

/* Quiet native pickers keep browser keyboard, form and top-layer behavior.
   ponytail: unsupported browsers keep native menus; add a fallback only when
   a supported client needs identical presentation without base-select. */
@supports (appearance: base-select) {
    :root[data-ui-style="quiet"] select:not([multiple]):is(:not([size]), [size="1"]),
    :root[data-ui-style="quiet"] select:not([multiple]):is(:not([size]), [size="1"])::picker(select) {
        appearance: base-select;
    }

    :root[data-ui-style="quiet"] select:not([multiple]):is(:not([size]), [size="1"]) {
        background-image: none;
        padding-inline-end: 12px;
        gap: 12px;
        align-items: center;
    }

    :root[data-ui-style="quiet"] select::picker-icon {
        content: "";
        width: 7px;
        height: 7px;
        margin-inline-start: auto;
        margin-inline-end: 2px;
        border: solid currentColor;
        border-width: 0 1.5px 1.5px 0;
        color: var(--color-text-secondary);
        transform: translateY(-2px) rotate(45deg);
        flex-shrink: 0;
    }

    :root[data-ui-style="quiet"] select:open::picker-icon {
        transform: translateY(2px) rotate(225deg);
    }

    :root[data-ui-style="quiet"] select:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

    :root[data-ui-style="quiet"] select::picker(select) {
        padding: 4px;
        margin-block: 4px;
        border: 1px solid var(--color-border);
        border-radius: 8px;
        background: var(--color-surface-panel);
        color: var(--color-text-primary);
        box-shadow: var(--shadow-lg);
        font: inherit;
        max-block-size: min(320px, 50dvh);
        max-inline-size: calc(100vw - 16px);
        overflow: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
    }

    :root[data-ui-style="quiet"] select:not([multiple]):is(:not([size]), [size="1"]) option {
        display: flex;
        align-items: center;
        gap: 12px;
        min-block-size: 34px;
        padding: 7px 10px;
        border-radius: 4px;
        color: var(--color-text-primary);
        background: transparent;
        white-space: normal;
        overflow-wrap: anywhere;
        cursor: pointer;
    }

    :root[data-ui-style="quiet"] select:not([multiple]):is(:not([size]), [size="1"]) option:checked {
        background: var(--color-surface-active);
        font-weight: 600;
    }

    :root[data-ui-style="quiet"] select:not([multiple]):is(:not([size]), [size="1"]) option:not(:disabled):is(:hover, :focus-visible) {
        background: var(--color-surface-active);
        outline: 1px solid var(--color-text-link);
        outline-offset: -1px;
    }

    :root[data-ui-style="quiet"] select option::checkmark {
        order: 1;
        margin-inline-start: auto;
        color: var(--color-text-link);
    }

    :root[data-ui-style="quiet"] select optgroup::before {
        padding: 8px 10px 4px;
        color: var(--color-text-secondary);
        font-size: 0.78rem;
        font-weight: 600;
    }

    :root[data-ui-style="quiet"] select:not([multiple]):is(:not([size]), [size="1"]) option:disabled {
        color: var(--color-text-secondary);
        opacity: 0.6;
        cursor: not-allowed;
    }

    @media (prefers-reduced-motion: no-preference) {
        :root[data-ui-style="quiet"] select::picker-icon { transition: transform 120ms ease; }
        :root[data-ui-style="quiet"] select:open::picker(select) { animation: quiet-picker-reveal 100ms ease-out; }
    }

    @media (forced-colors: active) {
        :root[data-ui-style="quiet"] select:not([multiple]):is(:not([size]), [size="1"]) option:checked {
            background: Highlight;
            color: HighlightText;
        }
        :root[data-ui-style="quiet"] select option::checkmark { color: inherit; }
    }
}

@keyframes quiet-picker-reveal { from { opacity: 0; } to { opacity: 1; } }

:root[data-ui-style="quiet"] .select-menu,
:root[data-ui-style="quiet"] .dropdown-menu {
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

:root[data-ui-style="quiet"] .chip,
:root[data-ui-style="quiet"] .status-badge,
:root[data-ui-style="quiet"] .toggle-track,
:root[data-ui-style="quiet"] .forecast-filter-chip,
:root[data-ui-style="quiet"] .source-summary-count {
    border-radius: var(--radius-full);
}

:root[data-ui-style="quiet"] .tabs {
    gap: 1px;
    padding: 3px;
    border-radius: 8px;
    background: var(--quiet-surface-subtle);
    box-shadow: none;
}

:root[data-ui-style="quiet"] .tab {
    min-height: 34px;
    padding: 7px 11px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 600;
}

:root[data-ui-style="quiet"] .tab.active,
:root[data-ui-style="quiet"] .tab.is-active,
:root[data-ui-style="quiet"] .tab[aria-selected="true"] {
    border-color: var(--quiet-line-strong);
    background: var(--quiet-surface);
    box-shadow: none;
}

:root[data-ui-style="quiet"] .chat-shell {
    border-radius: 8px;
    box-shadow: none;
}

:root[data-ui-style="quiet"] .chat-header {
    padding: 12px 16px;
    background: var(--quiet-surface);
}

:root[data-ui-style="quiet"] .chat-body {
    gap: 12px;
    padding: 18px 20px 12px;
    background: color-mix(in srgb, var(--quiet-surface) 78%, var(--quiet-canvas) 22%);
}

:root[data-ui-style="quiet"] .message {
    border-radius: 0;
    box-shadow: none;
    font-size: 0.86rem;
    line-height: 1.55;
}

:root[data-ui-style="quiet"] .message.bot {
    align-self: stretch;
    width: auto;
    max-width: none;
    padding: 10px 14px;
    border-left: 2px solid var(--quiet-line-strong);
    background: transparent;
}

:root[data-ui-style="quiet"] .message.bot:hover {
    border-left-color: var(--color-primary-blue);
}

:root[data-ui-style="quiet"] .message.user {
    max-width: 74%;
    padding: 9px 12px;
    border-radius: 8px;
    background: #112a34;
}

:root[data-ui-style="quiet"] .message.support,
:root[data-ui-style="quiet"] .message.admin-note {
    align-self: stretch;
    width: auto;
    max-width: none;
    padding: 10px 14px;
    border: 0;
    border-left: 2px solid var(--quiet-coral);
    border-radius: 0;
    background: color-mix(in srgb, var(--quiet-coral) 4%, var(--quiet-surface) 96%);
    box-shadow: none;
}

:root[data-ui-style="quiet"] .message.support.support-admin {
    border-left-color: #4c1d95;
    background: color-mix(in srgb, #4c1d95 9%, var(--quiet-surface) 91%);
}

:root[data-ui-style="quiet"] .message.tool {
    width: auto;
    max-width: none;
    border-color: var(--quiet-line);
    border-radius: 4px;
    background: var(--quiet-surface-subtle);
    box-shadow: none;
}

:root[data-ui-style="quiet"] .message-actions {
    position: static;
    width: fit-content;
    margin-top: 8px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 1;
}

:root[data-ui-style="quiet"] .message-actions .icon-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    color: var(--quiet-muted);
    border-radius: 5px;
}

:root[data-ui-style="quiet"] .message-actions .icon-btn:hover,
:root[data-ui-style="quiet"] .message-actions .icon-btn:focus-visible {
    color: var(--quiet-ink);
    background: var(--quiet-surface-subtle);
}

:root[data-ui-style="quiet"] .message-actions .icon-btn.active.thumbs-up {
    color: var(--color-primary-green);
}

:root[data-ui-style="quiet"] .message-actions .icon-btn.active.thumbs-down {
    color: var(--color-primary-red);
}

:root[data-ui-style="quiet"] .chat-footer {
    padding: 12px 14px;
    background: var(--quiet-surface);
}

:root[data-ui-style="quiet"] .chat-footer .input-wrapper {
    border-color: var(--quiet-line-strong);
    border-radius: 8px;
    background: color-mix(in srgb, var(--quiet-surface) 94%, var(--quiet-canvas) 6%);
}

:root[data-ui-style="quiet"] .chat-footer .input-wrapper .icon-btn[aria-label="Attach file"] {
    color: var(--quiet-ink);
}

:root[data-ui-style="quiet"] .chat-footer .input-wrapper .icon-btn[aria-label="Send message"] {
    width: 34px;
    height: 34px;
    min-width: 34px;
    color: #fff;
    background: var(--color-primary-blue);
    border-radius: 50%;
}

:root[data-ui-style="quiet"] .chat-footer .input-wrapper .icon-btn[aria-label="Send message"]:hover,
:root[data-ui-style="quiet"] .chat-footer .input-wrapper .icon-btn[aria-label="Send message"]:focus-visible {
    background: color-mix(in srgb, var(--color-primary-blue) 84%, #000 16%);
}

:root[data-ui-style="quiet"] .modal-content,
:root[data-ui-style="quiet"] .floating-table-dialog,
:root[data-ui-style="quiet"] .menu-dropdown {
    border-radius: 10px;
}

:root[data-ui-style="quiet"] .side-panel,
:root[data-ui-style="quiet"] .modal,
:root[data-ui-style="quiet"] .modal-content,
:root[data-ui-style="quiet"] .floating-table-dialog {
    border-radius: var(--radius-md) !important;
    border-color: var(--color-border);
    box-shadow: none !important;
}

/* Adaptive compact primitives. Flow: docs/agent/flows/features/idea-219-adaptive-mobile-sales-workspaces.mmd */
.nav-active-destination {
    display: none;
    min-width: 0;
    color: var(--color-text-primary);
    font-size: 0.86rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-workspace-toolbar {
    display: none;
}

.compact-overlay {
    position: fixed;
    inset: 0;
    z-index: 980;
    display: grid;
    background: rgba(9, 18, 33, 0.42);
    backdrop-filter: blur(2px);
}

.compact-drawer,
.compact-sheet,
.compact-drill-in {
    min-width: 0;
    background: var(--color-surface);
    color: var(--color-text-primary);
    box-shadow: var(--shadow-lg);
}

.compact-drawer {
    width: min(22rem, calc(100vw - 28px));
    height: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    padding: max(10px, env(safe-area-inset-top)) 0 max(10px, env(safe-area-inset-bottom));
    animation: compact-drawer-enter 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.compact-sheet {
    align-self: end;
    width: 100%;
    max-height: min(88dvh, 46rem);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    border-radius: 18px 18px 0 0;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    animation: compact-sheet-enter 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.compact-drill-in {
    width: 100%;
    height: 100dvh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    padding-top: env(safe-area-inset-top);
    animation: compact-drill-enter 160ms ease-out;
}

.compact-drill-in__header {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: max(12px, env(safe-area-inset-top)) 16px 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.compact-drill-in__header h2 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-drill-in__close {
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 auto;
}

.compact-drill-in__body {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.compact-overlay__header,
.compact-overlay__footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--color-surface);
}

.compact-overlay__header {
    min-height: 56px;
    border-bottom: 1px solid var(--color-border);
}

.compact-overlay__header > :first-child {
    min-width: 0;
    flex: 1 1 auto;
}

.compact-overlay__header h2,
.compact-overlay__header h3 {
    margin: 0;
    font-size: 1rem;
}

.compact-overlay__footer {
    justify-content: flex-end;
    border-top: 1px solid var(--color-border);
}

.compact-overlay__body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 16px;
}

.compact-data-list {
    display: grid;
    gap: 0;
    border-block: 1px solid var(--color-border);
    background: var(--color-surface);
}

.compact-data-row {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: 8px;
    padding: 14px 0;
    border: 0;
    border-bottom: 1px solid var(--color-border-light);
    background: transparent;
    color: inherit;
    text-align: left;
}

.compact-data-row:last-child {
    border-bottom: 0;
}

button.compact-data-row {
    min-height: 44px;
    cursor: pointer;
}

button.compact-data-row:active {
    background: var(--color-surface-active);
}

.compact-data-row__title,
.compact-data-row__meta,
.compact-data-row__value {
    min-width: 0;
    overflow-wrap: anywhere;
}

.compact-data-row__title {
    font-weight: 700;
}

.compact-data-row__meta {
    color: var(--color-text-secondary);
    font-size: 0.78rem;
}

.compact-data-row__value {
    font-variant-numeric: tabular-nums;
    font-weight: 650;
}

.compact-filter-summary {
    min-width: 0;
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-panel-switcher {
    display: flex;
    min-width: 0;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}

.compact-panel-switcher::-webkit-scrollbar {
    display: none;
}

.compact-panel-switcher button {
    min-height: 44px;
    flex: 0 0 auto;
}

.compact-status-banner {
    padding: 10px 12px;
    border-left: 3px solid var(--color-primary-blue);
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

@keyframes compact-drawer-enter {
    from { transform: translateX(-100%); opacity: 0.92; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes compact-sheet-enter {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes compact-drill-enter {
    from { transform: translateX(20px); opacity: 0.7; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 47.999rem) {
    .nav-active-destination,
    .compact-workspace-toolbar {
        display: flex;
        align-items: center;
    }

    .nav-active-destination {
        flex: 1 1 auto;
        justify-content: center;
    }

    .top-nav .nav-group,
    .top-nav .nav-dropdown {
        position: static;
    }

    .top-nav .nav-dropdown > summary {
        min-width: 74px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .top-nav .nav-menu {
        position: fixed;
        inset: var(--o24-nav-height, 56px) 0 0;
        width: 100%;
        max-width: none;
        max-height: none;
        overflow-y: auto;
        border: 0;
        border-top: 1px solid var(--color-border);
        border-radius: 0;
        padding: 10px max(12px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
        box-shadow: none;
    }

    .top-nav .nav-menu-item,
    .top-nav .nav-menu-row {
        min-height: 48px;
    }

    .compact-workspace-toolbar {
        min-height: 52px;
        width: 100%;
        justify-content: space-between;
        gap: 8px;
        padding: 6px 10px;
        border-bottom: 1px solid var(--color-border);
        background: var(--color-surface);
    }

    .compact-workspace-toolbar .btn-secondary,
    .compact-workspace-toolbar .icon-btn,
    :root[data-ui-style="quiet"] .compact-workspace-toolbar .btn-secondary,
    :root[data-ui-style="quiet"] .compact-workspace-toolbar .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .compact-drawer,
    .compact-sheet,
    .compact-drill-in {
        animation: none;
    }
}

/* Manager Workspace compact review presenter. Target mutation stays on wide screens. */
.manager-filter-backdrop {
    position: fixed;
    inset: 0;
    z-index: 988;
    border: 0;
    background: rgba(9, 18, 33, 0.42);
    backdrop-filter: blur(2px);
}

@media (max-width: 47.999rem) {
    .manager-workspace-app .main-layout {
        overflow: hidden;
    }

    .manager-workspace {
        height: 100%;
        padding: 12px 12px max(24px, env(safe-area-inset-bottom));
        overflow-y: auto;
    }

    .manager-workspace__heading {
        margin-bottom: 10px;
    }

    .manager-workspace__heading h1 {
        font-size: 1.35rem;
    }

    .manager-workspace button,
    .manager-workspace select,
    .manager-workspace input,
    :root[data-ui-style="quiet"] .manager-workspace button,
    :root[data-ui-style="quiet"] .manager-workspace select,
    :root[data-ui-style="quiet"] .manager-workspace input {
        min-height: 44px;
    }

    .manager-workspace .icon-btn,
    :root[data-ui-style="quiet"] .manager-workspace .icon-btn {
        min-width: 44px;
    }

    .manager-seller-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    .manager-compact-toolbar {
        position: sticky;
        top: -12px;
        z-index: 8;
        margin: 0 -12px 12px;
    }

    .manager-compact-toolbar .compact-filter-summary {
        flex: 1 1 auto;
    }

    .manager-filter-sheet {
        position: fixed;
        inset: auto 0 0;
        z-index: 989;
        width: 100%;
        max-height: min(88dvh, 46rem);
        margin: 0;
        padding: 0 0 max(10px, env(safe-area-inset-bottom));
        border: 0;
        border-radius: 18px 18px 0 0;
        background: var(--color-surface);
    }

    .manager-filter-sheet .manager-workspace__controls {
        min-height: 0;
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 14px;
        overflow-y: auto;
        padding: 14px 16px;
        overscroll-behavior: contain;
    }

    .manager-filter-sheet .manager-control {
        width: 100%;
        min-width: 0;
    }

    .manager-filter-sheet .manager-workspace__actions {
        min-height: 64px;
        justify-content: flex-end;
        align-self: auto;
        padding: 10px 16px;
        border-top: 1px solid var(--color-border);
    }

    .manager-filter-sheet .manager-refresh {
        display: none;
    }

    .manager-seller-list {
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding-inline: 14px;
    }

    .manager-seller-row {
        gap: 12px;
    }

    .manager-seller-row--error {
        box-shadow: inset 3px 0 0 var(--color-danger);
        padding-left: 10px;
    }

    .manager-seller-row__heading {
        display: flex;
        min-width: 0;
        align-items: flex-start;
        justify-content: space-between;
        gap: 10px;
    }

    .manager-seller-row__warning {
        flex: 0 0 auto;
        color: var(--color-danger);
        font-size: 0.72rem;
        font-weight: 700;
    }

    .manager-seller-row__metrics {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        margin: 0;
    }

    .manager-seller-row__metrics div {
        min-width: 0;
    }

    .manager-seller-row__metrics dt {
        color: var(--color-text-secondary);
        font-size: 0.7rem;
    }

    .manager-seller-row__metrics dd {
        min-width: 0;
        margin: 2px 0 0;
        overflow: hidden;
        font-size: 0.82rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .manager-seller-row__forecast {
        min-width: 0;
        overflow-x: auto;
    }

    .manager-pagination {
        justify-content: space-between;
    }

    .floating-table-overlay {
        z-index: 996;
        align-items: stretch;
        padding: 0;
    }

    .floating-table-dialog,
    :root[data-ui-style="quiet"] .floating-table-dialog {
        width: 100vw !important;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border: 0;
        border-radius: 0 !important;
    }

    .floating-table-dialog__header {
        min-height: 56px;
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .floating-table-dialog__body {
        padding: 12px 12px max(18px, env(safe-area-inset-bottom));
    }

    .floating-table-resize-handle {
        display: none;
    }
}
/* Unified CRM Formula authoring — idea-237-unified-crm-formula-authoring.mmd */
.crm-formula-expression {
  min-width: 0;
}

.crm-formula-expression__input {
  position: relative;
}

.crm-formula-expression .form-textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
}

.crm-formula-expression.is-compact .form-textarea {
  min-height: 72px;
}

.crm-formula-expression.is-invalid .form-textarea,
.crm-formula-expression .form-textarea[aria-invalid="true"] {
  border-color: var(--color-primary-red);
}

.crm-completion-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: min(320px, 42vh);
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  animation: crm-completion-in 100ms ease-out both;
}

.crm-completion-menu.is-portal {
  position: fixed;
  z-index: 10000;
  right: auto;
  bottom: auto;
}

.crm-completion-group {
  padding: 8px 10px 4px;
  color: var(--color-text-secondary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crm-completion-option {
  display: grid;
  width: 100%;
  gap: 2px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.crm-completion-option:hover,
.crm-completion-option.is-highlighted {
  background: var(--color-surface-active);
}

.crm-completion-option:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.crm-completion-option__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.crm-completion-option strong {
  color: var(--color-text-primary);
  font-size: 0.82rem;
}

.crm-completion-option > span,
.crm-completion-empty {
  color: var(--color-text-secondary);
  font-size: 0.74rem;
}

.crm-completion-option__reason {
  color: var(--color-primary-red) !important;
}

.crm-completion-empty {
  padding: 12px;
}

.crm-formula-badge {
  padding: 1px 6px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-secondary);
  font-size: 0.65rem;
  font-weight: 600;
}

.crm-formula-expected,
.crm-formula-status,
.crm-formula-analysis,
.crm-formula-diagnostic {
  margin-top: 6px;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
}

.crm-formula-status.is-checking,
.crm-formula-status.is-valid {
  color: var(--color-primary-green);
}

.crm-formula-status.is-dirty {
  color: var(--color-text-secondary);
}

.crm-formula-status.is-invalid,
.crm-formula-diagnostic.is-error {
  color: var(--color-primary-red);
}

.crm-formula-diagnostics {
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 2px solid var(--color-primary-red);
  background: var(--color-surface-alt);
}

.crm-formula-diagnostic {
  margin: 0;
}

.crm-formula-analysis summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 600;
}

.crm-formula-analysis > div {
  padding-top: 5px;
}

@media (prefers-reduced-motion: reduce) {
  .crm-completion-menu {
    animation: none;
  }
}
/* Interactive CRM lookup preview. This is a persistent, focusable surface, not a tooltip. */
.crm-record-hovercard {
  position: fixed;
  z-index: 1200;
  width: min(340px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  color: var(--color-text-primary);
  font-family: inherit;
}

.crm-record-hovercard[hidden] { display: none; }
.crm-record-hovercard__header { display: grid; gap: 2px; }
.crm-record-hovercard__object,
.crm-record-hovercard__label {
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  line-height: 1.3;
}

.crm-record-hovercard__title {
  color: var(--color-text-link);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.crm-record-hovercard__details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.crm-record-hovercard__detail,
.crm-record-hovercard__metric { display: grid; min-width: 0; gap: 2px; }
.crm-record-hovercard__value {
  color: var(--color-text-primary);
  font-size: 0.875rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-record-hovercard__lookup { color: var(--color-text-link); }
.crm-record-hovercard__value.crm-record-hovercard__money {
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: visible;
}
.crm-record-hovercard__money small { display: block; }
.crm-record-hovercard__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.crm-record-hovercard__metric .crm-record-hovercard__value {
  font-size: 1rem;
  font-weight: 650;
}

.crm-record-hovercard__status {
  display: block;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.crm-record-hovercard :focus-visible {
  outline: 2px solid var(--color-text-link);
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .crm-record-hovercard__details { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .crm-record-hovercard:not([hidden]) { animation: crm-hovercard-in 120ms ease-out; }
}

@keyframes crm-hovercard-in {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Workflow builder primitives.
   Layout remains page-owned; these cards are the reusable visual contract. */
.workflow-node-glyph {
  display: grid;
  width: 24px;
  height: 24px;
  flex: none;
  place-items: center;
  border-radius: 7px;
  background: color-mix(in srgb, var(--color-primary-blue) 10%, var(--color-surface));
  color: var(--color-primary-blue);
  font-size: 0.7rem;
  font-weight: 750;
}

.workflow-palette-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-surface-alt);
  cursor: grab;
  transition: border-color 120ms ease, background 120ms ease, transform 120ms ease;
}

.workflow-palette-item:hover {
  border-color: color-mix(in srgb, var(--color-primary-blue) 32%, var(--color-border));
  background: color-mix(in srgb, var(--color-primary-blue) 4%, var(--color-surface));
  transform: translateY(-1px);
}

.workflow-palette-item:active { cursor: grabbing; }
.workflow-palette-item__copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 1px;
}
.workflow-palette-item__copy strong {
  color: var(--color-text-primary);
  font-size: 0.72rem;
}
.workflow-palette-item__copy small {
  overflow: hidden;
  color: var(--color-text-secondary);
  font-size: 0.62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-palette-item__add {
  display: grid;
  width: 24px;
  height: 24px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-primary-blue);
  font: inherit;
  cursor: pointer;
}

.workflow-graph-node {
  min-height: 92px;
  padding: 11px 13px;
  border: 1px solid var(--color-border);
  border-left: 3px solid color-mix(in srgb, var(--color-primary-blue) 60%, var(--color-border));
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--color-primary-blue) 6%, transparent);
  cursor: pointer;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.workflow-graph-node:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px color-mix(in srgb, var(--color-primary-blue) 9%, transparent);
}

.workflow-graph-node.is-selected {
  border-color: var(--color-primary-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary-blue) 13%, transparent),
              0 10px 25px color-mix(in srgb, var(--color-primary-blue) 9%, transparent);
}

.workflow-graph-node--logic { border-left-color: var(--color-primary-blue); }
.workflow-graph-node--data { border-left-color: color-mix(in srgb, var(--color-primary-blue) 60%, var(--color-success)); }
.workflow-graph-node--crm_action { border-left-color: var(--color-success); }
.workflow-graph-node--composition { border-left-color: color-mix(in srgb, var(--color-primary-blue) 68%, var(--color-warning)); }
.workflow-graph-node--timing { border-left-color: var(--color-warning); }
.workflow-graph-node--outcome { border-left-color: var(--color-text-secondary); }

@media (prefers-reduced-motion: reduce) {
  .workflow-palette-item,
  .workflow-graph-node { transition: none; }
  .workflow-palette-item:hover,
  .workflow-graph-node:hover { transform: none; }
}

/* Shared CRM creation layout: home and related-record dialogs. */
.crm-creation-section { grid-column: 1 / -1; min-width: 0; }
.crm-creation-section h3 { margin: 0 0 var(--space-3, 12px); }
.crm-creation-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4, 16px); }
.crm-creation-cell { grid-column: span var(--creation-span, 2); min-width: 0; }
.crm-creation-cell > .form-group { margin: 0; }
@media (max-width: 640px) { .crm-creation-cell { grid-column: 1 / -1; } }

/* Record Overview density: shared across native CRM objects. */
.record-overview .record-section__heading { position: relative; }
.record-overview-density { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; cursor: pointer; position: absolute; right: 0; top: -1px; }
.record-overview-density__label { color: var(--color-text-secondary); line-height: 22px; }
.record-overview .record-section__heading h2 { padding-right: 100px; }
.record-overview--compact .record-section { padding-top: 12px; padding-bottom: 12px; }
.record-overview--compact .record-section__heading { margin-bottom: 8px; }
.record-overview--compact .record-section__fields { gap: 0; margin-top: 6px; }
.record-overview--compact .record-field { display: grid; grid-template-columns: minmax(90px, 124px) minmax(0, 1fr); gap: 4px 12px; align-items: baseline; padding: 7px 12px; min-height: 0; text-align: left; }
.record-overview--compact .record-field__label { margin: 0; color: var(--color-text-secondary); font-size: .74rem; font-weight: 500; line-height: 1.35; text-align: left; }
.record-overview--compact .record-field__value { margin: 0; min-width: 0; color: var(--color-text-primary, var(--color-text-body)); font-size: .9rem; font-weight: 500; line-height: 1.4; overflow-wrap: anywhere; text-align: left; justify-self: stretch; }
.record-overview--compact .record-field > small, .record-overview--compact .record-field > p { grid-column: 2; margin: 0; }
@media (max-width: 680px) { .record-overview--compact .record-field { grid-template-columns: minmax(85px, 112px) minmax(0, 1fr); } }

/* Canonical quiet o24 controls and admin navigation. */
:root[data-ui-style="quiet"] .btn-primary { background: var(--qa-blue); border-color: var(--qa-blue); color: #fff; font-weight: 500; box-shadow: none; }
:root[data-ui-style="quiet"] .btn-primary:hover:not(:disabled) { background: var(--qa-blue-hover); }
:root[data-ui-style="quiet"] .btn-secondary { border-color: var(--qa-line); background: var(--qa-surface); color: var(--qa-ink); font-weight: 500; }
:root[data-ui-style="quiet"] .admin-console { background: var(--qa-paper); border-color: var(--qa-line); }
:root[data-ui-style="quiet"] .admin-console__title { font-size: 13px; font-weight: 500; }
:root[data-ui-style="quiet"] .admin-console__section-title { color: var(--qa-muted); font-size: 10px; letter-spacing: .08em; border: 0; background: none; padding: 0; }
:root[data-ui-style="quiet"] .admin-console__item { border-radius: 6px; font-size: 13px; font-weight: 400; color: var(--qa-muted); }
:root[data-ui-style="quiet"] .admin-console__item--active { background: var(--qa-soft); color: var(--color-text-link); font-weight: 500; }
:root[data-ui-style="quiet"] .nav-dropdown > summary { border-radius: 6px; border-color: var(--qa-line); box-shadow: none; }
:root[data-ui-style="quiet"] .nav-dropdown .nav-menu { border-radius: 8px; border-color: var(--qa-line); box-shadow: var(--shadow-lg); }
:root[data-ui-style="quiet"] :is(h1,h2,h3) { font-weight: 500; letter-spacing: -.025em; }

:root[data-ui-style="quiet"] .nav-menu .nav-menu-item--danger { color: var(--color-danger); }
:root[data-ui-style="quiet"] .toggle-switch input:checked + .toggle-track { background: var(--qa-blue); }

/* Accessible object identity: record scope and the metadata/atlas preview only. */
:root .crm-object-theme { --crm-object-field-line: color-mix(in srgb, var(--crm-object-strong) 16%, transparent); --crm-object-section-line: color-mix(in srgb, var(--crm-object-strong) 28%, transparent); }
:root .crm-object-theme .record-page__identity h1,
:root .crm-object-theme .record-command__title,
:root .crm-object-theme .crm-object-preview-title,
:root .crm-object-theme .record-lookup-link { color: var(--crm-object-strong); }
:root .crm-object-theme .record-lookup-link { text-decoration: underline; text-underline-offset: 3px; }
:root .crm-object-theme .record-overview .record-section { border-bottom-color: var(--crm-object-section-line); }
:root .crm-object-theme .record-overview .record-section__fields > .record-field { border-bottom-color: var(--crm-object-field-line); }
:root .crm-object-theme .btn-primary { background: var(--crm-object-strong); border-color: var(--crm-object-strong); color: var(--crm-object-on-strong); transition: transform .14s ease; }
:root .crm-object-theme .btn-primary:hover:not(:disabled) { filter: none; background: var(--crm-object-hover); border-color: var(--crm-object-hover); }
:root .crm-object-theme .record-toggle input { accent-color: var(--crm-object-strong); }
:root .crm-object-theme .toggle-track { background: var(--color-text-secondary); transition: none; }
:root .crm-object-theme .toggle-track::after { background: var(--color-bg-cream); }
.crm-object-color-preview .toggle-switch input,
:root .crm-object-theme .toggle-switch input { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; }
:root .crm-object-theme .toggle-switch input:checked + .toggle-track { background: var(--crm-object-strong); }
:root .crm-object-theme .toggle-switch input:checked + .toggle-track::after { background: var(--crm-object-on-strong); }
:root .crm-object-theme .toggle-switch input:focus-visible + .toggle-track,
:root .crm-object-theme .btn-primary:focus-visible,
:root .crm-object-theme .record-lookup-link:focus-visible { outline: 2px solid var(--crm-object-strong); outline-offset: 3px; }
:root .crm-object-theme .record-stage__primary button.is-current,
:root .crm-object-theme .record-stage__secondary button.is-current { --record-stage-fill: var(--record-stage-current-fill, var(--crm-object-strong)); background: var(--record-stage-current-fill, var(--crm-object-strong)); border-color: var(--record-stage-current-fill, var(--crm-object-strong)); color: var(--record-stage-current-ink, var(--crm-object-on-strong)); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; opacity: 1; transition: transform .14s ease; }
:root .crm-object-theme .record-stage__primary button.is-current:hover:not(:disabled),
:root .crm-object-theme .record-stage__secondary button.is-current:hover:not(:disabled) { --record-stage-fill: var(--record-stage-current-fill, var(--crm-object-hover)); background: var(--record-stage-current-fill, var(--crm-object-hover)); color: var(--record-stage-current-ink, var(--crm-object-on-strong)); }
:root .crm-object-theme .record-stage__primary button.is-current span { opacity: 1; }
:root .crm-object-theme .record-stage__primary button.is-current.is-draft::after { color: color-mix(in srgb, var(--crm-object-strong) 68%, #111827); }
:root .crm-object-theme .record-stage__primary button:focus-visible { box-shadow: inset 0 0 0 3px var(--record-stage-option-ink, var(--crm-object-on-strong)); }
:root .crm-object-theme .record-stage__primary button.is-current:focus-visible { box-shadow: inset 0 0 0 3px var(--record-stage-current-ink, var(--crm-object-on-strong)); }
:root .crm-object-theme .record-stage__secondary button:focus-visible { outline: 2px solid var(--crm-object-strong); outline-offset: 2px; }
.crm-object-color-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding-block: 12px; border-top: 1px solid var(--crm-object-section-line, var(--color-border)); border-bottom: 1px solid var(--crm-object-field-line, var(--color-border)); }
.crm-object-color-preview .crm-object-preview-title { flex-basis: 100%; font-size: 1.25rem; }
.crm-object-color-preview .record-stage__primary { flex-basis: 100%; }
@media (forced-colors: active) {
  :root .crm-object-theme .record-stage__primary button.is-current,
  :root .crm-object-theme .record-stage__secondary button.is-current { background: Highlight !important; color: HighlightText !important; forced-color-adjust: none; }
}

:root .crm-object-theme .record-stage__secondary button.is-draft::after { content: "Draft"; margin-left: 7px; font-size: .64rem; text-transform: uppercase; }

/* Lookup identity belongs to the destination, including a body-mounted compact preview. */
:root .record-lookup-link[data-crm-preview-object]:focus-visible,
:root .crm-object-link[data-crm-preview-object]:focus-visible { outline-color: var(--crm-lookup-strong, var(--color-text-link)); }
:root .crm-record-hovercard.crm-object-theme { border-top: 3px solid var(--crm-object-strong); }
:root .crm-record-hovercard.crm-object-theme .crm-record-hovercard__title,
:root .crm-compact-editor__sample.crm-object-theme > strong { color: var(--crm-object-strong); }
:root .crm-record-hovercard.crm-object-theme .crm-record-hovercard__title { text-decoration: underline; }
:root .crm-record-hovercard.crm-object-theme .crm-record-hovercard__details,
:root .crm-record-hovercard.crm-object-theme .crm-record-hovercard__metrics { border-color: var(--crm-object-section-line); }
:root .crm-compact-editor__sample.crm-object-theme { border-color: var(--crm-object-section-line); }

.crm-money-input { position: relative; }
.crm-money-input .form-input { padding-right: 4.25rem; }
.crm-money-input__currency { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); font-size: .75rem; font-weight: 700; letter-spacing: .04em; pointer-events: none; }
.crm-fx-value { display: inline-flex; position: relative; }
.crm-fx-value__trigger { border-radius: .25rem; outline-offset: .2rem; }
.crm-fx-value__card { left: 0 !important; min-width: min(18rem, calc(100vw - 32px)); display: grid; gap: .45rem; text-align: left; font-weight: 400; transform: translateY(4px) !important; }
.crm-fx-value:hover .crm-fx-value__card,
.crm-fx-value:focus-within .crm-fx-value__card { transform: translateY(0) !important; }
.crm-fx-value__row { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 1rem; align-items: start; }
.crm-fx-value__row span:first-child { color: var(--color-text-muted); }
.crm-fx-value__row strong { font-weight: 700; overflow-wrap: anywhere; }
.crm-picklist-row { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 2px; border: 0; border-bottom: 1px solid var(--color-border); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.crm-picklist-row > span:first-child { display: grid; gap: 2px; }

/* Quiet working tables and icon actions: shared with the Quiet atlas. */
:root .o24-icon-action.o24-icon-action {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; width: 36px; min-width: 36px; height: 36px; min-height: 36px;
    padding: 8px; gap: 0; border-radius: var(--radius-sm); line-height: 1;
}
.o24-icon-action svg { display: block; flex: none; width: 18px; height: 18px; }
.o24-icon-action > span[aria-hidden] { display: inline-flex; }
.o24-icon-action:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: 3px; }
.o24-icon-action--danger:hover:not(:disabled) { color: var(--color-danger); border-color: var(--color-danger); }
.o24-icon-action:disabled { opacity: .45; cursor: not-allowed; }

/* Shared header-edge column resizing */
.o24-resizable-header { position: relative; }
.o24-column-handle {
  position: absolute; inset-block: 0; right: 0; width: 10px;
  cursor: col-resize; touch-action: none; user-select: none; z-index: 10;
}
.o24-column-handle::after { content: ''; position: absolute; inset-block: 8px; right: 3px; width: 2px; background: transparent; }
.o24-column-handle:is(:hover, :focus-visible)::after, .is-column-resizing .o24-column-handle::after { background: var(--color-primary-blue); }
.o24-column-handle:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: -2px; }
.is-column-resizing, .is-column-resizing * { cursor: col-resize !important; user-select: none !important; }
@media print { .o24-column-handle { display: none; } }

.o24-data-table.o24-data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.o24-data-table.o24-data-table :is(th, td) {
    height: 44px; padding: 10px 14px; border-bottom: 1px solid var(--color-border-light, var(--color-border));
    text-align: left; vertical-align: middle; font-size: .84rem; line-height: 1.4;
}
.o24-data-table.o24-data-table thead th {
    position: sticky; top: 0; z-index: 2; height: 38px; padding-block: 8px;
    background: var(--color-surface-alt); color: var(--color-text-secondary);
    font-size: .75rem; font-weight: 500; text-transform: none; letter-spacing: 0;
    box-shadow: 0 1px 0 var(--color-border);
}
.o24-data-table.o24-data-table tbody tr { background: var(--color-surface); }
.o24-data-table.o24-data-table tbody tr:hover,
.o24-data-table.o24-data-table tbody tr:focus-within { background: var(--color-surface-alt); }
.o24-data-table.o24-data-table tbody th { background: transparent; font-weight: 500; text-transform: none; }
.o24-data-table.o24-data-table tbody tr:last-child > * { border-bottom: 0; }
.o24-data-table.o24-data-table .o24-data-table__number {
    text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.o24-data-table__number button { justify-content: flex-end; }
.o24-data-table a:focus-visible, .o24-data-table button:focus-visible,
.crm-object-table-wrap:focus-visible, .record-table-wrap:focus-visible {
    outline: 2px solid var(--color-primary-blue); outline-offset: -2px;
}
.o24-table-overflow__preview { display: block; width: 100%; min-width: 0; max-height: 30px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o24-table-overflow__preview.is-record-link > a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.o24-table-overflow__preview.is-overflowing { cursor: zoom-in; }
.o24-table-overflow__preview.is-overflowing:hover { text-decoration: underline; text-underline-offset: 3px; }
.o24-table-overflow__preview:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: -2px; }
.o24-table-overflow__popover { position: fixed; z-index: 1100; display: flex; align-items: flex-start; gap: 12px; overflow: auto; padding: 12px; border: 1px solid var(--color-primary-blue); border-radius: 6px; background: var(--color-surface); color: var(--color-text-primary); box-shadow: 0 12px 32px rgb(0 0 0 / 18%); font-size: .84rem; line-height: 1.5; }
.o24-table-overflow__full { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.o24-table-overflow__full a { color: var(--color-text-link); font-weight: 600; }
.o24-table-overflow__close { flex: none; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--color-text-secondary); font: inherit; font-size: 1.2rem; cursor: pointer; }
.o24-table-overflow__close:hover { background: var(--color-surface-alt); }
.o24-table-overflow__close:focus-visible { outline: 2px solid var(--color-primary-blue); }
.record-create-action { display: inline-flex; align-items: center; gap: 6px; }
.record-create-action svg { width: 16px; height: 16px; }
.record-page__header { padding-bottom: 20px; border-bottom: 1px solid var(--color-border); }
.record-page__heading { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 20px; }
.record-page__identity { min-width: 0; flex: 1 1 340px; }
.record-page__identity h1 { margin: 5px 0 0; color: var(--color-text-primary); font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.2; letter-spacing: -.035em; overflow-wrap: anywhere; }
.record-header-fields { display: flex; width: calc(100% + 20px); flex-wrap: wrap; margin: 0 -10px; }
.record-header-fields .record-field { flex: 0 0 auto; padding: 8px 10px; }
.record-overview { padding-top: 6px; }
.record-section { padding: 20px 0; border-bottom: 1px solid var(--color-border); }
.record-section__heading h2 { margin: 0; font-size: .95rem; font-weight: 600; }
.record-section__heading p { max-width: 70ch; margin: 5px 0 0; color: var(--color-text-secondary); font-size: .84rem; }
.record-section__fields { display: flex; flex-wrap: wrap; margin: 12px 0 0; }
.record-field { position: relative; min-width: 0; padding: 13px 12px; border-radius: var(--radius-sm); }
.record-field--25 { width: 25%; } .record-field--50 { width: 50%; } .record-field--75 { width: 75%; } .record-field--100 { width: 100%; }
.record-field__label { display: block; margin-bottom: 6px; color: var(--color-text-secondary); font-size: .76rem; font-weight: 500; }
.record-field__label-text { display: block; }
.record-field__value { min-height: 22px; font-size: .95rem; font-weight: 500; }

/* Anonymous native scalar form; no authenticated application shell. */
.public-intake-page { height: auto; min-height: 0; background: var(--color-surface); color: var(--color-text-primary); }
/* Match the black/white pair used by intake accent contrast validation. */
:root[data-theme="dark"] .public-intake-page { background: #000; }
.public-intake-form { box-sizing: border-box; width: 100%; max-width: 640px; margin: 0 auto; padding: 24px; overflow-wrap: anywhere; }
.public-intake-form h1 { margin: 0 0 20px; font-size: 1.5rem; line-height: 1.25; color: var(--color-text-primary); }
.public-intake-form form { display: grid; gap: 20px; min-width: 0; }
.public-intake-form[data-spacing="compact"] form { gap: 12px; }
.public-intake-form .form-group { min-width: 0; margin: 0; }
.public-intake-form :is(.form-input, .form-select, .form-textarea) { box-sizing: border-box; width: 100%; min-width: 0; }
.public-intake-form .record-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.public-intake-form .btn-primary, .public-intake-form .btn-primary:hover { width: auto; background-color: var(--public-intake-accent, var(--qa-blue)); border-color: var(--public-intake-accent, var(--qa-blue)); color: var(--public-intake-on-accent, #fff); }
.public-intake-form p { margin: 8px 0; }
.public-intake-form .text-meta { color: var(--color-text-secondary); }
.public-intake-honeypot { display: none; }
@media (max-width: 480px) { .public-intake-form { padding: 16px; } }
.record-header-fields { margin-top: 10px; }
.record-header-fields .record-field { min-width: 140px; }
.record-header-fields .record-field__value { font-size: .9rem; }
.record-section__fields .record-field__value { overflow-wrap: anywhere; min-width: 0; }
@media (pointer: coarse) {
    :root .o24-icon-action.o24-icon-action { width: 44px; min-width: 44px; height: 44px; }
}
@media (max-width: 680px) {
    .record-section__fields .record-field { width: 100%; }
    .record-header-fields .record-field { min-width: 0; flex: 1 1 150px; }
}

.o24-data-table.o24-data-table.compact td { height: 36px; padding-block: 6px; }

@media (max-width: 680px) {
    :root .o24-icon-action.o24-icon-action { width: 44px; min-width: 44px; height: 44px; }
}

/* Shared record action disclosure and CRM feedback; Quiet atlas uses these too. */
.record-more { position: relative; }
.record-more > button { gap: 6px; }
.record-more > button svg, .record-more__panel svg { width: 18px; height: 18px; flex: none; }
.record-more__panel {
  position: fixed; inset: auto; margin: 0; width: 240px; max-width: calc(100vw - 24px);
  max-height: min(440px, calc(100dvh - 100px)); overflow-y: auto; padding: 6px;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text-primary); box-shadow: var(--shadow-md);
}
:root .record-more__panel > .btn-secondary, :root .record-more__panel > a {
  display: flex; width: 100%; min-height: 40px; justify-content: flex-start; gap: 10px;
  border: 0; background: transparent; box-shadow: none; padding: 9px 10px;
  text-align: left; white-space: normal;
}
:root .record-more__panel > .btn-secondary:hover, :root .record-more__panel > a:hover { background: var(--color-surface-alt); }
:root .record-more__panel > .record-more__danger { color: var(--color-danger); border-top: 1px solid var(--color-border); }
:is(.crm-object-page, .record-page, .record-command, .record-more__panel) :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--color-primary-blue); outline-offset: 3px;
}
.o24-feedback { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 14px; border-left: 3px solid var(--color-primary-blue); background: var(--color-surface-alt); }
.o24-feedback--error { border-color: var(--color-danger); color: var(--color-danger); }
.o24-feedback--success { border-color: var(--color-success, #168254); }
.o24-toast { position: fixed; z-index: 100; top: 72px; right: max(16px, env(safe-area-inset-right)); width: max-content; max-width: min(440px, calc(100vw - 32px)); margin: 0; border: 1px solid var(--color-border); border-left: 3px solid var(--color-success, #168254); border-radius: 6px; background: var(--color-surface); box-shadow: 0 10px 30px rgb(0 0 0 / 12%); pointer-events: none; }
@media (max-width: 680px) { :root .record-more__panel > .btn-secondary, :root .record-more__panel > a { min-height: 44px; } }

.o24-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Currency evidence stays inside its field in narrow and split record panes. */
.record-field .crm-fx-value { position: static; }
.record-field .crm-fx-value__card { left: 12px !important; width: 18rem; min-width: 0; max-width: calc(100% - 24px); }

/* Table editing: shared with the Quiet atlas table specimen. */
.o24-edit-cell { position: relative; display: flex; align-items: center; gap: 6px; min-height: 30px; min-width: 100px; padding: 3px 5px; margin: -3px -5px; border-radius: 4px; }
.o24-edit-cell:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: 1px; }
.o24-edit-cell__value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.o24-edit-cell__trigger { flex: 0 0 24px; display: grid; place-items: center; width: 24px; height: 26px; padding: 4px; border: 0; border-radius: 4px; background: transparent; color: var(--color-text-secondary); opacity: 0; cursor: pointer; }
.o24-edit-cell__trigger svg { width: 15px; height: 15px; }
.o24-edit-cell:hover .o24-edit-cell__trigger, .o24-edit-cell:focus-within .o24-edit-cell__trigger { opacity: 1; }
.o24-edit-cell__trigger:hover { color: var(--color-primary-blue); background: var(--color-surface-alt); }
.o24-edit-cell.is-dirty { box-shadow: inset 3px 0 var(--color-primary-blue); background: color-mix(in srgb, var(--color-primary-blue) 6%, var(--color-surface)); }
.o24-edit-cell.has-error { box-shadow: inset 3px 0 var(--color-error, #b42318); }
.o24-edit-cell :is(.form-input, .form-select) { min-width: 120px; width: 100%; max-width: 340px; min-height: 32px; padding: 5px 8px; }
.o24-edit-cell .crm-money-input { display: flex; align-items: center; gap: 5px; }
.o24-edit-cell .crm-multi-choice-control { display: flex; flex-wrap: wrap; white-space: normal; max-width: 340px; }
.o24-row-edit-bar, .o24-bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; margin: 8px 0; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface); font-size: .84rem; }
.o24-row-edit-bar { position: sticky; top: 0; z-index: 4; border-color: var(--color-primary-blue); }
.o24-row-edit-bar > span:first-child, .o24-bulk-bar > span:first-child { flex: 1; font-weight: 600; }
.o24-data-table.o24-data-table .o24-table-selection { width: 42px; min-width: 42px; padding-inline: 12px; }
.o24-table-selection input { width: 16px; height: 16px; accent-color: var(--color-primary-blue); cursor: pointer; }
.o24-data-table.o24-data-table tr.is-selected { background: color-mix(in srgb, var(--color-primary-blue) 5%, var(--color-surface)); }
.o24-edit-dialog { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface); color: var(--color-text-primary); box-shadow: 0 20px 70px rgb(0 0 0 / 18%); overflow: auto; }
.o24-edit-dialog::backdrop { background: rgb(15 23 42 / 36%); }
.o24-edit-dialog__header { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--color-border); background: var(--color-surface); }
.o24-edit-dialog__header h2 { margin: 0; font-size: 1.1rem; }
.o24-edit-dialog__body { padding: 20px 22px; overflow-wrap: anywhere; }
.o24-edit-dialog__body > p { margin: 0 0 16px; color: var(--color-text-secondary); }
.o24-edit-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.o24-edit-error { color: var(--color-error, #b42318); font-size: .8rem; white-space: normal; }
.o24-edit-choice { display: block; width: 100%; padding: 12px; text-align: left; background: transparent; color: inherit; border: 0; border-bottom: 1px solid var(--color-border); cursor: pointer; font: inherit; }
.o24-edit-choice:hover, .o24-edit-choice:focus-visible { background: var(--color-surface-alt); }
.o24-bulk-field { display: grid; grid-template-columns: 1fr; gap: 8px; padding-block: 16px; border-bottom: 1px solid var(--color-border); margin-bottom: 12px; }
.o24-bulk-field small { color: var(--color-text-secondary); }
.o24-bulk-results { list-style: none; padding: 0; }
.o24-bulk-results li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-block: 12px; border-bottom: 1px solid var(--color-border); }
.o24-bulk-results li > span { flex: 1; min-width: 160px; }
.o24-edit-dialog progress { width: 100%; accent-color: var(--color-primary-blue); }
/* Record brief documents are shared by admin preview and record readers. */
.o24-brief-dialog { width: min(960px, calc(100vw - 32px)); }
.o24-brief-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 12px; }
.o24-brief-actions .form-input { width: min(240px, 100%); }
.o24-brief-admin > table { width: 100%; }
.o24-brief-document { max-width: 76ch; margin-inline: auto; font-size: 1rem; line-height: 1.65; overflow-wrap: anywhere; white-space: normal; }
.o24-brief-document h1 { font-size: 1.65rem; line-height: 1.25; margin-block: 0 1rem; }
.o24-brief-document h2 { font-size: 1.25rem; line-height: 1.35; margin-block: 1.5rem .75rem; }
.o24-brief-document h3 { font-size: 1.1rem; }
.o24-brief-document p { margin-block: .75rem; }
.o24-brief-section { margin-block: 1.25rem; }
.o24-brief-table table { width: 100%; table-layout: fixed; }
.o24-brief-table .o24-data-table :is(td, th) { height: auto; white-space: normal; overflow-wrap: anywhere; }
.o24-brief-table .o24-data-table thead th { position: static; }
.o24-brief-table__continuation { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-block: 12px; }
/* Approved brief presentation primitives; source templates never supply CSS. */
.o24-brief-document .brief-showcase { max-width: 100%; }
.o24-brief-document:has(.brief-showcase) { max-width: none; }
.o24-brief-document .brief-hero { padding: 32px 36px; color: #fff; background: var(--qa-blue); border-radius: var(--radius-lg); border-bottom: 6px solid #8bb3ff; }
.o24-brief-document .brief-brand-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 32px; }
.o24-brief-logo { display: block; width: 112px; height: 44px; object-fit: contain; object-position: left center; }
.o24-brief-document .brief-eyebrow { margin: 0; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.o24-brief-document .brief-hero h1 { max-width: 22ch; font-size: clamp(1.9rem, 4vw, 3.3rem); font-weight: 600; letter-spacing: -.04em; margin-bottom: 12px; color: inherit; }
.o24-brief-document .brief-subtitle { font-size: 1rem; margin: 0 0 20px; color: inherit; }
.o24-brief-document .brief-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; margin: 24px 0; }
.o24-brief-document .brief-metric { min-width: 0; padding: 20px 22px; border-top: 3px solid currentColor; }
.o24-brief-document .brief-blue { color: var(--color-text-link); background: var(--qa-soft); }
.o24-brief-document .brief-green { color: var(--qa-green); background: var(--qa-green-bg); }
.o24-brief-document .brief-amber { color: var(--qa-amber); background: var(--qa-amber-bg); }
.o24-brief-document .brief-label { font-size: .72rem; line-height: 1.4; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 7px; color: var(--qa-muted); }
.o24-brief-document .brief-metric .brief-label { color: inherit; }
.o24-brief-document .brief-value { font-size: clamp(1.2rem, 2.6vw, 1.8rem); line-height: 1.3; font-weight: 600; letter-spacing: -.025em; margin: 0; color: var(--qa-ink); }
.o24-brief-document .brief-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.o24-brief-document .brief-details { margin: 0; padding-bottom: 20px; border-bottom: 1px solid var(--qa-line); }
.o24-brief-document .brief-details h2 { margin: 0 0 22px; }
.o24-brief-document .brief-details .brief-label { margin-top: 18px; }
.o24-brief-document .brief-details p:not(.brief-label) { margin: 0; }
.o24-brief-document .brief-next-step { padding: 20px 24px; border-left: 4px solid var(--qa-green); background: var(--qa-green-bg); }
.o24-brief-document .brief-next-step h2 { margin: 0 0 8px; color: var(--qa-green); }
.o24-brief-document .brief-next-step p { margin: 0; }
.o24-brief-document .brief-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; padding-top: 16px; border-top: 1px solid var(--qa-line); color: var(--qa-muted); font-size: .72rem; }
.o24-brief-document .brief-footer p { margin: 0; }
@media screen and (max-width: 680px) {
  .o24-brief-document .brief-hero { padding: 24px 20px; }
  .o24-brief-document .brief-brand-row { margin-bottom: 24px; }
  .o24-brief-document .brief-grid, .o24-brief-document .brief-columns { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .o24-brief-dialog { width: calc(100vw - 16px); }
  .o24-brief-table table, .o24-brief-table tbody, .o24-brief-table tr, .o24-brief-table td { display: block; width: 100%; }
  .o24-brief-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .o24-brief-table td { display: grid; grid-template-columns: minmax(80px, 35%) minmax(0, 1fr); gap: 12px; }
  .o24-brief-table td::before { content: attr(data-label); font-weight: 600; color: var(--color-text-secondary); }
  .o24-brief-table tr { border-bottom: 1px solid var(--color-border); padding-block: 8px; }
}
@media print {
  body:has(> .o24-brief-dialog[open]) { display: block; height: auto; min-height: 0; overflow: visible; margin: 0; background: var(--color-surface); }
  body:has(> .o24-brief-dialog[open]) > :not(.o24-brief-dialog[open]) { display: none !important; }
  .o24-brief-dialog[open] { position: static; inset: auto; margin: 0; width: 100%; max-width: none; max-height: none; height: auto; overflow: visible; border: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .o24-brief-dialog[open]::backdrop { display: none; }
  .o24-brief-dialog[open] .o24-edit-dialog__header, .o24-brief-dialog[open] .o24-brief-actions { display: none; }
  .o24-brief-dialog[open] .o24-edit-dialog__body { padding: 0; overflow: visible; }
  .o24-brief-document .brief-metric, .o24-brief-document .brief-next-step, .o24-brief-document .brief-hero { break-inside: avoid; }
  .o24-brief-document h1, .o24-brief-document h2, .o24-brief-document h3 { break-after: avoid; }
  .o24-brief-table tr { break-inside: avoid; }
  .o24-brief-table thead { display: table-header-group; }
}
@media (hover: none), (max-width: 680px) {
  .o24-edit-cell__trigger { opacity: 1; width: 36px; height: 36px; flex-basis: 36px; }
  .o24-edit-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .o24-edit-dialog__header, .o24-edit-dialog__body { padding: 16px; }
  .o24-edit-actions > button { flex: 1; min-height: 44px; }
}
/* Optional picklist colors keep labels and a contrast-selected foreground. */
.o24-choice-chip { display: inline-block; max-width: min(100%, 28ch); padding: 2px 8px; border-radius: 5px; font-size: inherit; font-weight: 500; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.o24-object-prefix { flex: none; padding: 2px 6px; background: var(--crm-object-strong, var(--qa-blue)); color: var(--crm-object-on-strong, #fff); font-size: 10px; font-weight: 600; letter-spacing: .04em; }
.o24-edit-cell:has(.o24-choice-chip) { min-width: max-content; }
.o24-choice-values { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: 100%; }
.o24-choice-color-control { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.o24-choice-color-control input[type="color"] { width: 36px; height: 32px; padding: 2px; border: 1px solid var(--color-border); border-radius: 5px; background: var(--color-surface); cursor: pointer; }
.o24-choice-color-control .form-input { width: 104px; min-width: 0; }

/* Native report charts */
.o24-report-chart { min-width: 0; color: var(--qa-ink); }
.o24-report-chart svg { display: block; width: 100%; max-height: 62vh; overflow: visible; }
.o24-report-chart__grid { stroke: var(--qa-line); stroke-width: 1; }
.o24-report-chart__label { fill: var(--qa-muted); font-size: 13px; font-family: inherit; }
.o24-report-chart__mark { outline: none; cursor: pointer; transition: opacity 160ms, filter 160ms; }
.o24-report-chart__bar { transition: x 380ms ease, y 380ms ease, height 380ms ease, width 380ms ease, fill 300ms ease; }
.o24-report-chart__mark:hover { filter: brightness(1.08); }
.o24-report-chart__mark:focus-visible { stroke: var(--qa-ink); stroke-width: 3; }
.o24-report-chart__pie-label { fill: white; font-size: 17px; font-weight: 700; paint-order: stroke; stroke: #18213677; stroke-width: 3px; }
.o24-report-chart__legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; list-style: none; padding: 0; margin: 12px 0 0; }
.o24-report-chart__legend li { display: flex; align-items: center; gap: 7px; color: var(--qa-muted); font-size: .78rem; }
.o24-report-chart__swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.o24-report-chart__note { color: var(--qa-muted); text-align: center; font-size: .76rem; margin-top: 18px; }
.o24-report-chart__empty { min-height: 300px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; color: var(--qa-muted); }
.o24-report-chart__empty strong { color: var(--qa-ink); font-size: 1.2rem; font-weight: 550; }
.o24-report-chart__table { overflow-x: auto; }
.o24-report-chart__table td { text-align: right; font-variant-numeric: tabular-nums; }
.o24-report-chart__link { padding: 0; border: 0; background: none; color: var(--qa-blue); font: inherit; text-align: left; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .o24-report-chart__mark, .o24-report-chart__bar { transition: none; } }
/* CRM field help is shared by records, creation forms, tables and administration. */
.crm-field-help {
  display: inline-flex;
  vertical-align: middle;
  margin-inline-start: 0.25rem;
}
.crm-field-help__trigger {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
}
.crm-field-help:hover .crm-field-help__trigger,
.crm-field-help.is-open .crm-field-help__trigger,
.crm-field-help__trigger:focus-visible,
.form-group:hover .crm-field-help__trigger,
.form-group:focus-within .crm-field-help__trigger,
.record-field:hover .crm-field-help__trigger,
.record-field:focus-within .crm-field-help__trigger,
th:hover .crm-field-help__trigger,
th:focus-within .crm-field-help__trigger {
  opacity: 1;
}
.crm-field-help__trigger:focus-visible,
.crm-field-help__close:focus-visible {
  outline: 2px solid var(--color-text-link);
  outline-offset: 2px;
}
.crm-field-help__panel {
  position: fixed;
  z-index: 1200;
  box-sizing: border-box;
  width: min(360px, calc(100vw - 24px));
  max-height: min(440px, calc(100vh - 48px));
  overflow-y: auto;
  overflow-wrap: anywhere;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: 0 12px 36px rgb(0 0 0 / 18%);
  text-align: start;
  font-size: 0.875rem;
  font-weight: 400;
  white-space: normal;
}
.crm-field-help__panel h3 {
  margin: 0.8rem 0 0.35rem;
  font-size: 0.82rem;
}
.crm-field-help__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.crm-field-help__title { display: block; font-size: 0.95rem; }
.crm-field-help__admin.has-divider {
  border-top: 1px solid var(--color-border);
  margin-top: 0.75rem;
  padding-top: 0.4rem;
}
.crm-field-help__content p { margin: 0.4rem 0; }
.crm-field-help__content ul,
.crm-field-help__content ol { padding-inline-start: 1.4rem; margin: 0.4rem 0; }
.crm-field-help__content a { color: var(--color-text-link); text-decoration: underline; }
.crm-field-help__close { display: grid; flex: none; width: 28px; height: 28px; place-items: center; margin: -5px -5px 0 0; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.crm-field-help__close:hover { background: var(--color-surface-alt); color: var(--color-text-primary); }
.crm-field-help__close svg { display: block; width: 16px; height: 16px; }
.crm-field-help-editor__toolbar,
.crm-field-help-editor__link { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.4rem 0; }
.crm-field-help-editor__toolbar .btn-secondary { min-height: 30px; padding: 0.2rem 0.5rem; }
.crm-field-help-editor__link .form-input { flex: 1 1 8rem; min-width: 0; }
/* Segmented view selection, matching native object Table/Kanban controls. */
.o24-view-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-surface-alt); }
.o24-view-switch button { display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 5px; padding: 7px 14px; background: transparent; color: var(--color-text-secondary); font: inherit; font-weight: 600; cursor: pointer; }
.o24-view-switch button[aria-pressed="true"] { background: var(--color-surface); color: var(--color-primary-blue); box-shadow: 0 1px 3px rgb(0 0 0 / 8%); }
.o24-view-switch button:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: 3px; }
.o24-view-switch button > span[aria-hidden] { display: inline-flex; }
.o24-view-switch svg { width: 16px; height: 16px; }
.crm-field-help-editor__preview {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  white-space: normal;
}
@media (hover: none), (pointer: coarse) {
  .crm-field-help__trigger { opacity: 1; min-width: 40px; min-height: 40px; }
  .crm-field-help__close { width: 44px; height: 44px; }
}

/* Native security proof uses the same controls on login, Company Settings and User. */
.native-mfa { min-width: 0; }
/* Native impersonation context: shared by every authenticated native shell. */
.o24-impersonation-bar { position: fixed; inset: auto auto max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); z-index: 20000; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; width: 420px; max-width: calc(100dvw - 24px); max-height: calc(100dvh - 24px); overflow: auto; padding: 12px; border: 1px solid var(--color-border); border-inline-start: 3px solid var(--color-primary-blue); border-radius: 12px; background: var(--color-surface); color: var(--color-text-primary); font-size: .78rem; line-height: 1.4; box-shadow: 0 4px 20px rgb(0 0 0 / 14%); }
.o24-impersonation-bar__identity { display: grid; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.o24-impersonation-bar strong { font-weight: 600; }
.o24-impersonation-bar__meta { color: var(--color-text-secondary); font-size: .7rem; }
.o24-impersonation-bar > .btn-secondary { width: 112px; white-space: normal; }
.o24-impersonation-bar button.o24-impersonation-bar__identity { width: auto; min-height: 44px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.o24-impersonation-bar__identity:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: 3px; }
.o24-impersonation-bar--compact { width: 48px; height: 48px; box-sizing: border-box; padding: 0; border: 1px solid var(--color-primary-blue); border-radius: 50%; overflow: visible; display: block; }
.o24-impersonation-bar--compact button.o24-impersonation-bar__identity { width: 100%; height: 100%; display: grid; place-items: center; border-radius: inherit; color: var(--color-primary-blue); font-weight: 600; }
:root .o24-impersonation-bar .btn-secondary { min-height: 44px; padding: 6px 10px; font-size: .75rem; background: var(--color-surface-alt); color: var(--color-text-primary); border-color: var(--color-border); transition: none; }
.o24-impersonation-bar__message { grid-column: 1 / -1; }
.o24-impersonation-bar__message + button { grid-column: 2; grid-row: 1; }
.native-mfa__form, .native-mfa__body { display: grid; gap: var(--space-3, 12px); }
.native-mfa .form-input, .native-mfa .form-textarea { width: 100%; box-sizing: border-box; }
.native-mfa .form-label { display: grid; gap: 6px; }
.native-mfa img { max-width: 100%; object-fit: contain; background: white; }
.native-mfa dialog, dialog.native-mfa { width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; }
.native-mfa button { margin: 4px 4px 4px 0; }
.native-mfa__actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2, 8px); }
.native-mfa__actions button { margin: 0; }

/* Meeting colors and discussion cues; category and criterion meanings stay distinct. */
.o24-meeting-legend, .o24-meeting-indicators, .meeting-appearance-preview { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.o24-meeting-category, .meeting-preview-event { display: inline-block; padding: 5px 8px; border-radius: 5px; background: var(--color-surface-alt); color: var(--color-text-primary); font-size: 12px; }
.o24-meeting-legend { margin: 6px 0 12px; }
.o24-meeting-indicators { margin-top: 4px; }
.o24-meeting-indicator { padding: 2px 5px; border: 1px solid var(--color-border); border-inline-start: 3px solid var(--color-border); border-radius: 4px; background: var(--color-surface); color: var(--color-text-primary); font: 11px/1.3 var(--font-ui, sans-serif); overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
button.o24-meeting-indicator { cursor: pointer; }
.o24-meeting-indicator:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: 2px; }
.meeting-source-selection { border: 1px solid var(--color-border); border-radius: 8px; padding: 12px; }
.meeting-source-choice { display: flex; align-items: center; gap: 8px; margin: 8px 0; overflow-wrap: anywhere; }
.meeting-appearance-preview { margin: 18px 0; }
.meeting-settings-tabs { overflow-x: auto; }
.meeting-tabs { overflow-x: auto; }
.meeting-tabs button { white-space: nowrap; }

/* Shared seller/admin bundle configurator: one body scroll and stable actions. */
.o24-configurator.cpq-dialog { width: min(1200px, calc(100vw - 48px)); height: min(840px, calc(100dvh - 48px)); max-height: min(840px, calc(100dvh - 48px)); overflow: hidden; }
.o24-configurator[open] { display: flex; flex-direction: column; }
.o24-configurator > header { flex: none; }
.o24-configurator .cpq-dialog__body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.o24-configurator__tabs { display: flex; position: sticky; top: -22px; gap: 20px; padding: 14px 0; background: var(--color-surface); z-index: 1; overflow-x: auto; }
.o24-configurator__tabs [role=tab] { flex: none; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--color-text-secondary); padding: 10px 0; cursor: pointer; }
.o24-configurator__tabs [aria-selected=true] { border-color: var(--color-text-primary); color: var(--color-text-primary); }
.o24-configurator__fields { display: grid; gap: 18px; }
.o24-configurator__fields--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.o24-configurator__field, .o24-configurator__option { min-width: 0; }
.o24-configurator__issues { margin: 12px 0; padding-left: 20px; }
.o24-configurator__issues button { text-align: left; }
.cpq-dialog footer.o24-configurator__footer, .o24-configurator footer.o24-configurator__footer { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 22px; border-top: 1px solid var(--color-border); margin: 0; background: var(--color-surface); }
.o24-configurator__footer > .cpq-actions { margin-inline-start: auto; }
.o24-configurator__estimate { display: grid; gap: 4px; font-variant-numeric: tabular-nums; }
@media (max-width: 767px) {
  .o24-configurator.cpq-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .o24-configurator__fields--two { grid-template-columns: minmax(0, 1fr); }
  .cpq-dialog footer.o24-configurator__footer, .o24-configurator footer.o24-configurator__footer { flex-wrap: wrap; padding: 12px; }
}

/* Wrapped record cells keep long labels inside resized columns. */
.o24-data-table.o24-data-table--wrap tbody td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.o24-data-table.o24-data-table--wrap tbody td :is(a, span) { white-space: normal; overflow-wrap: anywhere; max-width: 100%; }

/* Compact record-list filters wrap onto another row when space is limited. */
.o24-list-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.o24-list-filters > .form-select { flex: 0 1 auto; width: auto; min-width: min(9rem, 100%); max-width: 100%; }
.o24-list-filters > .form-input { flex: 0 1 16rem; width: 16rem; min-width: 0; max-width: 100%; }

/* Metric-colored report matrix: shared by Data viz and Home. */
.o24-report-matrix { min-width: 0; color: var(--qa-ink); }
.o24-report-matrix__scroll { max-height: 38rem; overflow: auto; border: 1px solid var(--qa-line); border-radius: var(--radius-md, 8px); }
.o24-report-matrix .o24-data-table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 2px; }
.o24-report-matrix th { background: var(--qa-surface); min-width: 7rem; max-width: 16rem; white-space: normal; }
.o24-report-matrix thead th { position: sticky; top: 0; z-index: 2; }
.o24-report-matrix tbody th, .o24-report-matrix tfoot th { position: sticky; left: 0; z-index: 1; }
.o24-report-matrix td { padding: 0; text-align: right; background: color-mix(in srgb, var(--matrix-hue, #1d63f2) var(--matrix-intensity, 0%), var(--qa-surface)); }
.o24-report-matrix td.o24-report-matrix__total { background: var(--qa-surface); font-weight: 650; }
.o24-report-matrix__value { display: block; width: 100%; min-height: 44px; padding: 10px 14px; border: 0; border-radius: 3px; background: transparent; color: var(--qa-ink); text-align: right; font: inherit; font-variant-numeric: tabular-nums; }
button.o24-report-matrix__value { cursor: pointer; text-decoration: underline; text-decoration-color: transparent; }
button.o24-report-matrix__value:hover { text-decoration-color: currentColor; }
.o24-report-matrix__value:focus-visible, .o24-report-matrix__scroll:focus-visible { outline: 2px solid var(--qa-ink); outline-offset: -3px; }
.o24-report-matrix__legend { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12px; }
.o24-report-matrix__gradient { display: inline-block; width: 100px; height: 10px; border: 1px solid var(--qa-line); border-radius: 3px; background: linear-gradient(to right, var(--qa-surface), #1d63f2); }
.o24-report-matrix__gradient.is-diverging { background: linear-gradient(to right, #df6b27, var(--qa-surface), #1d63f2); }
.crm-report-home-tile.is-small .o24-report-matrix__scroll { max-height: 16rem; }

/* Bounded review tables keep the existing dialog title and actions reachable. */
.o24-review-table { max-height: min(360px, 40dvh); overflow: auto; overscroll-behavior: contain; border: 1px solid var(--color-border); border-radius: var(--radius-sm); }
.o24-review-table > table { table-layout: fixed; }
.o24-review-table:focus-visible { outline: 2px solid var(--color-primary-blue); outline-offset: 2px; }
