/*
 * Soves shared UI components (milestone 24).
 *
 * Everything here is prefixed `soves-ui-`. If a class starts with `soves-ui-`
 * it is shared across the staff dashboard: do not fork it, do not override it
 * from a page stylesheet. Add a modifier here instead.
 *
 * Live examples of every component and every state: Staff Dashboard →
 * Main → UI Components (?section=components).
 */

/* ------------------------------------------------------------------ badge */

.soves-ui-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    padding: 4px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: var(--soves-dashboard-border);
    color: var(--soves-table-text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.soves-ui-badge.is-upcoming {
    background: var(--soves-table-badge-upcoming-bg);
    color: var(--soves-table-badge-upcoming-text);
}

.soves-ui-badge.is-pending {
    background: var(--soves-table-badge-pending-bg);
    color: var(--soves-table-badge-pending-text);
}

.soves-ui-badge.is-completed {
    background: var(--soves-table-badge-completed-bg);
    color: var(--soves-table-badge-completed-text);
}

.soves-ui-badge.is-cancelled {
    background: var(--soves-table-badge-cancelled-bg);
    color: var(--soves-table-badge-cancelled-text);
}

.soves-ui-badge.is-refunded {
    background: var(--soves-table-badge-refunded-bg);
    color: var(--soves-table-badge-refunded-text);
}

.soves-ui-badge.is-failed {
    background: var(--soves-table-badge-failed-bg);
    color: var(--soves-table-badge-failed-text);
}

.soves-ui-badge--dot::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex: 0 0 auto;
}

.soves-ui-badge--count {
    min-width: 22px;
    justify-content: center;
    padding: 3px 7px;
    font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------- button */

.soves-ui-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    /* Height is fixed rather than derived from padding, so a button and a link
     * styled as one always measure the same, with or without an icon. */
    height: 40px;
    min-height: 40px;
    padding: 0 16px;
    margin: 0;
    border: 1px solid var(--soves-dashboard-border-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--soves-dashboard-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    vertical-align: middle;
    appearance: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.soves-ui-button:hover {
    background: var(--soves-dashboard-soft-2);
    border-color: var(--soves-dashboard-muted);
}

.soves-ui-button:focus-visible {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 2px;
}

.soves-ui-button[disabled],
.soves-ui-button.is-disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.soves-ui-button--primary {
    border-color: var(--soves-brand-primary);
    background: var(--soves-brand-primary);
    color: #fff;
}

.soves-ui-button--primary:hover {
    background: var(--soves-brand-primary-hover);
    border-color: var(--soves-brand-primary-hover);
}

.soves-ui-button--secondary {
    background: var(--soves-dashboard-soft);
}

.soves-ui-button--ghost {
    border-color: transparent;
    background: transparent;
}

.soves-ui-button--ghost:hover {
    background: var(--soves-dashboard-soft-2);
    border-color: transparent;
}

.soves-ui-button--danger {
    border-color: var(--soves-dashboard-red);
    background: var(--soves-dashboard-red);
    color: #fff;
}

.soves-ui-button--danger:hover {
    background: var(--soves-dashboard-red-dark);
    border-color: var(--soves-dashboard-red-dark);
}

.soves-ui-button--link {
    height: auto;
    min-height: 0;
    padding: 0;
    border-color: transparent;
    background: transparent;
    color: var(--soves-brand-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Stays borderless and backgroundless on hover — it is text, not a box. */
.soves-ui-button--link:hover {
    border-color: transparent;
    background: transparent;
    color: var(--soves-brand-primary-hover);
}

.soves-ui-button--sm {
    height: 32px;
    min-height: 32px;
    padding: 0 11px;
    font-size: 13px;
}

.soves-ui-button--lg {
    height: 48px;
    min-height: 48px;
    padding: 0 22px;
    font-size: 15px;
}

/* Icon-only buttons are square, and match the height of their size. */
.soves-ui-button--icon {
    width: 40px;
    min-width: 40px;
    padding: 0;
}

.soves-ui-button--icon.soves-ui-button--sm {
    width: 32px;
    min-width: 32px;
}

.soves-ui-button--icon.soves-ui-button--lg {
    width: 48px;
    min-width: 48px;
}

/* Loading keeps the label visible so the reader still knows what is happening. */
.soves-ui-button.is-loading {
    pointer-events: none;
    opacity: .85;
}

.soves-ui-button.is-loading::before {
    content: "";
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: soves-ui-spin .7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-button.is-loading::before {
        animation-duration: 2.4s;
    }
}

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

.soves-ui-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.soves-ui-button-row--end {
    justify-content: flex-end;
}

/* Quiet destructive action — for a delete that sits inside a row of others. */
.soves-ui-button--danger-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--soves-dashboard-red);
}

.soves-ui-button--danger-ghost:hover {
    border-color: transparent;
    background: var(--soves-dashboard-red-soft);
}

.soves-ui-button--block {
    width: 100%;
}

/* The icon is boxed to a fixed square so it can never change the button's
 * height — that was what made icon and text-only buttons disagree. */
.soves-ui-button__icon {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    line-height: 1;
}

.soves-ui-button__icon .soves-lucide-icon {
    width: 18px;
    height: 18px;
}

.soves-ui-button--sm .soves-ui-button__icon {
    width: 16px;
    height: 16px;
}

.soves-ui-button--sm .soves-ui-button__icon .soves-lucide-icon {
    width: 16px;
    height: 16px;
}

/* Equal-width actions, for a row where the buttons should read as a set. */
.soves-ui-button-row--equal .soves-ui-button {
    flex: 0 0 auto;
    min-width: 116px;
}

.soves-ui-panel__actions--equal .soves-ui-button {
    min-width: 104px;
}

/* Count pill inside a button — "Bulk cancel (12)" without the brackets. */
.soves-ui-button__count {
    font-variant-numeric: tabular-nums;
    opacity: .65;
}

/* Toggle button — pressed state is driven by aria-pressed, not a class. */
.soves-ui-button[aria-pressed="true"] {
    border-color: var(--soves-brand-primary);
    background: var(--soves-brand-primary-soft);
    color: var(--soves-brand-primary);
}

/* Segmented group — one visual control made of several buttons. */
.soves-ui-button-group {
    display: inline-flex;
    flex-wrap: wrap;
}

.soves-ui-button-group .soves-ui-button {
    border-radius: 0;
    margin-left: -1px;
}

.soves-ui-button-group .soves-ui-button:first-child {
    border-radius: 8px 0 0 8px;
    margin-left: 0;
}

.soves-ui-button-group .soves-ui-button:last-child {
    border-radius: 0 8px 8px 0;
}

.soves-ui-button-group .soves-ui-button:hover,
.soves-ui-button-group .soves-ui-button[aria-pressed="true"] {
    position: relative;
    z-index: 1;
}

/* Split button — primary action plus a menu trigger. */
.soves-ui-button-split {
    display: inline-flex;
}

.soves-ui-button-split .soves-ui-button:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.soves-ui-button-split .soves-ui-button:last-child {
    width: 36px;
    min-width: 36px;
    padding: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    margin-left: -1px;
}

/* ------------------------------------------------------------------- link */

.soves-ui-link {
    color: var(--soves-brand-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.soves-ui-link:hover {
    color: var(--soves-brand-primary-hover);
}

.soves-ui-link:focus-visible {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.soves-ui-link--muted {
    color: var(--soves-dashboard-muted);
}

.soves-ui-link--muted:hover {
    color: var(--soves-dashboard-text);
}

.soves-ui-link--danger {
    color: var(--soves-dashboard-red);
}

.soves-ui-link--danger:hover {
    color: var(--soves-dashboard-red-dark);
}

/* Standalone link — sits on its own line and reads as a next step.
 * The rule is drawn with a border rather than text-decoration so it runs
 * unbroken under the label, the gap and the arrow. A flex container will not
 * underline across its children. */
.soves-ui-link--standalone {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    justify-self: start;
    border-bottom: 1px solid transparent;
    text-decoration: none;
}

.soves-ui-link--standalone:hover {
    border-bottom-color: currentColor;
    text-decoration: none;
}

.soves-ui-link--standalone::after {
    content: "\2192";
    transition: transform .15s ease;
}

.soves-ui-link--standalone:hover::after {
    transform: translateX(2px);
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-link--standalone::after {
        transition: none;
    }

    .soves-ui-link--standalone:hover::after {
        transform: none;
    }
}

/* External links say so, so nobody is surprised by leaving the dashboard. */
.soves-ui-link--external::after {
    content: "\2197";
    margin-left: 3px;
    font-size: .9em;
}

.soves-ui-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    justify-self: start;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.soves-ui-back-link::before {
    content: "\2190";
}

.soves-ui-back-link:hover {
    color: var(--soves-dashboard-text);
    text-decoration: underline;
}

/* ------------------------------------------------------------------ panel */

.soves-ui-panel {
    box-sizing: border-box;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: #fff;
    box-shadow: var(--soves-dashboard-card-shadow);
}

.soves-ui-panel__body {
    padding: 24px;
}

.soves-ui-panel--flush .soves-ui-panel__body {
    padding: 0;
}

.soves-ui-panel__head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--soves-dashboard-border);
}

.soves-ui-panel__head h2,
.soves-ui-panel__head h3 {
    margin: 0;
    font-size: 16px;
    line-height: 1.3;
}

.soves-ui-panel__head p {
    margin: 4px 0 0;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

/* Head parts: a text block on the left, actions on the right. */
.soves-ui-panel__head-text {
    min-width: 0;
}

.soves-ui-panel__title-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.soves-ui-panel__eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--soves-dashboard-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.soves-ui-panel__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* A secondary row under the head, for filters or a search box. */
.soves-ui-panel__toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 24px;
    border-bottom: 1px solid var(--soves-dashboard-border);
    background: var(--soves-dashboard-soft);
}

/* Two independent controls sharing one toolbar row — a preset group on one
 * side, a filter form on the other — pushed to opposite edges instead of
 * bunching together at the start. */
.soves-ui-panel__toolbar--split {
    justify-content: space-between;
}

/* The date-range filter bar here is only two short fields plus Apply/Reset —
 * unlike the page-level filter bars this same class powers elsewhere (five
 * fields on Payments, say), it never needs to wrap onto a second line. */
.soves-ui-panel__toolbar--split .soves-ui-filter-bar--inline {
    flex-wrap: nowrap;
}

.soves-ui-panel__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--soves-dashboard-border);
    background: var(--soves-dashboard-soft);
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

/* A panel that needs attention is marked by tinting its head, not by a stripe.
 * The colour then sits next to the words that explain it. */
.soves-ui-panel.is-warning > .soves-ui-panel__head {
    border-bottom-color: var(--soves-table-badge-pending-bg);
    background: var(--soves-table-badge-pending-bg);
}

.soves-ui-panel.is-warning > .soves-ui-panel__head h2,
.soves-ui-panel.is-warning > .soves-ui-panel__head h3 {
    color: var(--soves-table-badge-pending-text);
}

.soves-ui-panel.is-danger > .soves-ui-panel__head {
    border-bottom-color: var(--soves-table-badge-cancelled-bg);
    background: var(--soves-table-badge-cancelled-bg);
}

.soves-ui-panel.is-danger > .soves-ui-panel__head h2,
.soves-ui-panel.is-danger > .soves-ui-panel__head h3 {
    color: var(--soves-table-badge-cancelled-text);
}

.soves-ui-panel.is-success > .soves-ui-panel__head {
    border-bottom-color: var(--soves-table-badge-completed-bg);
    background: var(--soves-table-badge-completed-bg);
}

.soves-ui-panel.is-success > .soves-ui-panel__head h2,
.soves-ui-panel.is-success > .soves-ui-panel__head h3 {
    color: var(--soves-table-badge-completed-text);
}

/* Collapsible panel, built on <details> so it works without JavaScript. */
.soves-ui-panel--collapsible > summary {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    cursor: pointer;
    list-style: none;
}

.soves-ui-panel--collapsible > summary::-webkit-details-marker {
    display: none;
}

.soves-ui-panel--collapsible > summary h2,
.soves-ui-panel--collapsible > summary h3 {
    margin: 0;
    font-size: 16px;
}

.soves-ui-panel--collapsible > summary::after {
    content: "\25BE";
    color: var(--soves-dashboard-muted);
    transition: transform .15s ease;
}

.soves-ui-panel--collapsible[open] > summary {
    border-bottom: 1px solid var(--soves-dashboard-border);
}

.soves-ui-panel--collapsible[open] > summary::after {
    transform: rotate(180deg);
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-panel--collapsible > summary::after {
        transition: none;
    }
}

/* ------------------------------------------------------------ page header */

.soves-ui-page-header {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
}

.soves-ui-page-header__text h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.25;
    text-wrap: balance;
}

.soves-ui-page-header__text p {
    margin: 6px 0 0;
    max-width: 70ch;
    color: var(--soves-dashboard-muted);
    font-size: 14px;
}

.soves-ui-page-header__eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--soves-dashboard-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------------ table */

.soves-ui-table-wrap {
    overflow-x: auto;
    /* Browsers pair overflow-x: auto with an implicit overflow-y: auto,
     * which can draw an empty vertical scrollbar track even though the
     * table never overflows vertically (only sideways, when a row is
     * wider than the panel). Pin the vertical axis off explicitly so the
     * table's height is always exactly what its rows need. */
    overflow-y: hidden;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: var(--soves-table-surface);
}

.soves-ui-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 14px;
}

