/* 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 :is(h1, h2, h3, h4, h5, h6, strong) {
    color: inherit;
}

.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;
    /* --nhc-rt-viewport-* follow the visual viewport (on-screen keyboard),
       set by richtext-touch.js while fullscreen; otherwise the shell viewport vars apply. */
    top: var(--nhc-rt-viewport-top, var(--nhc-visual-viewport-offset-top, 0px));
    left: var(--nhc-rt-viewport-left, var(--nhc-visual-viewport-offset-left, 0px));
    width: var(--nhc-rt-viewport-width, var(--nhc-shell-viewport-width, 100vw));
    height: var(--nhc-rt-viewport-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;
}

/* Mail editing keeps the message typography and a stable gutter at every width.
   The delivered message and its preview own the centred 720px mail column. */
.nhc-richtext[data-richtext-content-style="email"] .nhc-richtext__surface {
    padding: 16px 22px;
    background: #fff;
    color: #172033;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.58;
}

.nhc-richtext[data-richtext-content-style="email"] .nhc-richtext__surface p {
    margin: 0 0 14px;
}

.nhc-richtext[data-richtext-content-style="email"] .nhc-richtext__surface a {
    color: #0f4c81;
}

.nhc-richtext[data-richtext-content-style="email"] .nhc-richtext__surface img {
    max-width: 100%;
    height: auto;
}


.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:is(:hover, :focus-visible, [aria-pressed="true"]),
.nhc-richtext .nhc-form__inline-action.nhc-richtext__tool:is(:hover, :focus-visible, [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;
}

/* Two-state icons (fullscreen): arrows out to the corners, arrows in when active. */
.nhc-richtext__tool[aria-pressed="true"] .nhc-richtext__icon-idle,
.nhc-richtext__tool:not([aria-pressed="true"]) .nhc-richtext__icon-pressed {
    display: none;
}

.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],
.nhc-richtext__popover-error[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 {
        gap: 0.04rem;
        padding: 0.2rem 0.2rem;
    }

    .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: inherit;
    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: inherit;
}

.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;
    flex-wrap: wrap;
    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;
}

.nhc-richtext__popover-error,
.nhc-richtext__notice {
    flex-basis: 100%;
    margin: 0;
    font-size: 0.78rem;
    color: var(--nhc-notice-error, #ef4444);
}

@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; }
/* Public submit protection bot trap (server/public_submit_protection.go): out of view for people, present for bots. */
.nhc-public-submit-trap { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* 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(calc(50% - 0.25rem), 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; }
.nhc-swatch { display: inline-block; width: 1rem; height: 1rem; margin-inline-end: 0.5rem; border: 1px solid rgba(120, 120, 120, 0.45); border-radius: 999px; vertical-align: -0.15rem; }
/* Sparkline cells (list_surface.tmpl) are sized here, not by SVG attributes: 6rem on wide
   screens, shrinking with the viewport on phones (22vw = 70 px at 320 px). */
.nhc-sparkline { display: inline-block; width: min(6rem, 22vw); max-width: 100%; height: 1.25rem; vertical-align: middle; }
/* 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 a row of pickers on phones (React scene-switches); a
   picker whose label does not fit wraps to the next row, so no label is clipped; 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: wrap; 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;
}

/* nhc-richtext-touch.css: rich-text toolbar overflow and touch sizing,
 * driven by richtext-touch.js. Ships inside the versioned SDUI stylesheet
 * (pkg/ui_htmx/assets.go) and is imported by the React RichTextEditor. */

/* Toolbar overflow (richtext-touch.js layoutToolbarOverflow): tools that do
 * not fit one row carry data-rt-overflow="1" and stay hidden until the "more"
 * toggle opens them as extra wrapped rows. data-rt-measuring lays every tool
 * on one unwrapped row for the measurement pass. */
.nhc-richtext .nhc-richtext__tool.nhc-richtext__overflow-toggle {
    display: none;
    order: 98;
    margin-left: auto;
}

.nhc-richtext .nhc-richtext__toolbar:is([data-rt-overflowing="1"], [data-rt-measuring="1"]) > .nhc-richtext__overflow-toggle {
    display: inline-flex;
}

.nhc-richtext .nhc-richtext__toolbar[data-rt-measuring="1"] {
    flex-wrap: nowrap;
    overflow: hidden;
}

.nhc-richtext .nhc-richtext__toolbar:not([data-rt-overflow-open="1"]) > [data-rt-overflow="1"] {
    display: none;
}

.nhc-richtext .nhc-richtext__tool.nhc-richtext__overflow-toggle[aria-expanded="true"] {
    background: color-mix(in srgb, var(--ring) 24%, var(--bg-level-2));
    color: var(--ring);
}

/* Touch: every toolbar and link-popover control is at least 44px, and the
 * link input uses 16px text so iOS does not zoom the page on focus. */
@media (pointer: coarse) {
    .nhc-richtext .nhc-richtext__tool,
    .nhc-richtext .nhc-form__inline-action.nhc-richtext__tool,
    .nhc-richtext .nhc-richtext__tool--label,
    .nhc-richtext .nhc-form__inline-action.nhc-richtext__tool--label {
        min-width: 2.75rem;
        height: 2.75rem;
    }

    .nhc-richtext__icon {
        width: 1.15rem;
        height: 1.15rem;
    }

    .nhc-richtext__popover-input,
    .nhc-richtext__popover-btn {
        height: 2.75rem;
        font-size: 1rem;
    }
}

/* ICON_ONLY command (CommandFlagBit ICON_ONLY, command_icons.go): a square
   icon button named by its label, at least 40 px, 44 px on touch; colours
   stay the host's button colours. */
.nhc-command--icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
}

