/* Components. Each block is documented with live examples in the handbook at /design. Values come from tokens.css. */

/* ---------- Utilities ---------- */

.nx-muted { color: var(--nx-text-muted); }
.nx-small { font-size: var(--nx-size-xs); }
.nx-strong { font-weight: var(--nx-weight-strong); color: var(--nx-ink); }
.nx-nowrap { white-space: nowrap; }
.nx-strong-link { font-weight: var(--nx-weight-strong); }
.nx-right { margin-left: auto; }
.nx-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Icon ---------- */

.nx-icon {
    flex: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -3px;
}

.nx-icon--sm { width: 14px; height: 14px; vertical-align: -2px; }
.nx-icon--lg { width: 22px; height: 22px; }

/* ---------- Buttons: colour states purpose; solid is primary, tint is secondary ---------- */

/* A grey action button is grey on a white card and white on a grey ground (--nx-on-grey is set by the grounds). */
.nx-btn {
    height: var(--nx-control);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nx-space-2);
    padding: 0 14px;
    border: 1px solid var(--nx-action-edge);
    border-radius: var(--nx-radius-control);
    background: var(--nx-on-grey, var(--nx-action));
    color: var(--nx-text);
    font-size: var(--nx-size-sm);
    font-weight: var(--nx-weight-strong);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--nx-fast), border-color var(--nx-fast);
}

.nx-btn:hover { background: var(--nx-action-hover); text-decoration: none; }

/* Primary: the one action of its purpose that matters most here. */
.nx-btn--add { background: var(--nx-add); border-color: var(--nx-add); color: var(--nx-text-on-solid); }
.nx-btn--add:hover { background: var(--nx-add-hover); }
.nx-btn--save { background: var(--nx-save); border-color: var(--nx-save); color: var(--nx-text-on-solid); }
.nx-btn--save:hover { background: var(--nx-save-hover); }
.nx-btn--delete { background: var(--nx-delete); border-color: var(--nx-delete); color: var(--nx-text-on-solid); }
.nx-btn--delete:hover { background: var(--nx-delete-hover); }

/* Secondary: any other action of that purpose. A tint on white, white on a grey ground. */
.nx-btn--add.nx-btn--tint { background: var(--nx-on-grey, var(--nx-add-tint)); border-color: var(--nx-add-edge); color: var(--nx-add-ink); }
.nx-btn--save.nx-btn--tint { background: var(--nx-on-grey, var(--nx-save-tint)); border-color: var(--nx-save-edge); color: var(--nx-save-ink); }
.nx-btn--delete.nx-btn--tint { background: var(--nx-on-grey, var(--nx-delete-tint)); border-color: var(--nx-delete-edge); color: var(--nx-delete-ink); }
.nx-btn--tint:hover { filter: brightness(.96); }

/* An add control inside the content it adds to (add item, add step). */
.nx-btn--dashed { background: transparent; border-style: dashed; border-color: var(--nx-add); color: var(--nx-add-ink); }
.nx-btn--dashed:hover { background: var(--nx-add-tint); }

.nx-btn--sm { height: var(--nx-control-sm); gap: 6px; padding: 0 10px; }
.nx-btn--icon { width: var(--nx-control); padding: 0; }
.nx-btn--icon.nx-btn--sm { width: var(--nx-control-sm); }

.nx-btn:disabled, .nx-btn[aria-disabled="true"] { opacity: .55; cursor: default; pointer-events: none; }

/* A bare icon button for rows, panel heads and the top bar. */
.nx-iconbtn {
    position: relative;
    flex: none;
    width: var(--nx-control);
    height: var(--nx-control);
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--nx-radius-control);
    background: transparent;
    color: var(--nx-text-muted);
    text-decoration: none;
}

.nx-iconbtn:hover { background: var(--nx-hover); color: var(--nx-ink); }
.nx-iconbtn--delete:hover { background: var(--nx-delete-tint); color: var(--nx-delete-ink); }
.nx-iconbtn--save:hover { background: var(--nx-save-tint); color: var(--nx-save-ink); }

.nx-pip {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--nx-notify);
    color: var(--nx-ink);
    font-size: 11px;
    font-weight: var(--nx-weight-strong);
    line-height: 16px;
    text-align: center;
}

/* ---------- Cards and panels ---------- */

.nx-card {
    min-width: 0;
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-radius-card);
    background: var(--nx-surface);
    --nx-on-grey: initial;
}

/* A well holds entry fields: a grey panel, white fields, white secondary buttons. */
.nx-card--well {
    border-color: var(--nx-panel-line);
    background: var(--nx-well);
    --nx-on-grey: var(--nx-surface);
}

.nx-card-head {
    display: flex;
    align-items: center;
    gap: var(--nx-space-2) var(--nx-space-3);
    flex-wrap: wrap;
    min-height: 56px;
    padding: var(--nx-space-3) var(--nx-space-4);
    border-bottom: 1px solid var(--nx-line-soft);
}

.nx-card--well > .nx-card-head { border-bottom-color: var(--nx-panel-line); }
.nx-card-head h2 { font-size: var(--nx-size-lg); }
.nx-card-count { margin-left: 4px; font-weight: var(--nx-weight); color: var(--nx-text-muted); }

/* A panel that shows only the first rows of a longer list: the search button that opens the rest, with the
   total on it. */
.nx-panelsearch {
    position: relative;
    width: 36px;
    height: var(--nx-control-sm);
    display: inline-grid;
    place-items: center;
    margin-right: 6px;
    padding: 0;
    border: 1px solid var(--nx-line-strong);
    border-radius: var(--nx-radius-control);
    background: var(--nx-action);
    color: var(--nx-text);
}

.nx-panelsearch:hover:not(:disabled) { background: var(--nx-action-hover); }

.nx-panelsearch .nx-count {
    position: absolute;
    top: -7px;
    right: -9px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    font-size: var(--nx-size-2xs);
    font-weight: var(--nx-weight-strong);
    line-height: 18px;
}
.nx-card-note { flex-basis: 100%; font-size: var(--nx-size-sm); color: var(--nx-text-muted); }
.nx-card-body { padding: var(--nx-space-4); }
.nx-card-foot { padding: var(--nx-space-3) var(--nx-space-4); border-top: 1px solid var(--nx-line-soft); }
.nx-card-more { padding: 0 var(--nx-space-4) 14px; font-size: var(--nx-size-sm); color: var(--nx-text-muted); }