.soves-ui-table th,
.soves-ui-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--soves-table-border);
    text-align: left;
    vertical-align: middle;
}

.soves-ui-table th {
    background: var(--soves-table-header);
    color: var(--soves-table-heading);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.soves-ui-table tbody tr:last-child td {
    border-bottom: 0;
}

.soves-ui-table tbody tr:hover {
    background: var(--soves-table-hover);
}

.soves-ui-table--compact th,
.soves-ui-table--compact td {
    padding: 8px 12px;
}

/* Bounded, internally-scrolling table — for a table inside a popup, where the
 * page itself should not grow to fit it. */
.soves-ui-table-wrap--scroll {
    overflow-y: auto;
}

/* Sticky header. Switches to separate borders because position: sticky on a
 * <th> does not reliably stick under border-collapse: collapse in every
 * engine — a real, documented cross-browser gap, not a guess. This design
 * only ever sets border-bottom on cells (no side borders), so the switch away
 * from collapse changes nothing visually; each row's bottom edge is drawn by
 * that row's own cells either way. */
.soves-ui-table--sticky {
    border-collapse: separate;
    border-spacing: 0;
}

.soves-ui-table--sticky thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: inset 0 -1px 0 var(--soves-table-border);
}

/* Sortable column header. */
.soves-ui-table__sort {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.soves-ui-table__sort:hover {
    color: var(--soves-brand-primary);
}

.soves-ui-table__sort:focus-visible {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.soves-ui-table__sort.is-active {
    color: var(--soves-brand-primary);
}

.soves-ui-table__sort-icon {
    display: inline-flex;
    flex: 0 0 auto;
    opacity: .45;
}

.soves-ui-table__sort:hover .soves-ui-table__sort-icon,
.soves-ui-table__sort.is-active .soves-ui-table__sort-icon {
    opacity: 1;
}

.soves-ui-table__sort-icon .soves-lucide-icon {
    width: 13px;
    height: 13px;
}

/* Descending is the icon's own resting direction (▾); ascending flips it. */
.soves-ui-table__sort-icon.is-asc {
    transform: rotate(180deg);
}

/* Cell primitives — where per-page inconsistency used to creep in. */

.soves-ui-cell-primary {
    display: grid;
    gap: 2px;
}

.soves-ui-cell-primary strong {
    color: var(--soves-table-heading);
    font-size: 14px;
}

/* The identifier in a row is the natural thing to click, so it opens the record
 * the same way the row's View action does. Styled as text, not as a button. */
.soves-ui-cell-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--soves-table-heading);
    font: inherit;
    font-weight: 700;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: text-decoration-color .15s ease, color .15s ease;
}

.soves-ui-cell-link:hover {
    color: var(--soves-brand-primary);
    text-decoration-color: currentColor;
}

.soves-ui-cell-link:focus-visible {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 2px;
    border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-cell-link {
        transition: none;
    }
}

.soves-ui-cell-primary span {
    color: var(--soves-table-muted);
    font-size: 12px;
}

.soves-ui-cell-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.soves-ui-cell-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: flex-start;
    white-space: normal;
}

.soves-ui-cell-actions .soves-ui-button {
    white-space: nowrap;
}

/* Row actions that should hug the table's trailing edge rather than the
 * cell's own left edge — used on tables where the actions column is a
 * dedicated, labeled trailing column (Staff, Roles) rather than inline with
 * other cell content. */
.soves-ui-cell-actions--end {
    justify-content: flex-end;
}

.soves-ui-cell-mono {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    white-space: nowrap;
}

/* ------------------------------------------------------------ empty state */

.soves-ui-empty {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 32px 20px;
    color: var(--soves-dashboard-muted);
    text-align: center;
}

.soves-ui-empty strong {
    color: var(--soves-dashboard-text);
    font-size: 15px;
}

.soves-ui-empty p {
    margin: 0;
    max-width: 46ch;
    font-size: 13px;
}

/* -------------------------------------------------------------------- kpi */

.soves-ui-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.soves-ui-kpi {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    box-sizing: border-box;
    padding: 18px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: #fff;
    box-shadow: var(--soves-dashboard-card-shadow);
}

.soves-ui-kpi__icon .soves-lucide-icon {
    width: 20px;
    height: 20px;
}

.soves-ui-kpi__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--soves-brand-primary-soft);
    color: var(--soves-brand-primary);
}

.soves-ui-kpi__body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.soves-ui-kpi__value {
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.soves-ui-kpi__label {
    color: var(--soves-dashboard-text);
    font-size: 13px;
    font-weight: 600;
}

.soves-ui-kpi__hint {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
}

.soves-ui-kpi.is-success .soves-ui-kpi__icon {
    background: var(--soves-table-badge-completed-bg);
    color: var(--soves-table-badge-completed-text);
}

.soves-ui-kpi.is-warning .soves-ui-kpi__icon {
    background: var(--soves-table-badge-pending-bg);
    color: var(--soves-table-badge-pending-text);
}

.soves-ui-kpi.is-danger .soves-ui-kpi__icon {
    background: var(--soves-table-badge-cancelled-bg);
    color: var(--soves-table-badge-cancelled-text);
}

/* A KPI that links somewhere must look like it does. */
a.soves-ui-kpi {
    color: inherit;
    text-decoration: none;
    transition: box-shadow .15s ease, transform .15s ease;
}

a.soves-ui-kpi:hover {
    box-shadow: var(--soves-dashboard-card-shadow-hover);
    transform: translateY(-1px);
}

a.soves-ui-kpi:focus-visible {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    a.soves-ui-kpi {
        transition: none;
    }

    a.soves-ui-kpi:hover {
        transform: none;
    }
}

/* ------------------------------------------------------------------- hub */

/* A grid of link-cards to a group of sub-sections — the Finance hub today,
 * usable anywhere a section is really just a menu onto a few real pages. */
.soves-ui-hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.soves-ui-hub-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    box-sizing: border-box;
    padding: 20px;
    color: inherit;
    text-decoration: none;
    transition: box-shadow .15s ease, transform .15s ease;
}

