/* rel-ease workspace system. Visual reference: contact-lists.aspx.
   Shared workspace components follow page CSS; Inbox imports the same tokens
   while keeping its own component geometry.
   Feature CSS owns workflow geometry; this file owns reusable presentation. */
:root:has(> body.dashboard-page),
body.app-shell.dashboard-page,
:root:has(> body.re-standard-ui),
body.app-shell.re-standard-ui {
    --ui-canvas: #f7f7f4;
    --ui-surface: #fff;
    --ui-surface-subtle: #f7f9f9;
    --ui-surface-selected: #edf5f5;
    --ui-ink: #203943;
    --ui-muted: #53686f;
    --ui-border: #dce5e7;
    --ui-border-strong: #8aabb1;
    --ui-accent: #2b6570;
    --ui-on-accent: #fff;
    --ui-header: #e9eeed;
    --ui-danger-surface: #fff3f1;
    --ui-danger-ink: #943d35;
    --ui-success-surface: #e9f4ef;
    --ui-success-ink: #286147;
    --ui-warning-surface: #fbf2df;
    --ui-warning-ink: #795019;
    --ui-radius: 18px;
    --ui-shadow: 0 10px 28px rgba(29,48,58,.055);
    --ui-text-shadow: none;
    --ui-decoration-filter: none;
    --ui-gap: 1rem;
    --ui-gutter: 2rem;
    --ui-small-text: .75rem;
    --ink: var(--ui-ink);
    --muted: var(--ui-muted);
    --line: var(--ui-border);
    --panel: var(--ui-surface);
    --panel-strong: var(--ui-surface);
    --surface: var(--ui-canvas);
    --input-bg: var(--ui-surface);
    --radius: var(--ui-radius);
    --soft-shadow: var(--ui-shadow);
    --release-command-surface: var(--ui-header);
    --release-command-ink: var(--ui-ink);
    color: var(--ui-ink);
    background: var(--ui-canvas);
    color-scheme: light;
}

:root[data-theme="dark"]:has(> body.dashboard-page),
:root[data-theme="dark"] body.app-shell.dashboard-page,
:root[data-theme="dark"]:has(> body.re-standard-ui),
:root[data-theme="dark"] body.app-shell.re-standard-ui {
    --ui-canvas: #11191f;
    --ui-surface: #1a2730;
    --ui-surface-subtle: #132029;
    --ui-surface-selected: #203740;
    --ui-ink: #f0f5f6;
    --ui-muted: #b7c8ce;
    --ui-border: rgba(220,229,231,.15);
    --ui-border-strong: #668f97;
    --ui-accent: #98c6cf;
    --ui-header: #202d35;
    --ui-danger-surface: #362425;
    --ui-danger-ink: #f0b0a8;
    --ui-success-surface: #203a31;
    --ui-success-ink: #a8dcc3;
    --ui-warning-surface: #3d3325;
    --ui-warning-ink: #ead0a1;
    --ui-shadow: 0 10px 28px rgba(0,0,0,.15);
    --release-command-surface: var(--ui-header);
    --release-command-ink: var(--ui-ink);
    color-scheme: dark;
}

html body.app-shell.re-standard-ui .main-content {
    min-width: 0;
    color: var(--ui-ink);
    background: var(--ui-canvas);
}

/* Full-bleed command bar; independent cards sit on the quiet canvas. */
html body.app-shell.re-standard-ui .main-content:has(> .workspace-panel),
html body.app-shell.re-standard-ui .main-content:has(> * > .re-page-header),
html body.app-shell.re-standard-ui .main-content:has(> .re-page-header) {
    padding: 0 !important;
}

html:root body.app-shell.re-standard-ui .main-content > .workspace-panel,
html:root body.app-shell.re-standard-ui .main-content > :has(> .re-page-header),
html:root body.app-shell.re-standard-ui .pos-kitchen-shell {
    width: 100%;
    max-width: none;
    min-width: 0 !important;
    margin: 0;
    padding: 0 var(--ui-gutter) 2rem !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) {
    position: sticky;
    top: 0;
    z-index: 60;
    display: flex !important;
    flex-direction: row;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 1rem;
    width: 100% !important;
    max-width: none;
    min-height: var(--release-shell-bar-height, 3.65rem) !important;
    height: auto !important;
    margin: 0 0 1rem !important;
    padding: .55rem 1.55rem .55rem calc(var(--release-rail-width, 1.375rem) + var(--release-rail-gap, 1.375rem)) !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: var(--ui-ink) !important;
    background: var(--ui-header) !important;
    box-shadow: 0 8px 22px rgba(29,48,58,.05) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: visible !important;
    isolation: isolate;
}

