/* nhc-form-widgets.css — the one stylesheet for the widgets that
 * pkg/ui_htmx/templates/form_surface.tmpl renders, that
 * assets/nhc-form-enhancements.js drives and that the React client's
 * UniversalDatePicker, UniversalDateRangePicker and RichTextEditor render:
 * the local date/time picker, its calendar grid and the rich text editor.
 *
 * This file is the single owner of those rules for both renderers. The
 * widget markup, the widget JS and the widget CSS are one contract, so they
 * live together under pkg/ui_htmx/assets: Go embeds this file and serves it
 * at FormWidgetStylesheetPath, and the React components import it by
 * relative path, exactly as they already import the widget JS from
 * clients/ui-react/src/lib/datetime-core.ts. There is no second copy under
 * clients/ui-react/src to keep in step.
 *
 * It is served as one file, so a relative @import would resolve against the
 * serving path and 404: the rules that used to live in richtext-source-mode,
 * richtext-white-surface and richtext-fullscreen are inlined below.
 *
 * Design tokens: this file uses the shared NHC design-system token names
 * (--border, --ring, --text-high/med/low, --bg-level-1/2, --ds-z-*). A host
 * whose stylesheet uses different names declares them for these widgets;
 * the portal theme does that in pkg/cmsportal/theme/assets/portal-account.css.
 */

nhc-date-time-picker {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.nhc-datetime {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
}

.nhc-datetime__group {
    position: relative;
    flex: 0 1 auto;
    min-width: 0;
}

.nhc-datetime__group--date {
    flex-basis: min(100%, 16rem);
}

.nhc-datetime__group--time {
    flex-basis: min(100%, 10rem);
}

.nhc-datetime__control {
    display: flex;
    align-items: center;
    min-height: 2.35rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    gap: 0.2rem;
    transition: none;
}

.nhc-datetime__control:focus-within {
    box-shadow: none;
}

.nhc-datetime__input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    border: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
    border-radius: 0;
    background: color-mix(in srgb, var(--bg-level-2) 92%, #0f151f);
    color: var(--text-high);
    font-size: 0.94rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    min-height: 2.35rem;
    padding: 0 0.6rem;
    box-shadow: none;
}

.nhc-datetime__input::placeholder {
    color: color-mix(in srgb, var(--text-low) 82%, transparent);
}

.nhc-datetime__input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--ring) 48%, var(--border));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 14%, transparent);
}

.nhc-datetime__trigger {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-med);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 140ms ease, opacity 140ms ease;
}

/* Compact navigable date fields open their calendar from the input focus. */
[data-date-navigation] nhc-date-time-picker .nhc-datetime__group--date .nhc-datetime__trigger {
    display: none;
}

.nhc-datetime__trigger:hover,
.nhc-datetime__trigger:focus-visible,
.nhc-datetime__trigger[aria-expanded="true"] {
    outline: none;
    color: color-mix(in srgb, var(--ring) 78%, white);
}

.nhc-datetime__panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: var(--ds-z-popover);
    width: min(20rem, calc(100vw - 2rem));
    border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
    border-radius: 0.8rem;
    background: color-mix(in srgb, var(--bg-level-1) 97%, #0b1017);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    padding: 0.85rem;
}

.nhc-datetime__panel[hidden],
.nhc-datetime__chooser[hidden],
.nhc-datetime__group[hidden] {
    display: none !important;
}

.nhc-datetime__panel--time {
    width: min(14rem, calc(100vw - 2rem));
}

.nhc-datetime__group[data-panel-placement="top"] .nhc-datetime__panel {
    top: auto;
    bottom: calc(100% + 0.35rem);
}

.nhc-datetime__panel-header {
    display: grid;
    grid-template-columns: 1.8rem minmax(0, 1fr) 1.8rem;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.6rem;
}

.nhc-datetime__nav {
    width: 1.8rem;
    height: 1.8rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-med);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
}

.nhc-datetime__nav:hover,
.nhc-datetime__nav:focus-visible {
    outline: none;
    color: color-mix(in srgb, var(--ring) 78%, white);
}

.nhc-datetime__headline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 0;
}

.nhc-datetime__headline-btn {
    min-width: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-high);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.12rem 0.16rem;
}

.nhc-datetime__headline-btn:hover,
.nhc-datetime__headline-btn:focus-visible,
.nhc-datetime__headline-btn[aria-pressed="true"] {
    outline: none;
    color: color-mix(in srgb, var(--ring) 78%, white);
}

.nhc-datetime__choice {
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-high);
    font-variant-numeric: tabular-nums;
}

.nhc-datetime__choice.is-selected,
.nhc-datetime__choice:hover,
.nhc-datetime__choice:focus-visible {
    outline: none;
    color: color-mix(in srgb, var(--ring) 82%, white);
    background: color-mix(in srgb, var(--ring) 12%, transparent);
}

.nhc-datetime__choice.is-selected {
    font-weight: 600;
    box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--ring) 72%, transparent);
}

.nhc-datetime__chooser {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.2rem;
}

.nhc-datetime__chooser--years {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nhc-datetime__choice {
    min-height: 2rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.8rem;
    font-weight: 400;
}

.nhc-datetime__quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.6rem;
}

.nhc-datetime__chip {
    min-height: 1.85rem;
    padding: 0.32rem 0.6rem;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ring) 12%, transparent);
    color: color-mix(in srgb, var(--ring) 78%, white);
    font-size: 0.74rem;
    font-weight: 600;
}

/* The named way out of an open panel, beside the quick chips. */
.nhc-datetime__chip--done {
    margin-left: auto;
    background: color-mix(in srgb, var(--ring) 22%, transparent);
}

.nhc-datetime__chip:hover,
.nhc-datetime__chip:focus-visible {
    outline: none;
    background: color-mix(in srgb, var(--ring) 18%, transparent);
}

.nhc-datetime__time-shell {
    display: grid;
    gap: 0.7rem;
}

.nhc-datetime__time-row {
    display: grid;
    grid-template-columns: 1.9rem minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
}

.nhc-datetime__time-label {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--text-low);
}

.nhc-datetime__stepper {
    display: grid;
    grid-template-columns: 1.7rem minmax(0, 1fr) 1.7rem;
    align-items: center;
    gap: 0.18rem;
}