.soves-ui-hub-card:hover {
    box-shadow: var(--soves-dashboard-card-shadow-hover);
    transform: translateY(-1px);
}

.soves-ui-hub-card:focus-visible {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 2px;
}

.soves-ui-hub-card__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--soves-brand-primary-soft);
    color: var(--soves-brand-primary);
}

.soves-ui-hub-card__icon .soves-lucide-icon {
    width: 20px;
    height: 20px;
}

.soves-ui-hub-card strong {
    font-size: 15px;
}

.soves-ui-hub-card p {
    margin: 0;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

.soves-ui-hub-card__action {
    margin-top: auto;
    padding-top: 8px;
    color: var(--soves-brand-primary);
    font-size: 13px;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-hub-card {
        transition: none;
    }

    .soves-ui-hub-card:hover {
        transform: none;
    }
}

/* A row of panels side by side — informational widgets that are each too
 * small to justify the full page width on their own (a provider breakdown,
 * a top-N list, a mini table). Collapses to one column on narrow screens. */
.soves-ui-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
}

/* Trend against the previous period. Direction is not the same as good or
 * bad — cancellations rising is an increase and a problem — so the caller
 * says which tone to use rather than the arrow deciding. */
.soves-ui-kpi__trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.soves-ui-kpi__trend.is-up::before {
    content: "\25B2";
    font-size: 9px;
}

.soves-ui-kpi__trend.is-down::before {
    content: "\25BC";
    font-size: 9px;
}

.soves-ui-kpi__trend.is-flat::before {
    content: "\2013";
}

.soves-ui-kpi__trend.is-good {
    color: var(--soves-table-badge-completed-text);
}

.soves-ui-kpi__trend.is-bad {
    color: var(--soves-table-badge-cancelled-text);
}

.soves-ui-kpi__trend.is-neutral {
    color: var(--soves-dashboard-muted);
}

.soves-ui-kpi__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 2px;
}

.soves-ui-kpi__compare {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
}

/* ------------------------------------------------------------- sparkline */

/* Standalone use — inside a table cell, a summary strip, anywhere a KPI
 * card's own tone classes are not available. Give the surrounding element a
 * size (a table cell is usually enough on its own), or size it directly the
 * way the KPI card's own spark slot does below. */
.soves-ui-sparkline {
    display: inline-block;
    width: 64px;
    height: 22px;
    color: var(--soves-brand-primary);
    vertical-align: middle;
}

.soves-ui-sparkline.is-success {
    color: var(--soves-table-badge-completed-text);
}

.soves-ui-sparkline.is-warning {
    color: var(--soves-table-badge-pending-text);
}

.soves-ui-sparkline.is-danger {
    color: var(--soves-dashboard-red);
}

.soves-ui-sparkline svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.soves-ui-sparkline__line {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.soves-ui-sparkline__fill {
    fill: currentColor;
    stroke: none;
    opacity: .12;
}

.soves-ui-sparkline__dot {
    fill: currentColor;
}

/* The KPI card's own spark slot: ui/kpi.php renders ui/sparkline.php with
 * class="soves-ui-kpi__spark" on the same element rather than nesting a
 * second wrapper. This sizing rule needs the extra class in the selector, not
 * just its own — .soves-ui-sparkline's 64x22 default above has equal
 * specificity to a bare .soves-ui-kpi__spark rule, so without the compound
 * selector here, whichever rule happened to come later in the file would
 * silently win regardless of which one was intended. */
.soves-ui-sparkline.soves-ui-kpi__spark {
    display: block;
    width: 100%;
    height: 28px;
    margin-top: 6px;
    color: var(--soves-brand-primary);
}

/* Colour follows the card's tone automatically, so a KPI's spark never needs
 * its own tone class — unlike the standalone .is-success/.is-warning/.is-danger
 * above, which exist because a table cell has no such parent tone to inherit. */
.soves-ui-kpi.is-success .soves-ui-kpi__spark {
    color: var(--soves-table-badge-completed-text);
}

.soves-ui-kpi.is-warning .soves-ui-kpi__spark {
    color: var(--soves-table-badge-pending-text);
}

.soves-ui-kpi.is-danger .soves-ui-kpi__spark {
    color: var(--soves-dashboard-red);
}

.soves-ui-kpi.is-loading .soves-ui-kpi__spark {
    display: none;
}

/* Compact is a different layout, not a shrunken one: the label leads as a small
 * caps line, the number sits under it, and the icon becomes a quiet mark in the
 * corner rather than a coloured tile competing with the value. */
.soves-ui-kpi--compact {
    position: relative;
    display: block;
    padding: 12px 14px;
    box-shadow: none;
}

.soves-ui-kpi--compact .soves-ui-kpi__body {
    display: block;
}

.soves-ui-kpi--compact .soves-ui-kpi__label {
    display: block;
    color: var(--soves-dashboard-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.soves-ui-kpi--compact .soves-ui-kpi__value {
    display: block;
    margin-top: 4px;
    font-size: 20px;
    line-height: 1.1;
}

.soves-ui-kpi--compact .soves-ui-kpi__icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto;
    height: auto;
    background: none;
    color: var(--soves-dashboard-border-strong);
}

.soves-ui-kpi--compact .soves-ui-kpi__icon .soves-lucide-icon {
    width: 18px;
    height: 18px;
}

.soves-ui-kpi--compact.is-success .soves-ui-kpi__icon,
.soves-ui-kpi--compact.is-warning .soves-ui-kpi__icon,
.soves-ui-kpi--compact.is-danger .soves-ui-kpi__icon {
    background: none;
}

.soves-ui-kpi--compact.is-success {
    border-left: 3px solid var(--soves-table-badge-completed-text);
}

.soves-ui-kpi--compact.is-warning {
    border-left: 3px solid var(--soves-table-badge-pending-text);
}

.soves-ui-kpi--compact.is-danger {
    border-left: 3px solid var(--soves-dashboard-red);
}

/* Loading placeholder, so a slow KPI does not collapse the grid. */
.soves-ui-kpi.is-loading .soves-ui-kpi__value,
.soves-ui-kpi.is-loading .soves-ui-kpi__label {
    border-radius: 4px;
    background: var(--soves-dashboard-border);
    color: transparent;
    animation: soves-ui-pulse 1.4s ease-in-out infinite;
}

@keyframes soves-ui-pulse {
    50% {
        opacity: .5;
    }
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-kpi.is-loading .soves-ui-kpi__value,
    .soves-ui-kpi.is-loading .soves-ui-kpi__label {
        animation: none;
    }
}

/* ----------------------------------------------------------------- notice */

.soves-ui-notice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 16px;
    border: 1px solid var(--soves-dashboard-border);
    border-left-width: 4px;
    border-radius: 8px;
    background: var(--soves-dashboard-soft);
    color: var(--soves-dashboard-text);
    font-size: 14px;
}

.soves-ui-notice--success {
    border-left-color: var(--soves-table-badge-completed-text);
    background: var(--soves-table-badge-completed-bg);
    color: var(--soves-table-badge-completed-text);
}

.soves-ui-notice--warning {
    border-left-color: var(--soves-table-badge-pending-text);
    background: var(--soves-table-badge-pending-bg);
    color: var(--soves-table-badge-pending-text);
}

.soves-ui-notice--error {
    border-left-color: var(--soves-table-badge-cancelled-text);
    background: var(--soves-table-badge-cancelled-bg);
    color: var(--soves-table-badge-cancelled-text);
}

.soves-ui-notice--info {
    border-left-color: var(--soves-dashboard-blue);
    background: var(--soves-table-badge-upcoming-bg);
    color: var(--soves-table-badge-upcoming-text);
}

.soves-ui-notice__body {
    flex: 1 1 auto;
    min-width: 0;
}

.soves-ui-notice__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

/* Dismiss control. Reuses the existing staff-dashboard-notices script via the
 * data-soves-alert-dismiss / data-soves-dashboard-alert hooks — no new JS. */
.soves-ui-notice__dismiss {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: currentColor;
    font-size: 17px;
    line-height: 1;
    opacity: .65;
    cursor: pointer;
}

.soves-ui-notice__dismiss:hover {
    background: rgba(15, 23, 42, .08);
    opacity: 1;
}

.soves-ui-notice__dismiss:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
    opacity: 1;
}

.soves-ui-notice.is-dismissing {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .2s ease, transform .2s ease;
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-notice.is-dismissing {
        transition: none;
    }
}

/* ----------------------------------------------------------------- dialog */

.soves-ui-dialog {
    width: min(640px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: #fff;
    color: var(--soves-dashboard-text);
    box-shadow: var(--soves-dashboard-shadow);
}

/* While the WordPress media library is open over a dialog, the dialog is
   dropped to non-modal (see HotelEditPage): keep it in place, below the media modal. */
.soves-ui-dialog[open]:not(:modal) {
    position: fixed;
    inset: 0;
    z-index: 100;
    height: fit-content;
    max-height: calc(100vh - 32px);
    margin: auto;
    overflow: auto;
}

.soves-ui-dialog--sm {
    width: min(440px, calc(100vw - 32px));
}

.soves-ui-dialog--lg {
    width: min(880px, calc(100vw - 32px));
}

.soves-ui-dialog::backdrop {
    background: rgba(15, 23, 42, .45);
}

.soves-ui-dialog__inner {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 64px);
}