@media (pointer: coarse) {
    .nhc-command--icon {
        min-width: var(--nhc-touch-target, 2.75rem);
        min-height: var(--nhc-touch-target, 2.75rem);
    }
}

/* Split button (CommandDescriptor.group, command_groups.go): the main command
   and a chevron toggle joined as one control; the toggle is a native
   <details> summary (Enter/Space, touch), its menu the group's other commands
   stacked under it, right-aligned and capped to the viewport. Colours stay the
   host's button colours; the menu uses the shared surface tokens. */
.nhc-command-split {
    position: relative;
    display: inline-flex;
    align-items: stretch;
    max-width: 100%;
}
.nhc-command-split > .nhc-command {
    min-width: 0;
    border-start-end-radius: 0;
    border-end-end-radius: 0;
}
.nhc-command-split__more {
    display: flex;
}
.nhc-command-split__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    list-style: none;
    cursor: pointer;
    border-start-start-radius: 0;
    border-end-start-radius: 0;
    border-inline-start: 1px solid var(--nhc-border, currentColor);
}
.nhc-command-split__toggle::-webkit-details-marker {
    display: none;
}
.nhc-command-split__more[open] > .nhc-command-split__toggle svg {
    transform: rotate(180deg);
}
.nhc-command-split__menu {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 0.25rem);
    z-index: var(--ds-z-menu);
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 100%;
    max-width: min(20rem, calc(100vw - 2rem));
    padding: 0.25rem;
    border: 1px solid var(--nhc-border, currentColor);
    border-radius: 0.375rem;
    background: var(--bg-level-2, Canvas);
    color: var(--text-high, CanvasText);
}
.nhc-command-split__menu > .nhc-command {
    width: 100%;
    min-height: 2.5rem;
    text-align: start;
    white-space: normal;
}

@media (pointer: coarse) {
    .nhc-command-split__toggle,
    .nhc-command-split__menu > .nhc-command {
        min-width: var(--nhc-touch-target, 2.75rem);
        min-height: var(--nhc-touch-target, 2.75rem);
    }
}

/* nhc datetime field (pkg/ui/datetimefield): a labelled value button and
   its drum popover. Look comes from --dtf-* tokens that default to the
   shared --ui-* tokens; a host maps its own brand tokens onto --dtf-* on
   its root class. Fixed head and drum heights: no jump on open. */