/* Grid children must be allowed to shrink to the available workspace width. */
html:root body.app-shell.re-standard-ui .main-content > :has(> .re-page-header) > * {
    min-width: 0 !important;
}

html:root body.app-shell.re-standard-ui .main-content > :has(> .re-page-header) > .re-page-header,
html:root body.app-shell.re-standard-ui .main-content > .workspace-panel > .cms-editor-head,
html:root body.app-shell.re-standard-ui .main-content > .workspace-panel > form > .re-page-header,
html:root body.app-shell.re-standard-ui .pos-kitchen-shell > .re-page-header {
    width: calc(100% + var(--ui-gutter) * 2) !important;
    margin-inline: calc(-1 * var(--ui-gutter)) !important;
}

html body.app-shell.re-standard-ui .re-workspace > .settings-hub {
    width: 100%;
    max-width: none;
    padding: 0;
}

html body.app-shell.re-standard-ui .operations-panorama {
    overflow: clip;
}

html:root body.app-shell.re-standard-ui .re-page-header > :is(.media-command-rail, .operations-hero-rail, .composition-editor-rail) {
    display: none;
}

html:root body.app-shell.re-standard-ui .re-page-heading {
    flex: 1 1 auto;
    min-width: 0;
}

html:root body.app-shell.re-standard-ui .re-page-header > .re-page-meta {
    display: flex;
    align-items: baseline;
    flex: 0 1 auto;
    flex-wrap: wrap;
    gap: .4rem;
    min-height: 0;
    min-width: 0;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    color: var(--ui-muted);
    background: none;
    box-shadow: none;
}

html:root body.app-shell.re-standard-ui .re-page-meta :is(strong, span, small) {
    color: var(--ui-muted) !important;
    font-size: .82rem !important;
    line-height: 1.35;
}

html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head)::before {
    content: attr(data-section-label);
    position: absolute;
    inset: 0 auto 0 0;
    display: block;
    width: var(--release-rail-width, 1.375rem);
    border: 0;
    border-right: 2px solid var(--brand);
    border-radius: 0;
    color: var(--ui-muted);
    background: var(--ui-surface-subtle);
    box-shadow: none;
    font-size: .75rem;
    font-weight: 500;
    letter-spacing: 0;
    line-height: var(--release-rail-width, 1.375rem);
    text-align: center;
    text-transform: none;
    text-overflow: ellipsis;
    padding-block: 0;
    padding-inline: .25rem;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    white-space: nowrap;
    overflow: hidden;
}

html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) > :first-child:not(:is(a, button, .re-page-actions, .cms-editor-actions, .action-control-bar)) {
    min-width: 0;
    flex: 1 1 auto;
}

html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) :is(h1, h2) {
    margin: 0 !important;
    color: var(--ui-ink) !important;
    font-size: clamp(1.2rem, 1.8vw, 1.55rem) !important;
    font-weight: 400 !important;
    line-height: 1.18 !important;
    letter-spacing: .025em !important;
    text-shadow: none !important;
    overflow-wrap: anywhere;
    white-space: normal !important;
}

/* The reference uses a compact command bar. Supporting copy belongs in
   the content; retain the authored descriptions for contextual use. */
html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) :is(p, .eyebrow, [class$="-eyebrow"], [class$="-kicker"], .text-uppercase.small) {
    display: none;
}

html:root body.app-shell.re-standard-ui .re-page-header::after {
    display: none;
}

html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) > :is(.re-page-actions, .cms-editor-actions, .hero-actions, .action-control-bar),
html:root body.app-shell.re-standard-ui .re-page-header > :is(a, button, details) {
    flex: 0 1 auto !important;
    width: auto !important;
    max-width: 70%;
    min-width: 0;
    margin-left: auto !important;
    margin-inline-start: auto !important;
    justify-content: flex-end !important;
}