.soves-ui-dialog__head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--soves-dashboard-border);
}

.soves-ui-dialog__head h2 {
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
}

.soves-ui-dialog__head p {
    margin: 4px 0 0;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

.soves-ui-dialog__close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 8px;
    background: #fff;
    color: var(--soves-dashboard-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.soves-ui-dialog__close:hover {
    background: var(--soves-dashboard-soft-2);
}

/* Storefront dialogs keep their controls readable under public-theme button styles. */
.soves-ui-dialog.soves-ui-dialog--travel .soves-ui-dialog__close {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 50%;
    background: var(--soves-dashboard-soft);
    color: var(--soves-brand-primary);
    font-size: 20px;
}

.soves-ui-dialog.soves-ui-dialog--travel .soves-ui-dialog__close:hover {
    background: var(--soves-brand-primary-soft);
}

.soves-ui-dialog__body {
    overflow-y: auto;
    padding: 20px;
}

.soves-ui-dialog__foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--soves-dashboard-border);
    background: var(--soves-dashboard-soft);
}

/* ------------------------------------------------------------ detail grid */

.soves-ui-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px 20px;
    margin: 0;
}

.soves-ui-detail-grid > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.soves-ui-detail-grid dt {
    color: var(--soves-dashboard-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.soves-ui-detail-grid dd {
    margin: 0;
    font-size: 14px;
    overflow-wrap: anywhere;
}

/* -------------------------------------------------------------- utilities */

.soves-ui-muted {
    color: var(--soves-dashboard-muted);
}

.soves-ui-stack {
    display: grid;
    gap: 20px;
}

@media (max-width: 600px) {
    .soves-ui-panel__body,
    .soves-ui-panel__head {
        padding: 16px;
    }

    .soves-ui-page-header {
        flex-direction: column;
    }
}

/* ---------------------------------------------------------------------------
 * Gallery page only (?section=components). Not part of the shared component
 * set — these classes style the examples, not the components themselves.
 * ------------------------------------------------------------------------- */

.soves-ui-demo-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.soves-ui-demo-group {
    scroll-margin-top: 16px;
}

.soves-ui-demo {
    display: grid;
    gap: 10px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--soves-dashboard-border);
}

.soves-ui-demo:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.soves-ui-demo__head h3 {
    margin: 0;
    font-size: 14px;
}

.soves-ui-demo__head p {
    margin: 3px 0 0;
    max-width: 72ch;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

.soves-ui-demo__stage {
    padding: 18px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 10px;
    background: var(--soves-dashboard-soft);
}

.soves-ui-demo__code summary {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.soves-ui-demo__code pre {
    overflow-x: auto;
    margin: 8px 0 0;
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--soves-dashboard-text);
    color: #e6edf6;
    font-size: 12px;
    line-height: 1.6;
}

.soves-ui-demo__tier {
    margin: 0 0 8px;
    font-size: 14px;
}

.soves-ui-planned-list {
    margin: 0;
    padding-left: 18px;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
    line-height: 1.8;
}

/* ------------------------------------------------------------------- form */

.soves-ui-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.soves-ui-field__label {
    color: var(--soves-dashboard-text);
    font-size: 13px;
    font-weight: 600;
}

.soves-ui-field__required {
    margin-left: 2px;
    color: var(--soves-dashboard-red);
}

.soves-ui-field__hint {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
}

.soves-ui-field__error {
    display: flex;
    gap: 5px;
    align-items: flex-start;
    color: var(--soves-table-badge-cancelled-text);
    font-size: 12px;
    font-weight: 600;
}

.soves-ui-input,
.soves-ui-select,
.soves-ui-textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--soves-dashboard-border-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--soves-dashboard-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.soves-ui-textarea {
    min-height: 92px;
    resize: vertical;
}

.soves-ui-select {
    appearance: none;
    padding-right: 34px;
    /* Chevron drawn inline so no image request is needed. */
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23667085' d='M4.2 6.3a1 1 0 0 1 1.4 0L8 8.7l2.4-2.4a1 1 0 1 1 1.4 1.4l-3.1 3.1a1 1 0 0 1-1.4 0L4.2 7.7a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 16px;
}

.soves-ui-input:focus,
.soves-ui-select:focus,
.soves-ui-textarea:focus {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 1px;
    border-color: var(--soves-brand-primary);
}

.soves-ui-input::placeholder,
.soves-ui-textarea::placeholder {
    color: var(--soves-dashboard-muted);
}

.soves-ui-input[disabled],
.soves-ui-select[disabled],
.soves-ui-textarea[disabled],
.soves-ui-input[readonly] {
    background: var(--soves-dashboard-soft-2);
    color: var(--soves-dashboard-muted);
    cursor: not-allowed;
}

.soves-ui-field.is-invalid .soves-ui-input,
.soves-ui-field.is-invalid .soves-ui-select,
.soves-ui-field.is-invalid .soves-ui-textarea {
    border-color: var(--soves-dashboard-red);
    background: var(--soves-dashboard-red-soft);
}

/* Checkbox and radio keep the native control — it is accessible, themable
 * enough via accent-color, and always matches the user's platform. */
.soves-ui-check {
    display: flex;
    gap: 9px;
    align-items: flex-start;
    font-size: 14px;
    cursor: pointer;
}

.soves-ui-check input {
    width: 17px;
    height: 17px;
    margin: 1px 0 0;
    flex: 0 0 auto;
    accent-color: var(--soves-brand-primary);
    cursor: pointer;
}

.soves-ui-check__text {
    display: grid;
    gap: 2px;
}

.soves-ui-check__hint {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
}

.soves-ui-check input[disabled] {
    cursor: not-allowed;
}

.soves-ui-check input[disabled] ~ .soves-ui-check__text {
    color: var(--soves-dashboard-muted);
}

.soves-ui-fieldset {
    display: grid;
    gap: 10px;
    padding: 0;
    border: 0;
    margin: 0;
}

.soves-ui-fieldset > legend {
    padding: 0;
    color: var(--soves-dashboard-text);
    font-size: 13px;
    font-weight: 600;
}

/* Form layout: fields flow into as many columns as fit. */
.soves-ui-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: start;
}

.soves-ui-form-stack {
    display: grid;
    gap: 12px;
}

.soves-ui-field--full {
    grid-column: 1 / -1;
}

.soves-ui-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

.soves-ui-form-actions--split {
    justify-content: space-between;
}

/* ---------------------------------------------------------- settings form */

.soves-ui-settings-form,
.soves-ui-settings-sections {
    display: grid;
    gap: 20px;
}

.soves-ui-settings-section {
    overflow: hidden;
    box-shadow: none;
}

.soves-ui-settings-section > .soves-ui-panel__body {
    background: var(--soves-dashboard-soft-2);
}

.soves-ui-settings-note {
    margin: 14px 0 0;
    color: var(--soves-dashboard-muted);
    font-size: 12px;
}

.soves-ui-settings-option-list {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: #fff;
}

.soves-ui-settings-option-list__header {
    display: grid;
    gap: 4px;
}

.soves-ui-settings-option-list__header h3 {
    margin: 0;
    color: var(--soves-dashboard-text);
    font-size: 15px;
}

.soves-ui-settings-option-list__header p {
    margin: 0;
    color: var(--soves-dashboard-muted);
    font-size: 12px;
}

.soves-ui-settings-option-list__rows {
    display: grid;
    gap: 12px;
}

.soves-ui-settings-option-list__items {
    display: grid;
    gap: 10px;
}

.soves-ui-option-list__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 10px;
    background: var(--soves-dashboard-soft-2);
}

.soves-ui-range-list__row {
    grid-template-columns: minmax(0, 1.4fr) minmax(100px, .6fr) minmax(100px, .6fr) auto;
}

.soves-ui-option-list__field {
    display: grid;
    gap: 6px;
}

.soves-ui-option-list__row .soves-ui-input,
.soves-ui-settings-section .soves-icon-text-repeater input,
.soves-ui-settings-section .soves-icon-text-repeater select {
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    color: var(--soves-dashboard-text);
    font: inherit;
}

.soves-ui-settings-option-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.soves-ui-settings-section .soves-icon-text-repeater {
    display: grid;
    gap: 12px;
}

.soves-ui-settings-section .soves-icon-text-repeater h3 {
    margin: 0;
    color: var(--soves-dashboard-text);
    font-size: 15px;
}

.soves-ui-settings-section .soves-icon-text-repeater .soves-repeater-rows {
    display: grid;
    gap: 10px;
}

.soves-ui-settings-section .soves-icon-text-repeater .soves-repeater-row {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

@media (max-width: 780px) {
    .soves-ui-settings-option-columns,
    .soves-ui-option-list__row,
    .soves-ui-settings-section .soves-icon-text-repeater .soves-repeater-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}

.soves-ui-settings-media-single {
    max-width: 420px;
    margin-top: 16px;
}

.soves-ui-settings-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.soves-ui-media-field {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: #fff;
}

.soves-ui-media-field__preview {
    display: flex;
    min-height: 128px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px dashed var(--soves-dashboard-border-strong);
    border-radius: 8px;
    background: var(--soves-dashboard-soft);
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    text-align: center;
}

.soves-ui-media-field__preview img {
    display: block;
    width: 100%;
    height: 128px;
    object-fit: contain;
}

.soves-ui-media-field__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* ------------------------------------------------------------- filter bar */

.soves-ui-filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
    padding: 16px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: var(--soves-dashboard-soft);
}