/* A bordered box inside a card: an address, a step in a trail. */
.nx-box { padding: 14px; border: 1px solid var(--nx-line); border-radius: var(--nx-radius-control); }
.nx-box--well { background: var(--nx-well); }
.nx-box--current { border-color: var(--nx-pastel-green); background: color-mix(in srgb, var(--nx-pastel-green-tint) 45%, var(--nx-surface)); }

.nx-boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--nx-space-4); padding: var(--nx-space-4); }

/* A plain grey label: Delivery, Billing. */
.nx-tag {
    height: 22px;
    display: inline-flex;
    align-items: center;
    padding: 0 var(--nx-space-2);
    border-radius: 4px;
    background: var(--nx-neutral-tint);
    color: var(--nx-neutral-ink);
    font-size: var(--nx-size-xs);
    font-weight: var(--nx-weight-strong);
}

/* ---------- Forms ---------- */

.nx-form {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--nx-space-4);
}

.nx-field {
    grid-column: span 6;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.nx-span-2 { grid-column: span 2; }
.nx-span-3 { grid-column: span 3; }
.nx-span-4 { grid-column: span 4; }
.nx-span-6 { grid-column: span 6; }
.nx-span-8 { grid-column: span 8; }
.nx-span-12 { grid-column: span 12; }

@media (max-width: 767px) {
    .nx-form > * { grid-column: span 12; }
}

/* A form section: the title sits outside, only the fields are boxed. Sections are set apart by space. */
.nx-formsection { min-width: 0; }
.nx-formsection > h2 { padding: 0 2px; font-size: var(--nx-size-xl); }
.nx-formsection > p { padding: 2px 2px 0; font-size: var(--nx-size-sm); color: var(--nx-text-muted); }

.nx-formpanel {
    margin-top: 10px;
    padding: var(--nx-space-6) var(--nx-space-8);
    border: 1px solid var(--nx-panel-line);
    border-radius: var(--nx-radius-card);
    background: var(--nx-well);
    --nx-on-grey: var(--nx-surface);
}

.nx-form-section {
    grid-column: span 12;
    margin-top: var(--nx-space-2);
    padding-top: var(--nx-space-4);
    border-top: 1px solid var(--nx-panel-line);
    font-size: var(--nx-size-lg);
}

@media (max-width: 767px) {
    .nx-formpanel { padding: var(--nx-space-4); }
}

.nx-label {
    font-size: var(--nx-size-sm);
    font-weight: var(--nx-weight-strong);
    color: var(--nx-text-soft);
}

.nx-required::after { content: " *"; color: var(--nx-bad); }

.nx-input {
    width: 100%;
    min-width: 0;
    height: var(--nx-control);
    padding: 0 10px;
    border: 1px solid var(--nx-field-line);
    border-radius: var(--nx-radius-control);
    background: var(--nx-surface);
    color: var(--nx-ink);
    transition: border-color var(--nx-fast), box-shadow var(--nx-fast);
}

textarea.nx-input {
    height: auto;
    min-height: 96px;
    padding: var(--nx-space-2) var(--nx-space-3);
    line-height: var(--nx-leading);
    resize: vertical;
}

select.nx-input {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234B5560' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}

input[type=color].nx-input { padding: 4px; }

.nx-input::placeholder { color: var(--nx-text-muted); }

.nx-input:focus, .nx-input:focus-visible {
    outline: 0;
    border-color: var(--nx-area-ink, var(--nx-add));
    box-shadow: 0 0 0 3px var(--nx-area-tint, var(--nx-add-tint));
}

.nx-input:disabled { background: var(--nx-hover); color: var(--nx-text-muted); }
.nx-input--sm { height: var(--nx-control-sm); }
.nx-input--num { text-align: right; font-variant-numeric: tabular-nums; }

.is-invalid > .nx-input, .nx-input.is-invalid {
    border-color: var(--nx-bad);
    box-shadow: 0 0 0 3px var(--nx-bad-tint);
}

.nx-hint { font-size: var(--nx-size-xs); color: var(--nx-text-muted); }
.nx-error { font-size: var(--nx-size-xs); font-weight: var(--nx-weight-strong); color: var(--nx-bad-ink); }

.nx-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    cursor: pointer;
}

.nx-check input, .nx-table input[type=checkbox] {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--nx-area-ink, var(--nx-add));
}

.nx-switch input {
    appearance: none;
    position: relative;
    width: 38px;
    height: 22px;
    border-radius: 11px;
    background: var(--nx-field-line);
    transition: background var(--nx-fast);
}

.nx-switch input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--nx-surface);
    transition: transform var(--nx-fast);
}

.nx-switch input:checked { background: var(--nx-save); }
.nx-switch input:checked::after { transform: translateX(16px); }

/* The save bar is the last thing inside its form. It rests at the form's end and sticks to the bottom of the
   window only while that end is off-screen. Delete on the left; Cancel, then Save last on the right. */
.nx-savebar {
    position: sticky;
    z-index: var(--nx-z-sticky);
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px var(--nx-space-6);
    flex-wrap: wrap;
    margin: 0 calc(var(--nx-space-6) * -1) calc(var(--nx-space-6) * -1);
    padding: var(--nx-space-3) var(--nx-space-6);
    border-top: 1px solid var(--nx-panel-line);
    background: var(--nx-ground);
    --nx-on-grey: var(--nx-surface);
}

.nx-savebar-end { margin-left: auto; display: flex; flex-wrap: wrap; gap: var(--nx-space-2); }

/* A save bar for edits made inside a card (invoice lines): it belongs to the card, not the page. */
.nx-savebar--inline {
    margin: 0;
    padding: 10px var(--nx-space-4);
    border-top: 2px solid var(--nx-warn);
    border-radius: 0 0 calc(var(--nx-radius-card) - 1px) calc(var(--nx-radius-card) - 1px);
    background: var(--nx-warn-tint);
}