.nhc-dtf {
  --dtf-ink: var(--ui-ink, #071426);
  --dtf-muted: var(--ui-muted, #667085);
  --dtf-line: var(--ui-line, #dfe5ee);
  --dtf-surface: var(--ui-surface, #ffffff);
  --dtf-soft: var(--ui-soft, #f1f4f8);
  --dtf-accent: var(--ui-accent, #c8102e);
  --dtf-danger: var(--ui-danger, #b42318);
  --dtf-accent-2: var(--ui-accent-2, var(--dtf-accent));
  --dtf-accent-line: var(--ui-accent-line, var(--dtf-accent));
  --dtf-on-accent: var(--ui-on-dark, #ffffff);
  --dtf-shadow: var(--ui-shadow, 0 24px 64px rgba(7, 20, 38, 0.11));
  --dtf-radius: var(--ui-radius, 14px);
  --dtf-radius-sm: var(--ui-radius-sm, 10px);
  --dtf-radius-pill: var(--ui-radius-pill, 999px);
  --dtf-fs-md: var(--ui-fs-md, 13px);
  --dtf-fs-base: var(--ui-fs-base, 14px);
  --dtf-fs-lg: var(--ui-fs-lg, 16px);
  --dtf-fw-bold: var(--ui-fw-bold, 700);
  --dtf-fw-medium: var(--ui-fw-medium, 600);
  --dtf-item: 36px;
  --dtf-head: 20px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

/* Stacked: label above a full-width button, like a native form field. */
.nhc-dtf--stack {
  display: grid;
  gap: 4px;
  padding: 0;
}

.nhc-dtf__label {
  color: var(--dtf-muted);
  font-size: var(--dtf-fs-md);
  font-weight: var(--dtf-fw-bold);
}

/* A stacked label reads like the host's native form labels (regular
   weight); a host maps its label size onto --dtf-label-fs. */
.nhc-dtf--stack .nhc-dtf__label {
  font-size: var(--dtf-label-fs, var(--dtf-fs-md));
  font-weight: var(--dtf-label-fw, normal);
}

.nhc-dtf__label:empty {
  display: none;
}

.nhc-dtf__button {
  font-size: var(--dtf-fs-base);
  font-variant-numeric: tabular-nums;
}

/* The default value button, for hosts that bring no button class. */
.nhc-dtf__button--default {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--dtf-line);
  border-radius: var(--dtf-radius-sm);
  background: var(--dtf-surface);
  color: var(--dtf-ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.nhc-dtf__button--default:focus-visible {
  outline: 2px solid var(--dtf-accent-line);
  outline-offset: 1px;
}

.nhc-dtf__button:disabled {
  opacity: 0.6;
  cursor: default;
}

.nhc-dtf__button[aria-invalid="true"] {
  border-color: var(--dtf-danger);
}

.nhc-dtf__button[aria-expanded="true"] {
  border-color: var(--dtf-accent);
}

/* The popover never sits in its container's flow: it opens in the top
   layer (popover="manual"; position: fixed where the API is missing), so
   it never grows a dialog's or page's scroll area. The script places it
   under the field, flips it above when it does not fit and clamps it to
   the viewport (--dtf-anchor-w = the field width). */
.nhc-dtf__pop {
  position: fixed;
  z-index: 30;
  inset: auto;
  top: 8px;
  left: 8px;
  margin: 0;
  width: min(max(var(--dtf-anchor-w, 280px), 280px), 360px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px;
  border: 1px solid var(--dtf-line);
  border-radius: var(--dtf-radius);
  background: var(--dtf-surface);
  color: var(--dtf-ink);
  box-shadow: var(--dtf-shadow);
  box-sizing: border-box;
}

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

/* Two parts, date | time, each headed and split by one thin full-height
   line; the time part reads HH:MM. One part fills the row alone. */
.nhc-dtf__drums {
  display: grid;
  grid-template-columns: minmax(0, 3.4fr) minmax(0, 2.4fr);
}

.nhc-dtf__drums--single {
  grid-template-columns: minmax(0, 1fr);
}

.nhc-dtf__part {
  display: grid;
  grid-template-rows: var(--dtf-head) auto;
  row-gap: 6px;
  min-width: 0;
}

.nhc-dtf__drums:not(.nhc-dtf__drums--single) .nhc-dtf__part--date {
  padding-right: 8px;
}

.nhc-dtf__drums:not(.nhc-dtf__drums--single) .nhc-dtf__part--time {
  padding-left: 8px;
  border-left: 1px solid var(--dtf-line);
}

.nhc-dtf__head {
  height: var(--dtf-head);
  line-height: var(--dtf-head);
  text-align: center;
  color: var(--dtf-muted);
  font-size: var(--ui-small, .8125rem);
  font-weight: var(--dtf-fw-bold);
  overflow: hidden;
  white-space: nowrap;
}

.nhc-dtf__wheels {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: 4px;
}

.nhc-dtf__part--time .nhc-dtf__wheels {
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
}

.nhc-dtf__colon {
  position: relative;
  align-self: center;
  height: var(--dtf-item);
  line-height: var(--dtf-item);
  padding: 0 2px;
  color: var(--dtf-ink);
  font-size: var(--dtf-fs-lg);
  font-weight: var(--dtf-fw-bold);
  pointer-events: none;
}

.nhc-dtf__wheels::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--dtf-item) * 2);
  height: var(--dtf-item);
  border-radius: var(--dtf-radius-sm);
  background: var(--dtf-soft);
  pointer-events: none;
}

.nhc-dtf__drum {
  position: relative;
  height: calc(var(--dtf-item) * 5);
  padding: calc(var(--dtf-item) * 2) 0;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  outline: none;
  border-radius: var(--dtf-radius-sm);
  -webkit-mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
  mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
}

.nhc-dtf__drum::-webkit-scrollbar {
  display: none;
}

.nhc-dtf__drum:focus-visible {
  box-shadow: inset 0 0 0 2px var(--dtf-accent-line);
}

.nhc-dtf__item {
  height: var(--dtf-item);
  line-height: var(--dtf-item);
  text-align: center;
  scroll-snap-align: center;
  font-size: var(--dtf-fs-lg);
  font-variant-numeric: tabular-nums;
  color: var(--dtf-muted);
  cursor: pointer;
  user-select: none;
}

.nhc-dtf__item[aria-selected="true"] {
  color: var(--dtf-ink);
  font-weight: var(--dtf-fw-bold);
}

.nhc-dtf__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.nhc-dtf__chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--dtf-line);
  border-radius: var(--dtf-radius-pill);
  background: var(--dtf-soft);
  color: var(--dtf-ink);
  font: inherit;
  font-size: var(--dtf-fs-base);
  cursor: pointer;
}

.nhc-dtf__chip:hover,
.nhc-dtf__chip:focus-visible {
  border-color: var(--dtf-accent-line);
}

.nhc-dtf__actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}

.nhc-dtf__action,
.nhc-dtf__done {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--dtf-line);
  border-radius: var(--dtf-radius-pill);
  background: var(--dtf-surface);
  color: var(--dtf-ink);
  font: inherit;
  font-weight: var(--dtf-fw-medium);
  cursor: pointer;
}

.nhc-dtf__done {
  margin-left: auto;
  border-color: var(--dtf-accent-2);
  background: var(--dtf-accent);
  color: var(--dtf-on-accent);
}

@media (max-width: 640px) {
  .nhc-dtf__drums { --dtf-item: 40px; }
}

/* Neutral UI tokens (--ui-*): the one :root shared by pkg/ui bricks and the
   pages that adopt them. Values are copied from
   pkg/portalask/assets/ask-tokens.css (--pa-*); a theme overrides a value
   here, never per component. --ui-accent is the single primary colour. */
:where(:root) {
  /* surfaces */
  --ui-bg: #f7f8fb;
  --ui-surface: #ffffff;
  --ui-soft: #f1f4f8;
  --ui-tint: rgba(7, 20, 38, 0.07);
  --ui-tint-strong: rgba(7, 20, 38, 0.13);
  --ui-overlay: rgba(7, 20, 38, 0.45);
  /* lines */
  --ui-line: #dfe5ee;
  --ui-line-soft: rgba(223, 229, 238, 0.86);
  --ui-line-strong: #cfd6e2;
  --ui-track: #d7dee9;
  /* text */
  --ui-ink: #071426;
  --ui-ink-2: #253247;
  --ui-muted: #667085;
  --ui-muted-2: #8b95a5;
  --ui-on-dark: #ffffff;
  /* brand and the single primary action colour */
  --ui-brand: #071426;
  --ui-accent: #ef1725;
  --ui-accent-2: #c90f1a;
  --ui-accent-soft: rgba(239, 23, 37, 0.28);
  --ui-accent-line: rgba(239, 23, 37, 0.35);
  /* status */
  --ui-ok: #1e7a3c;
  --ui-ok-bg: #e8f5ec;
  --ui-warn: #8a4b00;
  --ui-warn-bg: #fff4e0;
  --ui-warn-line: #f2c879;
  --ui-info: #1d4f91;
  --ui-info-bg: #eef4fc;
  --ui-info-line: #b9cfee;
  --ui-danger: #b3261e;
  --ui-danger-bg: #fdecee;
  --ui-danger-line: #f1b3b0;
  /* focus */
  --ui-focus-ring: rgba(239, 23, 37, 0.28);
  --ui-focus: 3px solid var(--ui-focus-ring);
  --ui-focus-offset: 2px;
  /* type: 6 sizes, 4 weights, one caps treatment */
  --ui-fs-xs: 11px;
  --ui-fs-sm: 12px;
  --ui-fs-md: 13px;
  --ui-fs-base: 14px;
  --ui-fs-lg: 16px;
  --ui-fs-xl: 18px;
  --ui-fw-regular: 400;
  --ui-fw-medium: 600;
  --ui-fw-bold: 700;
  --ui-fw-heavy: 800;
  --ui-caps-tracking: 0.04em;
  /* radius */
  --ui-radius-xs: 6px;
  --ui-radius-sm: 10px;
  --ui-radius-md: 12px;
  --ui-radius: 12px; /* the one card/field radius */
  --ui-radius-sheet: 16px;
  --ui-radius-pill: 999px;
  /* elevation */
  --ui-shadow-1: 0 10px 28px rgba(7, 20, 38, 0.05);
  --ui-shadow-2: 0 8px 18px rgba(7, 20, 38, 0.09);
  --ui-shadow-3: 0 16px 42px rgba(7, 20, 38, 0.09);
  --ui-shadow: 0 24px 64px rgba(7, 20, 38, 0.11);
  --ui-shadow-overlay: 0 24px 60px rgba(7, 20, 38, 0.28);
  /* spacing */
  --ui-sp-1: 2px;
  --ui-sp-2: 4px;
  --ui-sp-3: 6px;
  --ui-sp-4: 8px;
  --ui-sp-5: 10px;
  --ui-sp-6: 12px;
  --ui-sp-7: 16px;
  --ui-sp-8: 24px;
  /* controls */
  --ui-control-sm: 32px;
  --ui-control: 40px;
  --ui-control-lg: 50px;
  --ui-hit: 44px;
  /* layout (app bar brick) */
  --ui-gutter: 16px;
  --ui-content: 1200px;
  /* map pages from 1440 px (journey log .jl--map): a wider page column and
     one left column (list / ride info) width beside the map pane */
  --ui-content-map: clamp(1200px, 82vw, 1760px);
  --ui-map-side: 400px;
  --ui-bar: 56px;
  --ui-tabbar: 64px;
  --ui-logo-h: 28px;
  /* the one type scale, padding and control height (page.css): bricks and
     pages read these instead of own font stacks, heading sizes and heights */
  --ui-font: Inter, "Inter Fallback", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ui-h1: 1.75rem;
  --ui-h2: 1.25rem;
  --ui-h3: 1rem;
  --ui-h-weight: var(--ui-fw-bold);
  --ui-small: .8125rem;
  --ui-pad: var(--ui-sp-7);
  --ui-gap: var(--ui-sp-6);
  --ui-ctl-h: var(--ui-hit);
  /* the one page top: every frame's column starts --ui-page-top below the
     bar, and a sub-page's back row sits inside that band, so a title never
     moves between a page and its sub-pages (frame.css, appbar.css .ui-backrow) */
  --ui-page-top: var(--ui-hit);
  /* space fixed bottom overlays (cookie consent) keep free: the phone tab
     bar's height where one is shown (appbar.css), else 0 */
  --ui-bottom-inset: 0px;
}

/* pkg/ui/appbar page.css: the shared base of every app-bar page: one font,
   one heading scale, one radius, one control height (tokens.css). Element
   rules sit in :where() (zero specificity) so any page class still wins; the
   .ui-* classes are the shared bricks (button, field, card, chip). */
:where(body:has(.ui-appbar), .ui-page) { font-family: var(--ui-font); }
/* form controls do not inherit the font by default (Arial on map buttons) */
:where(body:has(.ui-appbar) button, body:has(.ui-appbar) input, body:has(.ui-appbar) select, body:has(.ui-appbar) textarea) { font-family: inherit; }
:where(.ui-page h1, .ui-h1) { font-size: var(--ui-h1); font-weight: var(--ui-h-weight); line-height: 1.2; }
:where(.ui-page h2, .ui-h2) { font-size: var(--ui-h2); font-weight: var(--ui-h-weight); line-height: 1.25; }
:where(.ui-page h3, .ui-h3) { font-size: var(--ui-h3); font-weight: var(--ui-h-weight); line-height: 1.3; }
:where(.ui-small) { font-size: var(--ui-small); }

/* button: pill at the control height; --primary is the accent action,
   --secondary the outlined quiet one next to it, --danger the destructive
   action (a delete, the confirm dialog's OK). States: hidden, disabled,
   aria-busy and htmx in flight. */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--ui-sp-3);
  min-height: var(--ui-ctl-h); padding: 0 var(--ui-pad);
  border: 1px solid var(--ui-line-strong); border-radius: var(--ui-radius-pill);
  background: var(--ui-surface); color: var(--ui-brand);
  font: inherit; font-weight: var(--ui-fw-medium); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.ui-btn:hover { background: var(--ui-tint); }
.ui-btn--primary { background: var(--ui-accent); border-color: var(--ui-accent); color: var(--ui-on-dark); }
.ui-btn--primary:hover { background: var(--ui-accent-2); border-color: var(--ui-accent-2); }
.ui-btn--secondary { background: transparent; border-color: var(--ui-line-strong); color: var(--ui-brand); }
.ui-btn--secondary:hover { background: var(--ui-tint); }
.ui-btn--danger { background: var(--ui-danger); border-color: var(--ui-danger); color: var(--ui-on-dark); }
.ui-btn--danger:hover { background: var(--ui-danger); border-color: var(--ui-danger-line); box-shadow: inset 0 0 0 99px var(--ui-tint-strong); }
/* quiet: text-only tertiary; small: compact row action. */
.ui-btn--quiet { background: transparent; border-color: transparent; padding: 0 var(--ui-gap); }
.ui-btn--small { padding: 0 var(--ui-gap); font-size: var(--ui-small); }
.ui-btn[hidden] { display: none; }
.ui-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ui-btn[aria-busy="true"], .ui-btn.htmx-request, .htmx-request .ui-btn[type="submit"] { opacity: 0.6; }

/* field: text input / select at the control height */
.ui-field {
  box-sizing: border-box; width: 100%; min-height: var(--ui-ctl-h); padding: 0 var(--ui-gap);
  border: 1px solid var(--ui-line); border-radius: var(--ui-radius);
  background: var(--ui-surface); color: var(--ui-ink); font: inherit;
}

/* card: one radius, one padding */
.ui-card {
  box-sizing: border-box; padding: var(--ui-pad);
  border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: var(--ui-surface);
}

/* chip: the one chip/badge. Static chips are small tinted labels (tones
   --ok --warn --info --accent); link/button chips are filter pills at the
   control height. */
.ui-chip {
  display: inline-flex; align-items: center; gap: var(--ui-sp-3); max-width: 100%;
  padding: var(--ui-sp-1) var(--ui-sp-5); border: 1px solid transparent; border-radius: var(--ui-radius-pill);
  background: var(--ui-soft); color: var(--ui-ink-2);
  font-size: var(--ui-small); font-weight: var(--ui-fw-medium); line-height: 1.4;
  white-space: nowrap; text-decoration: none;
}
.ui-chip--ok { background: var(--ui-ok-bg); color: var(--ui-ok); }
.ui-chip--warn { background: var(--ui-warn-bg); color: var(--ui-warn); }
.ui-chip--info { background: var(--ui-info-bg); color: var(--ui-info); }
.ui-chip--accent { background: var(--ui-accent); color: var(--ui-on-dark); }
a.ui-chip, button.ui-chip {
  flex: none; min-height: var(--ui-ctl-h); padding: 0 var(--ui-gap);
  border-color: var(--ui-line); background: var(--ui-surface); color: var(--ui-ink); font-family: inherit; cursor: pointer;
}
a.ui-chip:hover, button.ui-chip:hover { background: var(--ui-tint); }
.ui-btn:focus-visible, .ui-field:focus-visible, .ui-chip:focus-visible {
  outline: var(--ui-focus); outline-offset: var(--ui-focus-offset);
}

/* back link of a sub-page: drawn inside the page-top band of the column
   (zero flow height), so the title below sits at the same top as on a page
   without one; the bar keeps its brand */
.ui-backrow { position: relative; z-index: 1; height: 0; overflow: visible; }
.ui-backrow .ui-appbar__back { color: var(--ui-ink-2); text-decoration: none; }

/* pkg/ui/confirm: the one confirm dialog (tokens only). Actions: Cancel
   first, the destructive OK last, flush right. Phones: a bottom sheet. */
.ui-confirm {
  font-family: var(--ui-font);
  box-sizing: border-box; width: min(100% - 2rem, 26rem); max-height: calc(100% - 2rem); padding: var(--ui-pad);
  border: 0; border-radius: var(--ui-radius); background: var(--ui-surface); color: var(--ui-ink); box-shadow: var(--ui-shadow-overlay);
}
.ui-confirm::backdrop { background: var(--ui-overlay); }
.ui-confirm__q { margin: 0 0 var(--ui-pad); }
/* the SDUI htmx command confirm (pkg/ui_htmx writeConfirm) adds a title,
   the record subject and a muted hint around the question */
.ui-confirm__title { margin: 0 0 var(--ui-sp-3); font-size: var(--ui-h3); font-weight: var(--ui-h-weight); line-height: 1.3; }
.ui-confirm__subject { margin: 0 0 var(--ui-sp-3); }
.ui-confirm__hint { margin: calc(-1 * var(--ui-sp-3)) 0 var(--ui-pad); color: var(--ui-ink-2); font-size: var(--ui-small); }
.ui-confirm__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--ui-sp-3); margin: 0; }
@media (max-width: 639px) {
  .ui-confirm { width: 100%; max-width: none; margin: auto 0 0; border-radius: var(--ui-radius) var(--ui-radius) 0 0;
    padding-bottom: calc(var(--ui-pad) + env(safe-area-inset-bottom)); }
  .ui-confirm__actions .ui-btn { flex: 1 1 0; }
}