.soves-ui-filter-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.soves-ui-filter-bar__active {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.soves-ui-filter-bar__active:empty {
    display: none;
}

/* ------------------------------------------------------------ multiselect */

.soves-ui-multiselect {
    position: relative;
}

.soves-ui-multiselect__tags {
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-height: 40px;
    padding: 5px 8px;
    border: 1px solid var(--soves-dashboard-border-strong);
    border-radius: 8px;
    margin: 0;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    padding-right: 34px;
    cursor: pointer;
    list-style: none;
}

.soves-ui-multiselect:focus-within .soves-ui-multiselect__tags {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 1px;
    border-color: var(--soves-brand-primary);
}

.soves-ui-multiselect__input-wrap {
    flex: 1 1 100px;
    min-width: 100px;
}

.soves-ui-multiselect__input {
    width: 100%;
    padding: 3px 2px;
    border: 0;
    background: none;
    color: var(--soves-dashboard-text);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    cursor: pointer;
}

.soves-ui-multiselect__input::placeholder {
    color: var(--soves-dashboard-text);
    opacity: 0.75;
}

.soves-ui-multiselect__listbox {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 240px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 10px;
    margin: 0;
    background: #fff;
    box-shadow: var(--soves-dashboard-shadow);
    list-style: none;
}

.soves-ui-multiselect__listbox[hidden] {
    display: none;
}

.soves-ui-multiselect__option {
    padding: 8px 10px;
    border-radius: 7px;
    font-size: 13px;
    cursor: pointer;
}

.soves-ui-multiselect__option[hidden] {
    display: none;
}

.soves-ui-multiselect__option.is-active {
    background: var(--soves-brand-primary-soft);
    color: var(--soves-brand-primary);
}

.soves-ui-multiselect__empty {
    padding: 8px 10px;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

.soves-ui-multiselect__empty[hidden] {
    display: none;
}

/* -------------------------------------------------------------- pagination */

.soves-ui-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
}

.soves-ui-pagination__status {
    color: var(--soves-dashboard-muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.soves-ui-pagination__controls {
    display: flex;
    gap: 6px;
    align-items: center;
}

.soves-ui-pagination__pages {
    display: flex;
    gap: 2px;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none;
}

.soves-ui-pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--soves-dashboard-text);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

a.soves-ui-pagination__page:hover {
    border-color: var(--soves-dashboard-border-strong);
    background: var(--soves-dashboard-soft-2);
}

a.soves-ui-pagination__page:focus-visible {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 1px;
}

.soves-ui-pagination__page.is-current {
    border-color: var(--soves-brand-primary);
    background: var(--soves-brand-primary);
    color: #fff;
}

.soves-ui-pagination__gap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 32px;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

.soves-ui-pagination__jump {
    display: flex;
    gap: 6px;
    align-items: center;
}

.soves-ui-pagination__jump-input {
    height: 32px;
    width: 64px;
    padding: 0 8px;
    font-size: 13px;
    text-align: center;
}

@media (max-width: 520px) {
    .soves-ui-pagination__pages {
        display: none;
    }
}

/* ------------------------------------------------------------- empty state */

.soves-ui-empty__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: 4px;
    border-radius: 50%;
    background: var(--soves-dashboard-soft-2);
    color: var(--soves-dashboard-muted);
}

.soves-ui-empty__icon .soves-lucide-icon {
    width: 22px;
    height: 22px;
}

.soves-ui-empty__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

/* --------------------------------------------------------- dialog helpers */

.soves-ui-dialog__body .soves-ui-form-grid {
    margin: 0;
}

/* A destructive confirm names the record it is about to act on. */
.soves-ui-dialog__subject {
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--soves-dashboard-soft-2);
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
}

/* ------------------------------------------------- filter bar variations */

/* Stacked — a sidebar filter panel. Fields run down a single narrow column. */
.soves-ui-filter-bar--stacked {
    grid-template-columns: 1fr;
    max-width: 300px;
}

.soves-ui-filter-bar--stacked .soves-ui-filter-bar__actions {
    display: grid;
    gap: 8px;
}

.soves-ui-filter-bar--stacked .soves-ui-filter-bar__actions .soves-ui-button {
    width: 100%;
}

/* Inline — one row that sits directly above a table. Search takes the slack. */
.soves-ui-filter-bar--inline {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 12px;
}

.soves-ui-filter-bar--inline .soves-ui-field {
    flex: 0 1 170px;
}

.soves-ui-filter-bar--inline .soves-ui-field--grow {
    flex: 1 1 240px;
}

.soves-ui-filter-bar--inline .soves-ui-filter-bar__actions {
    flex: 0 0 auto;
}

/* Bare — no card around it, for a filter bar already inside a panel. */
.soves-ui-filter-bar--bare {
    padding: 0;
    border: 0;
    background: none;
    margin-bottom: 20px;
}

/* Inline + bare together (e.g. above a card-grid results list): the fields
   and the Apply/Reset actions previously ran together with no visual
   hierarchy. Push actions to the right so the bar reads as "controls on the
   left, action on the right", and separate the "Filtered by" summary line
   with its own top border so it reads as a result of the controls above it,
   not more of the same row. */
.soves-ui-filter-bar--inline.soves-ui-filter-bar--bare {
    gap: 12px 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--soves-dashboard-border);
}

.soves-ui-filter-bar--inline.soves-ui-filter-bar--bare .soves-ui-field {
    flex-basis: 190px;
}

.soves-ui-filter-bar--inline.soves-ui-filter-bar--bare .soves-ui-filter-bar__actions {
    margin-left: auto;
    align-self: flex-end;
}

.soves-ui-filter-bar--inline.soves-ui-filter-bar--bare .soves-ui-filter-bar__active {
    flex-basis: 100%;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px dashed var(--soves-dashboard-border);
}

/* Collapsible advanced filters, so a wide filter set does not dominate the
 * page when most people only use one or two of them. */
.soves-ui-filter-more {
    grid-column: 1 / -1;
}

.soves-ui-filter-more > summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    color: var(--soves-brand-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.soves-ui-filter-more > summary::-webkit-details-marker {
    display: none;
}

.soves-ui-filter-more > summary::after {
    content: "\25BE";
    transition: transform .15s ease;
}

.soves-ui-filter-more[open] > summary::after {
    transform: rotate(180deg);
}

.soves-ui-filter-more__fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-filter-more > summary::after {
        transition: none;
    }
}

/* A removable filter chip, so an applied filter can be cleared one at a time
 * instead of only all at once. */
.soves-ui-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 3px;
    border-radius: 999px;
    background: var(--soves-table-badge-upcoming-bg);
    color: var(--soves-table-badge-upcoming-text);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.soves-ui-filter-chip:hover {
    background: var(--soves-brand-primary-soft);
}

.soves-ui-filter-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: rgba(15, 23, 42, .1);
    line-height: 1;
}

.soves-ui-filter-chip__remove .soves-lucide-icon {
    width: 11px;
    height: 11px;
}

/* ============================================================ TIER 2 =====
 * Tabs, timeline, tags, avatars, progress, summary strips, activity lists,
 * copyable references, toggles, search boxes, bulk bars, dropdown menus.
 * ======================================================================== */

/* ------------------------------------------------------------------- tabs */

.soves-ui-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: 1px solid var(--soves-dashboard-border);
}

.soves-ui-tabs__tab {
    padding: 10px 14px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--soves-dashboard-muted);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.soves-ui-tabs__tab:hover {
    color: var(--soves-dashboard-text);
}

.soves-ui-tabs__tab[aria-selected="true"] {
    border-bottom-color: var(--soves-brand-primary);
    color: var(--soves-brand-primary);
}

.soves-ui-tabs__tab:focus-visible {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: -2px;
}

.soves-ui-tabs__count {
    margin-left: 6px;
    font-variant-numeric: tabular-nums;
    opacity: .7;
}

.soves-ui-tab-panel {
    padding-top: 16px;
}

.soves-ui-tab-panel[hidden] {
    display: none;
}

/* --------------------------------------------------------------- timeline */

.soves-ui-timeline {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.soves-ui-timeline__step {
    position: relative;
    padding: 0 0 18px 26px;
}

.soves-ui-timeline__step:last-child {
    padding-bottom: 0;
}

/* The dot marks the step; the line joins it to the one after. */
.soves-ui-timeline__step::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 0;
    width: 11px;
    height: 11px;
    box-sizing: border-box;
    border: 2px solid var(--soves-dashboard-border-strong);
    border-radius: 50%;
    background: #fff;
}

.soves-ui-timeline__step::after {
    content: "";
    position: absolute;
    top: 16px;
    bottom: 0;
    left: 5px;
    width: 1px;
    background: var(--soves-dashboard-border);
}

.soves-ui-timeline__step:last-child::after {
    display: none;
}

.soves-ui-timeline__step.is-done::before {
    border-color: var(--soves-table-badge-completed-text);
    background: var(--soves-table-badge-completed-text);
}

.soves-ui-timeline__step.is-current::before {
    border-color: var(--soves-brand-primary);
    box-shadow: 0 0 0 3px var(--soves-brand-primary-soft);
}

.soves-ui-timeline__step.is-failed::before {
    border-color: var(--soves-dashboard-red);
    background: var(--soves-dashboard-red);
}

.soves-ui-timeline__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.soves-ui-timeline__step.is-pending .soves-ui-timeline__label {
    color: var(--soves-dashboard-muted);
    font-weight: 500;
}