@media (max-width: 767px) {
    .nx-savebar { margin: 0 calc(var(--nx-space-4) * -1) calc(var(--nx-space-4) * -1); padding: var(--nx-space-3) var(--nx-space-4); }
}

/* A choice selector: a row of options, one chosen. Not buttons: the chosen option takes the area colour. */
.nx-choices { display: flex; flex-wrap: wrap; gap: var(--nx-space-2); }

.nx-choice {
    height: var(--nx-control-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid var(--nx-field-line);
    border-radius: var(--nx-radius-control);
    background: var(--nx-surface);
    color: var(--nx-text);
    font-size: var(--nx-size-sm);
}

.nx-choice:hover { border-color: var(--nx-text-muted); }
.nx-choice[aria-pressed="true"] { padding: 0 9px; border: 2px solid var(--nx-area-strong); background: var(--nx-area-tint); color: var(--nx-area-ink); font-weight: var(--nx-weight-strong); }

/* The date picker takes the system's field styling. */
.ndp-root.ndp-root {
    --ndp-bg: var(--nx-surface);
    --ndp-fg: var(--nx-ink);
    --ndp-muted: var(--nx-text-muted);
    --ndp-border: var(--nx-field-line);
    --ndp-accent: var(--nx-area-ink, var(--nx-add));
    --ndp-accent-soft: var(--nx-area-tint, var(--nx-add-tint));
    --ndp-today: var(--nx-area-ink, var(--nx-add));
    --ndp-invalid: var(--nx-bad);
    --ndp-radius: var(--nx-radius-control);
    --ndp-shadow: var(--nx-shadow-3);
    display: block;
    font-family: inherit;
}

.ndp-root.ndp-root .ndp-field { min-height: 40px; }
.ndp-root.ndp-root .ndp-input { height: 38px; font-size: var(--nx-size-md); }
.ndp-root.ndp-root .ndp-preview { font-size: var(--nx-size-xs); }

/* ---------- Tables ---------- */

/* Below its natural width a table scrolls inside its card instead of squeezing its columns. */
.nx-table-wrap { overflow-x: auto; }
.nx-table-wrap > .nx-table { min-width: 860px; }
.nx-card .nx-cols .nx-table-wrap > .nx-table, .nx-table--narrow { min-width: 0; }
.nx-cols .nx-table-wrap > .nx-table { min-width: 600px; }

.nx-table {
    width: 100%;
    border-collapse: collapse;
}

.nx-table th {
    padding: 10px var(--nx-space-3);
    background: var(--nx-well);
    font-size: var(--nx-size-sm);
    font-weight: var(--nx-weight-strong);
    color: var(--nx-text-soft);
    text-align: left;
    white-space: nowrap;
}

.nx-table td {
    padding: var(--nx-row) var(--nx-space-3);
    border-top: 1px solid var(--nx-line-soft);
    vertical-align: middle;
}

.nx-table tbody tr:hover td { background: var(--nx-hover); }
.nx-table tr.is-selected td { background: var(--nx-area-tint, var(--nx-hover)); }
.nx-table tr.is-changed td { background: var(--nx-warn-tint); }
.nx-table th:first-child, .nx-table td:first-child { padding-left: var(--nx-space-4); }
.nx-table th:last-child, .nx-table td:last-child { padding-right: var(--nx-space-4); }

/* Row titles are links in the area's colour. */
.nx-table td a:not(.nx-btn):not(.nx-iconbtn):not(.nx-avatar) { font-weight: var(--nx-weight-strong); }

.nx-table--compact { --nx-row: 6px; }
.nx-card--well .nx-table td { border-top-color: var(--nx-line); }

/* An invoice's lines: smaller text, so the row has room for more columns. The description is typed into. */
.nx-table--lines td, .nx-table--lines .nx-input { font-size: var(--nx-size-sm); }
.nx-table--lines th { font-size: var(--nx-size-xs); }
.nx-table--lines td { vertical-align: top; padding-top: 8px; padding-bottom: 8px; }
.nx-table--lines td:not(:has(.nx-input)) { padding-top: 14px; }
.nx-table--lines textarea.nx-input { field-sizing: content; width: 100%; min-width: 220px; min-height: var(--nx-control-sm); padding: 6px 8px; line-height: 1.4; resize: vertical; }

.nx-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nx-col-check { width: 44px; }
.nx-col-action { width: 1%; white-space: nowrap; text-align: right; }
.nx-debt { color: var(--nx-bad); font-weight: var(--nx-weight-strong); }
.nx-credit { color: var(--nx-ok-ink); }

.nx-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.nx-cell-text { min-width: 0; }
.nx-sub { font-size: var(--nx-size-xs); color: var(--nx-text-muted); }
.nx-sub a { color: inherit !important; font-weight: var(--nx-weight) !important; }

/* ---------- Lists: quick search, chips, the bars above and below the table, the search drawer ---------- */

/* The quick search over a list: a box joined to a "search by" choice, then icon buttons for Search and More
   options. Filters in use follow as chips, and More options carries their count. */
.nx-quicksearch { display: flex; flex-wrap: wrap; align-items: center; gap: var(--nx-space-2); }

.nx-searchjoin { display: flex; flex: 0 1 460px; min-width: 0; }
.nx-searchjoin > .nx-input:first-child { flex: 1 1 140px; border-radius: var(--nx-radius-control) 0 0 var(--nx-radius-control); }
.nx-searchjoin > .nx-input:last-child:not(:first-child) { flex: 1 1 200px; border-left: 0; border-radius: 0 var(--nx-radius-control) var(--nx-radius-control) 0; }
.nx-searchjoin > .nx-input:only-child { border-radius: var(--nx-radius-control); }
.nx-quicksearch .nx-input { border-color: var(--nx-line-strong); }

.nx-quickbtn {
    position: relative;
    width: 48px;
    height: var(--nx-control);
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--nx-line-strong);
    border-radius: var(--nx-radius-control);
    background: var(--nx-surface);
    color: var(--nx-text);
}

.nx-quickbtn:hover { background: var(--nx-hover); }
.nx-quickbtn.is-on { background: var(--nx-neutral-tint); }

.nx-quickbtn .nx-count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--nx-ink);
    color: var(--nx-text-on-solid);
    font-size: var(--nx-size-2xs);
    line-height: 18px;
}