html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) > :is(.re-page-actions, .cms-editor-actions, .hero-actions, .action-control-bar) {
    display: flex;
    flex-wrap: wrap !important;
    align-items: center;
    gap: .55rem;
    overflow: visible !important;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

/* Shared surfaces: list/detail panels, summaries, data tables and dialogs. */
html:root body.app-shell.re-standard-ui :is(
    .re-card, .card, .stat-card, .modal-content, .cms-modal-card, .panel:not(.workspace-panel),
    .central-summary-card, .central-list-card, .central-form-card,
    .central-settings-card, .central-settings-section, .central-toolbar-card,
    .commerce-summary-card, .commerce-card, .management-card,
    .module-card, .settings-card, .settings-hub-card, .website-hub-card,
    .pos-kitchen-ticket, .pos-kitchen-complete, .knowledge-video-menu-item,
    .contact-list-library, .contact-list-panel, .contact-list-first-run,
    .contact-list-workspace-head, .contact-list-summary > div
) {
    min-width: 0;
    border: 1px solid var(--ui-border) !important;
    border-radius: var(--ui-radius) !important;
    color: var(--ui-ink);
    background: var(--ui-surface) !important;
    box-shadow: var(--ui-shadow) !important;
}

html:root body.app-shell.re-standard-ui :is(.panel-head, .compact-head, .card-head, .section-head):not(.re-page-header) {
    min-height: 0;
    margin: 0 0 .85rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    color: var(--ui-ink);
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

html:root body.app-shell.re-standard-ui :is(.panel-head, .compact-head, .card-head, .section-head):not(.re-page-header)::before {
    display: none;
}

html:root body.app-shell.re-standard-ui :is(.panel-head, .compact-head, .card-head, .section-head):not(.re-page-header) :is(h1, h2, h3, .form-title) {
    color: var(--ui-ink) !important;
    font-size: 1.05rem;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: 0;
    white-space: normal;
}

html body.app-shell.re-standard-ui :is(.re-grid, .central-summary-grid, .commerce-summary-grid, .settings-hub-grid, .module-grid) {
    gap: var(--ui-gap);
}

html:root body.app-shell.re-standard-ui :is(.input-control, .form-control, .form-select, .quiet-form input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="submit"]):not([type="hidden"]), .quiet-form select, .quiet-form textarea) {
    max-width: 100%;
    border: 1px solid var(--ui-border-strong) !important;
    border-radius: 11px;
    color: var(--ui-ink) !important;
    background: var(--ui-surface) !important;
    box-shadow: none;
    font-weight: 400;
}

html body.app-shell.re-standard-ui .cms-modal-card .editor-heading-text {
    font-weight: 500;
    line-height: 1.25;
}

html body.app-shell.re-standard-ui :is(input, textarea)::placeholder {
    color: var(--ui-muted);
    opacity: 1;
}

/* One action hierarchy across headers, forms and dialogs. Matte dark
   primary actions retain the app's quiet gold detail in either theme. */