.soves-ui-timeline__meta {
    display: block;
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------- tags */

.soves-ui-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border: 1px solid var(--soves-dashboard-border-strong);
    border-radius: 6px;
    background: var(--soves-dashboard-soft);
    color: var(--soves-table-text);
    font-size: 12px;
    font-weight: 600;
}

.soves-ui-tag--accent {
    border-color: transparent;
    background: var(--soves-brand-primary-soft);
    color: var(--soves-brand-primary);
}

.soves-ui-tag__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, .1);
    color: inherit;
    cursor: pointer;
}

.soves-ui-tag__remove .soves-lucide-icon {
    width: 10px;
    height: 10px;
}

.soves-ui-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* ----------------------------------------------------------------- avatar */

.soves-ui-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 50%;
    background: var(--soves-brand-primary-soft);
    color: var(--soves-brand-primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.soves-ui-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.soves-ui-avatar--sm {
    width: 26px;
    height: 26px;
    font-size: 11px;
}

.soves-ui-avatar--lg {
    width: 46px;
    height: 46px;
    font-size: 16px;
}

.soves-ui-person {
    display: inline-flex;
    gap: 9px;
    align-items: center;
    min-width: 0;
}

.soves-ui-person__text {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.soves-ui-person__name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.soves-ui-person__meta {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------- progress */

.soves-ui-progress {
    display: grid;
    gap: 5px;
}

.soves-ui-progress__head {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    font-size: 12px;
}

.soves-ui-progress__value {
    color: var(--soves-dashboard-muted);
    font-variant-numeric: tabular-nums;
}

.soves-ui-progress__track {
    overflow: hidden;
    height: 7px;
    border-radius: 999px;
    background: var(--soves-dashboard-border);
}

.soves-ui-progress__fill {
    height: 100%;
    border-radius: 999px;
    background: var(--soves-brand-primary);
}

.soves-ui-progress.is-success .soves-ui-progress__fill {
    background: var(--soves-table-badge-completed-text);
}

.soves-ui-progress.is-warning .soves-ui-progress__fill {
    background: var(--soves-table-badge-pending-text);
}

.soves-ui-progress.is-danger .soves-ui-progress__fill {
    background: var(--soves-dashboard-red);
}

/* ---------------------------------------------------------- summary strip */

.soves-ui-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    align-items: center;
    padding: 14px 18px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: var(--soves-dashboard-soft);
}

.soves-ui-summary__item {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.soves-ui-summary__label {
    color: var(--soves-dashboard-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.soves-ui-summary__value {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

/* ---------------------------------------------------------- activity list */

.soves-ui-activity {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.soves-ui-activity__item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--soves-dashboard-border);
}

.soves-ui-activity__item:last-child {
    border-bottom: 0;
}

.soves-ui-activity__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 8px;
    background: var(--soves-dashboard-soft-2);
    color: var(--soves-dashboard-muted);
}

.soves-ui-activity__icon .soves-lucide-icon {
    width: 16px;
    height: 16px;
}

.soves-ui-activity__body {
    display: grid;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}

.soves-ui-activity__text {
    font-size: 14px;
}

.soves-ui-activity__meta {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- reference */

.soves-ui-reference {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 4px 2px 8px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 6px;
    background: var(--soves-dashboard-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
}

.soves-ui-reference__copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--soves-dashboard-muted);
    cursor: pointer;
}

.soves-ui-reference__copy:hover {
    background: var(--soves-dashboard-border);
    color: var(--soves-dashboard-text);
}

.soves-ui-reference__copy .soves-lucide-icon {
    width: 13px;
    height: 13px;
}

.soves-ui-reference__copy.is-copied {
    color: var(--soves-table-badge-completed-text);
}

/* ----------------------------------------------------------------- toggle */

.soves-ui-toggle {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    cursor: pointer;
}

.soves-ui-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.soves-ui-toggle__track {
    position: relative;
    width: 36px;
    height: 21px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--soves-dashboard-border-strong);
    transition: background-color .15s ease;
}

.soves-ui-toggle__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    transition: transform .15s ease;
}

.soves-ui-toggle input:checked + .soves-ui-toggle__track {
    background: var(--soves-brand-primary);
}

.soves-ui-toggle input:checked + .soves-ui-toggle__track::after {
    transform: translateX(15px);
}

.soves-ui-toggle input:focus-visible + .soves-ui-toggle__track {
    outline: 2px solid var(--soves-brand-accent);
    outline-offset: 2px;
}

.soves-ui-toggle input[disabled] + .soves-ui-toggle__track {
    opacity: .5;
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-toggle__track,
    .soves-ui-toggle__track::after {
        transition: none;
    }
}

/* ------------------------------------------------------------- search box */

.soves-ui-search {
    position: relative;
    display: block;
}

.soves-ui-search .soves-ui-input {
    padding-left: 36px;
    padding-right: 34px;
}

.soves-ui-search__icon {
    position: absolute;
    top: 50%;
    left: 11px;
    transform: translateY(-50%);
    color: var(--soves-dashboard-muted);
    pointer-events: none;
}

.soves-ui-search__icon .soves-lucide-icon {
    display: block;
    width: 16px;
    height: 16px;
}

.soves-ui-search__clear {
    position: absolute;
    top: 50%;
    right: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    background: var(--soves-dashboard-border);
    color: var(--soves-dashboard-text);
    cursor: pointer;
}

.soves-ui-search__clear[hidden] {
    display: none;
}

.soves-ui-search__clear .soves-lucide-icon {
    width: 11px;
    height: 11px;
}

/* ------------------------------------------------------------- date range */

.soves-ui-date-range {
    display: grid;
    gap: 10px;
}

.soves-ui-date-range__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.soves-ui-date-range__fields .soves-ui-field {
    flex: 1 1 150px;
}

.soves-ui-date-range__presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* ---------------------------------------------------------------- bulk bar */

.soves-ui-bulk-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border: 1px solid var(--soves-brand-primary);
    border-radius: 10px;
    background: var(--soves-brand-primary-soft);
}

.soves-ui-bulk-bar[hidden] {
    display: none;
}

.soves-ui-bulk-bar__count {
    color: var(--soves-brand-primary);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.soves-ui-bulk-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* --------------------------------------------------------------- dropdown */

.soves-ui-dropdown {
    position: relative;
    display: inline-flex;
}

.soves-ui-dropdown__menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    min-width: 190px;
    padding: 0;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--soves-dashboard-shadow);
}

.soves-ui-dropdown__menu[hidden] {
    display: none;
}

.soves-ui-dropdown__item {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--soves-dashboard-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.soves-ui-dropdown__item:hover,
.soves-ui-dropdown__item:focus-visible {
    background: var(--soves-dashboard-soft-2);
}

.soves-ui-dropdown__item .soves-lucide-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}

.soves-ui-dropdown__item--danger {
    color: var(--soves-dashboard-red);
}

.soves-ui-dropdown__separator {
    height: 1px;
    margin: 5px 4px;
    background: var(--soves-dashboard-border);
}

/* ------------------------------------------------------------ code viewer */

.soves-ui-code {
    overflow: auto;
    max-height: 380px;
    padding: 12px 14px;
    border-radius: 8px;
    margin: 0;
    background: var(--soves-dashboard-text);
    color: #e6edf6;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre;
    tab-size: 2;
}

/* ----------------------------------------------------------- notes thread */

.soves-ui-note {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 10px;
    background: var(--soves-dashboard-soft);
}

.soves-ui-note__head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
}

.soves-ui-note__time {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.soves-ui-note__body {
    font-size: 14px;
}

/* ============================================================ TIER 3 =====
 * Charts, skeleton loaders, toasts, tooltips, help popovers, inline row
 * edit, file upload, breadcrumbs, split layout.
 * ======================================================================== */

/* ------------------------------------------------------------------ chart */

.soves-ui-chart {
    display: grid;
    gap: 14px;
}

.soves-ui-chart__canvas {
    position: relative;
    width: 100%;
    height: 220px;
}

.soves-ui-chart__canvas canvas {
    width: 100% !important;
    height: 100% !important;
}

.soves-ui-chart__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 220px;
    border: 1px dashed var(--soves-dashboard-border-strong);
    border-radius: 10px;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

.soves-ui-chart__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.soves-ui-chart__legend li {
    display: flex;
    gap: 7px;
    align-items: center;
    font-size: 12px;
}

.soves-ui-chart__legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 3px;
    background: var(--soves-chart-color);
}

.soves-ui-chart__legend span {
    color: var(--soves-dashboard-muted);
}

.soves-ui-chart__legend strong {
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- skeleton */

.soves-ui-skeleton {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    background: var(--soves-dashboard-border);
}

.soves-ui-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
    animation: soves-ui-shimmer 1.6s ease-in-out infinite;
}

@keyframes soves-ui-shimmer {
    100% {
        transform: translateX(100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-skeleton::after {
        animation: none;
    }
}

.soves-ui-skeleton--text {
    height: 13px;
    margin: 4px 0;
}

.soves-ui-skeleton--title {
    height: 18px;
    width: 55%;
    margin: 4px 0 8px;
}

.soves-ui-skeleton--avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
}

.soves-ui-skeleton--button {
    width: 96px;
    height: 36px;
    border-radius: 8px;
}

.soves-ui-skeleton-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.soves-ui-skeleton-block {
    display: grid;
    gap: 6px;
}

/* ------------------------------------------------------------------ toast */

.soves-ui-toast-region {
    position: fixed;
    z-index: 200;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(340px, calc(100vw - 40px));
    pointer-events: none;
}

.soves-ui-toast {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    border: 1px solid var(--soves-dashboard-border);
    border-left-width: 4px;
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--soves-dashboard-shadow);
    pointer-events: auto;
    animation: soves-ui-toast-in .18s ease;
}