/* A plain search field with its icon, where a list needs no "search by" (the organisation switcher). */
.nx-searchfield {
    flex: 1 1 280px;
    max-width: 520px;
    height: var(--nx-control);
    display: flex;
    align-items: center;
    gap: var(--nx-space-2);
    padding: 0 var(--nx-space-3);
    border: 1px solid var(--nx-line-strong);
    border-radius: var(--nx-radius-control);
    background: var(--nx-surface);
    color: var(--nx-text-muted);
}

.nx-searchfield input { flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--nx-ink); }
.nx-searchfield input::placeholder { color: var(--nx-text-muted); opacity: 1; }
.nx-searchfield:focus-within { border-color: var(--nx-area-ink, var(--nx-add)); box-shadow: 0 0 0 3px var(--nx-area-tint, var(--nx-add-tint)); }

.nx-count {
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--nx-ink);
    color: var(--nx-text-on-solid);
    font-size: var(--nx-size-xs);
    font-weight: var(--nx-weight-strong);
}

.nx-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: var(--nx-space-1); }

.nx-chip {
    height: 28px;
    display: inline-flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--nx-line-strong);
    border-radius: 14px;
    background: var(--nx-surface);
    font-size: var(--nx-size-xs);
}

.nx-chip > span { padding: 0 4px 0 10px; }
.nx-chip b { font-weight: var(--nx-weight-strong); }
.nx-chip button { width: 26px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--nx-text-muted); }
.nx-chip button:hover { background: var(--nx-hover); color: var(--nx-ink); }
.nx-chips-clear { height: 28px; padding: 0 var(--nx-space-2); border: 0; background: none; color: var(--nx-area-ink, var(--nx-add-ink)); font-size: var(--nx-size-xs); font-weight: var(--nx-weight-strong); }

/* The bars above and below a list's table take the column-header grey, so the white controls on them stand out.
   Above: sort on the left, paging on the right. Below: the range shown on the left, paging on the right. */
.nx-listbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px var(--nx-space-6);
    padding: var(--nx-space-3) var(--nx-space-4);
    border-bottom: 1px solid var(--nx-line-soft);
    border-radius: calc(var(--nx-radius-card) - 1px) calc(var(--nx-radius-card) - 1px) 0 0;
    background: var(--nx-well);
    font-size: var(--nx-size-sm);
    color: var(--nx-text-muted);
    --nx-on-grey: var(--nx-surface);
}

.nx-listbar--foot {
    border-top: 1px solid var(--nx-line-soft);
    border-bottom: 0;
    border-radius: 0 0 calc(var(--nx-radius-card) - 1px) calc(var(--nx-radius-card) - 1px);
}

.nx-listbar label { display: inline-flex; align-items: center; gap: var(--nx-space-2); }
.nx-listbar .nx-input { width: auto; height: 36px; font-size: var(--nx-size-sm); border-color: var(--nx-line-strong); }
.nx-listbar-end { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--nx-space-3); }

/* The totals of everything the search found, under the table. */
.nx-totals { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--nx-space-3) var(--nx-space-10); padding: 14px var(--nx-space-4); border-top: 2px solid var(--nx-area); text-align: right; }
.nx-totals dt { font-size: var(--nx-size-xs); color: var(--nx-text-muted); }
.nx-totals dd { font-size: 16px; font-weight: var(--nx-weight-strong); font-variant-numeric: tabular-nums; }

/* The rest of a list's search: a drawer from the right, opened by More options. */
.nx-drawer-scrim { position: fixed; z-index: var(--nx-z-popover); inset: 0; background: var(--nx-scrim); animation: nx-fade-in var(--nx-slide) ease-out; }
.nx-drawer-scrim.is-closing { animation: nx-fade-out var(--nx-slide) ease-in forwards; }

.nx-drawer {
    position: fixed;
    z-index: calc(var(--nx-z-popover) + 1);
    inset: 0 0 0 auto;
    width: min(var(--nx-drawer-width), 100vw);
    display: flex;
    flex-direction: column;
    background: var(--nx-ground);
    box-shadow: var(--nx-shadow-3);
    --nx-on-grey: var(--nx-surface);
    animation: nx-drawer-in var(--nx-slide) ease-out;
}

.nx-drawer.is-closing { animation: nx-drawer-out var(--nx-slide) ease-in forwards; }

@keyframes nx-drawer-in { from { transform: translateX(100%); } }
@keyframes nx-drawer-out { to { transform: translateX(100%); } }
@keyframes nx-fade-in { from { opacity: 0; } }
@keyframes nx-fade-out { to { opacity: 0; } }

.nx-drawer-head { background: var(--nx-surface); --nx-on-grey: initial; flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--nx-space-3); padding: var(--nx-space-2) var(--nx-space-2) var(--nx-space-2) var(--nx-space-5); border-bottom: 1px solid var(--nx-line); }
.nx-drawer-head h2 { display: inline-flex; align-items: center; gap: 10px; font-size: 18px; }
.nx-drawer-head .nx-iconbtn { width: var(--nx-control-touch); height: var(--nx-control-touch); color: var(--nx-text); }
/* The form fills the drawer under its head and its body scrolls, so a long form never runs off the window. */
.nx-drawer > form { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 0; max-width: none; }
.nx-drawer-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: var(--nx-space-4) var(--nx-space-5); overflow-y: auto; }
.nx-drawer-body .nx-input { border-color: var(--nx-line-strong); }
.nx-drawer-body .nx-check { min-height: 24px; gap: var(--nx-space-2); font-size: var(--nx-size-sm); color: var(--nx-text-soft); }
.nx-drawer-body .nx-check input { width: 16px; height: 16px; }
/* The drawer is a form: the form grey, with white fields and white buttons. Its buttons are a save bar with no
   fill of its own, only a faint rule above it: at the end of the form, and stuck to the bottom of the drawer only while
   the form is taller than the window and that spot is off-screen. */
.nx-drawer-actions {
    position: sticky;
    bottom: calc(var(--nx-space-4) * -1);
    flex: none;
    display: flex;
    justify-content: flex-end;
    gap: var(--nx-space-2);
    margin: var(--nx-space-2) calc(var(--nx-space-5) * -1) calc(var(--nx-space-4) * -1);
    padding: var(--nx-space-3) var(--nx-space-5);
    border-top: 1px solid var(--nx-line);
    background: var(--nx-ground);
}