html:root body.app-shell.re-standard-ui .re-page-header > :is(a, button),
html:root body.app-shell.re-standard-ui .re-page-header > :is(.re-page-actions, .cms-editor-actions, .hero-actions, .action-control-bar) > :is(a, button, input[type="submit"]) {
    border: 1px solid var(--ui-header-action-border, #ad8c42) !important;
    border-radius: 11px !important;
    color: var(--ui-header-action-ink, #f7f7f3) !important;
    background: var(--ui-header-action-surface, #172c34) !important;
    box-shadow: 0 4px 12px rgba(16,31,38,.12) !important;
    text-shadow: none !important;
}

html:root body.app-shell.re-standard-ui .panel.re-card-collection {
    padding: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

html:root body.app-shell.re-standard-ui .workspace-panel > :is(.cms-shell, .team-shell) {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

/* Full-screen editors retain their workflow geometry above the page header. */
html:root body.app-shell.re-standard-ui .cms-shell.is-editor-open .cms-editor-panel {
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--ui-canvas) !important;
    box-shadow: none !important;
}

html:root body.app-shell.re-standard-ui .cms-shell.is-editor-open .cms-editor-bar {
    color: var(--ui-ink);
    background: var(--ui-header);
    box-shadow: var(--ui-shadow);
}

html body.app-shell.re-standard-ui .cms-editor-bar :is(.cms-editor-back, .re-editor-title) {
    color: var(--ui-ink);
}

html body.app-shell.re-standard-ui .re-editor-title {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: clamp(1.1rem, 1.8vw, 1.55rem);
    font-weight: 400;
    line-height: 1.2;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html body.app-shell.re-standard-ui :is(a, button, input).btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .62rem 1rem;
    font: inherit;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

html:root body.app-shell.re-standard-ui :is(a, button, input):is(.button-primary, .btn-primary, .primary-action, .full-width-action, .full-button) {
    min-height: 2.65rem;
    border: 1px solid #ad8c42 !important;
    border-radius: 11px !important;
    color: #f7f7f3 !important;
    background: #172c34 !important;
    box-shadow: 0 4px 12px rgba(16,31,38,.12) !important;
    text-shadow: none !important;
    transform: none !important;
}

html:root body.app-shell.re-standard-ui .web-editor-add-block > summary,
html:root body.app-shell.re-standard-ui :is(a, button, input):is(.button-secondary, .button-soft, .button-quiet, .button-light, .secondary-action, .btn:not(.btn-primary):not(.btn-danger)):not(.danger) {
    min-height: 2.65rem;
    border: 1px solid var(--ui-border-strong) !important;
    border-radius: 11px !important;
    color: var(--ui-ink) !important;
    background: var(--ui-surface) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important;
}

html:root body.app-shell.re-standard-ui :is(a, button, input):is(.button-primary, .btn-primary, .primary-action, .full-width-action, .full-button):hover {
    background: #25434e !important;
}

html:root body.app-shell.re-standard-ui :is(a, button, input):is(.button-secondary, .button-soft, .button-quiet, .button-light, .secondary-action, .btn:not(.btn-primary):not(.btn-danger)):not(.danger):hover {
    background: var(--ui-surface-selected) !important;
}

html:root body.app-shell.re-standard-ui :is(a, button, input):is(.danger, .button-danger, .btn-danger, .danger-action) {
    --ui-header-action-border: var(--ui-danger-ink);
    --ui-header-action-ink: var(--ui-danger-ink);
    --ui-header-action-surface: var(--ui-danger-surface);
    border: 1px solid var(--ui-danger-ink) !important;
    border-radius: 11px !important;
    color: var(--ui-danger-ink) !important;
    background: var(--ui-danger-surface) !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

html:root body.app-shell.re-standard-ui .danger :is(.action-control-label, .action-icon) {
    color: inherit !important;
}

html body.app-shell.re-standard-ui .action-control-label {
    font-weight: inherit;
}

html body.app-shell.re-standard-ui .management-search-panel:has(> .management-search-input):not(:has(select)) {
    grid-template-columns: minmax(0, 1fr);
}

html:root body.app-shell.re-standard-ui .info-tip {
    color: var(--ui-accent);
    border-color: var(--ui-border-strong);
    background: var(--ui-surface);
}

html body.app-shell.re-standard-ui .info-tip:not(:hover):not(:focus):not(:focus-within)::before,
html body.app-shell.re-standard-ui .info-tip:not(:hover):not(:focus):not(:focus-within)::after {
    display: none;
}

html body.app-shell.re-standard-ui .info-tip::before,
html body.app-shell.re-standard-ui .info-tip::after {
    color: var(--ui-ink);
    border-color: var(--ui-border);
    background: var(--ui-surface);
}

html body.app-shell.re-standard-ui :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--ui-accent) !important;
    outline-offset: 3px;
}

html body.app-shell.re-standard-ui :is(.re-empty, .empty-state, .empty-panel, .contact-list-empty-state, .contact-list-library-empty) {
    border-color: var(--ui-border-strong);
    border-radius: 13px;
    color: var(--ui-muted);
    background: var(--ui-surface-subtle);
}

html body.app-shell.re-standard-ui :is(.re-card, .re-empty) :is(p, small),
html body.app-shell.re-standard-ui :is(.muted, .text-muted, .help-text, .field-help, .empty-state p) {
    color: var(--ui-muted);
}

html body.app-shell.re-standard-ui :is(.pos-kitchen-items li, .pos-kitchen-done) {
    border-color: var(--ui-border);
}

html body.app-shell.re-standard-ui .knowledge-video-menu-copy small {
    color: var(--ui-muted);
    font-size: .75rem;
}

html body.app-shell.re-standard-ui .knowledge-video-card {
    color: var(--ui-ink);
    background: var(--ui-surface);
}

/* Account entry and recovery keep their focused layouts and share the
   application's surfaces and controls. White-label sign-in does not opt in. */
html:root body.app-shell.re-standard-ui.re-auth-ui :is(.login-card, .onboarding-card, .onboarding-choice, .register-value-panel, .register-startup-banner) {
    border: 1px solid var(--ui-border) !important;
    border-radius: var(--ui-radius) !important;
    color: var(--ui-ink) !important;
    background: var(--ui-surface) !important;
    box-shadow: var(--ui-shadow) !important;
}

html:root body.app-shell.re-standard-ui.re-auth-ui :is(.login-card, .onboarding-card, .register-value-panel, .register-startup-banner) :is(h1, h2, h3, label, .form-title, strong):not(.notice-panel *, .alert *) {
    color: var(--ui-ink) !important;
}

html:root body.app-shell.re-standard-ui.re-auth-ui :is(.login-card, .onboarding-card, .register-value-panel, .register-startup-banner) :is(p, small, .login-helper, label > span):not(.notice-panel *, .alert *) {
    color: var(--ui-muted) !important;
}

html:root body.app-shell.re-standard-ui.re-auth-ui :is(.login-card, .onboarding-card) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]), select, textarea) {
    border-color: var(--ui-border-strong) !important;
    color: var(--ui-ink) !important;
    background: var(--ui-surface-subtle) !important;
}

html:root body.app-shell.re-standard-ui.re-auth-ui .onboarding-choice:has(input:checked) {
    border-color: var(--ui-accent) !important;
    background: var(--ui-surface-selected) !important;
}

html:root body.app-shell.re-standard-ui.re-auth-ui .register-value-list :is(li, span) {
    color: var(--ui-ink);
}

html:root body.app-shell.re-standard-ui.re-auth-ui .register-startup-banner > span {
    color: var(--ui-muted);
}

html:root body.app-shell.re-standard-ui.re-auth-ui .register-terms-check {
    border-color: var(--ui-border) !important;
    color: var(--ui-ink) !important;
    background: var(--ui-surface-subtle) !important;
}

html:root body.app-shell.re-standard-ui.re-auth-ui .register-terms-check a {
    color: var(--ui-accent) !important;
    text-decoration: underline;
    text-underline-offset: .15em;
}

html:root body.app-shell.re-standard-ui.re-auth-ui .meta-auth-button {
    border: 1px solid #2265b4 !important;
    border-radius: 11px !important;
    color: #fff !important;
    background: #1257a5 !important;
    box-shadow: none !important;
    transform: none !important;
}

html:root body.app-shell.re-standard-ui.re-auth-ui .meta-auth-button:hover {
    background: #0d478b !important;
}

@media (max-width: 900px) {
    body.app-shell.re-standard-ui { --ui-gutter: .75rem; }
    html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) {
        position: relative;
        gap: .7rem;
        padding: .75rem .75rem .75rem 2.5rem !important;
    }
    html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) :is(h1, h2) {
        white-space: normal;
    }
}

@media (max-width: 560px) {
    /* Keep focused help text inside the mobile viewport. */
    html body.app-shell.re-standard-ui .info-tip::before {
        position: fixed;
        top: auto;
        bottom: 1rem;
        left: 50%;
        width: max-content;
        max-width: calc(100vw - 2rem);
        transform: translateX(-50%) !important;
    }
    html body.app-shell.re-standard-ui .info-tip::after { display: none; }
    html body.app-shell.re-standard-ui .management-search-panel:has(> .management-search-input) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    html body.app-shell.re-standard-ui .management-search-panel > .management-search-input {
        grid-column: 1 / -1;
    }
    html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) {
        flex-wrap: wrap;
    }
    html:root body.app-shell.re-standard-ui :is(.re-page-header, .workspace-panel > .cms-editor-head) > :is(.re-page-actions, .cms-editor-actions, .hero-actions, .action-control-bar) {
        max-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.app-shell.re-standard-ui :is(.re-card, .contact-list-card, .button-primary, .button-soft, .button-quiet) {
        transition: none !important;
        transform: none !important;
    }
}