.soves-ui-toast--success {
    border-left-color: var(--soves-table-badge-completed-text);
}

.soves-ui-toast--warning {
    border-left-color: var(--soves-table-badge-pending-text);
}

.soves-ui-toast--error {
    border-left-color: var(--soves-table-badge-cancelled-text);
}

.soves-ui-toast--info {
    border-left-color: var(--soves-dashboard-blue);
}

.soves-ui-toast__body {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
}

.soves-ui-toast__title {
    display: block;
    margin-bottom: 2px;
    font-weight: 700;
}

.soves-ui-toast__close {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--soves-dashboard-muted);
    cursor: pointer;
}

.soves-ui-toast__close:hover {
    background: var(--soves-dashboard-soft-2);
}

.soves-ui-toast.is-leaving {
    animation: soves-ui-toast-out .15s ease forwards;
}

@keyframes soves-ui-toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

@keyframes soves-ui-toast-out {
    to {
        opacity: 0;
        transform: translateY(4px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .soves-ui-toast,
    .soves-ui-toast.is-leaving {
        animation: none;
    }
}

/* --------------------------------------------------------------- tooltip */

/* CSS-only, so nothing needs JavaScript to explain itself. Works on any
 * element carrying data-soves-tooltip; keyboard focus triggers it too. */
[data-soves-tooltip] {
    position: relative;
}

[data-soves-tooltip]::after {
    content: attr(data-soves-tooltip);
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    z-index: 40;
    width: max-content;
    max-width: 220px;
    padding: 5px 9px;
    transform: translateX(-50%) translateY(2px);
    border-radius: 6px;
    background: var(--soves-dashboard-text);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .1s ease, transform .1s ease;
}

[data-soves-tooltip]:hover::after,
[data-soves-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

[data-soves-tooltip-position="bottom"]::after {
    top: calc(100% + 7px);
    bottom: auto;
    transform: translateX(-50%) translateY(-2px);
}

[data-soves-tooltip-position="bottom"]:hover::after,
[data-soves-tooltip-position="bottom"]:focus-visible::after {
    transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    [data-soves-tooltip]::after {
        transition: none;
    }
}

/* ------------------------------------------------------------ popover */

/* Built on the same open/close/outside-click behaviour as the dropdown menu
 * (data-soves-dropdown) — only the content inside differs, so no new
 * JavaScript is needed. */
.soves-ui-popover {
    width: min(280px, calc(100vw - 40px));
    padding: 14px;
}

.soves-ui-popover__title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 700;
}

.soves-ui-popover__body {
    margin: 0;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
    line-height: 1.5;
}

.soves-ui-help-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid var(--soves-dashboard-border-strong);
    border-radius: 50%;
    background: none;
    color: var(--soves-dashboard-muted);
    cursor: pointer;
}

.soves-ui-help-trigger .soves-lucide-icon {
    width: 11px;
    height: 11px;
}

.soves-ui-help-trigger:hover {
    border-color: var(--soves-brand-primary);
    color: var(--soves-brand-primary);
}

/* --------------------------------------------------------- inline edit */

.soves-ui-inline-edit {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    max-width: 100%;
}

.soves-ui-inline-edit__display {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.soves-ui-inline-edit__value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.soves-ui-inline-edit__form {
    display: none;
    gap: 6px;
    align-items: center;
}

.soves-ui-inline-edit.is-editing .soves-ui-inline-edit__display {
    display: none;
}

.soves-ui-inline-edit.is-editing .soves-ui-inline-edit__form {
    display: inline-flex;
}

.soves-ui-inline-edit__form .soves-ui-input {
    height: 32px;
    min-width: 140px;
    padding: 0 8px;
    font-size: 13px;
}

.soves-ui-inline-edit-trigger {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--soves-dashboard-muted);
    cursor: pointer;
}

.soves-ui-inline-edit-trigger:hover {
    background: var(--soves-dashboard-soft-2);
    color: var(--soves-dashboard-text);
}

.soves-ui-inline-edit-trigger .soves-lucide-icon {
    width: 13px;
    height: 13px;
}

/* ------------------------------------------------------------- file upload */

.soves-ui-upload {
    display: grid;
    gap: 10px;
    padding: 22px;
    border: 2px dashed var(--soves-dashboard-border-strong);
    border-radius: 12px;
    background: var(--soves-dashboard-soft);
    text-align: center;
    cursor: pointer;
}

.soves-ui-upload:hover,
.soves-ui-upload.is-dragover {
    border-color: var(--soves-brand-primary);
    background: var(--soves-brand-primary-soft);
}

.soves-ui-upload input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.soves-ui-upload__icon {
    display: flex;
    justify-content: center;
    color: var(--soves-dashboard-muted);
}

.soves-ui-upload__icon .soves-lucide-icon {
    width: 26px;
    height: 26px;
}

.soves-ui-upload__label {
    font-size: 14px;
    font-weight: 600;
}

.soves-ui-upload__hint {
    color: var(--soves-dashboard-muted);
    font-size: 12px;
}

.soves-ui-upload-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.soves-ui-upload-list__item {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
}

.soves-ui-upload-list__name {
    overflow: hidden;
    flex: 1 1 auto;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.soves-ui-upload-list__size {
    flex: 0 0 auto;
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.soves-ui-upload-list__remove {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--soves-dashboard-soft-2);
    color: var(--soves-dashboard-muted);
    cursor: pointer;
}

.soves-ui-upload-list__remove .soves-lucide-icon {
    width: 11px;
    height: 11px;
}

/* --------------------------------------------------------------- breadcrumbs */

.soves-ui-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin: 0 0 4px;
    padding: 0;
    list-style: none;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

.soves-ui-breadcrumbs li {
    display: flex;
    gap: 6px;
    align-items: center;
}

.soves-ui-breadcrumbs li:not(:last-child)::after {
    content: "/";
    color: var(--soves-dashboard-border-strong);
}

.soves-ui-breadcrumbs a {
    color: var(--soves-dashboard-muted);
    text-decoration: none;
}

.soves-ui-breadcrumbs a:hover {
    color: var(--soves-brand-primary);
    text-decoration: underline;
}

.soves-ui-breadcrumbs [aria-current="page"] {
    color: var(--soves-dashboard-text);
    font-weight: 600;
}

/* ------------------------------------------------------------- split layout */

.soves-ui-split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
    gap: 20px;
    align-items: start;
}

.soves-ui-split--even {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

@media (max-width: 780px) {
    .soves-ui-split,
    .soves-ui-split--even {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------------------ stepper */

.soves-ui-stepper {
    display: flex;
    gap: 0;
    margin: 0 0 6px;
    padding: 0;
    list-style: none;
}

.soves-ui-stepper li {
    display: flex;
    flex: 1 1 auto;
    gap: 8px;
    align-items: center;
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    font-weight: 700;
}

.soves-ui-stepper li:not(:last-child)::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    margin: 0 6px;
    background: var(--soves-dashboard-border);
}

.soves-ui-stepper__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    border: 1px solid var(--soves-dashboard-border-strong);
    border-radius: 50%;
    background: #fff;
}

.soves-ui-stepper li.is-done .soves-ui-stepper__num {
    border-color: var(--soves-table-badge-completed-text);
    background: var(--soves-table-badge-completed-text);
    color: #fff;
}

.soves-ui-stepper li.is-current {
    color: var(--soves-dashboard-text);
}

.soves-ui-stepper li.is-current .soves-ui-stepper__num {
    border-color: var(--soves-brand-primary);
    color: var(--soves-brand-primary);
}
/* ------------------------------------------------------------------ cards */

.soves-ui-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.soves-ui-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: var(--soves-dashboard-card-radius);
    background: #fff;
    box-shadow: var(--soves-dashboard-card-shadow);
}

.soves-ui-card__media {
    height: 148px;
    overflow: hidden;
    background: var(--soves-dashboard-soft-2);
}

.soves-ui-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.soves-ui-card__media-button {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.soves-ui-card__media-button:focus-visible {
    outline: 3px solid var(--soves-brand-primary);
    outline-offset: -3px;
}

/* Logo/badge media (e.g. an airline logo) must never be cropped/stretched
   the way a full-bleed photo is — shrink the box and letterbox the image
   on a neutral panel instead of covering it. */
.soves-ui-card__media--contain {
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid var(--soves-dashboard-border);
}

.soves-ui-card__media--contain img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.soves-ui-card__media--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--soves-dashboard-muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.soves-ui-card__body {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
}

.soves-ui-card__eyebrow {
    color: var(--soves-dashboard-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.soves-ui-card__title {
    margin: 0;
    color: var(--soves-dashboard-text);
    font-size: 16px;
    line-height: 1.3;
}

.soves-ui-card__subtitle {
    margin: -4px 0 0;
    color: var(--soves-dashboard-muted);
    font-size: 13px;
}

.soves-ui-card__rating {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--soves-brand-primary);
    font-size: 12px;
    font-weight: 700;
}

.soves-ui-card__rating .soves-lucide-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.soves-ui-card__rating span {
    margin-left: 4px;
    color: var(--soves-dashboard-muted);
    font-size: 11px;
    font-weight: 600;
}

.soves-ui-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.soves-ui-card__meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin: 2px 0 0;
}

.soves-ui-card__meta div {
    min-width: 0;
}

.soves-ui-card__meta dt {
    color: var(--soves-dashboard-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.soves-ui-card__meta dd {
    margin: 2px 0 0;
    overflow: hidden;
    color: var(--soves-dashboard-text);
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.soves-ui-card__price {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--soves-dashboard-border);
}

.soves-ui-card__price span {
    color: var(--soves-dashboard-muted);
    font-size: 11px;
}

.soves-ui-card__price strong {
    color: var(--soves-brand-primary);
    font-size: 18px;
}

.soves-ui-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
}

.soves-ui-card__selection {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    color: var(--soves-dashboard-text);
    font-size: 13px;
    font-weight: 700;
}

.soves-ui-card__selection input {
    width: 17px;
    height: 17px;
    accent-color: var(--soves-brand-primary);
}

/* Shared image preview used by staff cards and detail galleries. */
.soves-ui-lightbox[hidden] {
    display: none;
}

.soves-ui-lightbox {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 32px;
}

.soves-ui-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 18, 38, .82);
}

.soves-ui-lightbox__dialog {
    position: relative;
    z-index: 1;
    display: grid;
    max-width: min(1100px, 92vw);
    max-height: 92vh;
    place-items: center;
}

.soves-ui-lightbox__image {
    display: block;
    max-width: 86vw;
    max-height: 82vh;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .32);
    object-fit: contain;
}