/* A field in the drawer: a small quiet label over its control. A range is two controls with "to" between. */
.nx-dfield { display: flex; flex-direction: column; gap: var(--nx-space-1); min-width: 0; margin: 0; padding: 0; border: 0; font-size: var(--nx-size-xs); color: var(--nx-text-muted); }
.nx-dfield > legend { padding: 0; margin-bottom: var(--nx-space-1); }
.nx-dfield .nx-input { font-size: var(--nx-size-md); }
.nx-dfield .nx-input + .nx-input { margin-top: 2px; }
.nx-range { display: flex; align-items: flex-start; gap: var(--nx-space-2); }
.nx-range > span { height: var(--nx-control); display: inline-flex; align-items: center; color: var(--nx-text-muted); }
.nx-range > :not(span) { flex: 1 1 0; min-width: 0; }
.nx-range .ndp-root, .nx-range .ndp-root input { width: 100%; min-width: 0; }
/* The drawer cuts off what leaves it, so a picker's calendar opens inside it: the first of a pair from its
   left edge, the second from its right. The drawer is wide enough for the calendar with its times. */
.nx-range > .ndp-root:last-child .ndp-panel { left: auto; right: 0; }

/* The older filter strip, kept for lists that have not moved to the search drawer. */
.nx-filters {
    display: flex;
    align-items: center;
    gap: var(--nx-space-2);
    flex-wrap: wrap;
    padding: var(--nx-space-3) var(--nx-space-4);
    border-bottom: 1px solid var(--nx-line-soft);
    border-radius: calc(var(--nx-radius-card) - 1px) calc(var(--nx-radius-card) - 1px) 0 0;
    background: var(--nx-well);
    --nx-on-grey: var(--nx-surface);
}

.nx-filters .nx-input { width: auto; height: var(--nx-control); }
.nx-filters .nx-field { flex: 0 1 200px; }

.nx-filter-panel {
    padding: var(--nx-space-4);
    border-bottom: 1px solid var(--nx-line-soft);
    background: var(--nx-well);
    --nx-on-grey: var(--nx-surface);
}

.nx-bulk {
    display: flex;
    align-items: center;
    gap: var(--nx-space-4);
    flex-wrap: wrap;
    padding: var(--nx-space-2) var(--nx-space-4);
    background: var(--nx-ink);
    color: var(--nx-text-on-solid);
    font-weight: var(--nx-weight-strong);
}

.nx-pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--nx-size-sm); color: var(--nx-text-muted); }

.nx-pager-btn {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--nx-line-strong);
    border-radius: var(--nx-radius-control);
    background: var(--nx-surface);
    color: var(--nx-text);
}

.nx-pager-btn:hover:not(:disabled) { background: var(--nx-hover); }
.nx-pager-btn:disabled { color: var(--nx-text-muted); opacity: .55; cursor: default; }
.nx-pager label { display: inline-flex; align-items: center; gap: var(--nx-space-2); margin-right: var(--nx-space-2); }
.nx-pager select.nx-input { width: auto; height: 36px; font-size: var(--nx-size-sm); }
.nx-pager .nx-pager-page { width: 52px; height: 36px; padding: 0 6px; font-size: var(--nx-size-sm); text-align: center; }

/* A status in words: a pill in one of the pastels, tint fill, pastel border, dark text. */
.nx-badge {
    height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid var(--nx-pastel-grey);
    border-radius: 12px;
    background: var(--nx-pastel-grey-tint);
    color: var(--nx-pastel-grey-ink);
    font-size: var(--nx-size-xs);
    font-weight: var(--nx-weight-strong);
    white-space: nowrap;
}

.nx-badge--ok, .nx-badge--green { border-color: var(--nx-pastel-green); background: var(--nx-pastel-green-tint); color: var(--nx-pastel-green-ink); }
.nx-badge--warn, .nx-badge--orange { border-color: var(--nx-pastel-orange); background: var(--nx-pastel-orange-tint); color: var(--nx-pastel-orange-ink); }
.nx-badge--bad, .nx-badge--red { border-color: var(--nx-pastel-red); background: var(--nx-pastel-red-tint); color: var(--nx-pastel-red-ink); }
.nx-badge--info, .nx-badge--blue { border-color: var(--nx-pastel-blue); background: var(--nx-pastel-blue-tint); color: var(--nx-pastel-blue-ink); }
.nx-badge--purple { border-color: var(--nx-pastel-purple); background: var(--nx-pastel-purple-tint); color: var(--nx-pastel-purple-ink); }

/* A status as an icon tile: the pastel itself with a white icon, its name in the tooltip. */
.nx-tile {
    flex: none;
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: var(--nx-radius-control);
    background: var(--nx-pastel-grey-tint);
    color: var(--nx-text-muted);
}

.nx-tile .nx-icon { width: 16px; height: 16px; }
.nx-tile--lg { width: 36px; height: 36px; }
.nx-tile--lg .nx-icon { width: 20px; height: 20px; }
.nx-tile--green { background: var(--nx-pastel-green); color: var(--nx-text-on-solid); }
.nx-tile--orange { background: var(--nx-pastel-orange); color: var(--nx-text-on-solid); }
.nx-tile--blue { background: var(--nx-pastel-blue); color: var(--nx-text-on-solid); }
.nx-tile--purple { background: var(--nx-pastel-purple); color: var(--nx-text-on-solid); }
.nx-tile--red { background: var(--nx-pastel-red); color: var(--nx-text-on-solid); }

/* A group on a list: its colour alone, its name on hover. */
.nx-groups { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.nx-group { width: 16px; height: 16px; border-radius: 50%; background: var(--nx-dot, var(--nx-pastel-grey)); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }

.nx-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.nx-dot {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--nx-dot, var(--nx-field-line));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}

.nx-avatar {
    flex: none;
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--nx-avatar, var(--nx-skeleton));
    color: var(--nx-text-soft);
    font-size: var(--nx-size-xs);
    font-weight: var(--nx-weight-strong);
    text-decoration: none !important;
    user-select: none;
}