.nhc-datetime__step {
    width: 1.7rem;
    height: 1.7rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-med);
    font-size: 1rem;
    font-weight: 600;
}

.nhc-datetime__step:hover,
.nhc-datetime__step:focus-visible {
    outline: none;
    color: color-mix(in srgb, var(--ring) 78%, white);
}

.nhc-datetime__step-input {
    width: 100%;
    min-height: 2rem;
    border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
    border-radius: 0.55rem;
    background: color-mix(in srgb, var(--bg-level-2) 82%, transparent);
    color: var(--text-high);
    text-align: center;
    font-size: 0.94rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    padding: 0 0.4rem;
}

.nhc-datetime__step-input:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--ring) 48%, var(--border));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ring) 14%, transparent);
}

@media (max-width: 720px) {
    .nhc-datetime {
        gap: 0.55rem;
    }

    .nhc-datetime__group,
    .nhc-datetime__group--date,
    .nhc-datetime__group--time {
        flex-basis: 100%;
    }

    .nhc-datetime__panel,
    .nhc-datetime__panel--time {
        width: min(100vw - 2rem, 20rem);
    }
}

/* Shared day grid for nhc-date-time-picker and nhc-daterange-picker. Owns the
   weekday header, the 7-column day grid, and every state a plain day button
   can be in; range-only modifiers (start/end/in-range/preview) live in
   daterange.css next to the range picker chrome that uses them. */

.nhc-calendar__weekdays,
.nhc-calendar__grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.18rem;
}

.nhc-calendar__weekdays {
    margin-bottom: 0.25rem;
}

.nhc-calendar__weekdays span {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-low);
}

.nhc-calendar__day {
    min-height: 2.25rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text-high);
    font-size: 0.875rem;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.nhc-calendar__day.is-outside {
    opacity: 0.42;
}

.nhc-calendar__day.is-today {
    color: color-mix(in srgb, var(--ring) 82%, white);
}

.nhc-calendar__day.is-disabled,
.nhc-calendar__day:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nhc-calendar__day:hover:not(:disabled),
.nhc-calendar__day:focus-visible,
.nhc-calendar__day.is-selected {
    outline: none;
    color: color-mix(in srgb, var(--ring) 82%, white);
    background: color-mix(in srgb, var(--ring) 12%, transparent);
}

.nhc-calendar__day.is-selected {
    font-weight: 600;
    box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--ring) 72%, transparent);
}

/* Touch screens (phones and tablets) get finger-sized days; the grid keeps
   seven columns, so the cell width already follows the container. */
@media (pointer: coarse) {
    .nhc-calendar__day {
        min-height: 2.6rem;
        font-size: 0.95rem;
    }

    .nhc-calendar__weekdays span {
        font-size: 0.74rem;
    }
}

.nhc-richtext__source-canvas {
    background: #fff;
}

.nhc-richtext__source {
    flex: 1 1 auto;
    width: 100%;
    min-height: 100%;
    border: 0;
    background: #fff;
    color: #111827;
    outline: none;
    padding: 0.85rem 0.95rem;
    resize: none;
    font: 0.86rem/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    tab-size: 2;
}

.nhc-richtext__source::selection {
    background: #bfdbfe;
}

.nhc-richtext__source:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.nhc-richtext[data-richtext-surface-tone="white"] {
    background: #fff;
    border-color: #d1d5db;
}

.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__canvas {
    background: #fff;
}

.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface {
    background: #fff;
    color: #111827;
}

.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface:empty::before {
    color: #6b7280;
}

.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface h1,
.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface h2,
.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface h3,
.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface h4,
.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface h5,
.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface h6,
.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface strong {
    color: #111827;
}

.nhc-richtext[data-richtext-surface-tone="white"] .nhc-richtext__surface blockquote {
    color: #374151;
    border-left-color: #d1d5db;
}

[data-editor-fullscreen-host="1"] {
    position: relative;
}

/* Hide covered controls and scrollbars without moving the React-owned editor. */
[data-editor-fullscreen-host="1"]:has(.nhc-richtext.is-fullscreen) {
    visibility: hidden;
    overflow: clip;
}