.soves-ui-lightbox__close,
.soves-ui-lightbox__nav {
    position: absolute;
    z-index: 2;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .35);
    border-radius: 50%;
    background: rgba(8, 18, 38, .72);
    color: #fff;
    cursor: pointer;
}

.soves-ui-lightbox__close:hover,
.soves-ui-lightbox__nav:hover {
    background: var(--soves-brand-primary);
}

.soves-ui-lightbox__close {
    top: -18px;
    right: -18px;
}

.soves-ui-lightbox__nav--prev {
    top: 50%;
    left: -58px;
    transform: translateY(-50%);
}

.soves-ui-lightbox__nav--next {
    top: 50%;
    right: -58px;
    transform: translateY(-50%);
}

.soves-ui-lightbox__counter {
    position: absolute;
    right: 0;
    bottom: -28px;
    left: 0;
    color: #fff;
    font-size: 12px;
    text-align: center;
}

body.soves-ui-lightbox-open {
    overflow: hidden;
}

@media (max-width: 700px) {
    .soves-ui-lightbox {
        padding: 20px;
    }

    .soves-ui-lightbox__nav--prev {
        left: 8px;
    }

    .soves-ui-lightbox__nav--next {
        right: 8px;
    }
}

/* Listing Translation tab: original on the left, translation on the right; every part is a collapsible block. */
.soves-ui-translation-tab__heads {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px 24px;
    align-items: start;
    margin-bottom: 4px;
}

/* One column head: a small caption, then its language picker under it, both aligned with the part columns below. */
.soves-ui-translation-tab__head {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 12px 14px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 10px;
    background: var(--soves-dashboard-soft);
}

.soves-ui-translation-tab__eyebrow,
.soves-ui-translation-piece__label,
.soves-ui-translation-part__cols span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--soves-dashboard-muted);
}

.soves-ui-translation-tab__picker {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--soves-dashboard-muted);
}

.soves-ui-translation-tab__picker span {
    flex: 0 0 auto;
    white-space: nowrap;
}

.soves-ui-translation-tab__picker select {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.soves-ui-translation-tab__toolbar {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    margin: 0 0 8px;
    padding-top: 8px;
}

.soves-ui-translation-tab__link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--soves-brand-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.soves-ui-translation-tab__parts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.soves-ui-translation-part {
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 10px;
    background: #fff;
}

.soves-ui-translation-part[open] {
    border-color: var(--soves-dashboard-border-strong, var(--soves-dashboard-border));
}

.soves-ui-translation-part__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    list-style: none;
}

.soves-ui-translation-part__summary::-webkit-details-marker {
    display: none;
}

.soves-ui-translation-part__summary::before {
    content: "\25B8";
    margin-right: 10px;
    color: var(--soves-dashboard-muted);
    transition: transform .15s ease;
}

.soves-ui-translation-part[open] > .soves-ui-translation-part__summary::before {
    transform: rotate(90deg);
}

.soves-ui-translation-part__title {
    flex: 1;
    font-weight: 700;
    color: var(--soves-dashboard-text);
}

.soves-ui-translation-part__status {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--soves-dashboard-soft);
    color: var(--soves-dashboard-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.soves-ui-translation-part__status.is-complete {
    background: var(--soves-table-badge-completed-bg, #e3f6ea);
    color: var(--soves-table-badge-completed-text, #17673a);
}

.soves-ui-translation-part__status.is-partial {
    background: var(--soves-table-badge-pending-bg, #fff3d6);
    color: var(--soves-table-badge-pending-text, #7a5200);
}

.soves-ui-translation-part__body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--soves-dashboard-border);
}

.soves-ui-translation-part__cols {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 10px 0 6px;
}

.soves-ui-translation-part__cols span:first-child {
    grid-column: 2;
}

.soves-ui-translation-part__cols--plain {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.soves-ui-translation-part__cols--plain span:first-child {
    grid-column: auto;
}

.soves-ui-translation-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--soves-dashboard-border);
}

.soves-ui-translation-item:last-of-type {
    border-bottom: 0;
}

.soves-ui-translation-piece {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    padding: 3px 0;
}

.soves-ui-translation-piece__label {
    padding-top: 9px;
}

.soves-ui-translation-piece__original {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 6px;
    background: var(--soves-dashboard-soft);
    color: var(--soves-dashboard-text);
    font-size: 14px;
    line-height: 1.5;
}

.soves-ui-translation-piece__text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.soves-ui-translation-piece__original em {
    color: var(--soves-dashboard-muted);
}

.soves-ui-translation-item__icon {
    padding: 0 8px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 999px;
    background: #fff;
    font-size: 11px;
    color: var(--soves-dashboard-muted);
}

.soves-ui-translation-piece input,
.soves-ui-translation-piece textarea,
.soves-ui-translation-piece__editor input,
.soves-ui-translation-piece__editor textarea {
    width: 100%;
    box-sizing: border-box;
}

/* A plain part has no label column: the original and the editor share the two columns. */
.soves-ui-translation-piece--plain {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding-top: 0;
}

.soves-ui-translation-piece__editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.soves-ui-translation-part__note {
    margin: 0;
    font-size: 13px;
    color: var(--soves-dashboard-muted);
}

.soves-ui-translation-part__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.soves-ui-translation-part--structured .soves-ui-translation-part__note {
    margin-top: 8px;
}

@media (max-width: 782px) {
    .soves-ui-translation-tab__heads,
    .soves-ui-translation-piece,
    .soves-ui-translation-piece--plain {
        grid-template-columns: minmax(0, 1fr);
    }

    .soves-ui-translation-part__cols {
        display: none;
    }

    .soves-ui-translation-piece__label {
        padding-top: 0;
    }
}

.soves-ui-translation-piece input[type="text"],
.soves-ui-translation-piece textarea,
.soves-ui-translation-piece__editor input[type="text"],
.soves-ui-translation-piece__editor textarea {
    padding: 8px 10px;
    border: 1px solid var(--soves-dashboard-border-strong, #cfd6de);
    border-radius: 6px;
    background: #fff;
    color: var(--soves-dashboard-text);
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
}

.soves-ui-translation-piece textarea,
.soves-ui-translation-piece__editor textarea {
    resize: vertical;
}

.soves-ui-translation-piece input[type="text"]:focus,
.soves-ui-translation-piece textarea:focus,
.soves-ui-translation-piece__editor input[type="text"]:focus,
.soves-ui-translation-piece__editor textarea:focus {
    border-color: var(--soves-brand-primary);
    outline: 2px solid var(--soves-brand-primary-soft, rgba(0, 0, 0, .08));
    outline-offset: 0;
}

.soves-ui-translation-tab__picker select {
    padding: 7px 10px;
    border: 1px solid var(--soves-dashboard-border-strong, #cfd6de);
    border-radius: 6px;
    background: #fff;
    color: var(--soves-dashboard-text);
    font: inherit;
    font-size: 14px;
}

.soves-ui-translation-tab__picker select:focus {
    border-color: var(--soves-brand-primary);
    outline: 2px solid var(--soves-brand-primary-soft, rgba(0, 0, 0, .08));
    outline-offset: 0;
}

/* Translation tab: sync note and page check. */
.soves-ui-translation-tab__sync {
    margin-top: 6px !important;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--soves-dashboard-soft);
    color: var(--soves-dashboard-text) !important;
    font-weight: 400 !important;
}

.soves-ui-translation-check {
    margin: 0 0 20px;
    padding: 14px 16px;
    border: 1px solid var(--soves-dashboard-border);
    border-radius: 10px;
}

.soves-ui-translation-check__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.soves-ui-translation-check__head p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--soves-dashboard-muted);
}

.soves-ui-translation-check__list {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.soves-ui-translation-check__list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--soves-dashboard-soft);
    font-size: 14px;
}

.soves-ui-translation-check__part {
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    color: var(--soves-dashboard-muted);
}

.soves-ui-translation-check__part.is-uncovered {
    color: #b3261e;
}


/* Dynamic packages reuse the booking components within their dashboard card. */
.soves-dynamic-package-dashboard .dp-dashboard-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 20px;
}
.soves-dynamic-package-dashboard .dp-dashboard-body > * {
    min-width: 0;
    max-width: 100%;
}
.soves-dynamic-package-dashboard .soves-table td > span {
    display: block;
}