.nx-avatar img { width: 100%; height: 100%; display: block; border-radius: inherit; object-fit: cover; }
.nx-avatar--square { border-radius: 8px; }
.nx-avatar--sm { width: 24px; height: 24px; font-size: 11px; }
.nx-avatar--lg { width: 40px; height: 40px; font-size: var(--nx-size-sm); }
.nx-avatar--area { background: var(--nx-area-tint); color: var(--nx-area-ink); }

/* ---------- Messages ---------- */

.nx-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: var(--nx-space-3) 14px;
    border: 1px solid var(--nx-info-edge);
    border-radius: var(--nx-radius-control);
    background: var(--nx-info-tint);
    color: var(--nx-info-ink);
    font-weight: var(--nx-weight-strong);
}

.nx-alert--error { border-color: var(--nx-bad-edge); background: var(--nx-bad-tint); color: var(--nx-bad-ink); }
.nx-alert--success { border-color: var(--nx-ok-edge); background: var(--nx-ok-tint); color: var(--nx-ok-ink); }
.nx-alert--warning { border-color: var(--nx-warn-edge); background: var(--nx-warn-tint); color: var(--nx-warn-ink); }

.nx-toasts {
    position: fixed;
    z-index: var(--nx-z-toast);
    right: var(--nx-space-6);
    bottom: var(--nx-space-6);
    display: flex;
    flex-direction: column;
    gap: var(--nx-space-2);
    width: min(360px, calc(100vw - 32px));
}

.nx-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: var(--nx-space-3) var(--nx-space-2) var(--nx-space-3) 14px;
    border-radius: var(--nx-radius-control);
    background: var(--nx-ink);
    color: var(--nx-text-on-solid);
    box-shadow: var(--nx-shadow-3);
}

.nx-toast .nx-icon { margin-top: 2px; }
.nx-toast--success .nx-icon:first-child { color: #7FD67F; }
.nx-toast--error .nx-icon:first-child { color: #FF9C94; }
.nx-toast .nx-iconbtn { width: 28px; height: 28px; color: var(--nx-chrome-text); }
.nx-toast .nx-iconbtn:hover { background: var(--nx-chrome-hover); color: #fff; }

.nx-dialog {
    width: min(480px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    border: 0;
    border-radius: var(--nx-radius-card);
    background: var(--nx-surface);
    color: var(--nx-text);
    box-shadow: var(--nx-shadow-3);
}

.nx-dialog--wide { width: min(760px, calc(100vw - 32px)); }
.nx-dialog::backdrop { background: var(--nx-scrim); }
.nx-dialog-head { display: flex; align-items: center; gap: var(--nx-space-2); padding: 10px var(--nx-space-2) 10px var(--nx-space-5); border-bottom: 1px solid var(--nx-line-soft); }
.nx-dialog-head h2 { flex: 1 1 auto; font-size: 18px; }
.nx-dialog-body { padding: var(--nx-space-5); overflow-y: auto; }
.nx-dialog-body--flush { padding: 0; }
.nx-dialog-foot { display: flex; justify-content: flex-end; gap: var(--nx-space-2); flex-wrap: wrap; padding: var(--nx-space-3) var(--nx-space-5); align-items: center; border-top: 1px solid var(--nx-line); background: var(--nx-ground); border-radius: 0 0 var(--nx-radius-card) var(--nx-radius-card); --nx-on-grey: var(--nx-surface); }

/* ---------- Menus ---------- */

.nx-menu { position: relative; display: inline-flex; }

.nx-menu-backdrop { position: fixed; z-index: var(--nx-z-popover); inset: 0; }

.nx-menu-list {
    --nx-on-grey: initial;
    position: absolute;
    z-index: calc(var(--nx-z-popover) + 1);
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    max-height: 60vh;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-radius-card);
    background: var(--nx-surface);
    color: var(--nx-text);
    box-shadow: var(--nx-shadow-2);
}

.nx-menu-list--left { right: auto; left: 0; }

.nx-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--nx-radius-control);
    background: none;
    color: var(--nx-text);
    text-align: left;
    text-decoration: none;
}

.nx-menu-item:hover { background: var(--nx-hover); text-decoration: none; }
.nx-menu-item .nx-icon { color: var(--nx-text-muted); }
.nx-menu-title { padding: 8px 10px 6px; font-size: var(--nx-size-xs); font-weight: var(--nx-weight-strong); color: var(--nx-text-muted); }
.nx-menu-sep { height: 1px; margin: 6px 0; background: var(--nx-line); }
.nx-menu-item:disabled { opacity: .55; cursor: default; background: none; }

/* A header menu: wider, rows run edge to edge at touch height, with a grey head or foot. */
.nx-menu-list--panel { width: 280px; padding: var(--nx-space-2) 0 0; overflow: hidden; box-shadow: var(--nx-shadow-3); }
.nx-menu-list--panel .nx-menu-item { min-height: var(--nx-control-touch); gap: var(--nx-space-3); padding: 0 var(--nx-space-4); border-radius: 0; }
.nx-menu-list--panel .nx-menu-sep { margin: var(--nx-space-2) 0; }
.nx-menu-list--panel > :last-child:not(.nx-menu-foot) { margin-bottom: var(--nx-space-2); }
.nx-menu-head { display: flex; align-items: center; gap: var(--nx-space-3); margin: calc(var(--nx-space-2) * -1) 0 var(--nx-space-2); padding: 14px var(--nx-space-4); border-bottom: 1px solid var(--nx-line); background: var(--nx-ground); }
.nx-menu-foot { margin-top: var(--nx-space-2); padding: 10px var(--nx-space-4) var(--nx-space-3); border-top: 1px solid var(--nx-line); background: var(--nx-ground); font-size: var(--nx-size-xs); color: var(--nx-text-muted); text-align: center; }
.nx-menu-foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px var(--nx-space-3); margin-top: 2px; }
.nx-menu-foot a { color: inherit; text-decoration: underline; }
.nx-key { flex: none; padding: 1px 7px; border: 1px solid var(--nx-line-strong); border-radius: 4px; font-family: inherit; font-size: var(--nx-size-xs); color: var(--nx-text-muted); }