.nhc-richtext.is-fullscreen {
    position: fixed;
    top: var(--nhc-visual-viewport-offset-top, 0px);
    left: var(--nhc-visual-viewport-offset-left, 0px);
    width: var(--nhc-shell-viewport-width, 100vw);
    height: var(--nhc-shell-viewport-height, 100dvh);
    visibility: visible;
    z-index: var(--ds-z-panel);
    border-radius: 0;
    box-shadow: none;
    background:
        linear-gradient(180deg,
            color-mix(in srgb, var(--bg-level-1) 98%, #06090f) 0%,
            color-mix(in srgb, var(--bg-level-0) 98%, #04070d) 100%);
}

[data-editor-fullscreen-host="1"] .nhc-richtext.is-fullscreen {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.nhc-richtext.is-fullscreen,
.nhc-richtext.nhc-richtext--fill-available.is-fullscreen {
    min-height: 0;
    max-height: 100%;
}

.nhc-richtext.is-fullscreen .nhc-richtext__canvas {
    flex: 1 1 0;
    min-height: 0;
    resize: none;
}

.nhc-richtext.is-fullscreen .nhc-richtext__toolbar {
    min-height: 0;
    max-height: 40%;
    overflow-y: auto;
}

.nhc-richtext.is-fullscreen .nhc-richtext__surface,
.nhc-richtext.is-fullscreen .nhc-richtext__source {
    min-height: 100%;
    max-height: none;
    padding: 1rem 1.1rem 1.4rem;
}


.nhc-richtext {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 0;
    gap: 0;
    border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
    border-radius: 0.5rem;
    background: color-mix(in srgb, var(--bg-level-1) 96%, #0b1017);
    overflow: hidden;
}

.nhc-richtext.nhc-richtext--fill-available {
    flex: 1 1 auto;
    min-height: 12rem;
}

.nhc-richtext.nhc-richtext--fill-available .nhc-richtext__canvas,
.nhc-richtext.nhc-richtext--fill-available .nhc-richtext__source-canvas {
    flex: 1 1 auto;
}

.nhc-richtext__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.14rem;
    padding: 0.26rem 0.35rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
    background: color-mix(in srgb, var(--bg-level-2) 78%, #101722);
    position: relative;
    flex: 0 0 auto;
    z-index: var(--ds-z-selection);
}

.nhc-richtext__toolbar[data-link-open="1"] {
    align-items: stretch;
}

.nhc-richtext__sep {
    width: 1px;
    height: 1.15rem;
    flex: 0 0 auto;
    margin: 0 0.15rem;
    background: color-mix(in srgb, var(--border) 70%, transparent);
}

.nhc-richtext__tool,
.nhc-richtext__popover-btn {
    appearance: none;
    font: inherit;
    cursor: pointer;
}

.nhc-richtext .nhc-richtext__tool,
.nhc-richtext .nhc-form__inline-action.nhc-richtext__tool {
    min-width: 1.8rem;
    height: 1.8rem;
    padding: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent;
    color: color-mix(in srgb, var(--text-high) 88%, white);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    box-shadow: none;
    white-space: nowrap;
}

.nhc-richtext .nhc-richtext__tool--label,
.nhc-richtext .nhc-form__inline-action.nhc-richtext__tool--label {
    min-width: 2.05rem;
    padding: 0 0.35rem;
    font-size: 0.69rem;
    letter-spacing: 0.02em;
}

.nhc-richtext .nhc-richtext__tool:hover,
.nhc-richtext .nhc-richtext__tool:focus-visible,
.nhc-richtext .nhc-richtext__tool[aria-pressed="true"],
.nhc-richtext .nhc-form__inline-action.nhc-richtext__tool:hover,
.nhc-richtext .nhc-form__inline-action.nhc-richtext__tool:focus-visible,
.nhc-richtext .nhc-form__inline-action.nhc-richtext__tool[aria-pressed="true"] {
    background: color-mix(in srgb, var(--ring) 10%, transparent);
    color: color-mix(in srgb, var(--ring) 68%, white);
}

.nhc-richtext .nhc-richtext__tool[aria-pressed="true"],
.nhc-richtext .nhc-form__inline-action.nhc-richtext__tool[aria-pressed="true"] {
    background: color-mix(in srgb, var(--ring) 24%, var(--bg-level-2));
    color: var(--ring);
    box-shadow: inset 0 -2px 0 var(--ring);
}

.nhc-richtext__tool:disabled,
.nhc-richtext__popover-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.nhc-richtext__icon {
    width: 0.9rem;
    height: 0.9rem;
    display: block;
}

.nhc-richtext__canvas {
    display: flex;
    min-height: 12rem;
    min-width: 0;
    resize: vertical;
    overflow: auto;
    overscroll-behavior: contain;
    background: color-mix(in srgb, var(--bg-level-1) 95%, #101722);
}

.nhc-richtext__canvas[hidden],
.nhc-richtext__popover[hidden] {
    display: none;
}

.nhc-richtext__surface {
    flex: 1 1 auto;
    min-height: 100%;
    max-height: none;
    overflow: visible;
    padding: 0.85rem 0.95rem;
    outline: none;
    color: color-mix(in srgb, var(--text-high) 94%, white);
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: normal;
    word-break: break-word;
}

.nhc-richtext__surface[contenteditable="false"] {
    opacity: 0.7;
    cursor: not-allowed;
}

.nhc-richtext__surface:empty::before {
    content: attr(data-placeholder);
    color: color-mix(in srgb, var(--text-low) 88%, #94a3b8);
}

@media (max-width: 640px) {
    .mail-compose-body-editor {
        flex: 0 0 auto;
        height: clamp(12rem, 44dvh, 28rem);
        min-height: 12rem;
        max-height: 28rem;
    }

    .mail-compose-body-editor .nhc-richtext {
        height: 100%;
        min-height: 0;
    }

    .mail-compose-body-editor .nhc-richtext__toolbar {
        max-height: 3.58rem;
        gap: 0.04rem;
        padding: 0.2rem 0.2rem;
        overflow-y: auto;
    }

    .mail-compose-body-editor .nhc-richtext__tool {
        min-width: 1.55rem;
        height: 1.55rem;
    }

    .mail-compose-body-editor .nhc-richtext__sep {
        margin-inline: 0.03rem;
    }

    .mail-compose-body-editor .nhc-richtext__canvas {
        resize: none;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mail-compose-body-editor .nhc-richtext__surface {
        overflow: visible;
    }
}

.nhc-richtext__surface > *:first-child {
    margin-top: 0;
}

.nhc-richtext__surface > *:last-child {
    margin-bottom: 0;
}

.nhc-richtext__surface p,
.nhc-richtext__surface ul,
.nhc-richtext__surface ol,
.nhc-richtext__surface blockquote,
.nhc-richtext__surface pre {
    margin: 0 0 0.95rem;
}

.nhc-richtext__surface h1,
.nhc-richtext__surface h2,
.nhc-richtext__surface h3,
.nhc-richtext__surface h4,
.nhc-richtext__surface h5,
.nhc-richtext__surface h6 {
    margin: 1.1rem 0 0.55rem;
    color: color-mix(in srgb, var(--text-high) 98%, white);
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.015em;
}

.nhc-richtext__surface h1 {
    font-size: 1.55rem;
}

.nhc-richtext__surface h2 {
    font-size: 1.28rem;
}

.nhc-richtext__surface h3 {
    font-size: 1.08rem;
}

.nhc-richtext__surface strong {
    font-weight: 700;
    color: color-mix(in srgb, var(--text-high) 100%, white);
}

.nhc-richtext__surface em {
    font-style: italic;
}

.nhc-richtext__surface u {
    text-underline-offset: 0.14em;
    text-decoration-thickness: 0.09em;
}

.nhc-richtext__surface img,
.nhc-richtext__surface table,
.nhc-richtext__surface pre,
.nhc-richtext__surface blockquote {
    max-width: 100%;
}

.nhc-richtext__surface blockquote {
    margin-left: 0;
    margin-right: 0;
    padding-left: 0.9rem;
    border-left: 3px solid color-mix(in srgb, var(--ring) 54%, transparent);
    color: color-mix(in srgb, var(--text-med) 90%, #cbd5e1);
    font-style: italic;
}

.nhc-richtext__surface ul {
    list-style: disc outside;
    padding-left: 1.45rem;
}

.nhc-richtext__surface ol {
    list-style: decimal outside;
    padding-left: 1.35rem;
}

.nhc-richtext__surface ul ul {
    list-style-type: circle;
}

.nhc-richtext__surface ul ul ul {
    list-style-type: square;
}

.nhc-richtext__surface ol ol {
    list-style-type: lower-alpha;
}

.nhc-richtext__surface li + li {
    margin-top: 0.3rem;
}

.nhc-richtext__surface li::marker {
    color: color-mix(in srgb, var(--ring) 66%, var(--text-high));
}

.nhc-richtext__surface a {
    color: color-mix(in srgb, var(--ring) 72%, #1d4ed8);
    text-decoration: underline;
}

/* The htmx editor toggles the link popover with the hidden attribute
 * (form-enhancements-richtext.js); the class's display:flex would win over
 * the UA [hidden] rule on a host without a [hidden] reset (the portal
 * theme), so the [hidden] state is spelled out above. */
.nhc-richtext__popover {
    position: static;
    z-index: var(--ds-z-editor-tools);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: min(100%, 34rem);
    max-width: 100%;
    flex: 1 0 100%;
    order: 99;
    margin-top: 0.1rem;
    padding: 0.45rem 0 0;
    border-radius: 0.55rem;
    background: transparent;
    box-shadow: none;
}

.nhc-richtext__popover-input {
    min-width: 13rem;
    width: 100%;
    flex: 1 1 21rem;
    height: 2rem;
    border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    border-radius: 0.4rem;
    padding: 0 0.8rem;
    font-size: 0.82rem;
    background: color-mix(in srgb, var(--bg-level-2) 92%, #111827);
    color: var(--text-high);
}

.nhc-richtext__popover-btn {
    height: 2rem;
    min-width: 5.5rem;
    padding: 0 0.89rem;
    border-radius: 0.4rem;
    border: 1px solid color-mix(in srgb, var(--ring) 32%, transparent);
    background: color-mix(in srgb, var(--ring) 16%, var(--bg-level-2));
    color: color-mix(in srgb, var(--ring) 76%, white);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .nhc-richtext__popover {
        width: 100%;
    }

    .nhc-richtext__popover-input {
        min-width: 0;
    }
}

/* ----------------------------------------------------------------------
 * Notices, invalid fields and the image field's status line: the one
 * "something must be fixed or did not work" look for every htmx SDUI form.
 *
 * pkg/eventapp/ui.WithFormNotice (server) and form-enhancements-notices.js
 * (browser) both render `.nhc-form-notice.nhc-form-notice--<kind>` with
 * data-form-notice="1", role="alert"/"status" and aria-live; dialog-shell.js
 * focuses it after a swap. A refused field carries aria-invalid="true" and
 * an `.nhc-form__validation` block under it, whether the server rendered
 * the refusal (FormFieldRuntime.ValidationMessages) or the browser's native
 * validation did (form-enhancements-fields.js markInvalidField). The image
 * field's `.nhc-form__media-status` line reports upload/download progress
 * and failure by data-state (form-enhancements-media.js setMediaStatus).
 *
 * The three hues are mixed with the host's own text colour, so the same
 * rules read on the admin shell's light surfaces and a portal's dark ones;
 * a host may still override the --nhc-notice-* hues.
 * -------------------------------------------------------------------- */

.nhc-form-notice,
.nhc-form__validation,
.nhc-form__media-status {
    --nhc-notice-error: #ef4444;
    --nhc-notice-warning: #f59e0b;
    --nhc-notice-success: #22c55e;
    --nhc-notice-ink: color-mix(in srgb, var(--nhc-notice-hue) 65%, var(--text-high, currentColor));
}

.nhc-form-notice {
    --nhc-notice-hue: var(--nhc-notice-success);
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin: 0 0 1rem 0;
    padding: 0.65rem 0.85rem;
    border: 1px solid color-mix(in srgb, var(--nhc-notice-hue) 55%, transparent);
    border-left-width: 4px;
    border-radius: 0.6rem;
    background: color-mix(in srgb, var(--nhc-notice-hue) 14%, transparent);
    color: var(--nhc-notice-ink);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0;
    text-transform: none;
    scroll-margin-top: 0.75rem;
}

.nhc-form-notice::before {
    content: "i";
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.05rem;
    border-radius: 999px;
    background: var(--nhc-notice-hue);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 800;
    line-height: 1;
}

.nhc-form-notice--error {
    --nhc-notice-hue: var(--nhc-notice-error);
}

.nhc-form-notice--error::before {
    content: "!";
}

.nhc-form-notice--warning {
    --nhc-notice-hue: var(--nhc-notice-warning);
}

.nhc-form-notice--warning::before {
    content: "!";
}

.nhc-form-notice--success::before {
    content: "\2713";
}

.nhc-form-notice:focus {
    outline: 2px solid color-mix(in srgb, var(--nhc-notice-hue) 70%, transparent);
    outline-offset: 2px;
}

/* Invalid control: red ring on the control the browser or server refused,
 * and the label of that field marked the same way. */
.nhc-form [aria-invalid="true"],
.nhc-form .nhc-richtext:has([aria-invalid="true"]) .nhc-richtext__canvas,
.nhc-form nhc-date-time-picker[aria-invalid="true"] .nhc-datetime__control,
.nhc-form nhc-date-time-picker:has([aria-invalid="true"]) .nhc-datetime__control {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px color-mix(in srgb, #ef4444 35%, transparent);
}

.nhc-form .nhc-form__field:has([aria-invalid="true"]) > .nhc-form__label {
    color: color-mix(in srgb, #ef4444 70%, var(--text-high, currentColor));
}

.nhc-form__validation {
    --nhc-notice-hue: var(--nhc-notice-error);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.3rem;
    color: var(--nhc-notice-ink);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}

.nhc-form__validation > [role="alert"]::before {
    content: "! ";
    font-weight: 800;
}

.nhc-form__validation > [role="status"] {
    --nhc-notice-hue: var(--nhc-notice-warning);
}

/* Image field status line: hidden until it has something to say. */
.nhc-form__media-status {
    display: none;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.35rem;
    min-height: 1.15rem;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-med, currentColor);
    scroll-margin-bottom: 0.75rem;
}

.nhc-form__media-status:not(:empty) {
    display: flex;
}

.nhc-form__media-status[data-state="error"] {
    --nhc-notice-hue: var(--nhc-notice-error);
    color: var(--nhc-notice-ink);
}

.nhc-form__media-status[data-state="warning"] {
    --nhc-notice-hue: var(--nhc-notice-warning);
    color: var(--nhc-notice-ink);
}

.nhc-form__media-status[data-state="ok"] {
    --nhc-notice-hue: var(--nhc-notice-success);
    color: var(--nhc-notice-ink);
}

.nhc-form__media-status[data-state="error"]::before,
.nhc-form__media-status[data-state="warning"]::before,
.nhc-form__media-status[data-state="ok"]::before {
    content: "!";
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: var(--nhc-notice-hue);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.nhc-form__media-status[data-state="ok"]::before {
    content: "\2713";
}

.nhc-form__media-status[data-state="loading"]::before {
    content: "";
    flex: 0 0 auto;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 999px;
    border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
    border-top-color: currentColor;
    animation: nhc-media-status-spin 0.8s linear infinite;
}

@keyframes nhc-media-status-spin {
    to { transform: rotate(360deg); }
}

/* PROGRESS command (CommandFlagBit PROGRESS): while its form posts, the
   button's label covers the page, so nothing else can be clicked; the
   outcome arrives as the notice. */
.nhc-command-form.htmx-request [data-command-progress]::after {
    content: attr(data-command-progress) " \2026";
    position: fixed;
    inset: 0;
    z-index: var(--ds-z-dialog);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(0 0 0 / 0.55);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: progress;
    pointer-events: auto;
}

/* Modal shell (command_render.go writeSurface + dialog-shell.js), the htmx
 * peer of the React ModalHost frame: the panel is capped at the viewport, the
 * surface header with the X and the command bar stay visible, and only the
 * body (for a form, its field list) scrolls inside the panel. */
.nhc-modal {
    position: fixed;
    inset: 0;
    z-index: var(--ds-z-dialog);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
        max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: rgb(0 0 0 / 0.6);
}

.nhc-modal__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 1px solid var(--border, rgb(120 120 120 / 0.35));
    border-radius: 14px;
    background: var(--bg-level-2, #fff);
}

.nhc-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.nhc-modal__panel > .nhc-surface {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.nhc-modal__panel > .nhc-surface > .nhc-surface__header {
    flex: none;
    padding-right: 3rem;
}

.nhc-modal__panel > .nhc-surface > .nhc-surface__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nhc-modal__panel .nhc-surface__body > form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.nhc-modal__panel .nhc-surface__body > form > .nhc-form__fields {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nhc-modal__panel .nhc-form__actions {
    flex: none;
}

@media (max-width: 639px) {
    .nhc-modal {
        padding: 0;
    }

    .nhc-modal__panel {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}

/* Workspace rail label overflow (Workspace.rail_label_overflow). A rail item
 * is .nhc-rail-label with its text in .nhc-rail-label__text. Unset/WRAP marks
 * an ancestor data-rail-label-overflow="wrap" (React: the rail list, htmx: the
 * workspace region) and the label breaks onto further lines at the rail
 * width; ELLIPSIS emits no marker and keeps the one-line truncation each
 * renderer already draws, so no rule exists for it. */
[data-rail-label-overflow="wrap"] .nhc-rail-label {
    height: auto;
}

[data-rail-label-overflow="wrap"] .nhc-rail-label__text {
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

/* Row collection (FIELD_TYPE_ROW_COLLECTION, renderer_row_collection.go): an
 * editable lines grid. The table is fixed-layout with server-sent column
 * widths, so a row added or removed in place by form-enhancements-rows.js
 * changes the grid's height only, never its column geometry. */
.nhc-rowgrid {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

.nhc-rowgrid__table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

.nhc-rowgrid__col--actions {
    width: 2.5rem;
}

.nhc-rowgrid__head,
.nhc-rowgrid__cell {
    padding: 0.125rem 0.25rem;
    text-align: start;
    vertical-align: middle;
}

.nhc-rowgrid__head {
    font-size: 0.8125rem;
    font-weight: 600;
    opacity: 0.8;
}

.nhc-rowgrid__cell--end {
    text-align: end;
}

.nhc-rowgrid__input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.nhc-rowgrid__cell--end .nhc-rowgrid__input {
    text-align: end;
}

.nhc-rowgrid__input[readonly] {
    background: transparent;
    border-color: transparent;
}

.nhc-rowgrid__row--blank .nhc-rowgrid__input {
    opacity: 0.85;
}

.nhc-rowgrid__remove {
    width: 2rem;
    min-height: 2rem;
    padding: 0;
    line-height: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    cursor: pointer;
}

.nhc-rowgrid__remove:hover,
.nhc-rowgrid__remove:focus-visible {
    border-color: currentColor;
}

.nhc-rowgrid__remove[hidden] {
    display: none;
}

.nhc-rowgrid__footer {
    display: flex;
    justify-content: flex-start;
    padding-top: 0.25rem;
}

/* Standard document detail (htmx peer of the React document-detail-blocks):
   metric cards on top (as many >=12rem tiles as fit), then section columns at
   least two tiles wide, flowing as masonry: each block keeps its own height. */
.nhc-document-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: 0.5rem; margin: 0 0 1rem; }
.nhc-document-metrics > div { min-width: 0; border: 1px solid var(--nhc-border, #d0d5dd); border-radius: 0.375rem; padding: 0.5rem 0.625rem; }
/* MetricTone tints, same palette as nhc-scene.css swatches. */
.nhc-document-metrics > div[data-tone="s"] { border-color: #05966966; background: #05966914; }
.nhc-document-metrics > div[data-tone="d"] { border-color: #e11d4866; background: #e11d4814; }
.nhc-document-metrics > div[data-tone="i"] { border-color: #2563eb66; background: #2563eb14; }
.nhc-document-metrics > div[data-tone="w"] { border-color: #d9770666; background: #d9770614; }
.nhc-document-metrics dt { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; opacity: 0.7; }
.nhc-document-metrics dd { margin: 0; padding-top: 0.25rem; font-weight: 600; overflow-wrap: anywhere; }
.nhc-document-blocks { columns: 24.5rem; column-gap: 1rem; }
.nhc-document-block { break-inside: avoid; margin: 0 0 1rem; min-width: 0; border: 1px solid var(--nhc-border, #d0d5dd); border-radius: 0.5rem; padding: 0.75rem 1rem; }
.nhc-document-block h3 { margin: 0 0 0.5rem; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.nhc-document-block dl { display: grid; gap: 0.5rem; margin: 0; }
.nhc-document-block dt { font-size: 0.75rem; opacity: 0.7; }
.nhc-document-block dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
/* A related tab that carries info blocks (DocumentRelatedCollectionTab.info): a closed
   disclosure below the scene, the peer of the React detail tab. */
.nhc-document-tab { margin-top: 1rem; }
.nhc-document-tab > summary { padding: 0.75rem 0; font-weight: 600; cursor: pointer; }
/* Related collections (collection_table, list_surface.tmpl). An INLINE one is a
   fixed-height box below the scene, as React's h-[min(60vh,24rem)] min-h-56, so a
   front-view pick, which swaps the surface, keeps the layout. The table scrolls in
   its own box and never widens the page (320/375 px phones included). */
.nhc-document-inline { display: flex; flex-direction: column; height: min(60vh, 24rem); min-height: 14rem; min-width: 0; margin-top: 1rem; overflow: hidden; border: 1px solid var(--nhc-border, #d0d5dd); border-radius: 0.5rem; }
.nhc-collection-table { display: flex; flex: 1; flex-direction: column; min-height: 0; min-width: 0; }
.nhc-collection-table__title { margin: 0; padding: 0.5rem 0.75rem; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.nhc-collection-table > p { padding: 0 0.75rem; }
.nhc-collection-table__form { display: contents; }
/* Sideways the box contains its scroll (no back swipe); up and down it hands the
   finger to the page at its end, so one finger still scrolls a phone page over a list. */
.nhc-collection-table__scroll { flex: 1; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior-x: contain; }
.nhc-document-tab .nhc-collection-table__scroll { max-height: min(60vh, 24rem); }
.nhc-collection-table table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.nhc-collection-table th, .nhc-collection-table td { padding: 0.5rem 0.75rem; text-align: start; white-space: nowrap; border-bottom: 1px solid var(--nhc-border, #d0d5dd); }
.nhc-collection-table th { position: sticky; top: 0; background: Canvas; font-weight: 600; }
.nhc-collection-table [data-align="center"] { text-align: center; }
.nhc-collection-table [data-align="end"] { text-align: end; }
/* The row opener fills its cell, which hands it its padding, so the whole cell is
   a tap target of at least 44 px (2.75rem), as React opens on the row. */
.nhc-collection-table td:has(> .nhc-collection-table__open) { padding: 0; }
.nhc-collection-table__open { display: block; box-sizing: border-box; width: 100%; min-height: 2.75rem; padding: 0.5rem 0.75rem; border: 0; background: none; color: inherit; font: inherit; text-align: inherit; text-decoration: underline; cursor: pointer; }
/* The opener touches the scroll box's edges, which would clip a ring drawn outside it. */
.nhc-collection-table__open:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
/* Collection display switch (template collection_display): both panes share one
   fixed height and the checked radio picks the pane, so a switch never moves
   the page; TABLE is kind 1, SCENE kind 4 (CollectionPresentationKind). */
.nhc-collection-display { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.nhc-collection-display__pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.nhc-collection-display__switch { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.375rem; }
.nhc-collection-display__option { display: inline-flex; align-items: center; min-height: 2.25rem; padding: 0 0.75rem; border: 1px solid var(--nhc-border, #d0d5dd); border-radius: 0.5rem; cursor: pointer; font-size: 0.875rem; }
.nhc-collection-display__option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nhc-collection-display__option:has(input:checked) { border-color: currentColor; font-weight: 600; }
.nhc-collection-display__option:has(input:focus-visible) { outline: 2px solid currentColor; outline-offset: 2px; }
@media (pointer: coarse) { .nhc-collection-display__option { min-height: 2.75rem; min-width: 2.75rem; justify-content: center; } }
/* Without :has() the radios pick nothing, so both panes show one under the other and the switch hides. */
.nhc-collection-display[data-switch] > .nhc-collection-display__pane { height: min(70vh, 40rem); min-height: 20rem; }
@supports selector(:has(*)) {
  .nhc-collection-display[data-switch] > .nhc-collection-display__pane { display: none; }
  .nhc-collection-display:has([data-display-option="1"]:checked) > [data-display-pane="1"],
  .nhc-collection-display:has([data-display-option="4"]:checked) > [data-display-pane="4"] { display: flex; }
}
@supports not selector(:has(*)) { .nhc-collection-display__switch { display: none; } }
/* Phones (below 40rem, as nhc-scene.css): a list whose only display is its table is capped as the
   switch box is, so the table scrolls under a sticky header. Desktop lists grow with the page; a
   plan-only pane keeps its plan's own height (nhc-scene.css), so it never spills out of a cap. */
@media (max-width: 39.99rem) { .nhc-surface--list .nhc-collection-display:not([data-switch]) > [data-display-pane="1"] { max-height: max(20rem, min(70vh, 40rem)); } }
/* In an INLINE related box the display and its panes take the box's height, never more. */
.nhc-document-inline > .nhc-collection-display { flex: 1; min-height: 0; }
.nhc-document-inline .nhc-collection-display > .nhc-collection-display__pane,
.nhc-document-inline .nhc-collection-display[data-switch] > .nhc-collection-display__pane { flex: 1; height: auto; min-height: 0; }
.nhc-collection-display__pane > .nhc-scene { flex: 1; min-height: 0; grid-template-rows: auto minmax(0, 1fr); }
.nhc-collection-display[data-switch] .nhc-scene__svg { height: 100%; min-height: 0; }

/* Layout scene 2D plan (htmx peer of React ScenePlan2D; renderer_scene.go).
   Tones = scene-tones.ts (graphPalette): s success, d danger, i info,
   w warning, e empty (unspecified, muted), n neutral. The root's data-mode picks which data-m<k> tone
   paints a box. */
.nhc-scene { display: grid; gap: 0.5rem; min-width: 0; }
.nhc-scene__toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.nhc-scene__chips { display: flex; flex-wrap: wrap; gap: 0.25rem; min-width: 0; }
.nhc-scene__chip { border: 1px solid var(--nhc-border, #d0d5dd); border-radius: 999px; padding: 0.125rem 0.625rem; background: transparent; color: inherit; font: inherit; font-size: 0.8125rem; cursor: pointer; }
/* Touch screens: every plan control is a finger-size target. */
@media (pointer: coarse) { .nhc-scene__chip { min-width: 2.75rem; min-height: 2.75rem; } }
.nhc-scene__chip[aria-pressed="true"] { background: var(--nhc-accent, #2563eb); border-color: var(--nhc-accent, #2563eb); color: #fff; }
/* A plan sits in a scrolling page: one finger scrolls the page, two fingers move and zoom the plan
   (scene-enhancements.js reads this touch-action). Full screen takes every gesture. The svg has its
   own click listener, so iOS would flash its tap highlight over the whole plan: none is drawn. */
.nhc-scene__svg { display: block; width: 100%; height: min(70vh, 40rem); min-height: 20rem; border: 1px solid var(--nhc-border, #d0d5dd); border-radius: 0.5rem; touch-action: pan-x pan-y; user-select: none; -webkit-tap-highlight-color: transparent; }
/* Full screen (data-fullscreen, set by the [data-scene-full] chip): the same plan over the visual
   viewport with the shell's viewport variables, as the rich text editor, above the navigation. */
.nhc-scene[data-fullscreen] { position: fixed; top: var(--nhc-visual-viewport-offset-top, 0px); left: var(--nhc-visual-viewport-offset-left, 0px); width: var(--nhc-shell-viewport-width, 100vw); height: var(--nhc-shell-viewport-height, 100dvh); z-index: var(--ds-z-menu); box-sizing: border-box; grid-template-rows: auto minmax(0, 1fr); padding: max(var(--nhc-safe-top, 0px), 0.5rem) 0.5rem max(var(--nhc-safe-bottom, 0px), 0.5rem); background: var(--bg-level-0, Canvas); touch-action: none; }
.nhc-scene[data-fullscreen] .nhc-scene__svg { height: 100%; min-height: 0; touch-action: none; }
.nhc-scene__chip svg { vertical-align: middle; }
/* Phones (below 40rem, the React client's sm width): one native picker replaces the chips of its group. */
.nhc-scene__pick { display: none; min-height: 2.75rem; max-width: 100%; border: 1px solid var(--nhc-border, #d0d5dd); border-radius: 0.5rem; padding: 0 0.5rem; background: transparent; color: inherit; font: inherit; font-size: 1rem; }
/* The switch groups (mode, level) share ONE non-wrapping row of pickers on phones (React
   scene-switches); from 40rem up the wrapper is display: contents, so the chips sit as before. */
.nhc-scene__switches { display: contents; }
@media (max-width: 39.99rem) {
  .nhc-scene__pick { display: block; width: 100%; }
  .nhc-scene__pick ~ .nhc-scene__chip { display: none; }
  .nhc-scene__switches { display: flex; flex: 1 1 100%; flex-wrap: nowrap; gap: 0.5rem; min-width: 0; }
  .nhc-scene__switches > .nhc-scene__chips { flex: 1 1 auto; min-width: 0; }
}
.nhc-scene [data-scene-off] { display: none; }
.nhc-scene__s { vector-effect: non-scaling-stroke; stroke-width: 1px; }
.nhc-scene__s--floor { fill: #94a3b8; fill-opacity: 0.15; stroke: none; }
.nhc-scene__s--rack { fill: none; stroke: #64748b; }
.nhc-scene__s--shape { fill: none; stroke: #64748b; stroke-dasharray: 4 3; }
.nhc-scene__box { fill: #64748b; stroke: #fff; stroke-width: 1px; vector-effect: non-scaling-stroke; cursor: pointer; }
.nhc-scene__box:hover { stroke: #0f172a; stroke-width: 2px; }
/* The scene's selected item (SceneSurface.selected_item_id), drawn on top. */
.nhc-scene__selected { fill: none; stroke: #0f172a; stroke-width: 4px; vector-effect: non-scaling-stroke; pointer-events: none; }
/* A scene below a document's info blocks (DocumentSurface.scene), e.g. the rack front view. */
.nhc-document-scene { display: grid; gap: 0.5rem; min-width: 0; margin-top: 1rem; }
.nhc-document-scene > h3 { margin: 0; font-size: 0.9375rem; }
.nhc-document-scene .nhc-scene__svg { height: min(45vh, 24rem); min-height: 14rem; }
.nhc-scene[data-mode="0"] [data-m0="s"], .nhc-scene[data-mode="1"] [data-m1="s"], .nhc-scene[data-mode="2"] [data-m2="s"], .nhc-scene[data-mode="3"] [data-m3="s"] { fill: #059669; }
.nhc-scene[data-mode="0"] [data-m0="d"], .nhc-scene[data-mode="1"] [data-m1="d"], .nhc-scene[data-mode="2"] [data-m2="d"], .nhc-scene[data-mode="3"] [data-m3="d"] { fill: #e11d48; }
.nhc-scene[data-mode="0"] [data-m0="i"], .nhc-scene[data-mode="1"] [data-m1="i"], .nhc-scene[data-mode="2"] [data-m2="i"], .nhc-scene[data-mode="3"] [data-m3="i"] { fill: #2563eb; }
.nhc-scene[data-mode="0"] [data-m0="w"], .nhc-scene[data-mode="1"] [data-m1="w"], .nhc-scene[data-mode="2"] [data-m2="w"], .nhc-scene[data-mode="3"] [data-m3="w"] { fill: #d97706; }
.nhc-scene[data-mode="0"] [data-m0="e"], .nhc-scene[data-mode="1"] [data-m1="e"], .nhc-scene[data-mode="2"] [data-m2="e"], .nhc-scene[data-mode="3"] [data-m3="e"] { fill: #cbd5e1; }
.nhc-scene__legend { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: center; font-size: 0.8125rem; }
.nhc-scene__legend[hidden] { display: none; }
.nhc-scene__legend-title { font-weight: 600; }
.nhc-scene__key { display: inline-flex; align-items: center; gap: 0.25rem; }
.nhc-scene__swatch { width: 0.75rem; height: 0.75rem; border-radius: 0.125rem; background: #64748b; }
.nhc-scene__swatch[data-tone="s"] { background: #059669; }
.nhc-scene__swatch[data-tone="d"] { background: #e11d48; }
.nhc-scene__swatch[data-tone="i"] { background: #2563eb; }
.nhc-scene__swatch[data-tone="w"] { background: #d97706; }
.nhc-scene__swatch[data-tone="e"] { background: #cbd5e1; }
.nhc-scene-empty { display: grid; gap: 0.5rem; justify-items: start; }
/* Pick route (renderer_scene_route.go, React SceneRouteLayer.tsx): walked legs dimmed, the current
   leg emphasised, numbered stops (done, short, skipped, current); never takes a tap. */
.nhc-scene__leg { fill: none; stroke: #2563eb; stroke-width: 3px; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.nhc-scene__leg--done { stroke: #94a3b8; stroke-opacity: 0.6; }
.nhc-scene__leg--current { stroke: #1d4ed8; stroke-width: 6px; }
.nhc-scene__route-target { fill: none; stroke: #1d4ed8; stroke-width: 4px; vector-effect: non-scaling-stroke; }
/* A marker is drawn in screen px and scaled by scene millimetres per pixel (renderer_scene_route.go). */
.nhc-scene__mark { transform: scale(var(--nhc-scene-mm, 1)); }
.nhc-scene__stop circle { fill: #fff; stroke: #2563eb; stroke-width: 2px; vector-effect: non-scaling-stroke; }
.nhc-scene__stop text { fill: #1e293b; text-anchor: middle; dominant-baseline: central; font-weight: 600; }
.nhc-scene__stop[data-done] circle { fill: #e2e8f0; stroke: #94a3b8; }
.nhc-scene__stop[data-done] text { fill: #64748b; }
.nhc-scene__stop[data-short] circle { fill: #fef3c7; stroke: #d97706; }
.nhc-scene__stop[data-skipped] circle { fill: #fff; stroke: #94a3b8; stroke-dasharray: 3 2; }
.nhc-scene__stop[data-current] circle { fill: #1d4ed8; stroke: #fff; }
.nhc-scene__stop[data-current] text { fill: #fff; }

/* Fullscreen task workspaces (WORKSPACE_FLAG_BIT_TASK_FULLSCREEN): on a phone
   or tablet (html[data-device], nhc-device.js) with a compact viewport (the
   React lg boundary) the region leads with a menu + title bar and the surface
   headers give their row to the task content. A desktop window resized
   narrow keeps its normal chrome. The sibling selector survives per-surface
   outerHTML swaps. */
.nhc-workspace-topbar {
    display: none;
}

@media (max-width: 1023px) {
    html:is([data-device="phone"], [data-device="tablet"]) .nhc-workspace-topbar {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        min-height: 2.75rem;
        padding: 0 0.5rem;
        border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
    }

    html:is([data-device="phone"], [data-device="tablet"]) .nhc-workspace-topbar__menu {
        min-width: 2.75rem;
        min-height: 2.75rem;
        font-size: 1.25rem;
        background: none;
        border: 0;
        color: inherit;
    }

    html:is([data-device="phone"], [data-device="tablet"]) .nhc-workspace-topbar__title {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 600;
    }

    html:is([data-device="phone"], [data-device="tablet"]) .nhc-workspace-topbar ~ .nhc-region-surface .nhc-surface__header {
        display: none;
    }
}

/* Section tabs of a multi-section workspace (workspace_sections.go): one
   scrolling row of 44 px tabs above the one shown section, on every device. */
.nhc-workspace-sections__tabs {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.nhc-workspace-sections__tab {
    flex: 0 0 auto;
    min-height: 2.75rem;
    padding: 0 0.75rem;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    color: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.nhc-workspace-sections__tab[aria-selected="true"] {
    border-bottom-color: currentColor;
    font-weight: 600;
}

/* The shell status line (shell_status_line.go): one 48 px row whose customer
   zone never wraps or grows. The chip takes the free space and truncates
   (min-width: 0); a container query drops its text when the zone is too
   narrow, so 320 px phones never scroll sideways. Both buttons are 44 px. */
.nhc-status-line {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 3rem;
    min-width: 0;
    padding: 0 0.25rem;
    border-top: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
    background: var(--background, inherit);
}

.nhc-status-line[hidden] {
    display: none;
}

/* A native select never shrinks below its longest option unless its flex
   item may: both selectors give way to the customer zone at 320 px and the
   browser truncates the shown option. */
.nhc-scope-selector {
    flex: 0 1 auto;
    min-width: 0;
}

.nhc-scope-selector select {
    width: 100%;
    min-height: 2.75rem;
    max-width: 12rem;
    margin-right: 0.25rem;
}

.nhc-customer-context {
    container-type: inline-size;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.25rem;
    min-width: 2.75rem;
    flex: 0 0 auto;
}

.nhc-customer-context--selected {
    flex: 1 1 auto;
}

.nhc-customer-context__form {
    display: contents;
}

.nhc-customer-context__open,
.nhc-customer-context__clear {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.75rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    padding: 0 0.5rem;
    background: none;
    border: 0;
    border-radius: 0.375rem;
    color: inherit;
    cursor: pointer;
}

.nhc-customer-context__open {
    min-width: 2.75rem;
    max-width: 100%;
    flex: 0 1 auto;
    overflow: hidden;
    justify-content: flex-start;
}

.nhc-customer-context__clear {
    justify-content: center;
    flex: 0 0 auto;
    font-size: 1.25rem;
    border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
}

.nhc-customer-context__icon {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
}

.nhc-customer-context__filter {
    position: absolute;
    right: -0.25rem;
    bottom: -0.25rem;
    color: var(--gold, #c8a03c);
}

.nhc-customer-context__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    font-size: 0.75rem;
    line-height: 1rem;
    text-align: left;
}

.nhc-customer-context__label,
.nhc-customer-context__description {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nhc-customer-context__label {
    font-weight: 600;
}

.nhc-customer-context__description {
    opacity: 0.7;
}

@container (max-width: 9rem) {
    .nhc-customer-context__text {
        display: none;
    }
}

/* Shell scan (shell_scan.tmpl): the header search field and scan button, and
   the panel with the inline camera and the resolve result. */
.nhc-shell-scan__bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.nhc-shell-scan__search {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 44px;
}
.nhc-shell-scan__button,
.nhc-shell-scan__close {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nhc-shell-scan__panel {
    display: grid;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--bg-level-2);
}
.nhc-shell-scan__panel[hidden] {
    display: none;
}
.nhc-shell-scan__close {
    justify-self: end;
}
.nhc-shell-scan__choices,
.nhc-shell-scan__preview {
    display: grid;
    gap: 0.5rem;
}
.nhc-shell-scan__fields {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
    margin: 0;
}