/* The organisation switcher's list, inside its dialog. */
.nx-switcher-find { padding: var(--nx-space-4) var(--nx-space-5) var(--nx-space-2); }
.nx-switcher-find .nx-searchfield { max-width: none; }
.nx-switcher-list { padding: 0 var(--nx-space-2) var(--nx-space-2); max-height: 50vh; overflow-y: auto; }
.nx-switcher-row { display: flex; align-items: center; gap: var(--nx-space-3); min-height: 56px; padding: 0 var(--nx-space-3); border-radius: var(--nx-radius-control); color: var(--nx-text); text-decoration: none; }
a.nx-switcher-row:hover { background: var(--nx-hover); text-decoration: none; }
.nx-switcher-row.is-current { background: var(--nx-ground); }
.nx-switcher-row .nx-avatar { width: 36px; height: 36px; }

/* ---------- Typeahead ---------- */

.nx-typeahead { position: relative; }

.nx-typeahead-list {
    position: absolute;
    z-index: var(--nx-z-popover);
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-radius-card);
    background: var(--nx-surface);
    box-shadow: var(--nx-shadow-2);
}

.nx-typeahead-option { padding: 8px 10px; border-radius: var(--nx-radius-control); cursor: pointer; }
.nx-typeahead-option:hover { background: var(--nx-hover); text-decoration: none; }
a.nx-typeahead-option { display: block; color: var(--nx-text); text-decoration: none; }

/* ---------- Loading and empty ---------- */

.nx-skeleton {
    height: 12px;
    border-radius: 6px;
    background: var(--nx-skeleton);
    animation: nx-pulse 1.4s ease-in-out infinite;
}

.nx-skeleton-rows { display: flex; flex-direction: column; gap: 18px; padding: var(--nx-space-5) var(--nx-space-4); }

@keyframes nx-pulse {
    50% { opacity: .5; }
}

.nx-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--nx-space-2);
    padding: var(--nx-space-6) var(--nx-space-4);
}

.nx-empty-title { font-size: var(--nx-size-lg); font-weight: var(--nx-weight-strong); color: var(--nx-ink); }

/* ---------- Record and dashboard ---------- */

.nx-summary { display: flex; gap: var(--nx-space-8); flex-wrap: wrap; padding: var(--nx-space-4); }
.nx-metric-label { font-size: var(--nx-size-xs); color: var(--nx-text-muted); }
.nx-metric-value { font-size: 18px; font-weight: var(--nx-weight-strong); color: var(--nx-ink); }
.nx-metric-value a { color: inherit; }

.nx-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px var(--nx-space-6); }
.nx-kv dt { font-size: var(--nx-size-xs); color: var(--nx-text-muted); }
.nx-kv dd { margin-top: var(--nx-space-1); }

/* A record's fields: a small label over each value, as many columns as fit. */
.nx-defs { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px var(--nx-space-6); padding: var(--nx-space-4); }
.nx-defs dt { font-size: var(--nx-size-xs); color: var(--nx-text-muted); }
.nx-defs dd { margin-top: var(--nx-space-1); min-width: 0; overflow-wrap: anywhere; }
/* An item that takes the whole width: a text area's value, or the control that shows the hidden fields. */
.nx-defs-row { grid-column: 1 / -1; }
.nx-defs-text { white-space: pre-line; }
.nx-morebtn { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--nx-area-ink, var(--nx-add-ink)); font-size: var(--nx-size-sm); font-weight: var(--nx-weight-strong); }
.nx-morebtn:hover { text-decoration: underline; }
.nx-defs--wide { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.nx-unset { color: var(--nx-text-muted); }

/* A row in a card: a person, a job, a note. Rows are divided by a soft line. */
.nx-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--nx-space-3); padding: 14px var(--nx-space-4); color: var(--nx-text); text-decoration: none; }
.nx-item + .nx-item { border-top: 1px solid var(--nx-line-soft); }
a.nx-item:hover { background: var(--nx-hover); text-decoration: none; }
.nx-item-lead { display: flex; align-items: center; gap: var(--nx-space-3); min-width: 0; flex: 1 1 0; }
.nx-item-facts { display: flex; flex-wrap: wrap; gap: 4px var(--nx-space-4); font-size: var(--nx-size-sm); color: var(--nx-text-muted); }
.nx-item-mark { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--nx-radius-control); background: var(--nx-area-tint); color: var(--nx-area-ink); }

/* Sections with nothing in them take one line each: the name, and the button that adds to it. */
.nx-line { display: flex; align-items: center; justify-content: space-between; gap: var(--nx-space-3); min-height: 46px; padding: 0 var(--nx-space-4); }
.nx-line + .nx-line { border-top: 1px solid var(--nx-line-soft); }
.nx-line-note { margin-left: 6px; font-size: var(--nx-size-sm); color: var(--nx-text-muted); }
.nx-line--tall { padding-top: 6px; padding-bottom: 6px; }

/* The one headline figure of a record: Remaining due on an invoice. */
.nx-headline-label { font-size: var(--nx-size-sm); color: var(--nx-text-muted); }
.nx-headline { font-size: var(--nx-size-3xl); font-weight: var(--nx-weight-strong); line-height: 1.2; color: var(--nx-ink); font-variant-numeric: tabular-nums; }
.nx-headline-note { margin-top: 2px; font-weight: var(--nx-weight-strong); }

/* A record's standing, straight on the page above its cards: the headline figure, then a tile and words for each
   status. */
.nx-standing { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--nx-space-5) var(--nx-space-12); }
.nx-standing-label { font-size: var(--nx-size-sm); color: var(--nx-text-muted); }
.nx-standing-value { display: flex; align-items: center; gap: var(--nx-space-2); margin-top: var(--nx-space-2); color: var(--nx-text); }
.nx-standing-value img { width: 28px; height: 28px; border-radius: var(--nx-radius-control); object-fit: contain; background: var(--nx-surface); }

/* The documents a sale went through, in order, with the days between them. The last is the one on screen. */
.nx-trail { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding-bottom: var(--nx-space-4); border-bottom: 1px solid var(--nx-line-soft); }
.nx-trail-step { display: flex; align-items: center; gap: 10px; padding: var(--nx-space-2) 14px var(--nx-space-2) 10px; border: 1px solid var(--nx-line); border-radius: var(--nx-radius-control); background: var(--nx-well); }
.nx-trail-step.is-current { border-color: var(--nx-pastel-green); background: color-mix(in srgb, var(--nx-pastel-green-tint) 40%, var(--nx-surface)); }
.nx-trail-step .nx-tile { width: 32px; height: 32px; }
.nx-trail-gap { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--nx-text-soft); font-size: var(--nx-size-xs); font-weight: var(--nx-weight-strong); }

/* A tag on a record: its colour alone as a ribbon, its name on hover. */
.nx-ribbon { width: 28px; height: 36px; display: inline-grid; place-items: center; color: var(--nx-dot, var(--nx-pastel-grey)); }
.nx-ribbon .nx-icon { width: 20px; height: 20px; fill: currentColor; }

/* The sums under a table of lines. */
.nx-sums-wrap { display: flex; justify-content: flex-end; padding: 14px var(--nx-space-4); border-top: 1px solid var(--nx-line-soft); }
.nx-sums { margin-left: auto; width: min(320px, 100%); padding: var(--nx-space-4); display: grid; grid-template-columns: 1fr auto; gap: 6px var(--nx-space-6); font-variant-numeric: tabular-nums; }
.nx-sums-wrap > .nx-sums { margin: 0; padding: 0; }
.nx-sums dt { color: var(--nx-text-muted); }
.nx-sums dd { text-align: right; }
.nx-sums .is-total { margin-top: 2px; padding-top: var(--nx-space-2); border-top: 2px solid var(--nx-area); font-size: 16px; font-weight: var(--nx-weight-strong); color: var(--nx-ink); }

@media (max-width: 767px) {
    .nx-kv { grid-template-columns: minmax(0, 1fr); }
}

.nx-list { list-style: none; margin: 0; padding: 0; }
.nx-list > li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--nx-line-soft); }
.nx-list > li:last-child { border-bottom: 0; }
.nx-list .is-done .nx-grow { color: var(--nx-text-muted); text-decoration: line-through; }
.nx-list input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--nx-area-ink); }

.nx-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.nx-timeline > li { display: flex; gap: 10px; }

.nx-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--nx-space-4); }

@media (max-width: 1000px) {
    .nx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.nx-stat { display: flex; flex-direction: column; gap: var(--nx-space-1); padding: var(--nx-space-4); }
.nx-stat-value { font-size: 26px; line-height: var(--nx-leading-tight); font-weight: var(--nx-weight-strong); color: var(--nx-ink); }

/* ---------- Charts ---------- */

.nx-chart { display: block; width: 100%; height: auto; }
.nx-chart text { font-family: var(--nx-font); font-size: 12px; fill: var(--nx-text-muted); }
.nx-chart-axis { stroke: var(--nx-chart-axis); stroke-width: 1; }
.nx-chart-grid { stroke: var(--nx-chart-grid); stroke-width: 1; }
.nx-chart [data-click] { cursor: pointer; }
.nx-legend { display: flex; gap: var(--nx-space-4); flex-wrap: wrap; font-size: var(--nx-size-xs); color: var(--nx-text-muted); }
.nx-legend-key { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; }
.nx-pie { display: flex; align-items: center; gap: var(--nx-space-5); flex-wrap: wrap; }
.nx-pie svg { flex: 0 1 200px; min-width: 150px; }
.nx-pie table { flex: 1 1 160px; border-collapse: collapse; }
.nx-pie td { padding: 4px 6px; }
.nx-pie tr[data-click] { cursor: pointer; }
.nx-pie tr:hover td { background: var(--nx-hover); }
.nx-pie td a { color: inherit; }
.nx-funnel { display: flex; flex-direction: column; gap: 10px; }
.nx-funnel-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 48px; gap: var(--nx-space-3); align-items: center; }
.nx-funnel-bar { height: 26px; min-width: 2px; border-radius: var(--nx-radius-control); }

/* ---------- Flow: a process read top to bottom (Automate) ---------- */

.nx-flow { display: flex; flex-direction: column; align-items: center; padding: var(--nx-space-6) var(--nx-space-4); }

.nx-step {
    width: 100%;
    max-width: 440px;
    display: flex;
    align-items: flex-start;
    gap: var(--nx-space-3);
    padding: var(--nx-space-3) 14px;
    border: 1px solid var(--nx-line);
    border-radius: var(--nx-radius-card);
    background: var(--nx-surface);
    color: inherit;
    text-align: left;
}

button.nx-step:hover { border-color: var(--nx-field-line); }
.nx-step.is-selected { border-color: var(--nx-area-ink); box-shadow: 0 0 0 3px var(--nx-area-tint); }

.nx-step-mark {
    flex: none;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--nx-neutral-ink);
    color: var(--nx-text-on-solid);
}

.nx-step--trigger .nx-step-mark { background: var(--nx-area-strong); color: var(--nx-area-on-strong); }
.nx-step--question .nx-step-mark { background: #1B7079; }
.nx-step-kind { font-size: var(--nx-size-xs); font-weight: var(--nx-weight-strong); letter-spacing: .05em; text-transform: uppercase; color: var(--nx-text-muted); }
.nx-step-title { font-weight: var(--nx-weight-strong); color: var(--nx-ink); }
.nx-flow-wire { width: 2px; height: 20px; background: var(--nx-field-line); opacity: .6; }
.nx-flow-wait { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--nx-radius-pill); background: var(--nx-neutral-tint); color: var(--nx-neutral-ink); font-size: var(--nx-size-xs); font-weight: var(--nx-weight-strong); }
.nx-flow-branches { width: 100%; max-width: 780px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--nx-space-4); padding-top: var(--nx-space-3); border-top: 2px solid color-mix(in srgb, var(--nx-field-line) 60%, transparent); }
.nx-flow-branch { display: flex; flex-direction: column; align-items: center; }

@media (max-width: 767px) {
    .nx-flow-branches { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Area tile: an area's icon on its colour, wherever a row refers to an area ---------- */

.nx-area-tile {
    flex: none;
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 6px;
    background: var(--nx-area-strong);
    color: var(--nx-area-on-strong);
}
