/*
  Kartiva design system (ADR-0027): design tokens, the default Kartiva theme, browser surfaces and component styles.
  Components never use raw values: every color, size and duration is a token, so a tenant's theme (ADR-0020) recolors
  everything by replacing the brand layer. Direction: live lists are departure boards; a value that changes flips in
  its cell (FlapText) without moving its row.

  Layers:
    1. Brand (the tenant replaces it): --kv-brand, --kv-accent, --kv-online and their contrast-checked inks.
    2. Semantic: surfaces, text, borders, states. Light and dark with light-dark(); <html data-theme> forces one.
    3. Component: sizes and shapes read from the two above.
*/

@font-face {
    font-family: "Manrope";
    src: url("fonts/manrope-latin-wght.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Barlow Condensed";
    src: url("fonts/barlow-condensed-latin-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Barlow Condensed";
    src: url("fonts/barlow-condensed-latin-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light dark;

    /* 1. Brand: Kartiva's own (Branding/kartiva). TenantTheme replaces these with the tenant's, already checked. */
    --kv-brand: #14213d;
    --kv-brand-ink: light-dark(#14213d, #c9d4ea);
    --kv-accent: #fca311;
    --kv-accent-ink: light-dark(#8a5300, #fca311);
    --kv-on-accent: #14213d;
    --kv-online: #2ee6a6;
    --kv-online-ink: light-dark(#0b7a55, #2ee6a6);
    --kv-on-brand: #f5f1e8;
    --kv-brand-fill: light-dark(#14213d, #426bc1);
    --kv-on-brand-fill: #f5f1e8;
    --kv-on-brand-muted: #a9b3c7;

    /* 2. Semantic */
    --kv-bg: light-dark(#f6f5f1, #0b1220);
    --kv-surface: light-dark(#ffffff, #111a2e);
    --kv-surface-2: light-dark(#efede7, #18233a);
    --kv-surface-3: light-dark(#e4e1d8, #22304c);
    --kv-text: light-dark(#14213d, #f5f1e8);
    --kv-text-muted: light-dark(#4f5869, #a3aec3);
    --kv-border: light-dark(#dedbd2, #1f2b45);
    --kv-border-strong: light-dark(#c4c0b4, #33415f);
    --kv-danger: light-dark(#b42318, #f28b82);
    --kv-danger-soft: light-dark(#fbe9e7, #3a1d1f);
    --kv-danger-fill: #b42318;
    --kv-on-danger-fill: #ffffff;
    /* What hovers on filled controls mix toward: a lighter step of their own fill. */
    --kv-lighten: #ffffff;
    --kv-warning: var(--kv-accent-ink);
    --kv-warning-soft: color-mix(in oklab, var(--kv-accent) 18%, var(--kv-surface));
    --kv-success: var(--kv-online-ink);
    --kv-success-soft: color-mix(in oklab, var(--kv-online) 16%, var(--kv-surface));
    --kv-focus: light-dark(#14213d, #fca311);
    --kv-scrim: rgb(11 18 32 / 0.55);

    /*
      The analog board (ADR-0027): electromechanical tiles with a hinge across the middle, two greys and an ivory ink,
      the same in both schemes. Late and online inks come from TenantTheme, already checked against the tiles.
    */
    --kv-tile-top: #2b2d31;
    --kv-tile-bottom: #24262a;
    --kv-tile-hinge: #0b0c0e;
    --kv-tile-ink: #ece6d6;
    --kv-tile-dim: #8d8a82;
    --kv-tile-late: #fca311;
    --kv-tile-online: #2ee6a6;
    --kv-tile-danger: #ff6b5e;
    --kv-panel-line: #2a3654;
    --kv-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --kv-row-changed: light-dark(color-mix(in oklab, var(--kv-accent) 26%, var(--kv-surface)), color-mix(in oklab, var(--kv-accent) 40%, var(--kv-surface)));
    --kv-row-late: var(--kv-accent-ink);
    --kv-row-cancelled: light-dark(#8a8f99, #6b7488);

    /* Typography: Manrope for reading, Barlow Condensed for figures and states on the board. Every stack, here and in
       each skin, ends with the system's color emoji fonts, so an emoji a customer writes never shows as a box or in
       black and white when the skin's letter has none. */
    --kv-font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol";
    --kv-font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, var(--kv-font-emoji);
    --kv-font-board: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif, var(--kv-font-emoji);
    --kv-text-xs: 0.75rem;
    --kv-text-sm: 0.875rem;
    --kv-text-base: 1rem;
    --kv-text-lg: 1.125rem;
    --kv-text-xl: 1.375rem;
    --kv-text-2xl: clamp(1.5rem, 1.25rem + 1vw, 1.875rem);
    --kv-text-board: 1.25rem;
    --kv-weight-regular: 450;
    --kv-weight-medium: 600;
    --kv-weight-bold: 750;
    --kv-weight-heavy: 800;
    --kv-tracking-tight: -0.02em;
    --kv-leading: 1.55;

    /* Space (4 px steps), shape, layout */
    --kv-space-1: 0.25rem;
    --kv-space-2: 0.5rem;
    --kv-space-3: 0.75rem;
    --kv-space-4: 1rem;
    --kv-space-5: 1.25rem;
    --kv-space-6: 1.5rem;
    --kv-space-8: 2rem;
    --kv-space-10: 2.5rem;
    --kv-radius-sm: 0.375rem;
    --kv-radius-md: 0.625rem;
    --kv-radius-lg: 0.875rem;
    --kv-radius-pill: 999px;
    --kv-radius-cell: 3px;
    --kv-target: 2.75rem;
    --kv-rail: 5.5rem;
    --kv-bottom-nav: 4rem;
    /* The content uses the width it has; only very wide monitors leave margins beside it. */
    --kv-content: 120rem;

    /* Depth: offset and soft blur, never a halo */
    --kv-shadow-sm: 0 1px 2px light-dark(rgb(20 33 61 / 0.08), rgb(0 0 0 / 0.45));
    --kv-shadow-md: 0 2px 4px light-dark(rgb(20 33 61 / 0.06), rgb(0 0 0 / 0.4)),
        0 12px 28px light-dark(rgb(20 33 61 / 0.12), rgb(0 0 0 / 0.5));

    /* Motion: the flap is the one authored moment; everything else is quick and quiet. */
    --kv-duration-fast: 120ms;
    --kv-duration-base: 200ms;
    --kv-duration-flap: 260ms;
    --kv-flap-stagger: 35ms;
    --kv-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme="dark"] {
    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
    :root {
        --kv-duration-fast: 0ms;
        --kv-duration-base: 0ms;
        --kv-duration-flap: 0ms;
        --kv-flap-stagger: 0ms;
    }
}

/* Base and browser surfaces: the parts the browser draws carry the theme too. */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scrollbar-color: var(--kv-border-strong) transparent;
    accent-color: var(--kv-brand);
}

body {
    margin: 0;
    min-height: 100dvh;
    background: var(--kv-bg);
    color: var(--kv-text);
    font-family: var(--kv-font-sans);
    font-size: var(--kv-text-base);
    font-weight: var(--kv-weight-regular);
    line-height: var(--kv-leading);
    caret-color: var(--kv-accent-ink);
}

::selection {
    background: color-mix(in oklab, var(--kv-accent) 45%, transparent);
    color: var(--kv-text);
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.2;
    letter-spacing: var(--kv-tracking-tight);
    text-wrap: balance;
}

h1 {
    font-size: var(--kv-text-2xl);
    font-weight: var(--kv-weight-heavy);
}

h2 {
    font-size: var(--kv-text-xl);
    font-weight: var(--kv-weight-bold);
}

h3 {
    font-size: var(--kv-text-lg);
    font-weight: var(--kv-weight-bold);
}

p {
    margin: 0;
    text-wrap: pretty;
}

a {
    color: var(--kv-brand-ink);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 2px;
    border-radius: var(--kv-radius-sm);
}

table {
    font-variant-numeric: tabular-nums;
}

.kv-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.kv-muted {
    color: var(--kv-text-muted);
}

.kv-stack {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-6);
}

/* Icon */
.kv-icon {
    flex: none;
    stroke: currentColor;
}

/* Button */
.kv-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--kv-space-2);
    min-height: var(--kv-target);
    padding: var(--kv-space-2) var(--kv-space-4);
    border: 1px solid var(--kv-border-strong);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    color: var(--kv-text);
    font: inherit;
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-bold);
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--kv-duration-fast) var(--kv-ease-out),
        border-color var(--kv-duration-fast) var(--kv-ease-out), transform var(--kv-duration-fast) var(--kv-ease-out);
}

.kv-button:hover {
    border-color: var(--kv-text-muted);
}

.kv-button:active {
    transform: translateY(1px);
}

.kv-button--primary {
    background: var(--kv-brand-fill);
    border-color: var(--kv-brand-fill);
    color: var(--kv-on-brand-fill);
}

.kv-button--primary:hover {
    background: color-mix(in oklab, var(--kv-brand-fill) 86%, var(--kv-lighten));
    border-color: color-mix(in oklab, var(--kv-brand-fill) 86%, var(--kv-lighten));
}

.kv-button--accent {
    background: var(--kv-accent);
    border-color: var(--kv-accent);
    color: var(--kv-on-accent);
}

.kv-button--ghost {
    background: transparent;
    border-color: transparent;
}

.kv-button--ghost:hover {
    background: var(--kv-surface-2);
    border-color: transparent;
}

.kv-button--danger {
    color: var(--kv-danger);
}

.kv-button--sm {
    min-height: 2.25rem;
    padding: 0 var(--kv-space-3);
}

.kv-button--icon {
    width: var(--kv-target);
    padding: 0;
}

.kv-button:disabled,
.kv-button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.kv-button__spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: kv-spin 700ms linear infinite;
}

@keyframes kv-spin {
    to {
        transform: rotate(1turn);
    }
}

/* Badge: a state in words, tinted from its own hue */
.kv-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-1);
    padding: 0.125rem 0.625rem;
    border-radius: var(--kv-radius-pill);
    background: var(--kv-surface-2);
    color: var(--kv-text);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    white-space: nowrap;
}

.kv-badge--accent {
    background: var(--kv-warning-soft);
    color: var(--kv-accent-ink);
}

.kv-badge--success {
    background: var(--kv-success-soft);
    color: var(--kv-online-ink);
}

.kv-badge--danger {
    background: var(--kv-danger-soft);
    color: var(--kv-danger);
}

.kv-badge--brand {
    background: var(--kv-brand);
    color: var(--kv-on-brand);
}

.kv-badge__dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
}

/* Avatar */
.kv-avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--kv-surface-3);
    color: var(--kv-text);
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-bold);
    position: relative;
}

.kv-avatar--sm {
    width: 2rem;
    height: 2rem;
    font-size: var(--kv-text-xs);
}

.kv-avatar--online::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: var(--kv-online);
    border: 2px solid var(--kv-surface);
}

/* Fields */
.kv-field {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    min-width: 0;
}

.kv-field__label {
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-bold);
}

.kv-field__hint {
    font-size: var(--kv-text-sm);
    color: var(--kv-text-muted);
}

.kv-field__error {
    font-size: var(--kv-text-sm);
    color: var(--kv-danger);
    font-weight: var(--kv-weight-medium);
}

.kv-input {
    width: 100%;
    min-height: var(--kv-target);
    padding: 0 var(--kv-space-3);
    border: 1px solid var(--kv-border-strong);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    color: var(--kv-text);
    font: inherit;
    font-size: var(--kv-text-base);
    transition: border-color var(--kv-duration-fast) var(--kv-ease-out);
}

.kv-input::placeholder {
    color: var(--kv-text-muted);
}

.kv-input:hover {
    border-color: var(--kv-text-muted);
}

.kv-input:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 0;
    border-color: var(--kv-focus);
}

.kv-input[aria-invalid="true"] {
    border-color: var(--kv-danger);
}

select.kv-input {
    appearance: none;
    padding-right: var(--kv-space-8);
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(-45deg, transparent 50%, currentColor 50%);
    background-position: right 1.1rem center, right 0.8rem center;
    background-size: 0.3rem 0.3rem;
    background-repeat: no-repeat;
}

.kv-check {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-2);
    min-height: var(--kv-target);
    font-size: var(--kv-text-base);
    cursor: pointer;
}

.kv-check input {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
}

/* Switch: a checkbox that looks like a switch and stays one for assistive tech */
.kv-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-3);
    min-height: var(--kv-target);
    cursor: pointer;
}

.kv-switch input {
    appearance: none;
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    margin: 0;
    border-radius: var(--kv-radius-pill);
    background: var(--kv-surface-3);
    border: 1px solid var(--kv-border-strong);
    cursor: pointer;
    transition: background-color var(--kv-duration-base) var(--kv-ease-out);
}

.kv-switch input::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    background: var(--kv-surface);
    box-shadow: var(--kv-shadow-sm);
    transition: transform var(--kv-duration-base) var(--kv-ease-out);
}

.kv-switch input:checked {
    background: var(--kv-brand-fill);
    border-color: var(--kv-brand-fill);
}

.kv-switch input:checked::after {
    transform: translateX(1.25rem);
}

/* Tabs */
.kv-tabs {
    display: flex;
    gap: var(--kv-space-1);
    border-bottom: 1px solid var(--kv-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.kv-tab {
    min-height: var(--kv-target);
    padding: 0 var(--kv-space-4);
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--kv-text-muted);
    font: inherit;
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-bold);
    white-space: nowrap;
    cursor: pointer;
}

.kv-tab[aria-selected="true"] {
    color: var(--kv-text);
    border-bottom-color: var(--kv-accent);
}

.kv-tab__count {
    margin-left: var(--kv-space-2);
    font-family: var(--kv-font-board);
    font-variant-numeric: tabular-nums;
    color: var(--kv-text-muted);
}

/* Section: a titled region separated by hairlines, never a card inside a card */
.kv-section {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-4);
    padding-top: var(--kv-space-6);
    border-top: 1px solid var(--kv-border);
}

.kv-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--kv-space-4);
}

/* A collapsible section (ADR-0045): its title opens and closes it, with the chevron of a record's sections. */
.kv-section--collapsible > summary {
    list-style: none;
    min-height: var(--kv-target);
    cursor: pointer;
}

.kv-section--collapsible > summary::-webkit-details-marker {
    display: none;
}

.kv-section--collapsible > summary:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 2px;
}

.kv-section--collapsible > summary h2 {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-section__chevron {
    flex: none;
    color: var(--kv-text-muted);
    transition: transform var(--kv-duration-fast);
}

.kv-section--collapsible[open] .kv-section__chevron {
    transform: rotate(90deg);
}

/* Panel: one bordered surface for a block of work */
.kv-panel {
    background: var(--kv-surface);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
    padding: var(--kv-space-6);
}

/* Notice: inline message with its own tone; no side stripe */
.kv-notice {
    display: flex;
    gap: var(--kv-space-3);
    align-items: flex-start;
    padding: var(--kv-space-3) var(--kv-space-4);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface-2);
    font-size: var(--kv-text-sm);
}

.kv-notice--success {
    background: var(--kv-success-soft);
}

.kv-notice--danger {
    background: var(--kv-danger-soft);
}

.kv-notice--warning {
    background: var(--kv-warning-soft);
}

/* Empty state */
.kv-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--kv-space-3);
    padding: var(--kv-space-8) var(--kv-space-6);
    border: 1px dashed var(--kv-border-strong);
    border-radius: var(--kv-radius-lg);
    color: var(--kv-text-muted);
}

.kv-empty strong {
    color: var(--kv-text);
    font-size: var(--kv-text-lg);
}

/* Skeleton */
.kv-skeleton {
    display: block;
    height: 1rem;
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface-2);
    animation: kv-pulse 1.4s ease-in-out infinite;
}

@keyframes kv-pulse {
    50% {
        opacity: 0.55;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kv-skeleton,
    .kv-button__spinner {
        animation: none;
    }
}

/*
 * The loading line (ADR-0029): across the top while the app waits for the server. The analog board's own is the
 * default: accent flaps that turn over one by one along a dark rail. Each skin draws its own in skins.css.
 */
.kv-loading {
    position: fixed;
    inset: 0 0 auto;
    z-index: 60;
    height: 6px;
    overflow: hidden;
    background: color-mix(in srgb, var(--kv-brand) 35%, transparent);
    pointer-events: none;
}

.kv-loading__bar {
    display: block;
    width: 40%;
    height: 100%;
    background: repeating-linear-gradient(90deg, var(--kv-accent) 0 14px, transparent 14px 18px);
    animation: kv-loading-slide 1.2s steps(10) infinite;
}

@keyframes kv-loading-slide {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(250%);
    }
}

/* A pattern that marches along the whole line: its tile moves by its own width. */
@keyframes kv-loading-march {
    to {
        background-position-x: var(--kv-loading-tile, 16px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .kv-loading__bar {
        width: 100%;
        opacity: 0.7;
        transform: none;
        animation: none;
    }
}

/*
 * The blocking layer (ADR-0039): while a save takes longer than a moment, half-dark over the whole page, with the
 * skin's dialog in the middle holding the skin's own loading line (the same .kv-loading, here inside the card).
 */
.kv-busy {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: grid;
    place-items: center;
    padding: var(--kv-space-4);
    background: rgb(11 18 32 / 0.5);
    /* On a dark theme a dark veil alone barely shows: what is behind also blurs. */
    backdrop-filter: blur(2px);
    cursor: progress;
    animation: kv-busy-in 160ms ease-out;
}

.kv-busy__card {
    width: min(18rem, 100%);
    align-items: center;
    text-align: center;
    padding: var(--kv-space-5) var(--kv-space-6);
}

.kv-loading.kv-loading--inline {
    --kv-loading-run: calc(min(18rem, 100vw) - 3rem - 26px);
    position: relative;
    inset: auto;
    z-index: auto;
    width: 100%;
    border-radius: 999px;
}

.kv-busy__text {
    margin: 0;
    font-weight: 600;
}

@keyframes kv-busy-in {
    from {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kv-busy {
        animation: none;
    }
}

/* Dialog: a protected task over a scrim; a sheet from the bottom on the phone */
.kv-dialog__scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: var(--kv-space-4);
    background: var(--kv-scrim);
}

.kv-dialog {
    width: min(32rem, 100%);
    max-height: calc(100dvh - 2rem);
    overflow: auto;
    background: var(--kv-surface);
    border-radius: var(--kv-radius-lg);
    box-shadow: var(--kv-shadow-md);
    padding: var(--kv-space-6);
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-4);
}

.kv-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--kv-space-2);
}

@media (max-width: 47.99rem) {
    .kv-dialog__scrim {
        place-items: end stretch;
        padding: 0;
    }

    .kv-dialog {
        width: 100%;
        border-radius: var(--kv-radius-lg) var(--kv-radius-lg) 0 0;
        padding-bottom: max(var(--kv-space-6), env(safe-area-inset-bottom));
    }
}

/*
  The confirmation and result dialogs (ADR-0055): centered on every screen, over any other dialog. The icon sits in a
  halo of its tone that opens once, and its strokes draw themselves; with reduced motion both are simply there.
*/
.kv-alert__scrim {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: var(--kv-space-4);
    background: var(--kv-scrim);
    animation: kv-alert-fade var(--kv-duration-base) var(--kv-ease-out);
}

.kv-alert {
    --kv-alert-tone: var(--kv-accent);
    --kv-alert-soft: var(--kv-surface-2);
    width: min(26rem, 100%);
    max-height: calc(100dvh - 2rem);
    overflow: auto;
    display: grid;
    justify-items: center;
    gap: var(--kv-space-3);
    padding: var(--kv-space-8) var(--kv-space-6) var(--kv-space-6);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
    background: var(--kv-surface);
    color: var(--kv-text);
    box-shadow: var(--kv-shadow-md);
    text-align: center;
    animation: kv-alert-in var(--kv-duration-base) var(--kv-ease-out);
}

.kv-alert:focus {
    outline: none;
}

.kv-alert--success {
    --kv-alert-tone: var(--kv-success);
    --kv-alert-soft: var(--kv-success-soft);
}

.kv-alert--warning {
    --kv-alert-tone: var(--kv-warning);
    --kv-alert-soft: var(--kv-warning-soft);
}

.kv-alert--danger {
    --kv-alert-tone: var(--kv-danger);
    --kv-alert-soft: var(--kv-danger-soft);
}

.kv-alert__icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 4.5rem;
    height: 4.5rem;
    margin-bottom: var(--kv-space-1);
    border-radius: 50%;
    background: var(--kv-alert-soft);
    color: var(--kv-alert-tone);
}

.kv-alert__icon .kv-icon {
    position: relative;
}

.kv-alert__icon .kv-icon > * {
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    animation: kv-alert-draw 700ms var(--kv-ease-out) 120ms forwards;
}

.kv-alert__halo {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--kv-alert-tone);
    opacity: 0;
    animation: kv-alert-halo 900ms var(--kv-ease-out) 80ms;
}

.kv-alert__title {
    margin: 0;
    font-size: var(--kv-text-xl);
    font-weight: var(--kv-weight-bold);
    letter-spacing: var(--kv-tracking-tight);
}

.kv-alert__message {
    margin: 0;
    color: var(--kv-text-muted);
    line-height: var(--kv-leading);
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.kv-alert__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--kv-space-2);
    width: 100%;
    margin-top: var(--kv-space-3);
}

.kv-alert__actions > * {
    flex: 1 1 8rem;
}

@keyframes kv-alert-fade {
    from { opacity: 0; }
}

@keyframes kv-alert-in {
    from { opacity: 0; transform: translateY(0.5rem) scale(0.96); }
}

@keyframes kv-alert-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes kv-alert-halo {
    from { opacity: 0.7; transform: scale(0.85); }
    to { opacity: 0; transform: scale(1.45); }
}

@media (prefers-reduced-motion: reduce) {
    .kv-alert__scrim,
    .kv-alert,
    .kv-alert__halo {
        animation: none;
    }

    .kv-alert__icon .kv-icon > * {
        animation: none;
        stroke-dashoffset: 0;
    }
}

/*
  FlapText: the signature move. Each character sits on its own tile, hinged across the middle, the two halves in
  slightly different greys; a change drops the lower leaf into place from the hinge, the new character on it.
*/
.kv-flap {
    display: inline-flex;
    gap: 0.1em;
    font-family: var(--kv-font-board);
    font-weight: 700;
    font-size: var(--kv-text-board);
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-transform: uppercase;
    perspective: 18rem;
    vertical-align: middle;
}

.kv-flap__cell {
    position: relative;
    display: inline-grid;
    place-items: center;
    min-width: 0.95em;
    padding: 0.14em 0.12em;
    border-radius: 0.1em;
    background: linear-gradient(
        to bottom,
        var(--kv-tile-top) 0 49%,
        var(--kv-tile-hinge) 49% 51%,
        var(--kv-tile-bottom) 51% 100%);
    color: var(--kv-tile-ink);
    box-shadow: 0 0.06em 0.08em rgb(0 0 0 / 0.55);
}

.kv-flap__cell--flip::before {
    content: attr(data-c);
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: inherit;
    border-radius: inherit;
    background: var(--kv-tile-bottom);
    color: inherit;
    clip-path: inset(51% 0 0 0);
    transform-origin: 50% 50%;
    backface-visibility: hidden;
    animation: kv-leaf var(--kv-duration-flap) cubic-bezier(0.55, 0, 0.75, 0.3) both;
    animation-delay: calc(var(--kv-i, 0) * var(--kv-flap-stagger));
}

@keyframes kv-leaf {
    from {
        transform: rotateX(92deg);
        filter: brightness(1.8);
    }

    to {
        transform: rotateX(0deg);
        filter: none;
    }
}

.kv-flap--late .kv-flap__cell {
    color: var(--kv-tile-late);
}

.kv-flap--danger .kv-flap__cell {
    color: var(--kv-tile-danger);
}

.kv-flap--online .kv-flap__cell {
    color: var(--kv-tile-online);
}

/* A figure inside running text: the characters without tiles, so no leaf either. */
.kv-flap--plain {
    text-transform: none;
}

.kv-flap--plain .kv-flap__cell {
    background: transparent;
    color: inherit;
    padding: 0;
    box-shadow: none;
}

.kv-flap--plain .kv-flap__cell--flip::before {
    content: none;
}

/*
  The board panel: the page's dark blue under a fine grain and a perforated mesh, the same in both schemes (a board
  hung in a lit room). It is color-scheme: dark, so every token inside resolves to its dark value: badges, avatars and
  buttons on a board need nothing of their own. Lists that are boards and the figures of the business use it; forms,
  dialogs and cards stay on the normal surfaces.
*/
.kv-panel--board,
.kv-board {
    color-scheme: dark;
    --kv-text: var(--kv-tile-ink);
    --kv-text-muted: var(--kv-tile-dim);
    --kv-border: var(--kv-panel-line);
    border: 1px solid var(--kv-panel-line);
    border-radius: var(--kv-radius-sm);
    background-color: var(--kv-bg);
    background-image:
        radial-gradient(ellipse at 50% 20%, rgb(255 255 255 / 0.05), transparent 65%),
        radial-gradient(circle, rgb(0 0 0 / 0.45) 0.7px, transparent 0.9px),
        var(--kv-grain);
    background-size: auto, 4px 4px, 180px 180px;
    color: var(--kv-text);
}

.kv-panel--board {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-6);
    padding: var(--kv-space-6);
}

/* Small condensed caps over a figure or a column, as printed on the board's frame. */
.kv-eyebrow {
    margin: 0;
    font-family: var(--kv-font-board);
    font-size: var(--kv-text-sm);
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--kv-text-muted);
}

/* The headline of a board: one value in large tiles that wrap on a narrow screen. */
.kv-headline .kv-flap {
    flex-wrap: wrap;
    row-gap: 0.12em;
    font-size: clamp(1.75rem, 5vw, 3.25rem);
}

.kv-figures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--kv-space-4);
    margin: 0;
}

.kv-figure {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--kv-space-2);
    padding: var(--kv-space-4);
    border: 1px solid var(--kv-panel-line);
    border-radius: var(--kv-radius-sm);
}

.kv-figure dd {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-3);
    margin: 0;
}

.kv-figure .kv-flap {
    font-size: 2rem;
}

/* LiveBoard: a semantic table whose rows rerank and whose cells flip */
.kv-board {
    width: 100%;
    overflow: hidden;
}

.kv-board__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--kv-space-4);
    padding: var(--kv-space-5) var(--kv-space-5) var(--kv-space-3);
}

.kv-board__title {
    font-family: var(--kv-font-board);
    font-size: var(--kv-text-xl);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.kv-board table {
    width: 100%;
    border-collapse: collapse;
}

.kv-board th {
    padding: var(--kv-space-3) var(--kv-space-5);
    text-align: left;
    font-family: var(--kv-font-board);
    font-size: var(--kv-text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--kv-text-muted);
    border-bottom: 1px solid var(--kv-border);
    white-space: nowrap;
}

.kv-board th button {
    all: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-1);
}

.kv-board th button:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 2px;
}

.kv-board td {
    padding: var(--kv-space-3) var(--kv-space-5);
    border-bottom: 1px solid var(--kv-border);
    font-size: var(--kv-text-sm);
    vertical-align: middle;
}

.kv-board tr:last-child td {
    border-bottom: 0;
}

.kv-board tr[data-tone="changed"] td {
    background: var(--kv-row-changed);
}

.kv-board tr[data-tone="cancelled"] td {
    color: var(--kv-row-cancelled);
}

.kv-board tr[data-tone="cancelled"] .kv-flap__cell {
    background: transparent;
    box-shadow: none;
    color: var(--kv-row-cancelled);
}

/* Who a row is about: ivory ink in the board's letter, not tiles (names vary in length and must read at a glance). */
.kv-board__primary {
    font-family: var(--kv-font-board);
    font-weight: 600;
    font-size: var(--kv-text-lg);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.kv-board__secondary {
    display: block;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
    max-width: 28rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kv-board__empty {
    padding: var(--kv-space-8) var(--kv-space-5);
    color: var(--kv-text-muted);
}

/*
  On the phone the board stacks each row: who it is on top, then the rest one under the other, each with the row's
  whole width. A board that leads with a figure (a waiting time) keeps it beside the rest, in a narrow column.
*/
@media (max-width: 47.99rem) {
    .kv-board thead {
        display: none;
    }

    .kv-board table,
    .kv-board tbody {
        display: block;
    }

    .kv-board tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: var(--kv-space-1) var(--kv-space-3);
        padding: var(--kv-space-3) var(--kv-space-4);
        border-bottom: 1px solid var(--kv-border);
    }

    .kv-board[data-lead="figure"] tr {
        grid-template-columns: 5rem minmax(0, 1fr);
    }

    .kv-board tr[data-tone="changed"] {
        background: var(--kv-row-changed);
    }

    .kv-board td {
        display: block;
        min-width: 0;
        padding: 0;
        border: 0;
        background: none !important;
    }

    .kv-board[data-lead="figure"] td:first-child {
        grid-row: span 3;
    }

    .kv-board td[data-priority="low"] {
        display: none;
    }
}

/* AppShell: navy rail on wide screens, bottom navigation on the phone */
.kv-shell {
    display: grid;
    grid-template-columns: var(--kv-rail) minmax(0, 1fr);
    min-height: 100dvh;
}

.kv-shell__rail {
    position: sticky;
    top: 0;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--kv-space-1);
    padding: var(--kv-space-4) 0;
    background: var(--kv-brand);
    color: var(--kv-on-brand-muted);
}

.kv-shell__logo {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: var(--kv-space-5);
    border-radius: var(--kv-radius-md);
    overflow: hidden;
}

.kv-shell__logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.kv-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 4.75rem;
    min-height: 3.5rem;
    border-radius: var(--kv-radius-md);
    color: inherit;
    font-size: 0.6875rem;
    font-weight: var(--kv-weight-bold);
    text-decoration: none;
    position: relative;
}

.kv-nav-item:hover {
    color: var(--kv-on-brand);
}

.kv-nav-item[aria-current="page"],
.kv-nav-item.active {
    background: color-mix(in oklab, var(--kv-brand) 78%, var(--kv-lighten));
    color: var(--kv-on-brand);
}

/* A long label never spills out of the rail or the bottom bar */
.kv-nav-item > span:not(.kv-nav-item__badge) {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-nav-item__badge {
    position: absolute;
    top: 0.25rem;
    right: 0.35rem;
    min-width: 1.15rem;
    padding: 0 0.3rem;
    border-radius: var(--kv-radius-pill);
    background: var(--kv-accent);
    color: var(--kv-on-accent);
    font-family: var(--kv-font-board);
    font-size: 0.75rem;
    line-height: 1.15rem;
    text-align: center;
}

.kv-nav-item:focus-visible {
    outline-color: var(--kv-accent);
}

.kv-shell__spacer {
    flex: 1;
}

/*
 * The menu's entries scroll when they do not fit (ADR-0039): a short window for the rail, a narrow one for the menu on
 * top or at the bottom (an unfolded phone is "wide" yet small). kartiva.js marks the ends with more to see
 * (data-kv-more-start / -end): the entries fade there and an arrow takes the menu further. The scrollbar stays hidden.
 */
.kv-shell__scroll {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    width: 100%;
}

.kv-shell__nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--kv-space-1);
    flex: 1 1 auto;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.kv-shell__nav::-webkit-scrollbar {
    display: none;
}

.kv-shell__scroll[data-kv-more-start] .kv-shell__nav {
    mask-image: linear-gradient(to bottom, transparent, #000 2.5rem);
}

.kv-shell__scroll[data-kv-more-end] .kv-shell__nav {
    mask-image: linear-gradient(to top, transparent, #000 2.5rem);
}

.kv-shell__scroll[data-kv-more-start][data-kv-more-end] .kv-shell__nav {
    mask-image: linear-gradient(to bottom, transparent, #000 2.5rem, #000 calc(100% - 2.5rem), transparent);
}

.kv-scroll-hint {
    position: absolute;
    z-index: 1;
    left: 50%;
    display: none;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--kv-on-brand) 22%, transparent);
    color: var(--kv-on-brand);
    cursor: pointer;
    transform: translateX(-50%);
}

.kv-scroll-hint:hover {
    background: color-mix(in srgb, var(--kv-on-brand) 34%, transparent);
}

.kv-scroll-hint--start {
    top: 0;
}

.kv-scroll-hint--start .kv-icon {
    transform: rotate(180deg);
}

.kv-scroll-hint--end {
    bottom: 0;
}

.kv-shell__scroll[data-kv-more-start] .kv-scroll-hint--start,
.kv-shell__scroll[data-kv-more-end] .kv-scroll-hint--end {
    display: grid;
}

.kv-shell__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Its own layer above the content (and the top menu), so the person's menu opens over any panel, whatever a skin
   does to it (frosted glass, rotated stickers and shadows each start a layer of their own). */
.kv-topbar {
    position: relative;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: var(--kv-space-4);
    min-height: 4rem;
    padding: 0 var(--kv-space-6);
    border-bottom: 1px solid var(--kv-border);
    background: var(--kv-surface);
}

.kv-topbar__tenant {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    min-width: 0;
}

.kv-topbar__tenant strong {
    font-size: var(--kv-text-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kv-topbar__tenant span {
    font-size: var(--kv-text-xs);
    color: var(--kv-text-muted);
}

.kv-topbar__end {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-shell__content {
    width: 100%;
    max-width: var(--kv-content);
    margin-inline: auto;
    padding: var(--kv-space-6);
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-6);
}

.kv-bottom-nav {
    display: none;
}

/*
  Where the menu goes on wide screens (ADR-0029): left (above), right, on top under the business's bar, or at the
  bottom. On the phone every position keeps the bottom bar.
*/
@media (min-width: 48rem) {
    .kv-shell[data-menu="right"] {
        grid-template-columns: minmax(0, 1fr) var(--kv-rail);
    }

    .kv-shell[data-menu="right"] .kv-shell__rail {
        order: 2;
    }

    .kv-shell[data-menu="top"],
    .kv-shell[data-menu="bottom"] {
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
    }

    /* The bar of the business, the menu and the content stack as rows of the shell. */
    .kv-shell[data-menu="top"] .kv-shell__main {
        display: contents;
    }

    .kv-shell[data-menu="top"] .kv-topbar {
        order: 1;
    }

    .kv-shell[data-menu="top"] .kv-shell__rail {
        order: 2;
        top: 0;
        z-index: 20;
    }

    .kv-shell[data-menu="top"] .kv-shell__content {
        order: 3;
    }

    .kv-shell[data-menu="top"] .kv-shell__rail,
    .kv-shell[data-menu="bottom"] .kv-shell__rail {
        height: auto;
        flex-direction: row;
        justify-content: flex-start;
        padding: var(--kv-space-1) var(--kv-space-4);
        overflow-x: auto;
    }

    .kv-shell[data-menu="top"] .kv-shell__logo,
    .kv-shell[data-menu="bottom"] .kv-shell__logo {
        margin: 0 var(--kv-space-4) 0 0;
        flex: none;
    }

    .kv-shell[data-menu="top"] .kv-nav-item,
    .kv-shell[data-menu="bottom"] .kv-nav-item {
        flex: none;
        width: auto;
        min-width: 5.5rem;
        padding: 0 var(--kv-space-2);
    }

    /* In a row: the entries scroll sideways; centered while they fit, from the first one when they do not. */
    .kv-shell[data-menu="top"] .kv-shell__nav,
    .kv-shell[data-menu="bottom"] .kv-shell__nav {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .kv-shell[data-menu="bottom"] .kv-shell__nav > :first-child {
        margin-inline-start: auto;
    }

    .kv-shell[data-menu="bottom"] .kv-shell__nav > :last-child {
        margin-inline-end: auto;
    }

    .kv-shell:is([data-menu="top"], [data-menu="bottom"]) .kv-shell__scroll[data-kv-more-start] .kv-shell__nav {
        mask-image: linear-gradient(to right, transparent, #000 3rem);
    }

    .kv-shell:is([data-menu="top"], [data-menu="bottom"]) .kv-shell__scroll[data-kv-more-end] .kv-shell__nav {
        mask-image: linear-gradient(to left, transparent, #000 3rem);
    }

    .kv-shell:is([data-menu="top"], [data-menu="bottom"]) .kv-shell__scroll[data-kv-more-start][data-kv-more-end] .kv-shell__nav {
        mask-image: linear-gradient(to right, transparent, #000 3rem, #000 calc(100% - 3rem), transparent);
    }

    .kv-shell:is([data-menu="top"], [data-menu="bottom"]) .kv-scroll-hint {
        top: 50%;
        bottom: auto;
        left: auto;
        transform: translateY(-50%) rotate(-90deg);
    }

    .kv-shell:is([data-menu="top"], [data-menu="bottom"]) .kv-scroll-hint--start {
        left: 0;
    }

    .kv-shell:is([data-menu="top"], [data-menu="bottom"]) .kv-scroll-hint--end {
        right: 0;
    }
}

@media (min-width: 48rem) {

    .kv-shell[data-menu="bottom"] {
        padding-bottom: calc(var(--kv-bottom-nav) + var(--kv-space-2));
    }

    .kv-shell[data-menu="bottom"] .kv-shell__rail {
        position: fixed;
        z-index: 30;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        justify-content: center;
    }
}

@media (max-width: 47.99rem) {
    .kv-shell {
        grid-template-columns: minmax(0, 1fr);
        padding-bottom: calc(var(--kv-bottom-nav) + env(safe-area-inset-bottom));
    }

    .kv-shell__rail {
        display: none;
    }

    .kv-topbar {
        padding: 0 var(--kv-space-4);
        padding-top: env(safe-area-inset-top);
    }

    .kv-shell__content {
        padding: var(--kv-space-4);
    }

    .kv-bottom-nav {
        position: fixed;
        z-index: 30;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        justify-content: space-around;
        padding: var(--kv-space-1) var(--kv-space-2) env(safe-area-inset-bottom);
        min-height: var(--kv-bottom-nav);
        background: var(--kv-brand);
        color: var(--kv-on-brand-muted);
    }

    .kv-bottom-nav .kv-nav-item {
        flex: 1;
    }
}

/* PageHeader */
.kv-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--kv-space-4);
}

.kv-page-header__text {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    min-width: 0;
}

.kv-page-header__text p {
    color: var(--kv-text-muted);
}

.kv-page-header__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

/* The arrow back to the page before (ADR-0044): a round button beside the title; on the phone, a line over it with the page's name. */
.kv-page-header__title {
    display: flex;
    align-items: center;
    gap: var(--kv-space-3);
    min-width: 0;
}

.kv-back {
    flex: none;
    display: inline-grid;
    place-items: center;
    width: var(--kv-target);
    height: var(--kv-target);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-pill);
    color: var(--kv-text);
    text-decoration: none;
}

.kv-back:hover {
    background: var(--kv-surface-2);
}

.kv-back__text {
    display: none;
}

/*
  The trail of pages (ADR-0044): a thin line over the title with the pages visited, the one shown last. When there are
  many, "…" opens the ones in between. The phone does without it: the arrow back says where it goes.
*/
.kv-trail {
    margin-bottom: calc(-1 * var(--kv-space-3));
    font-size: var(--kv-text-sm);
    color: var(--kv-text-muted);
}

.kv-trail ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-1) var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-trail li {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
    min-width: 0;
}

.kv-trail li + li::before {
    content: "›";
    color: var(--kv-text-muted);
}

.kv-trail a,
.kv-trail [aria-current] {
    max-width: 18rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-trail a {
    color: inherit;
    text-decoration: none;
}

.kv-trail a:hover {
    color: var(--kv-text);
    text-decoration: underline;
}

.kv-trail [aria-current] {
    color: var(--kv-text);
    font-weight: var(--kv-weight-bold);
}

.kv-trail__more {
    position: relative;
}

.kv-trail__more > summary {
    list-style: none;
    padding: 0 var(--kv-space-2);
    border-radius: var(--kv-radius-sm);
    cursor: pointer;
}

.kv-trail__more > summary::-webkit-details-marker {
    display: none;
}

.kv-trail__more > summary:hover {
    background: var(--kv-surface-2);
    color: var(--kv-text);
}

.kv-trail__list {
    position: absolute;
    left: 0;
    top: calc(100% + var(--kv-space-1));
    z-index: 35;
    min-width: 14rem;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: var(--kv-space-2);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    box-shadow: var(--kv-shadow-md);
}

@media (max-width: 47.99rem) {
    .kv-trail {
        display: none;
    }

    .kv-page-header__title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .kv-back {
        display: inline-flex;
        align-items: center;
        gap: var(--kv-space-1);
        width: auto;
        max-width: 100%;
        height: auto;
        min-height: var(--kv-target);
        border: 0;
        color: var(--kv-text-muted);
        font-size: var(--kv-text-sm);
        font-weight: var(--kv-weight-bold);
    }

    .kv-back:hover {
        background: none;
        color: var(--kv-text);
    }

    .kv-back__text {
        display: inline;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Menu (user, tenant): a disclosure without script */
.kv-menu {
    position: relative;
}

.kv-menu > summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-2);
    min-height: var(--kv-target);
    padding: 0 var(--kv-space-2);
    border-radius: var(--kv-radius-md);
    cursor: pointer;
    font-weight: var(--kv-weight-bold);
    font-size: var(--kv-text-sm);
}

.kv-menu > summary::-webkit-details-marker {
    display: none;
}

.kv-menu > summary:hover {
    background: var(--kv-surface-2);
}

.kv-menu__list {
    position: absolute;
    right: 0;
    top: calc(100% + var(--kv-space-1));
    z-index: 35;
    min-width: 14rem;
    padding: var(--kv-space-2);
    margin: 0;
    list-style: none;
    background: var(--kv-surface);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
    box-shadow: var(--kv-shadow-md);
}

.kv-menu__item {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
    width: 100%;
    min-height: var(--kv-target);
    padding: 0 var(--kv-space-3);
    border: 0;
    border-radius: var(--kv-radius-md);
    background: none;
    color: var(--kv-text);
    font: inherit;
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-medium);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.kv-menu__item:hover {
    background: var(--kv-surface-2);
}

.kv-menu__label {
    padding: var(--kv-space-2) var(--kv-space-3);
    font-size: var(--kv-text-xs);
    color: var(--kv-text-muted);
}

/* The person's preferences in the menu: the scheme and the language, each under its heading. */
.kv-menu__list:has(.kv-menu__group) {
    min-width: 18rem;
}

.kv-menu__group {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    padding: var(--kv-space-2) var(--kv-space-3) var(--kv-space-3);
    border-bottom: 1px solid var(--kv-border);
}

.kv-menu__heading {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-2);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    color: var(--kv-text-muted);
}

.kv-input--compact {
    min-height: 2.5rem;
}

/* A segmented choice: the options side by side, the chosen one filled. */
.kv-segmented {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface-2);
}

.kv-segmented__option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--kv-space-1);
    min-height: 2.5rem;
    padding: 0 var(--kv-space-2);
    border: 0;
    border-radius: calc(var(--kv-radius-md) - 2px);
    background: none;
    color: var(--kv-text-muted);
    font: inherit;
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    cursor: pointer;
}

.kv-segmented__option:hover {
    color: var(--kv-text);
}

.kv-segmented__option:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 1px;
}

/* The scheme in use: kartiva.js sets data-theme (none means the system's). */
:root[data-theme="light"] [data-kv-theme-option="light"],
:root[data-theme="dark"] [data-kv-theme-option="dark"],
:root:not([data-theme]) [data-kv-theme-option="system"],
.kv-segmented__option[aria-checked="true"] {
    background: var(--kv-surface);
    color: var(--kv-text);
    box-shadow: var(--kv-shadow-sm);
}

/* Tenant picker: the businesses a person can enter */
.kv-tenants {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-4);
    max-width: 40rem;
}

.kv-tenants ul {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
    background: var(--kv-surface);
    overflow: hidden;
}

.kv-tenants li + li {
    border-top: 1px solid var(--kv-border);
}

.kv-tenants button {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--kv-space-3);
    width: 100%;
    min-height: 4rem;
    padding: var(--kv-space-3) var(--kv-space-5);
    border: 0;
    background: none;
    color: var(--kv-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.kv-tenants button:hover {
    background: var(--kv-surface-2);
}

.kv-tenants__name {
    font-weight: var(--kv-weight-bold);
}

.kv-tenants__role {
    font-size: var(--kv-text-sm);
    color: var(--kv-text-muted);
}

/* Public pages (SSR): sign-in and messages, on the brand */
.kv-public {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}

.kv-public__brand {
    background: var(--kv-brand);
    color: var(--kv-on-brand);
    padding: var(--kv-space-10);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--kv-space-8);
}

.kv-public__brand img {
    width: min(16rem, 70%);
    height: auto;
}

.kv-public__brand p {
    color: var(--kv-on-brand-muted);
    max-width: 30rem;
}

.kv-public__body {
    padding: var(--kv-space-10);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--kv-space-5);
    max-width: 36rem;
}

.kv-public__body p {
    color: var(--kv-text-muted);
    max-width: 65ch;
}

/* Sign in or create the account; the password help folds under them (ADR-0035). */
.kv-public__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-3);
}

.kv-public__body .kv-public__hint {
    margin: 0;
    font-size: var(--kv-text-sm);
}

.kv-public__help {
    padding-top: var(--kv-space-3);
    border-top: 1px solid var(--kv-border);
}

.kv-public__help > summary {
    width: fit-content;
    color: var(--kv-brand-ink);
    font-weight: var(--kv-weight-bold);
    cursor: pointer;
}

.kv-public__help > p {
    margin: var(--kv-space-2) 0;
    font-size: var(--kv-text-sm);
}

.kv-public__steps {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-4);
    margin: 0;
    padding-left: var(--kv-space-5);
}

.kv-public__steps p {
    margin: 0 0 var(--kv-space-2);
}

.kv-team__actions {
    white-space: nowrap;
}

@media (max-width: 47.99rem) {
    .kv-public {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto 1fr;
    }

    .kv-public__brand,
    .kv-public__body {
        padding: var(--kv-space-6) var(--kv-space-4);
    }
}

/* A person in a row: avatar beside name and contact */
.kv-person {
    display: flex;
    align-items: center;
    gap: var(--kv-space-3);
    min-width: 0;
}

.kv-person > * {
    min-width: 0;
}

.kv-form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-4);
}

.kv-public__lead {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
}

.kv-stack--tight {
    gap: var(--kv-space-3);
}

/* Component catalog (/dev/components, development only) */
.kv-catalog {
    max-width: var(--kv-content);
    margin: 0 auto;
    padding: var(--kv-space-8) var(--kv-space-6) var(--kv-space-10);
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-8);
    background: var(--kv-bg);
    color: var(--kv-text);
}

/* Same width as the light catalog; the dark background bleeds to the edges through a clipped shadow. */
.kv-catalog--dark {
    color-scheme: dark;
    box-shadow: 0 0 0 100vmax var(--kv-bg);
    clip-path: inset(0 -100vmax);
}

.kv-catalog__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--kv-space-4);
}

.kv-catalog__switch,
.kv-catalog__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-3);
}

.kv-catalog__swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: var(--kv-space-4);
}

.kv-catalog__swatch {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    font-size: var(--kv-text-sm);
}

.kv-catalog__swatch span {
    height: 3.5rem;
    border-radius: var(--kv-radius-md);
    border: 1px solid var(--kv-border);
}

.kv-catalog__swatch code {
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
}

.kv-catalog__icon {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-2);
    padding: var(--kv-space-1) var(--kv-space-2);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    font-size: var(--kv-text-xs);
}

@media (max-width: 47.99rem) {
    .kv-catalog {
        padding: var(--kv-space-5) var(--kv-space-4) var(--kv-space-8);
    }
}

.kv-flap__unit {
    align-self: flex-end;
    margin-left: 0.2em;
    font-family: var(--kv-font-sans);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    color: var(--kv-text-muted);
}

.kv-flap--plain {
    gap: 0;
    letter-spacing: 0.04em;
}

/* Records (§13.3): fields drawn from metadata, the record form, its card and the pipeline board */
.kv-input--area {
    min-height: 6rem;
    padding-block: var(--kv-space-2);
    resize: vertical;
}

.kv-input--figure {
    font-variant-numeric: tabular-nums;
}

.kv-affix {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-affix .kv-input {
    flex: 1;
    min-width: 0;
}

.kv-affix__text {
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-bold);
}

.kv-field__required {
    margin-left: var(--kv-space-1);
    color: var(--kv-danger);
}

.kv-field__static {
    min-height: var(--kv-target);
    margin: 0;
    display: flex;
    align-items: center;
    color: var(--kv-text-muted);
}

/* Checkbox lists in even columns, so the boxes line up from one row to the next. */
.kv-choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: var(--kv-space-2) var(--kv-space-4);
}

.kv-relation {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
}

.kv-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-1);
    min-height: 2rem;
    padding-left: var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-pill);
    background: var(--kv-surface-2);
    font-size: var(--kv-text-sm);
}

.kv-chip__remove {
    all: unset;
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--kv-radius-pill);
    cursor: pointer;
    color: var(--kv-text-muted);
}

.kv-chip__remove:hover {
    color: var(--kv-text);
}

.kv-chip__remove:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 1px;
}

.kv-results {
    margin: 0;
    padding: var(--kv-space-1);
    list-style: none;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    box-shadow: var(--kv-shadow-md);
}

.kv-results__item {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: var(--kv-target);
    padding: 0 var(--kv-space-3);
    border-radius: var(--kv-radius-sm);
    cursor: pointer;
}

.kv-results__item:hover,
.kv-results__item:focus-visible {
    background: var(--kv-surface-2);
}

.kv-record-form {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-5);
}

/*
  Every form on a 12-column grid (EditForm with kv-form, and the record form's fields): each field takes a fixed share,
  so the controls line up in columns and rows never leave holes. Four per row on wide screens, two on a tablet, one on
  the phone; long text and checkbox lists take the whole row. Label, control, hint and error share the rows of their
  line (subgrid), so the controls start at the same height even when a label wraps.
*/
.kv-form,
.kv-record-form__fields {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--kv-space-4) var(--kv-space-5);
    align-items: start;
}

.kv-form > .kv-field,
.kv-record-form__fields > .kv-field {
    grid-column: span 3;
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 4;
    row-gap: var(--kv-space-1);
    align-content: start;
}

/* A checkbox or switch sits on the controls' line, below where a label would be. */
.kv-form > .kv-check,
.kv-form > .kv-switch {
    grid-column: span 3;
    grid-row: span 4;
    margin-top: calc(var(--kv-text-sm) * 1.5 + var(--kv-space-1));
}

.kv-form > .kv-field--wide,
.kv-record-form__fields > .kv-field--wide {
    grid-column: 1 / -1;
}

/*
  The button bar: the form's actions together in their own row at the bottom right, the main one last. It closes a form
  (inside the grid it takes the whole row) or a section of one.
*/
.kv-form__actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: var(--kv-space-2);
    padding-top: var(--kv-space-4);
    border-top: 1px solid var(--kv-border);
}

/* Says why the bar is active: what is on screen is not saved yet. */
.kv-form__pending {
    margin-inline-end: auto;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
}

@media (max-width: 79.99rem) {
    .kv-form > :is(.kv-field, .kv-check, .kv-switch):not(.kv-field--wide),
    .kv-record-form__fields > .kv-field:not(.kv-field--wide) {
        grid-column: span 6;
    }
}

@media (max-width: 47.99rem) {
    .kv-form > :is(.kv-field, .kv-check, .kv-switch):not(.kv-field--wide),
    .kv-record-form__fields > .kv-field:not(.kv-field--wide) {
        grid-column: 1 / -1;
    }

    .kv-form__actions > * {
        flex: 1 1 auto;
    }

    .kv-form__actions > .kv-form__pending {
        flex-basis: 100%;
    }
}

.kv-form-section {
    border-top: 1px solid var(--kv-border);
    padding-top: var(--kv-space-3);
}

.kv-form-section > summary {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
    min-height: var(--kv-target);
    font-weight: var(--kv-weight-bold);
    cursor: pointer;
}

.kv-form-section > summary:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 2px;
}

.kv-form-section > summary::-webkit-details-marker {
    display: none;
}

.kv-form-section > summary {
    list-style: none;
}

.kv-form-section__chevron {
    color: var(--kv-text-muted);
    transition: transform var(--kv-duration-fast);
}

.kv-form-section[open] .kv-form-section__chevron {
    transform: rotate(90deg);
}

.kv-form-section[open] > summary {
    margin-bottom: var(--kv-space-3);
}

.kv-record-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: var(--kv-space-4) var(--kv-space-5);
    margin: 0 0 var(--kv-space-4);
}

.kv-record-fact dt {
    font-size: var(--kv-text-sm);
    color: var(--kv-text-muted);
}

.kv-record-fact dd {
    margin: var(--kv-space-1) 0 0;
    overflow-wrap: anywhere;
}

.kv-record {
    display: grid;
    gap: var(--kv-space-6);
}

@media (min-width: 64rem) {
    .kv-record {
        grid-template-columns: minmax(0, 1fr) 20rem;
        align-items: start;
    }
}

.kv-follow {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-follow__item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--kv-space-2);
    padding: var(--kv-space-3) 0;
    border-bottom: 1px solid var(--kv-border);
}

.kv-follow__item[data-tone="changed"] {
    background: var(--kv-row-changed);
    padding-inline: var(--kv-space-3);
}

.kv-follow__pipeline {
    font-weight: var(--kv-weight-bold);
    color: inherit;
}

.kv-links__label {
    margin: var(--kv-space-3) 0 var(--kv-space-1);
    font-size: var(--kv-text-sm);
    color: var(--kv-text-muted);
}

.kv-links {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-links li {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
    min-height: 2rem;
}

.kv-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-3);
    margin-bottom: var(--kv-space-4);
}

/* «Columnas» of a commerce list (ADR-0063): the business's own fields the person turns on as columns. */
.kv-columns {
    position: relative;
    display: flex;
    align-items: flex-end;
}

:not(.kv-toolbar) > .kv-columns {
    margin-bottom: var(--kv-space-3);
}

.kv-columns__panel {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    min-width: 14rem;
    max-width: calc(100vw - 2rem);
    margin: var(--kv-space-2) 0 0;
    padding: var(--kv-space-3);
}

/* «Filtros» of a commerce list (ADR-0064): the business fields indexed, as filters; each one applied is a chip. */
.kv-filters__panel {
    gap: var(--kv-space-3);
    width: min(22rem, calc(100vw - 2rem));
    max-height: min(70vh, 32rem);
    overflow-y: auto;
}

.kv-filters__range {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--kv-space-2);
}

.kv-filters__chips {
    flex-basis: 100%;
    margin-bottom: var(--kv-space-3);
}

.kv-search {
    position: relative;
    flex: 1 1 18rem;
    max-width: 28rem;
}

.kv-search .kv-input {
    width: 100%;
    padding-left: var(--kv-space-10);
}

.kv-search__icon {
    position: absolute;
    left: var(--kv-space-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--kv-text-muted);
    pointer-events: none;
}

.kv-board__link {
    color: inherit;
    text-decoration: none;
}

.kv-board__link:hover {
    text-decoration: underline;
}

.kv-load-more {
    display: flex;
    justify-content: center;
    padding: var(--kv-space-4) 0;
}

/*
  Kanban: columns side by side; on the phone, tabs and one column at a time. Columns fill the width when they fit and
  keep a readable width (17rem) when they do not: then the row scrolls sideways, snapping to a column. A column is
  never taller than the window (its cards scroll inside it). The row is a focusable region (the arrow keys move it)
  and, while there is more on a side, the arrows above it (kartiva.js marks data-kv-more-start / -end, ADR-0039) take
  it most of a screen further, so every stage can be reached even with the scrollbar below the window.
*/
.kv-kanban__tabs {
    display: none;
}

.kv-kanban__nav {
    display: none;
    justify-content: flex-end;
    gap: var(--kv-space-1);
    margin-bottom: var(--kv-space-2);
}

.kv-kanban__board:is([data-kv-more-start], [data-kv-more-end]) .kv-kanban__nav {
    display: flex;
}

/* The side with nothing more keeps its place, so the other arrow does not jump; hidden, it is not focusable either. */
.kv-kanban__board:not([data-kv-more-start]) .kv-kanban__arrow--start,
.kv-kanban__board:not([data-kv-more-end]) .kv-kanban__arrow--end {
    visibility: hidden;
}

.kv-kanban__columns {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(17rem, 1fr);
    align-items: start;
    gap: var(--kv-space-3);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: auto;
    padding-bottom: var(--kv-space-3);
}

.kv-kanban__columns:focus-visible {
    outline-offset: 4px;
}

.kv-kanban__column {
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    min-height: 12rem;
    max-height: calc(100dvh - 7rem);
    padding: var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface-2);
    transition: border-color var(--kv-duration-fast);
}

.kv-kanban__column.is-over {
    border-color: var(--kv-accent);
    border-style: dashed;
}

/* Each column is headed by a strip of the board: the stage in its letter and the count in tiles. */
.kv-kanban__head {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--kv-space-2);
    margin-bottom: var(--kv-space-1);
    padding: var(--kv-space-2) var(--kv-space-3);
}

.kv-kanban__head h2 {
    margin: 0;
    font-family: var(--kv-font-board);
    font-size: var(--kv-text-base);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.kv-kanban__head .kv-flap {
    font-size: var(--kv-text-lg);
}

.kv-kanban__column[data-kind="won"] .kv-kanban__head h2 {
    color: var(--kv-online-ink);
}

.kv-kanban__column[data-kind="lost"] .kv-kanban__head h2 {
    color: var(--kv-danger);
}

.kv-kanban__empty {
    margin: 0;
    padding: var(--kv-space-4) 0;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
    text-align: center;
}

.kv-kanban__cards {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    min-height: 0;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.kv-card {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    padding: var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface);
    box-shadow: var(--kv-shadow-sm);
}

.kv-card[draggable="true"] {
    cursor: grab;
}

.kv-card[data-tone="changed"] {
    background: var(--kv-row-changed);
}

.kv-card__title {
    font-weight: var(--kv-weight-bold);
    color: inherit;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.kv-card__title:hover {
    text-decoration: underline;
}

.kv-card__caption {
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
}

.kv-card__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--kv-space-2);
}

.kv-flap--compact {
    font-size: var(--kv-text-sm);
}

@media (max-width: 47.99rem) {
    .kv-kanban__tabs {
        display: block;
        margin-bottom: var(--kv-space-3);
    }

    .kv-kanban__columns {
        display: block;
        overflow: visible;
    }

    /* One column at a time: the tabs choose it, nothing scrolls sideways. */
    .kv-kanban__board:is([data-kv-more-start], [data-kv-more-end]) .kv-kanban__nav {
        display: none;
    }

    .kv-kanban__column {
        display: none;
        min-height: 0;
        max-height: none;
        border: 0;
        padding: 0;
        background: none;
    }

    .kv-kanban__column.is-selected {
        display: flex;
    }

    .kv-kanban__head {
        display: none;
    }

    .kv-kanban__cards {
        overflow: visible;
    }
}

/* "Más" on the phone's bottom bar: the rest of the menu as a sheet above it, scrolling when it does not fit */
.kv-bottom-nav__more {
    display: contents;
}

.kv-bottom-nav__more > summary {
    list-style: none;
    cursor: pointer;
}

.kv-bottom-nav__more > summary::-webkit-details-marker {
    display: none;
}

.kv-bottom-nav__sheet {
    position: fixed;
    right: var(--kv-space-3);
    bottom: calc(var(--kv-bottom-nav) + var(--kv-space-2));
    min-width: 14rem;
    max-height: calc(100dvh - var(--kv-bottom-nav) - var(--kv-space-2) - var(--kv-space-3));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--kv-space-2);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    color: var(--kv-text);
    box-shadow: var(--kv-shadow-md);
}

/* A group on the phone's bar (ADR-0043): its pages in a sheet like "Más", from the left edge. */
/*
  A group's sheet opens over its own tab (the tabs share the bar's width), kept inside the screen: Seguimiento's over
  Seguimiento, Comercial's over Comercial, not over Inicio.
*/
.kv-bottom-nav__sheet--group {
    --kv-sheet-width: min(14rem, calc(100vw - 2 * var(--kv-space-3)));
    right: auto;
    left: clamp(
        var(--kv-space-3),
        calc((var(--kv-tab, 0) + 0.5) * 100vw / var(--kv-tabs, 5) - var(--kv-sheet-width) / 2),
        calc(100vw - var(--kv-sheet-width) - var(--kv-space-3)));
    width: var(--kv-sheet-width);
    min-width: 0;
}

/* A group's name over its entries, in the "Más" sheet and in a group's submenu (ADR-0043). */
.kv-menu__heading {
    margin: 0;
    padding: var(--kv-space-3) var(--kv-space-3) var(--kv-space-1);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kv-text-muted);
}

.kv-menu__heading:first-child {
    padding-top: var(--kv-space-1);
}

.kv-menu__divider {
    margin: var(--kv-space-2) var(--kv-space-1);
    border: 0;
    border-top: 1px solid var(--kv-border);
}

.kv-menu__item.active {
    background: var(--kv-surface-2);
    font-weight: var(--kv-weight-bold);
}

.kv-menu__count {
    margin-inline-start: auto;
    min-width: 1.25rem;
    padding: 0 0.35rem;
    border-radius: var(--kv-radius-pill);
    background: var(--kv-accent);
    color: var(--kv-on-accent);
    font-size: var(--kv-text-xs);
    line-height: 1.25rem;
    text-align: center;
}

/*
  A group of the wide-screen menu (ADR-0043): an entry like the others with a small chevron, whose submenu is a popover
  over everything. kartiva.js places it beside the rail (left or right) or under (over) the menu on top (at the bottom),
  and gives it the height there is; it scrolls when it is longer.
*/
.kv-nav-group {
    flex: none;
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    cursor: pointer;
}

.kv-nav-group:hover {
    color: var(--kv-on-brand);
}

.kv-nav-group__chevron {
    position: absolute;
    right: 0.3rem;
    bottom: 0.3rem;
    opacity: 0.75;
    transform: rotate(-90deg);
}

.kv-shell[data-menu="right"] .kv-nav-group__chevron {
    transform: rotate(90deg);
}

.kv-shell[data-menu="top"] .kv-nav-group__chevron {
    transform: none;
}

.kv-shell[data-menu="bottom"] .kv-nav-group__chevron {
    transform: rotate(180deg);
}

.kv-nav-group__menu {
    position: fixed;
    inset: auto;
    margin: 0;
    min-width: 14rem;
    max-width: min(20rem, calc(100vw - 1rem));
    max-height: calc(100dvh - 1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--kv-space-2);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    color: var(--kv-text);
    box-shadow: var(--kv-shadow-md);
}

/* The board's reference in the catalog (/dev/components): a table whose rows share the columns, like one board. */
.kv-analog__rows {
    display: grid;
    grid-template-columns: repeat(4, max-content);
    gap: var(--kv-space-2) var(--kv-space-5);
    align-items: center;
    font-size: 1.15rem;
    overflow-x: auto;
}

.kv-analog__row {
    display: contents;
}

.kv-analog__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

@media (max-width: 47.99rem) {
    .kv-panel--board {
        padding: var(--kv-space-4);
    }

    .kv-analog__rows {
        font-size: 0.9rem;
        gap: var(--kv-space-3);
    }
}

/* The appearance screen (ADR-0029): palette cards, menu sketches, brand colors and the logo. */
.kv-skin-grid,
.kv-swatch-grid,
.kv-layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: var(--kv-space-3);
}

.kv-skin-card,
.kv-swatch-card,
.kv-layout-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--kv-space-2);
    padding: var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    color: var(--kv-text);
    font: inherit;
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-bold);
    text-align: left;
    cursor: pointer;
}

.kv-skin-card:hover,
.kv-swatch-card:hover,
.kv-layout-card:hover {
    border-color: var(--kv-border-strong);
}

.kv-skin-card[aria-checked="true"],
.kv-swatch-card[aria-checked="true"],
.kv-layout-card[aria-checked="true"] {
    border-color: var(--kv-brand-ink);
    box-shadow: 0 0 0 1px var(--kv-brand-ink);
}

.kv-skin-card:focus-visible,
.kv-swatch-card:focus-visible,
.kv-layout-card:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 2px;
}

/* A skin the plan doesn't include (ADR-0068): still a preview, not a choice. */
.kv-skin-card--locked {
    cursor: not-allowed;
    border-style: dashed;
}

.kv-skin-card--locked:hover {
    border-color: var(--kv-border);
}

.kv-skin-card--locked .kv-skin-card__sample {
    opacity: 0.6;
}

.kv-skin-card__plan,
.kv-skin-card__note {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-1);
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-medium);
}

.kv-swatch-card__colors {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    width: 100%;
    height: 2.25rem;
    border-radius: var(--kv-radius-sm);
    overflow: hidden;
}

/* A small drawing of the shell: the menu (i) on its side of the content (b). */
.kv-layout-card__sketch {
    display: grid;
    gap: 3px;
    width: 100%;
    height: 3.5rem;
    padding: 4px;
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface-2);
}

.kv-layout-card__sketch i {
    border-radius: 2px;
    background: var(--kv-brand);
}

.kv-layout-card__sketch b {
    border-radius: 2px;
    background: var(--kv-border);
}

.kv-layout-card__sketch[data-menu="left"] {
    grid-template-columns: 1fr 4fr;
}

.kv-layout-card__sketch[data-menu="right"] {
    grid-template-columns: 4fr 1fr;
}

.kv-layout-card__sketch[data-menu="right"] i {
    order: 2;
}

.kv-layout-card__sketch[data-menu="top"] {
    grid-template-rows: 1fr 4fr;
}

.kv-layout-card__sketch[data-menu="bottom"] {
    grid-template-rows: 4fr 1fr;
}

.kv-layout-card__sketch[data-menu="bottom"] i {
    order: 2;
}

.kv-form--colors {
    margin-top: var(--kv-space-3);
}

.kv-color {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-color input[type="color"] {
    width: 3rem;
    height: var(--kv-target);
    padding: 2px;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    cursor: pointer;
}

.kv-logo-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-4);
}

.kv-logo-field__preview {
    width: 4rem;
    height: 4rem;
    border-radius: var(--kv-radius-md);
    border: 1px solid var(--kv-border);
    object-fit: contain;
    background: var(--kv-surface-2);
}

.kv-logo-field__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

/* A file picker drawn as a button: the input stays in the label, hidden, so the keyboard still reaches it. */
.kv-button--file {
    cursor: pointer;
}

.kv-button--file:focus-within {
    outline: 2px solid var(--kv-focus);
    outline-offset: 2px;
}

/* A skin's card on the appearance screen: a corner of the app in that skin's own styles (skins.css). */
.kv-skin-card__sample {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--kv-space-2);
    width: 100%;
    min-height: 3.5rem;
    padding: var(--kv-space-2) var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
}

/* A skin's floor (the neon grid) stays inside its own card instead of covering the page. */
.kv-skin-card__sample {
    position: relative;
    overflow: hidden;
}

.kv-skin-card__sample[data-skin]::before {
    position: absolute;
    inset: 0;
    height: auto;
}

.kv-skin-card__sample[data-skin="board"] {
    background: var(--kv-tile-hinge);
}

/* The appearance history: one row per saved version, its colors, what it was and when, and the way back to it. */
.kv-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
    gap: var(--kv-space-3);
}

.kv-history-card {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--kv-space-3);
    padding: var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
}

.kv-history-card .kv-swatch-card__colors {
    height: 2.5rem;
}

.kv-history-card__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: var(--kv-text-sm);
}

.kv-history-card__text > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/*
  The shared inbox (§5.1, ADR-0028): the list, the open thread and the contact, side by side on a wide screen and each
  scrolling on its own; on the phone they are steps (data-step) and only the current one shows.
*/
.kv-inbox {
    --kv-inbox-height: calc(100dvh - 4rem - 2 * var(--kv-space-6));
    display: grid;
    grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr) minmax(16rem, 20rem);
    height: var(--kv-inbox-height);
    min-height: 28rem;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
    background: var(--kv-surface);
    overflow: hidden;
}

.kv-inbox__list,
.kv-inbox__thread,
.kv-inbox__contact {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.kv-inbox__list {
    border-right: 1px solid var(--kv-border);
}

.kv-inbox__contact {
    gap: var(--kv-space-3);
    padding: var(--kv-space-4);
    border-left: 1px solid var(--kv-border);
    overflow-y: auto;
}

.kv-inbox__head {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
    padding: var(--kv-space-4);
    border-bottom: 1px solid var(--kv-border);
}

.kv-inbox__head h1 {
    margin: 0;
    font-size: var(--kv-text-xl);
}

.kv-inbox__items {
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-y: auto;
}

.kv-inbox__item {
    display: flex;
    align-items: flex-start;
    gap: var(--kv-space-3);
    width: 100%;
    padding: var(--kv-space-3) var(--kv-space-4);
    border: 0;
    border-bottom: 1px solid var(--kv-border);
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.kv-inbox__item:hover {
    background: var(--kv-surface-2);
}

.kv-inbox__item[aria-current="true"] {
    background: var(--kv-surface-2);
    box-shadow: inset 3px 0 0 var(--kv-accent);
}

.kv-inbox__item-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.kv-inbox__item-top,
.kv-inbox__item-bottom {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
    min-width: 0;
}

.kv-inbox__item-top strong {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-inbox__item-top time {
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
    white-space: nowrap;
}

.kv-inbox__preview {
    flex: 1;
    overflow: hidden;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-inbox__closing {
    display: inline-flex;
    color: var(--kv-accent-ink);
}

.kv-inbox__unread {
    display: inline-grid;
    place-items: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.35rem;
    border-radius: var(--kv-radius-pill);
    background: var(--kv-accent);
    color: var(--kv-on-accent);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
}

.kv-inbox__thread-head {
    display: flex;
    align-items: center;
    gap: var(--kv-space-3);
    padding: var(--kv-space-3) var(--kv-space-4);
    border-bottom: 1px solid var(--kv-border);
}

.kv-inbox__who {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.kv-inbox__who > * {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-inbox__assign select {
    max-width: 14rem;
}

.kv-inbox__back {
    display: none;
}

/* "New messages": over the end of the thread while the person reads further up (ADR-0039). */
.kv-inbox__newer {
    position: relative;
    z-index: 1;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-1);
    margin-top: calc(-2.5rem - var(--kv-space-2));
    margin-bottom: var(--kv-space-2);
    padding: var(--kv-space-1) var(--kv-space-3);
    border: 0;
    border-radius: 999px;
    background: var(--kv-brand);
    color: var(--kv-on-brand);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    box-shadow: var(--kv-shadow-md);
    cursor: pointer;
}

/* Back at the end by hand (kartiva.followEnd marks it): nothing new is waiting below. */
.kv-inbox__messages[data-kv-at-end="1"] + .kv-inbox__newer {
    display: none;
}

.kv-inbox__messages {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    flex: 1;
    margin: 0;
    padding: var(--kv-space-4);
    list-style: none;
    overflow-y: auto;
    background: var(--kv-bg);
}

.kv-inbox__older {
    align-self: center;
    margin: var(--kv-space-2) 0;
}

.kv-inbox__day {
    align-self: center;
    margin: var(--kv-space-2) 0;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
}

/* A message: the customer's on the left, the business's on the right in its brand. */
.kv-bubble {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    max-width: min(34rem, 80%);
    padding: var(--kv-space-2) var(--kv-space-3);
    border-radius: var(--kv-radius-md);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.kv-bubble--in {
    align-self: flex-start;
    border: 1px solid var(--kv-border);
    border-bottom-left-radius: var(--kv-radius-sm);
    background: var(--kv-surface);
}

.kv-bubble--out {
    align-self: flex-end;
    border-bottom-right-radius: var(--kv-radius-sm);
    background: var(--kv-brand-fill);
    color: var(--kv-on-brand-fill);
}

.kv-bubble--failed {
    outline: 2px solid var(--kv-danger);
}

.kv-bubble__author {
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    opacity: 0.85;
}

.kv-bubble__meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--kv-space-1);
    font-size: var(--kv-text-xs);
    opacity: 0.8;
}

.kv-bubble__status[data-status="read"] {
    color: var(--kv-online);
}

.kv-bubble__status[data-status="failed"] {
    color: var(--kv-danger);
    font-weight: var(--kv-weight-bold);
}

/* What customers write goes in the reading letter, whose stack ends with the color emoji fonts (--kv-font-emoji). */
.kv-bubble__text,
.kv-bubble__reaction,
.kv-inbox__preview {
    font-family: var(--kv-font-sans);
}

/* A notice by WhatsApp and the template it goes as outside the 24-hour window (ADR-0048). */
.kv-notice-card {
    display: grid;
    gap: var(--kv-space-3);
}

.kv-notice-card__values {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2) var(--kv-space-4);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-notice-card__preview {
    margin: 0;
    padding: var(--kv-space-3);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface-2);
    white-space: pre-line;
}

.kv-notice-card__actions {
    display: flex;
    justify-content: flex-end;
}

/* The business's own account at a payment provider (ADR-0077): the provider on the left; its mode, its account and
   what can be done on the right, each at its natural width, wrapping under the name on a narrow screen. */
.kv-payment-connection {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2) var(--kv-space-4);
    padding-block: var(--kv-space-2);
}

.kv-payment-connection + .kv-payment-connection {
    border-top: 1px solid var(--kv-border);
}

.kv-payment-connection__state {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--kv-space-2) var(--kv-space-3);
    text-align: right;
}

/* The options of a message (ADR-0048): one per line under the text, like WhatsApp's reply buttons. */
.kv-bubble__options {
    display: grid;
    gap: var(--kv-space-1);
    margin: var(--kv-space-2) 0 0;
    padding: 0;
    list-style: none;
}

.kv-bubble__options li {
    padding: var(--kv-space-1) var(--kv-space-2);
    border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent);
    text-align: center;
    font-weight: var(--kv-weight-medium);
}

/* The customer's reaction, hanging from the bubble's lower corner like WhatsApp's. */
.kv-bubble {
    position: relative;
}

.kv-bubble__reaction {
    position: absolute;
    bottom: calc(var(--kv-space-3) * -1);
    left: var(--kv-space-2);
    padding: 0 var(--kv-space-1);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-pill);
    background: var(--kv-surface);
    color: var(--kv-text);
    font-size: var(--kv-text-sm);
    line-height: 1.4;
}

.kv-bubble:has(.kv-bubble__reaction) {
    margin-bottom: var(--kv-space-3);
}

/* Files in a bubble: an image or sticker that opens in full, players, a document to download, a place on the map. */
.kv-bubble__media {
    display: block;
    line-height: 0;
}

.kv-bubble__image {
    max-width: min(18rem, 100%);
    max-height: 20rem;
    border-radius: var(--kv-radius-sm);
    object-fit: cover;
}

/* A sticker goes as WhatsApp shows it: on its own, without the bubble around it, about 144 px; an animated one plays. */
.kv-bubble--sticker {
    border-color: transparent;
    background: transparent;
    color: var(--kv-text);
    padding-inline: 0;
}

.kv-bubble__image--sticker {
    width: 9rem;
    height: 9rem;
    max-width: 100%;
    object-fit: contain;
}

.kv-bubble__sticker-missing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 9rem;
    height: 9rem;
    max-width: 100%;
    border: 1px dashed var(--kv-border);
    border-radius: var(--kv-radius-md);
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
}

.kv-bubble__audio {
    width: min(18rem, 100%);
    height: 2.5rem;
}

.kv-bubble__video {
    max-width: min(20rem, 100%);
    max-height: 20rem;
    border-radius: var(--kv-radius-sm);
}

.kv-bubble__document,
.kv-bubble__location {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
    color: inherit;
    text-decoration: none;
}

.kv-bubble__document {
    min-width: min(14rem, 100%);
    padding: var(--kv-space-2);
    border: 1px solid color-mix(in srgb, currentColor 25%, transparent);
    border-radius: var(--kv-radius-sm);
}

.kv-bubble__document > span:not(.kv-sr-only) {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.kv-bubble__document strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-bubble__document small {
    opacity: 0.8;
}

.kv-bubble__location:hover .kv-bubble__text,
.kv-bubble__document:hover strong {
    text-decoration: underline;
}

.kv-bubble__media-state {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-1);
    font-size: var(--kv-text-sm);
    font-style: italic;
    opacity: 0.85;
}

.kv-bubble__error {
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
}

.kv-inbox__thread > .kv-notice {
    margin: var(--kv-space-3) var(--kv-space-4);
}

/* After the 24 h window: why the box is locked, and the way out (an approved template). */
.kv-inbox__closed {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--kv-space-2);
    padding: var(--kv-space-3) var(--kv-space-4);
    border-top: 1px solid var(--kv-border);
}

.kv-inbox__template,
.kv-inbox__quick {
    flex: none;
}

/* The clip opens the file picker, which stays hidden; the chosen file waits above the box with its caption. */
.kv-inbox__attach {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--kv-radius-md);
    color: var(--kv-text-muted);
    cursor: pointer;
}

.kv-inbox__attach:hover,
.kv-inbox__attach:focus-within {
    background: color-mix(in srgb, currentColor 8%, transparent);
    color: var(--kv-text);
}

.kv-inbox__attach input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.kv-inbox__attachment {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
    margin: 0 var(--kv-space-4);
    padding: var(--kv-space-2) var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-bottom: none;
    border-radius: var(--kv-radius-md) var(--kv-radius-md) 0 0;
    background: var(--kv-surface);
}

.kv-inbox__attachment-name {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.kv-inbox__attachment-name strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-inbox__thread > .kv-inbox__attachment + .kv-field__error {
    padding: 0 var(--kv-space-4);
}

.kv-template-picker__category {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
    margin: 0;
    font-size: var(--kv-text-sm);
}

.kv-template-picker__preview {
    max-width: 100%;
    margin-left: auto;
}

.kv-inbox__composer {
    display: flex;
    align-items: flex-end;
    gap: var(--kv-space-2);
    padding: var(--kv-space-3) var(--kv-space-4);
    border-top: 1px solid var(--kv-border);
}

.kv-inbox__composer textarea {
    flex: 1;
    min-height: 2.75rem;
    max-height: 10rem;
    resize: vertical;
}

.kv-inbox__thread > .kv-field__error {
    padding: 0 var(--kv-space-4) var(--kv-space-3);
}

/* Reply to the customer or leave a note for the team: the switch sits above the box, which loses its own line. */
.kv-inbox__modes {
    padding: var(--kv-space-2) var(--kv-space-4) 0;
    border-top: 1px solid var(--kv-border);
}

.kv-inbox__modes .kv-segmented {
    display: inline-grid;
}

.kv-inbox__modes .kv-segmented__option {
    min-height: 2rem;
    padding: 0 var(--kv-space-3);
}

.kv-inbox__modes + .kv-inbox__composer,
.kv-inbox__modes + .kv-inbox__closed,
.kv-inbox__modes + .kv-notice,
.kv-inbox__modes + .kv-inbox__attachment {
    border-top: none;
}

.kv-inbox__modes + .kv-inbox__attachment {
    margin-top: var(--kv-space-2);
}

.kv-inbox__composer--note textarea {
    border-color: var(--kv-accent);
    background: var(--kv-warning-soft);
}

/* An internal note: across the thread in the note colour, never mistaken for something the customer reads. */
.kv-note {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    align-self: center;
    width: min(40rem, 92%);
    padding: var(--kv-space-2) var(--kv-space-3);
    border: 1px dashed color-mix(in oklab, var(--kv-accent) 55%, var(--kv-border));
    border-left: 4px solid var(--kv-accent);
    border-radius: var(--kv-radius-md);
    background: var(--kv-warning-soft);
    color: var(--kv-text);
}

.kv-note__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-1);
    font-size: var(--kv-text-xs);
}

.kv-note__text {
    font-family: var(--kv-font-sans);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.kv-note__meta,
.kv-note__confirm,
.kv-note__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--kv-space-1);
    font-size: var(--kv-text-xs);
}

.kv-note__meta {
    color: var(--kv-text-muted);
}

.kv-note__edit {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
}

/* The quick replies above the box: what "/" or the bolt offers, the chosen one marked, each with its shortcut and text. */
.kv-quick-picker {
    max-height: 16rem;
    margin: var(--kv-space-2) var(--kv-space-4) 0;
    padding: var(--kv-space-1);
    overflow-y: auto;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    box-shadow: var(--kv-shadow-sm);
}

.kv-quick-picker > p,
.kv-quick-picker > a {
    display: block;
    margin: 0;
    padding: var(--kv-space-2) var(--kv-space-3);
    font-size: var(--kv-text-sm);
}

.kv-quick-picker__items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-quick-picker__item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: var(--kv-space-2) var(--kv-space-3);
    border: none;
    border-radius: var(--kv-radius-sm);
    background: transparent;
    color: var(--kv-text);
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.kv-quick-picker__item:hover {
    background: var(--kv-surface-2);
}

[aria-selected="true"] > .kv-quick-picker__item {
    background: var(--kv-surface-2);
    box-shadow: inset 3px 0 0 var(--kv-accent);
}

.kv-quick-picker__head,
.kv-quick-list__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--kv-space-2);
    font-size: var(--kv-text-sm);
}

.kv-quick-picker__head code,
.kv-quick-list__head code {
    color: var(--kv-brand-ink);
    font-weight: var(--kv-weight-bold);
}

.kv-quick-picker__text,
.kv-quick-list__text {
    display: -webkit-box;
    overflow: hidden;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: pre-wrap;
}

.kv-inbox__thread > .kv-inbox__missing {
    padding: 0 var(--kv-space-4) var(--kv-space-2);
    color: var(--kv-warning);
}

/* The settings page of the quick replies: the form, then one card per reply. */
.kv-quick-form {
    margin-bottom: var(--kv-space-5);
}

.kv-quick-form__shortcut {
    display: flex;
    align-items: center;
    gap: var(--kv-space-1);
    font-weight: var(--kv-weight-bold);
}

.kv-quick-form__variables {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
}

.kv-quick-form__variable {
    padding-right: var(--kv-space-3);
    font-family: ui-monospace, monospace;
    cursor: pointer;
}

.kv-quick-list {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-quick-list__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--kv-space-1) var(--kv-space-3);
    padding: var(--kv-space-3) var(--kv-space-4);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
}

.kv-quick-list__text {
    grid-column: 1;
    font-size: var(--kv-text-sm);
}

.kv-quick-list__actions {
    display: flex;
    grid-row: 1 / span 2;
    grid-column: 2;
    align-items: center;
}

/* The AI agent's page (ADR-0037): its usage, its knowledge base with the entries to complete, and the try. */
.kv-agent__usage,
.kv-agent__hint {
    margin: 0 0 var(--kv-space-3);
    font-size: var(--kv-text-sm);
}

.kv-agent__template summary {
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
    cursor: pointer;
}

.kv-agent__template p {
    margin: var(--kv-space-2) 0 0;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
    white-space: pre-wrap;
}

.kv-agent__pending {
    border-color: var(--kv-accent);
    box-shadow: inset 3px 0 0 var(--kv-accent);
}

.kv-agent__body {
    grid-column: 1;
    font-size: var(--kv-text-sm);
    white-space: pre-wrap;
}

.kv-agent__entry {
    grid-column: 1 / -1;
}

.kv-agent__chat {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    margin: 0 0 var(--kv-space-3);
    padding: 0;
    list-style: none;
}

.kv-agent__chat:empty {
    display: none;
}

.kv-agent__handoff {
    display: block;
    margin-top: var(--kv-space-1);
    color: var(--kv-accent-ink);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
}

.kv-agent__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

.kv-agent__try {
    display: flex;
    gap: var(--kv-space-2);
}

.kv-agent__try .kv-input {
    flex: 1;
    min-width: 0;
}

/* The inbox: a conversation the agent handed to a person, and the switch that pauses the agent in it. */
.kv-inbox__needs {
    display: inline-flex;
    color: var(--kv-accent-ink);
}

.kv-inbox__ai {
    white-space: nowrap;
}

.kv-inbox__contact h2 {
    margin: 0;
    font-size: var(--kv-text-lg);
}

.kv-inbox__facts {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    margin: 0;
}

.kv-inbox__facts dt {
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
}

.kv-inbox__facts dd {
    margin: 0;
}

.kv-inbox__stages {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-inbox > .kv-inbox__thread > .kv-empty,
.kv-inbox__list > .kv-empty {
    margin: auto;
}

/* A medium screen gives the thread the room: the contact opens as a step. */
@media (max-width: 79.99rem) {
    .kv-inbox {
        grid-template-columns: minmax(16rem, 20rem) minmax(0, 1fr);
    }

    .kv-inbox__contact {
        display: none;
    }

    .kv-inbox[data-step="Contact"] .kv-inbox__thread {
        display: none;
    }

    .kv-inbox[data-step="Contact"] .kv-inbox__contact {
        display: flex;
    }

    .kv-inbox__contact .kv-inbox__back {
        display: inline-flex;
        align-self: flex-start;
    }
}

/* The phone: one step at a time, with "Back". */
@media (max-width: 47.99rem) {
    .kv-inbox {
        --kv-inbox-height: calc(100dvh - 4rem - var(--kv-bottom-nav) - 2 * var(--kv-space-4));
        grid-template-columns: minmax(0, 1fr);
        border-radius: var(--kv-radius-md);
    }

    .kv-inbox .kv-inbox__list,
    .kv-inbox .kv-inbox__thread,
    .kv-inbox .kv-inbox__contact {
        display: none;
        border: 0;
    }

    .kv-inbox[data-step="List"] .kv-inbox__list,
    .kv-inbox[data-step="Thread"] .kv-inbox__thread,
    .kv-inbox[data-step="Contact"] .kv-inbox__contact {
        display: flex;
    }

    .kv-inbox__back {
        display: inline-flex;
    }

    .kv-inbox__assign select {
        max-width: 8rem;
    }
}

/* Development's mailbox (/dev/mail, ADR-0035): the list of messages beside the one shown as a mail client would. */
.kv-dev-mail {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-4);
    min-height: 100vh;
    padding: var(--kv-space-5);
    background: var(--kv-bg);
}

.kv-dev-mail__head h1 {
    margin: 0;
}

.kv-dev-mail__grid {
    display: grid;
    flex: 1;
    grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
    gap: var(--kv-space-4);
}

.kv-dev-mail__list {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-dev-mail__list a {
    display: flex;
    flex-direction: column;
    padding: var(--kv-space-2) var(--kv-space-3);
    border-radius: var(--kv-radius-md);
    color: var(--kv-text);
    text-decoration: none;
}

.kv-dev-mail__list a[aria-current="true"],
.kv-dev-mail__list a:hover {
    background: var(--kv-surface-2);
}

.kv-dev-mail__list span {
    font-size: var(--kv-text-xs);
}

.kv-dev-mail__pane {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
}

.kv-dev-mail__view {
    width: 100%;
    min-height: 70vh;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: #f6f5f1;
}

@media (max-width: 47.99rem) {
    .kv-dev-mail__grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Commerce modules (ADR-0040): data tables, figures and compact forms shared by every screen of the family D. */
.kv-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface);
}

.kv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--kv-text-sm);
    font-variant-numeric: tabular-nums;
}

.kv-table th,
.kv-table td {
    padding: var(--kv-space-2) var(--kv-space-3);
    border-bottom: 1px solid var(--kv-border);
    text-align: left;
    vertical-align: top;
}

.kv-table th {
    position: sticky;
    top: 0;
    background: var(--kv-surface-2);
    font-weight: var(--kv-weight-medium);
    color: var(--kv-text-muted);
    white-space: nowrap;
}

.kv-table tbody tr:last-child td {
    border-bottom: 0;
}

.kv-table tbody tr:hover {
    background: color-mix(in oklab, var(--kv-surface-2) 60%, transparent);
}

.kv-table .kv-num {
    text-align: right;
    white-space: nowrap;
}

.kv-table tr[data-muted="true"] td {
    color: var(--kv-text-muted);
}

.kv-table tfoot td {
    font-weight: var(--kv-weight-bold);
    background: var(--kv-surface-2);
}

.kv-table__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--kv-space-1);
}

.kv-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: var(--kv-space-3);
    margin: 0 0 var(--kv-space-4);
}

.kv-stat {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    padding: var(--kv-space-3) var(--kv-space-4);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface);
}

.kv-stat dt {
    font-size: var(--kv-text-xs);
    color: var(--kv-text-muted);
}

.kv-stat dd {
    margin: 0;
    font-size: var(--kv-text-xl);
    font-weight: var(--kv-weight-bold);
    font-variant-numeric: tabular-nums;
}

.kv-grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: var(--kv-space-3) var(--kv-space-4);
}

.kv-grid-form .kv-field--wide {
    grid-column: 1 / -1;
}

.kv-lines {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
}

.kv-line {
    display: grid;
    grid-template-columns: minmax(10rem, 3fr) minmax(5rem, 1fr) minmax(6rem, 1fr) auto;
    gap: var(--kv-space-2);
    align-items: end;
}

.kv-checks {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2) var(--kv-space-4);
}

.kv-tree {
    margin: 0;
    padding-left: var(--kv-space-4);
    list-style: none;
}

.kv-tree .kv-tree {
    border-left: 1px dashed var(--kv-border);
    margin-left: var(--kv-space-2);
}

.kv-tree__node {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
    padding: var(--kv-space-1) 0;
}

.kv-tree__level {
    font-size: var(--kv-text-xs);
    color: var(--kv-text-muted);
}

/* Categorías «Por niveles» (ADR-0057): a select per level, the search, the table of one level and the bar of the changes
   not saved yet. On a phone the table turns into one card per row. */
.kv-categories__views {
    margin-bottom: var(--kv-space-4);
}

.kv-levels__choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--kv-space-3);
    margin-bottom: var(--kv-space-3);
}

.kv-levels__toolbar {
    align-items: end;
}

.kv-levels__search {
    flex: 1 1 16rem;
}

.kv-levels__results {
    display: grid;
    gap: var(--kv-space-1);
    margin: 0 0 var(--kv-space-4);
    padding: 0;
    list-style: none;
}

.kv-levels__result {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--kv-space-3);
    inline-size: 100%;
    min-block-size: 2.75rem;
    padding: var(--kv-space-2) var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface);
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.kv-levels__result:hover {
    background: var(--kv-surface-2);
}

.kv-levels__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2);
    margin-bottom: var(--kv-space-3);
}

.kv-levels__title {
    margin: 0;
    font-size: var(--kv-text-lg);
}

.kv-levels__table .kv-levels__name {
    min-inline-size: 10rem;
}

.kv-levels__table .kv-levels__num {
    inline-size: 6rem;
}

.kv-levels__open {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-1);
    min-block-size: 2rem;
    padding: 0 var(--kv-space-2);
    border: 0;
    border-radius: var(--kv-radius-sm);
    background: transparent;
    color: var(--kv-brand);
    font: inherit;
    cursor: pointer;
}

.kv-levels__open:hover {
    background: var(--kv-surface-2);
}

.kv-levels__table tr[data-pending="true"] td {
    background: color-mix(in oklab, var(--kv-brand) 6%, transparent);
}

.kv-levels__table tr[data-highlight="true"] td {
    background: color-mix(in oklab, var(--kv-brand) 12%, transparent);
}

.kv-levels__bar {
    position: sticky;
    bottom: var(--kv-space-3);
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-3);
    margin-top: var(--kv-space-3);
    padding: var(--kv-space-3);
    border: 1px solid var(--kv-brand);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface);
}

@media (max-width: 47.99rem) {
    .kv-levels__bar {
        bottom: calc(var(--kv-bottom-nav) + var(--kv-space-2));
    }

    .kv-levels__table thead {
        position: absolute;
        inline-size: 1px;
        block-size: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .kv-levels__table tr {
        display: grid;
        gap: var(--kv-space-2);
        padding: var(--kv-space-3);
        border-bottom: 1px solid var(--kv-border);
    }

    .kv-levels__table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--kv-space-3);
        padding: 0;
        border: 0;
    }

    .kv-levels__table td[data-label]::before {
        content: attr(data-label);
        color: var(--kv-text-muted);
    }

    .kv-levels__table .kv-levels__name {
        flex: 1;
        min-inline-size: 0;
    }

    .kv-levels__table .kv-table__actions {
        justify-content: flex-start;
    }
}

.kv-print {
    max-width: 48rem;
    padding: var(--kv-space-6);
    background: #ffffff;
    color: #111111;
}

@media (max-width: 47.99rem) {
    .kv-line {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media print {
    .kv-shell__nav,
    .kv-shell__rail,
    .kv-topbar,
    .kv-bottom-nav,
    .kv-page-header__actions,
    .kv-no-print {
        display: none !important;
    }
}

/* Deliveries (ADR-0040, piece 7): the slots offered by day, as chips to pick one, and the signature pad. */
.kv-slots {
    display: grid;
    gap: var(--kv-space-3);
    margin-block: var(--kv-space-3);
}

.kv-slots__day {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-slots__day > strong {
    min-width: 7rem;
    font-size: var(--kv-text-sm);
}

button.kv-chip {
    padding-inline: var(--kv-space-3);
    color: var(--kv-text);
    cursor: pointer;
    font: inherit;
    font-size: var(--kv-text-sm);
}

button.kv-chip:hover {
    border-color: var(--kv-accent);
}

button.kv-chip[aria-pressed="true"] {
    border-color: var(--kv-accent);
    background: var(--kv-accent);
    color: var(--kv-on-accent);
}

.kv-signature {
    display: block;
    width: 100%;
    max-width: 32rem;
    height: 10rem;
    border: 1px dashed var(--kv-border-strong, var(--kv-border));
    border-radius: var(--kv-radius-md);
    background: #fff;
    touch-action: none;
}

.kv-evidence {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-3);
}

.kv-evidence img {
    max-width: 16rem;
    max-height: 12rem;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: #fff;
}

/* A number typed inside a table cell (ADR-0040, piece 9: what arrived, what goes back). */
.kv-input--sm {
    width: 5.5rem;
    min-height: 2rem;
    padding-block: 0.25rem;
    text-align: right;
}

/* The photos and documents of a record (ADR-0049): thumbnails in a grid, documents by name. */
.kv-record-files__list {
    display: grid;
    gap: var(--kv-space-2);
    margin: 0 0 var(--kv-space-3);
    padding: 0;
    list-style: none;
}

.kv-record-files__list--gallery {
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
}

.kv-record-files__item {
    display: grid;
    gap: var(--kv-space-1);
    justify-items: start;
}

.kv-record-files__item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--kv-radius-md);
    border: 1px solid var(--kv-border);
}

.kv-record-files__upload {
    cursor: pointer;
}

/* The calendar (ADR-0050): a day per section, its appointments by time, with their state and what can be done. */
.kv-calendar__toolbar {
    align-items: end;
    flex-wrap: wrap;
}

.kv-calendar__range {
    margin-inline: var(--kv-space-2) auto;
}

.kv-calendar__day + .kv-calendar__day {
    margin-top: var(--kv-space-4);
}

.kv-calendar__date {
    font-size: var(--kv-text-lg);
}

.kv-calendar__list {
    display: grid;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-calendar__item {
    display: grid;
    grid-template-columns: 7rem 1fr auto;
    gap: var(--kv-space-2) var(--kv-space-3);
    align-items: center;
    padding: var(--kv-space-2) var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
}

.kv-calendar__item[data-status="cancelled"] {
    opacity: 0.6;
}

.kv-calendar__time {
    font-variant-numeric: tabular-nums;
    font-weight: var(--kv-weight-medium);
}

.kv-calendar__what {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1) var(--kv-space-2);
}

.kv-calendar__actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
    justify-content: flex-end;
}

.kv-appointment-slots {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    margin-block: var(--kv-space-3);
}

.kv-chip--selected {
    background: var(--kv-accent);
    color: var(--kv-on-accent);
}

@media (max-width: 40rem) {
    .kv-calendar__item {
        grid-template-columns: 1fr auto;
    }

    .kv-calendar__what {
        grid-column: 1 / -1;
    }
}

/*
  The calendar's grids (ADR-0050). Week and day: a column per day over the hours of the schedule, the closed times on
  the second surface and the open ones on the page's own, each appointment a block placed by its times. Month: whole
  weeks from Monday with chips. Who attends gets one of five hues drawn from the business's three brand colors, so
  every palette and both schemes recolor them; the status changes the block's weight, not its hue.
*/
.kv-calendar-grid,
.kv-calendar-month {
    --kv-calendar-hour: 3.5rem;
    --kv-calendar-hue-0: var(--kv-brand-fill);
    --kv-calendar-hue-1: var(--kv-accent);
    --kv-calendar-hue-2: var(--kv-online);
    --kv-calendar-hue-3: color-mix(in oklab, var(--kv-brand-fill) 45%, var(--kv-online));
    --kv-calendar-hue-4: color-mix(in oklab, var(--kv-accent) 45%, var(--kv-brand-fill));
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
    background: var(--kv-surface);
    overflow: hidden;
}

.kv-calendar-grid__scroll {
    max-height: max(24rem, calc(100dvh - 16rem));
    overflow: auto;
    overscroll-behavior: contain;
}

.kv-calendar-grid__head,
.kv-calendar-grid__body {
    display: grid;
    grid-template-columns: 3.5rem repeat(var(--kv-calendar-days), minmax(0, 1fr));
}

.kv-calendar-grid[data-view="week"] :is(.kv-calendar-grid__head, .kv-calendar-grid__body) {
    min-width: 46rem;
}

.kv-calendar-grid__head {
    position: sticky;
    top: 0;
    z-index: 6;
    background: var(--kv-surface);
    border-bottom: 1px solid var(--kv-border);
}

.kv-calendar-grid__corner {
    position: sticky;
    left: 0;
    background: var(--kv-surface);
}

.kv-calendar-grid__day-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--kv-space-2);
    padding: var(--kv-space-2) var(--kv-space-1);
    border-left: 1px solid var(--kv-border);
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-medium);
    text-transform: capitalize;
}

.kv-calendar-grid__day-name strong {
    display: inline-grid;
    place-items: center;
    min-width: 2rem;
    height: 2rem;
    padding-inline: var(--kv-space-1);
    border-radius: var(--kv-radius-pill);
    color: var(--kv-text);
    font-size: var(--kv-text-lg);
    font-weight: var(--kv-weight-bold);
    font-variant-numeric: tabular-nums;
}

.kv-calendar-grid__day-name[data-today] {
    color: var(--kv-text);
}

.kv-calendar-grid__day-name[data-today] strong {
    background: var(--kv-brand-fill);
    color: var(--kv-on-brand-fill);
}

.kv-calendar-grid__body {
    height: calc(var(--kv-calendar-hours) * var(--kv-calendar-hour));
}

.kv-calendar-grid__gutter {
    position: sticky;
    left: 0;
    z-index: 5;
    display: grid;
    grid-auto-rows: var(--kv-calendar-hour);
    background: var(--kv-surface);
}

.kv-calendar-grid__hour {
    padding-inline-end: var(--kv-space-2);
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
    font-variant-numeric: tabular-nums;
    text-align: end;
    transform: translateY(-0.6em);
}

.kv-calendar-grid__hour:first-child {
    transform: none;
}

/* The column is the closed time; the open times sit over it on the page's surface, the hour lines over both. */
.kv-calendar-grid__column {
    position: relative;
    min-width: 0;
    border-left: 1px solid var(--kv-border);
    background: var(--kv-surface-2);
}

.kv-calendar-grid__column::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background-image: linear-gradient(to bottom, var(--kv-border) 1px, transparent 1px);
    background-size: 100% var(--kv-calendar-hour);
    pointer-events: none;
}

.kv-calendar-grid__open {
    position: absolute;
    inset-inline: 0;
    background: var(--kv-surface);
}

.kv-calendar-grid__column[data-today] .kv-calendar-grid__open {
    background: color-mix(in oklab, var(--kv-brand-fill) 3%, var(--kv-surface));
}

.kv-calendar-grid__slot {
    position: absolute;
    inset-inline: 0;
    z-index: 2;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.kv-calendar-grid__slot:hover {
    background: color-mix(in oklab, var(--kv-brand-fill) 10%, transparent);
}

.kv-calendar-grid__now {
    position: absolute;
    inset-inline: 0;
    z-index: 4;
    border-top: 2px solid var(--kv-danger);
    pointer-events: none;
}

.kv-calendar-grid__now::before {
    content: "";
    position: absolute;
    top: calc(-0.3125rem - 1px);
    left: -0.3125rem;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: var(--kv-radius-pill);
    background: var(--kv-danger);
}

.kv-calendar-block,
.kv-calendar-chip {
    --kv-calendar-hue: var(--kv-calendar-hue-0);
    margin: 0;
    border: 1px solid color-mix(in oklab, var(--kv-calendar-hue) 55%, var(--kv-surface));
    border-radius: var(--kv-radius-sm);
    background: color-mix(in oklab, var(--kv-calendar-hue) 18%, var(--kv-surface));
    color: var(--kv-text);
    font: inherit;
    font-size: var(--kv-text-xs);
    line-height: 1.3;
    text-align: start;
    cursor: pointer;
    transition: background-color var(--kv-duration-fast) var(--kv-ease-out);
}

.kv-calendar-block:hover,
.kv-calendar-chip:hover {
    background: color-mix(in oklab, var(--kv-calendar-hue) 30%, var(--kv-surface));
}

.kv-calendar-block:focus-visible,
.kv-calendar-chip:focus-visible {
    z-index: 7;
    outline-offset: 1px;
}

:is(.kv-calendar-block, .kv-calendar-chip)[data-hue="1"] {
    --kv-calendar-hue: var(--kv-calendar-hue-1);
}

:is(.kv-calendar-block, .kv-calendar-chip)[data-hue="2"] {
    --kv-calendar-hue: var(--kv-calendar-hue-2);
}

:is(.kv-calendar-block, .kv-calendar-chip)[data-hue="3"] {
    --kv-calendar-hue: var(--kv-calendar-hue-3);
}

:is(.kv-calendar-block, .kv-calendar-chip)[data-hue="4"] {
    --kv-calendar-hue: var(--kv-calendar-hue-4);
}

/* Attended: done, so it steps back. No-show: only its outline, dashed in red. Cancelled: struck through, dimmed. */
:is(.kv-calendar-block, .kv-calendar-chip)[data-status="attended"] {
    border-color: var(--kv-border-strong);
    background: color-mix(in oklab, var(--kv-calendar-hue) 7%, var(--kv-surface));
    color: var(--kv-text-muted);
}

:is(.kv-calendar-block, .kv-calendar-chip)[data-status="noShow"] {
    border-style: dashed;
    border-color: var(--kv-danger);
    background: var(--kv-surface);
    color: var(--kv-text-muted);
}

:is(.kv-calendar-block, .kv-calendar-chip)[data-status="cancelled"] {
    border-color: var(--kv-border);
    background: var(--kv-surface-2);
    color: var(--kv-row-cancelled);
    text-decoration: line-through;
}

.kv-calendar-block {
    position: absolute;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-height: 1.375rem;
    padding: var(--kv-space-1) var(--kv-space-2);
    overflow: hidden;
}

.kv-calendar-block > * {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-calendar-block__time {
    font-variant-numeric: tabular-nums;
    font-weight: var(--kv-weight-medium);
}

.kv-calendar-block__service {
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-bold);
}

/* Under 45 minutes there is room for one line: the time and the service. */
.kv-calendar-block[data-short] {
    flex-direction: row;
    align-items: center;
    gap: var(--kv-space-1);
    padding-block: 0;
}

.kv-calendar-block[data-short] .kv-calendar-block__service {
    font-size: var(--kv-text-xs);
}

.kv-calendar-block[data-short] :is(.kv-calendar-block__who, .kv-calendar-block__end) {
    display: none;
}

.kv-calendar-block[data-short] .kv-calendar-block__time {
    flex: none;
}

.kv-calendar-month__head,
.kv-calendar-month__days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.kv-calendar-month__head span {
    padding: var(--kv-space-2);
    border-bottom: 1px solid var(--kv-border);
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    text-transform: capitalize;
}

/* The 1 px gap shows the border color between the days. */
.kv-calendar-month__days {
    gap: 1px;
    background: var(--kv-border);
}

.kv-calendar-month__day {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    min-height: 7.5rem;
    padding: var(--kv-space-1);
    background: var(--kv-surface);
    cursor: pointer;
    transition: background-color var(--kv-duration-fast) var(--kv-ease-out);
}

.kv-calendar-month__day:hover {
    background: color-mix(in oklab, var(--kv-brand-fill) 5%, var(--kv-surface));
}

.kv-calendar-month__day[data-outside] {
    background: var(--kv-surface-2);
}

.kv-calendar-month__number {
    align-self: flex-start;
    min-width: 2rem;
    height: 2rem;
    padding-inline: var(--kv-space-1);
    border: 0;
    border-radius: var(--kv-radius-pill);
    background: none;
    color: var(--kv-text);
    font: inherit;
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-bold);
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.kv-calendar-month__day[data-outside] .kv-calendar-month__number {
    color: var(--kv-text-muted);
}

.kv-calendar-month__day[data-today] .kv-calendar-month__number {
    background: var(--kv-brand-fill);
    color: var(--kv-on-brand-fill);
}

.kv-calendar-chip {
    display: flex;
    gap: var(--kv-space-1);
    width: 100%;
    min-width: 0;
    padding: 1px var(--kv-space-1);
}

.kv-calendar-chip__time {
    flex: none;
    font-variant-numeric: tabular-nums;
    font-weight: var(--kv-weight-bold);
}

.kv-calendar-chip__what {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kv-calendar-month__more {
    align-self: flex-start;
    padding: 0 var(--kv-space-1);
    border: 0;
    background: none;
    color: var(--kv-brand-ink);
    font: inherit;
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    cursor: pointer;
}

.kv-calendar-month__more:hover {
    text-decoration: underline;
}

.kv-calendar-detail__status {
    align-self: flex-start;
}

.kv-calendar-detail .kv-record-facts {
    margin: 0;
}

.kv-calendar-detail .kv-dialog__actions {
    flex-wrap: wrap;
}

@media (max-width: 47.99rem) {
    .kv-calendar-grid,
    .kv-calendar-month {
        --kv-calendar-hour: 3rem;
    }

    .kv-calendar-month__day {
        min-height: 4.75rem;
    }

    /* On the phone a day shows its times; the day view has the rest. */
    .kv-calendar-chip__what {
        display: none;
    }
}

/* ── Tasks, the bell and the automations (ADR-0052) ─────────────────────────────────────────── */

.kv-task-list {
    display: grid;
    gap: var(--kv-space-2);
    margin: 0 0 var(--kv-space-3);
    padding: 0;
    list-style: none;
}

.kv-task {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: var(--kv-space-3);
    align-items: start;
    padding: var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
}

.kv-task[data-status="overdue"] {
    border-color: var(--kv-danger);
}

.kv-task[data-status="done"] .kv-task__title {
    text-decoration: line-through;
    color: var(--kv-text-muted);
}

.kv-task[data-status="archived"] {
    grid-template-columns: 1fr auto;
    opacity: 0.75;
}

.kv-task__check {
    inline-size: 1.25rem;
    block-size: 1.25rem;
    margin-top: 0.125rem;
    accent-color: var(--kv-accent);
}

.kv-task__body {
    display: grid;
    gap: var(--kv-space-1);
    min-width: 0;
}

.kv-task__title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.kv-task__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    align-items: center;
    font-size: 0.875rem;
}

.kv-task__notes {
    font-size: 0.875rem;
    white-space: pre-line;
}

.kv-task__actions {
    display: flex;
    gap: var(--kv-space-1);
}

.kv-contact-tasks {
    display: grid;
    gap: var(--kv-space-2);
    justify-items: start;
}

.kv-contact-tasks .kv-task-list {
    justify-self: stretch;
}

.kv-bell > summary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 2.5rem;
    block-size: 2.5rem;
    border-radius: var(--kv-radius-pill);
    cursor: pointer;
    list-style: none;
}

.kv-bell > summary::-webkit-details-marker {
    display: none;
}

.kv-bell__count {
    position: absolute;
    top: 0.125rem;
    right: 0.125rem;
    min-inline-size: 1.125rem;
    padding: 0 0.25rem;
    border-radius: var(--kv-radius-pill);
    background: var(--kv-danger-fill);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
}

.kv-bell__panel {
    min-width: min(22rem, 90vw);
    max-height: 70vh;
    overflow-y: auto;
}

.kv-bell__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2);
    padding: var(--kv-space-1) var(--kv-space-2);
}

.kv-bell__items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-bell__item {
    display: grid;
    gap: 0.125rem;
    inline-size: 100%;
    padding: var(--kv-space-2);
    border: 0;
    border-radius: var(--kv-radius-sm);
    background: none;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.kv-bell__item:hover,
.kv-bell__item:focus-visible {
    background: var(--kv-surface-2);
}

.kv-bell__item[data-read="false"] .kv-bell__message {
    font-weight: 600;
}

.kv-bell__when,
.kv-bell__empty {
    font-size: 0.8125rem;
}

.kv-bell__empty {
    padding: var(--kv-space-2);
}

.kv-automation__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-automation[data-supported="false"] {
    opacity: 0.75;
}

.kv-automation p {
    margin: var(--kv-space-1) 0 0;
}

.kv-automation-runs {
    display: grid;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-automation-runs > li {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    align-items: center;
}

/* The visual editor of automations (ADR-0083): the flow on the left, top to bottom, and its panel on the right. */
.kv-flow__bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-3);
    align-items: end;
    margin-bottom: var(--kv-space-4);
}

.kv-flow__bar .kv-field {
    min-width: 14rem;
}

.kv-flow__bar .kv-flow__days {
    min-width: 6rem;
    max-width: 8rem;
}

.kv-flow__bar-actions {
    display: flex;
    gap: var(--kv-space-3);
    align-items: center;
    margin-inline-start: auto;
}

.kv-flow__issues ul {
    margin: var(--kv-space-1) 0 0;
    padding-inline-start: var(--kv-space-5);
}

.kv-flow__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
    gap: var(--kv-space-5);
    align-items: start;
}

@media (max-width: 900px) {
    .kv-flow__layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.kv-flow__canvas {
    display: grid;
    justify-items: center;
    gap: 0;
    padding: var(--kv-space-4);
    overflow-x: auto;
    border: 1px dashed var(--kv-border-strong);
    border-radius: var(--kv-radius-lg);
    background: var(--kv-surface-2);
}

.kv-flow__list {
    display: grid;
    justify-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-flow__item {
    display: grid;
    justify-items: center;
    width: 100%;
}

.kv-flow__card {
    display: flex;
    align-items: stretch;
    gap: var(--kv-space-2);
    width: min(100%, 22rem);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    color: var(--kv-text);
    text-align: start;
}

.kv-flow__card--trigger {
    display: grid;
    gap: var(--kv-space-1);
    padding: var(--kv-space-3);
    border-top: 3px solid var(--kv-accent);
    cursor: pointer;
}

.kv-flow__card.is-selected {
    outline: 2px solid var(--kv-accent);
    outline-offset: 1px;
}

.kv-flow__card.has-issue {
    border-color: var(--kv-danger);
}

.kv-flow__open {
    display: grid;
    flex: 1;
    gap: var(--kv-space-1);
    padding: var(--kv-space-3);
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.kv-flow__kind {
    display: inline-flex;
    gap: var(--kv-space-1);
    align-items: center;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kv-flow__summary {
    overflow-wrap: anywhere;
}

.kv-flow__moves {
    display: grid;
    align-content: center;
    padding-inline-end: var(--kv-space-1);
}

.kv-flow__add {
    display: grid;
    justify-items: center;
    padding: var(--kv-space-1) 0;
}

.kv-flow__add::before {
    content: "";
    width: 2px;
    height: var(--kv-space-3);
    background: var(--kv-border-strong);
}

.kv-flow__add-menu {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
    justify-content: center;
}

.kv-flow__branches {
    display: grid;
    grid-template-columns: repeat(2, minmax(14rem, 1fr));
    gap: var(--kv-space-3);
    width: 100%;
    margin-top: var(--kv-space-2);
}

.kv-flow__branch {
    display: grid;
    justify-items: center;
    padding: var(--kv-space-2);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
}

.kv-flow__branch--yes {
    border-top: 3px solid var(--kv-success);
}

.kv-flow__branch--no {
    border-top: 3px solid var(--kv-border-strong);
}

.kv-flow__branch-label {
    font-size: var(--kv-text-sm);
    font-weight: 600;
}

.kv-flow__end {
    padding: var(--kv-space-1) var(--kv-space-4);
    border-radius: var(--kv-radius-pill);
    background: var(--kv-surface-3);
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
}

.kv-flow__panel {
    position: sticky;
    top: var(--kv-space-4);
    display: grid;
    gap: var(--kv-space-3);
    padding: var(--kv-space-4);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
    background: var(--kv-surface);
}

.kv-flow__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
}

.kv-flow__form {
    display: grid;
    gap: var(--kv-space-3);
}

.kv-flow__title {
    margin: 0;
    font-size: var(--kv-text-lg);
}

.kv-flow__rule {
    padding: var(--kv-space-2);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
}

.kv-flow__contacts,
.kv-flow__path,
.kv-flow__runs,
.kv-flow__run-steps {
    display: grid;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-flow__contacts {
    display: flex;
    flex-wrap: wrap;
}

.kv-flow__path > li {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    align-items: center;
}

.kv-flow__runs > li {
    padding-bottom: var(--kv-space-2);
    border-bottom: 1px solid var(--kv-border);
}

.kv-flow__run-steps {
    margin-top: var(--kv-space-1);
    padding-inline-start: var(--kv-space-4);
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
}

/* Configuración → Funciones (ADR-0060): a card per module, its switch on the right, its capabilities folded below. */
.kv-functions__reason {
    max-width: 40rem;
    margin-bottom: var(--kv-space-4);
}

.kv-function__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--kv-space-3);
}

.kv-function__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
    min-width: 0;
}

.kv-function__badges {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
}

.kv-function[data-enabled="false"] .kv-function__line {
    color: var(--kv-text-muted);
}

.kv-function p {
    margin: var(--kv-space-1) 0 0;
}

.kv-function__reset {
    margin-top: var(--kv-space-2);
}

.kv-function__capabilities {
    margin-top: var(--kv-space-3);
    border-top: 1px solid var(--kv-border);
    padding-top: var(--kv-space-2);
}

.kv-function__capabilities > summary {
    min-height: var(--kv-target);
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-medium);
}

.kv-function__list {
    display: grid;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-capability {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-3);
    padding: var(--kv-space-2) 0;
    border-bottom: 1px solid var(--kv-border);
}

.kv-capability:last-child {
    border-bottom: 0;
}

.kv-capability__text {
    display: grid;
    gap: var(--kv-space-1);
    min-width: 0;
    font-size: var(--kv-text-sm);
}

.kv-capability__name {
    font-weight: var(--kv-weight-medium);
}

.kv-capability__adjusted {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-capability[data-enabled="false"] .kv-capability__name {
    color: var(--kv-text-muted);
}

/* The levels of the trade (ADR-0066): three choices side by side over the cards, the business's one marked. */
.kv-levels {
    margin-bottom: var(--kv-space-4);
}

.kv-levels__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-levels p {
    margin: var(--kv-space-1) 0 0;
}

.kv-levels__options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: var(--kv-space-2);
    margin-top: var(--kv-space-3);
}

.kv-level {
    display: grid;
    align-content: start;
    gap: var(--kv-space-1);
    min-height: var(--kv-target);
    padding: var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
    color: inherit;
    font: inherit;
    font-size: var(--kv-text-sm);
    text-align: start;
    cursor: pointer;
}

.kv-level:hover:not(:disabled) {
    border-color: var(--kv-accent);
}

.kv-level:focus-visible {
    outline: 2px solid var(--kv-focus);
    outline-offset: 2px;
}

.kv-level:disabled {
    cursor: default;
}

.kv-level[aria-pressed="true"] {
    border-color: var(--kv-accent);
    box-shadow: inset 0 0 0 1px var(--kv-accent);
}

.kv-level__name {
    font-weight: var(--kv-weight-medium);
}

.kv-level__stay-off {
    color: var(--kv-text-muted);
}

.kv-functions__plan {
    margin-bottom: var(--kv-space-4);
}

/* The platform console's businesses and its support sessions (ADR-0067). */
.kv-businesses {
    margin-top: var(--kv-space-4);
}

.kv-businesses__list {
    display: grid;
    gap: var(--kv-space-2);
    margin: var(--kv-space-3) 0 0;
    padding: 0;
    list-style: none;
}

.kv-business {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2);
    padding: var(--kv-space-2) 0;
    border-bottom: 1px solid var(--kv-border);
}

.kv-business__text {
    display: grid;
    gap: var(--kv-space-1);
    min-width: 0;
}

/* The paid period of each business and the filter by it; its payments and «Ya pagué» open under the row. */
.kv-businesses__filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
    margin-top: var(--kv-space-2);
}

.kv-business__paid {
    font-size: var(--kv-text-sm);
    color: var(--kv-text-muted);
}

.kv-billing {
    flex-basis: 100%;
    display: grid;
    gap: var(--kv-space-2);
    padding: var(--kv-space-2) 0 0;
    overflow-x: auto;
}

.kv-billing__reports {
    display: grid;
    gap: var(--kv-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-billing__report {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
}

/* «Contratar»: the amount with IVA and the transfer data to copy. */
.kv-purchase__pay {
    display: grid;
    gap: var(--kv-space-1);
    margin: var(--kv-space-3) 0;
}

.kv-purchase__transfer {
    display: grid;
    gap: var(--kv-space-1);
    margin: 0;
}

.kv-purchase__transfer div {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

.kv-purchase__transfer dt {
    min-width: 8rem;
    color: var(--kv-text-muted);
}

.kv-purchase__transfer dd {
    margin: 0;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.kv-purchase__clabe,
.kv-purchase__reference {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    user-select: all;
}

.kv-support__band {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--kv-space-2);
    margin-bottom: var(--kv-space-4);
}

/* The log of adjustments: newest first, one card per change. */
.kv-adjustments {
    display: grid;
    gap: var(--kv-space-2);
    margin: 0 0 var(--kv-space-4);
    padding: 0;
    list-style: none;
}

.kv-adjustment__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-adjustment p {
    margin: var(--kv-space-1) 0 0;
}

/* Configuración → Campos (ADR-0061): the entity's fields by section, a row each with its badges and its actions. */
.kv-fields__usage {
    margin: 0 0 var(--kv-space-3);
}

.kv-fields__entities {
    margin-bottom: var(--kv-space-4);
    overflow-x: auto;
}

.kv-fields__list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-3);
    min-height: var(--kv-target);
    padding: var(--kv-space-2) 0;
    border-bottom: 1px solid var(--kv-border);
}

.kv-field-row:last-child {
    border-bottom: 0;
}

.kv-field-row__text {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-1) var(--kv-space-2);
    min-width: 0;
}

.kv-field-row__name {
    overflow-wrap: anywhere;
}

.kv-field-row__badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
}

.kv-field-row[data-hidden="true"] .kv-field-row__name,
.kv-field-row[data-archived="true"] .kv-field-row__name {
    color: var(--kv-text-muted);
}

.kv-fields__sheet .kv-check + .kv-field__hint {
    margin: 0 0 var(--kv-space-3);
}

.kv-fields__roles {
    border: 0;
    margin: 0 0 var(--kv-space-3);
    padding: 0;
}

.kv-fields__type,
.kv-fields__preview {
    margin-top: var(--kv-space-3);
    border-top: 1px solid var(--kv-border);
    padding-top: var(--kv-space-2);
}

.kv-fields__type > summary,
.kv-fields__preview > summary {
    min-height: var(--kv-target);
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: var(--kv-weight-medium);
}

.kv-fields__preview-form {
    border: 1px dashed var(--kv-border);
    border-radius: var(--kv-radius-md);
    padding: var(--kv-space-3);
    max-height: 50vh;
    overflow-y: auto;
}

@media (max-width: 640px) {
    .kv-field-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Configuración → Nombres (ADR-0062): the search and the reason side by side when there is room; a row per name with the
   template's word under the business's and its actions on the right, stacked on a phone. */
.kv-names__tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: var(--kv-space-3);
    max-width: 60rem;
    margin-bottom: var(--kv-space-4);
}

.kv-names__language {
    margin: 0 0 var(--kv-space-3);
}

.kv-names__list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-name-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-3);
    min-height: var(--kv-target);
    padding: var(--kv-space-2) 0;
    border-bottom: 1px solid var(--kv-border);
}

.kv-name-row:last-child {
    border-bottom: 0;
}

.kv-name-row__text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--kv-space-1);
    min-width: 0;
}

.kv-name-row__name {
    overflow-wrap: anywhere;
}

.kv-name-row__group,
.kv-name-row__template {
    font-size: var(--kv-text-sm);
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .kv-name-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .kv-task {
        grid-template-columns: auto 1fr;
    }

    .kv-task__actions {
        grid-column: 2;
    }
}

/* ── WhatsApp broadcasts, tags and consent (ADR-0053) ─────────────────────────────────────── */

.kv-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-1);
    padding: 0.125rem var(--kv-space-2);
    border-radius: var(--kv-radius-pill);
    background: var(--kv-surface-2);
    font-size: 0.875rem;
}

.kv-tag__remove {
    display: inline-flex;
    padding: 0;
    border: 0;
    background: none;
    color: var(--kv-text-muted);
    cursor: pointer;
}

.kv-tag__remove:hover,
.kv-tag__remove:focus-visible {
    color: var(--kv-danger);
}

.kv-tags__add {
    display: flex;
    gap: var(--kv-space-2);
    align-items: center;
}

.kv-contact-marketing {
    display: grid;
    gap: var(--kv-space-2);
    justify-items: start;
}

.kv-broadcast-list {
    display: grid;
    gap: var(--kv-space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-broadcast {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--kv-space-2) var(--kv-space-3);
    align-items: center;
}

.kv-broadcast__name {
    font-weight: 600;
}

.kv-broadcast .kv-broadcast-counts {
    grid-column: 1 / -1;
}

.kv-broadcast-counts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
    gap: var(--kv-space-3);
    margin: 0;
}

.kv-broadcast-counts__item dt {
    color: var(--kv-text-muted);
    font-size: 0.8125rem;
}

.kv-broadcast-counts__item dd {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.kv-broadcast-counts--compact .kv-broadcast-counts__item dd {
    font-size: 1rem;
}

.kv-steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    margin: 0 0 var(--kv-space-4);
    padding: 0;
    list-style: none;
    counter-reset: kv-step;
}

.kv-steps > li {
    counter-increment: kv-step;
}

.kv-steps__button {
    display: inline-flex;
    gap: var(--kv-space-2);
    align-items: center;
    padding: var(--kv-space-1) var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-pill);
    background: var(--kv-surface);
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.kv-steps__button::before {
    content: counter(kv-step);
    font-weight: 700;
}

.kv-steps > li[aria-current="step"] .kv-steps__button {
    border-color: var(--kv-accent);
    background: var(--kv-accent);
    color: var(--kv-on-accent);
}

.kv-steps__button:disabled {
    cursor: default;
    opacity: 0.6;
}

.kv-fieldset {
    display: grid;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    border: 0;
}

.kv-fieldset > legend {
    margin-bottom: var(--kv-space-1);
    font-weight: 600;
}

.kv-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    align-items: end;
}

.kv-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--kv-space-2);
    margin-top: var(--kv-space-3);
}

.kv-template-body {
    margin: 0;
    padding: var(--kv-space-3);
    border-inline-start: 3px solid var(--kv-accent);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface-2);
    white-space: pre-line;
}

.kv-audience-summary {
    display: grid;
    gap: var(--kv-space-1);
}

.kv-audience-summary p {
    margin: 0;
}

.kv-audience-summary__count {
    font-size: 1.125rem;
}

/* The home dashboard (ADR-0054): blocks of tiles on the board, each figure with its comparison and where it leads. */
.kv-home__toolbar {
    align-items: center;
    margin-top: var(--kv-space-5);
}

.kv-home__toolbar .kv-segmented {
    display: inline-grid;
}

.kv-home__at {
    font-size: var(--kv-text-sm);
}

.kv-home__block {
    margin-block: var(--kv-space-5);
}

.kv-home__title {
    margin: 0 0 var(--kv-space-3);
    font-size: var(--kv-text-lg);
}

.kv-home__title a {
    color: inherit;
}

.kv-home__tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: var(--kv-space-3);
}

.kv-tile {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    padding: var(--kv-space-3) var(--kv-space-4);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface);
    min-inline-size: 0;
}

.kv-tile--urgent {
    border-color: var(--kv-accent);
}

.kv-tile__label a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: color-mix(in oklab, currentColor 35%, transparent);
    text-underline-offset: 0.2em;
}

.kv-tile__value .kv-flap {
    font-size: 1.75rem;
    flex-wrap: wrap;
}

.kv-tile__delta,
.kv-tile__hint {
    font-size: var(--kv-text-xs);
}

.kv-tile__delta {
    color: var(--kv-text-muted);
    font-variant-numeric: tabular-nums;
}

.kv-tile__delta--better {
    color: var(--kv-success);
}

.kv-tile__delta--worse {
    color: var(--kv-danger);
}

.kv-funnel {
    display: grid;
    gap: var(--kv-space-2);
    margin: var(--kv-space-4) 0 0;
    padding: 0;
    list-style: none;
}

.kv-funnel__stage {
    display: grid;
    grid-template-columns: minmax(7rem, 12rem) minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--kv-space-3);
}

.kv-funnel__track {
    block-size: 0.75rem;
    border-radius: 999px;
    background: color-mix(in oklab, var(--kv-text-muted) 14%, transparent);
    overflow: hidden;
}

.kv-funnel__bar {
    display: block;
    block-size: 100%;
    border-radius: inherit;
    background: var(--kv-funnel-color, var(--kv-brand));
}

.kv-funnel__count {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
    font-variant-numeric: tabular-nums;
    font-size: var(--kv-text-sm);
}

@media (max-width: 40rem) {
    .kv-funnel__stage {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .kv-funnel__track {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

/* Configuración → Listas (ADR-0056): the lists on one side, the items of the chosen one on the other; stacked on a phone,
   where each row of the table becomes a card with its labels. */
.kv-lists {
    display: grid;
    grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
    gap: var(--kv-space-6);
    align-items: start;
}

.kv-lists__group {
    margin: var(--kv-space-4) 0 var(--kv-space-2);
    font-size: var(--kv-text-sm);
    font-weight: var(--kv-weight-medium);
    color: var(--kv-text-muted);
}

.kv-lists__group:first-child {
    margin-top: 0;
}

.kv-lists__choices {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-lists__choice {
    display: flex;
    justify-content: space-between;
    gap: var(--kv-space-2);
    inline-size: 100%;
    padding: var(--kv-space-2) var(--kv-space-3);
    border: 1px solid transparent;
    border-radius: var(--kv-radius-sm);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.kv-lists__choice:hover {
    background: var(--kv-surface-2);
}

.kv-lists__choice[aria-current="true"] {
    border-color: var(--kv-border);
    background: var(--kv-surface);
    font-weight: var(--kv-weight-medium);
}

.kv-lists__title {
    margin: 0 0 var(--kv-space-3);
    font-size: var(--kv-text-lg);
}

/* While a search is on, the arrows that reorder the list hide; this line says why. */
.kv-lists__hint {
    margin: 0 0 var(--kv-space-2);
    font-size: var(--kv-text-sm);
}

@media (max-width: 47.99rem) {
    .kv-lists {
        grid-template-columns: minmax(0, 1fr);
    }

    .kv-lists__choices {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .kv-lists__choice {
        inline-size: auto;
        border-color: var(--kv-border);
    }

    .kv-lists__table thead {
        position: absolute;
        inline-size: 1px;
        block-size: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .kv-lists__table tr {
        display: grid;
        gap: var(--kv-space-1);
        padding: var(--kv-space-3);
        border-bottom: 1px solid var(--kv-border);
    }

    .kv-lists__table td {
        display: flex;
        justify-content: space-between;
        gap: var(--kv-space-3);
        padding: 0;
        border: 0;
    }

    .kv-lists__table td[data-label]::before {
        content: attr(data-label);
        color: var(--kv-text-muted);
    }

    .kv-lists__table .kv-table__actions {
        justify-content: flex-start;
    }
}

/* The customer portal (ADR-0069): mobile first, one column, with the business's name, logo and colors over Kartiva's
   components. The business's skin hangs from [data-skin] as in the app. */
.kv-portal {
    min-height: 100dvh;
    background: var(--kv-surface);
    color: var(--kv-text);
    display: flex;
    flex-direction: column;
}

.kv-portal__bar {
    background: var(--kv-brand);
    color: var(--kv-on-brand);
    display: flex;
    align-items: center;
    gap: var(--kv-space-3);
    padding: var(--kv-space-3) var(--kv-space-4);
}

.kv-portal__bar img {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--kv-radius-md, 0.5rem);
    object-fit: contain;
    background: var(--kv-surface-raised, #fff);
}

.kv-portal__name {
    font-weight: 700;
    font-size: var(--kv-text-lg, 1.125rem);
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.kv-portal__bar .kv-button {
    color: inherit;
}

.kv-portal__main {
    width: 100%;
    max-width: 40rem;
    margin: 0 auto;
    padding: var(--kv-space-5) var(--kv-space-4) var(--kv-space-10);
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-5);
}

.kv-portal__form {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-4);
}

.kv-portal__notice {
    white-space: pre-line;
    line-height: 1.6;
}

.kv-portal__sections,
.kv-portal__records,
.kv-portal__fields,
.kv-portal__files {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
}

.kv-portal__record {
    width: 100%;
    text-align: start;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-3);
    padding: var(--kv-space-4);
    min-height: 3rem;
}

.kv-portal__field dt {
    font-size: var(--kv-text-sm);
    color: var(--kv-text-muted);
}

.kv-portal__field dd {
    margin: var(--kv-space-1) 0 0;
    overflow-wrap: anywhere;
}

/* The modules' sections of the portal (ADR-0069): «Mi saldo» (each credit, its amounts, «Pagar» and its payments) and
   «Mis citas»; the same cards as the template's sections, one column on the phone. */
.kv-portal__module {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-4);
}

.kv-portal__credit,
.kv-portal__studies,
.kv-portal__appointment {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
    padding: var(--kv-space-4);
}

.kv-portal__credit-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--kv-space-3);
}

.kv-portal__credit-head h2,
.kv-portal__credit-head h3 {
    margin: 0;
    font-size: var(--kv-text-base);
    overflow-wrap: anywhere;
}

.kv-portal__amounts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--kv-space-3);
    margin: 0;
}

.kv-portal__amounts dt {
    font-size: var(--kv-text-sm);
    color: var(--kv-text-muted);
}

.kv-portal__amounts dd {
    margin: var(--kv-space-1) 0 0;
    font-variant-numeric: tabular-nums;
}

.kv-portal__balance dd {
    font-weight: 600;
}

.kv-portal__next,
.kv-portal__when,
.kv-portal__muted {
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-portal__muted {
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
}

.kv-portal__subtitle {
    margin: 0;
    font-size: var(--kv-text-sm);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--kv-text-muted);
}

.kv-portal__pay {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
}

.kv-portal__payments {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
}

.kv-portal__payment {
    display: flex;
    justify-content: space-between;
    gap: var(--kv-space-3);
    font-variant-numeric: tabular-nums;
}

/* «Mis estudios» (ADR-0095): each class of the term as a row with its outcome on the right, its timetable under it and
   its partial grades, final grade and attendance as a strip of small figures that wraps on the phone. */
.kv-portal__classes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
}

.kv-portal__class {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    padding-block-end: var(--kv-space-3);
    border-block-end: 1px solid var(--kv-border);
}

.kv-portal__class:last-child {
    padding-block-end: 0;
    border-block-end: 0;
}

.kv-portal__class-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--kv-space-3);
}

.kv-portal__grades {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2) var(--kv-space-4);
    margin: var(--kv-space-1) 0 0;
}

.kv-portal__grades dt {
    font-size: var(--kv-text-xs);
    color: var(--kv-text-muted);
}

.kv-portal__grades dd {
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.kv-portal__final dd {
    font-weight: 600;
}

/* «Documentos pendientes» (ADR-0097): what the school still needs, listed inside its notice. */
.kv-portal__missing-list {
    margin: var(--kv-space-1) 0;
    padding-inline-start: var(--kv-space-5);
}

.kv-portal__transcript td:first-child,
.kv-portal__transcript td:nth-child(4) {
    font-variant-numeric: tabular-nums;
}

/* «Mis suscripciones» (ADR-0078): an open charge's amount with its «Pagar», kept together on the right. */
.kv-portal__charge-pay {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: var(--kv-space-2);
}

/* «Estado de cuenta» (ADR-0091): each pending charge with its due date and late fees under it, its amount on the right;
   the selected total and the pay buttons below, wrapping on the phone. */
.kv-portal__school-concept {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    min-width: 0;
}

.kv-portal__school-fee {
    padding-left: var(--kv-space-5);
}

.kv-portal__school-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

.kv-portal__school-total {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* A payment link the team sends (ADR-0091): the link to copy beside its button, and the list of charges to choose. */
.kv-paylink {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
}

.kv-paylink__url {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    align-items: center;
}

.kv-paylink__url .kv-input {
    flex: 1 1 16rem;
    min-width: 0;
}

.kv-paylink__charges {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
}

.kv-paylink__fee {
    padding-left: var(--kv-space-6);
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
}

@media (max-width: 24rem) {
    .kv-portal__amounts {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* «Configuración → Portal» (ADR-0069): the portal's look beside a small portal screen that previews it; one column on
   the phone. The preview carries its own colors and skin, so the app around it keeps its own. */
.kv-portal-look {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--kv-space-5);
    align-items: start;
}

@media (min-width: 64rem) {
    .kv-portal-look {
        grid-template-columns: minmax(0, 1fr) 20rem;
    }

    .kv-portal--preview {
        position: sticky;
        top: var(--kv-space-4);
    }
}

.kv-portal-look__choices,
.kv-portal-look__modes,
.kv-portal-look__brand {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
    min-width: 0;
}

.kv-portal--preview {
    min-height: 0;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md, 0.5rem);
    overflow: hidden;
    pointer-events: none;
}

.kv-portal--preview .kv-portal__main {
    padding: var(--kv-space-4);
    gap: var(--kv-space-3);
}

.kv-portal--preview .kv-button {
    align-self: flex-start;
}

.kv-portal__preview-hello {
    margin: 0;
    font-weight: 700;
    font-size: var(--kv-text-lg, 1.125rem);
}

.kv-portal-privacy__text {
    width: 100%;
    min-height: 12rem;
    resize: vertical;
    white-space: pre-wrap;
}

/* The filter bar of every list and board (§13.3): search, dates and the list's own filters in one row that wraps. */
.kv-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--kv-space-3);
    margin-bottom: var(--kv-space-4);
}

.kv-filterbar__field {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    min-width: 10rem;
}

.kv-filterbar__label {
    font-size: var(--kv-text-xs, 0.75rem);
    font-weight: 600;
    color: var(--kv-text-muted);
}

.kv-filterbar__end {
    display: flex;
    align-items: center;
    gap: var(--kv-space-3);
    margin-left: auto;
    min-height: 2.5rem;
}

.kv-filterbar__busy {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-2);
    color: var(--kv-text-muted);
}

.kv-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: kv-spin 0.8s linear infinite;
}

@keyframes kv-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .kv-spinner { animation: none; }
}

/* The pages of a list (§13.3): the range, the size of a page and previous / next. */
.kv-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--kv-space-3);
    margin-top: var(--kv-space-4);
}

.kv-pager__range {
    color: var(--kv-text-muted);
}

.kv-pager__size {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-pager__size .kv-input {
    width: auto;
}

.kv-pager__moves {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-2);
}

/* Lead forms (ADR-0081): the public page in the portal's frame, its hidden trap, and the builder's list of fields. */
.kv-lead-form__trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.kv-lead-form__form {
  position: relative;
}

.kv-lead-form--embed .kv-portal__main {
  padding-block: var(--kv-space-3, 0.75rem);
}

.kv-lead-form-fields {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.kv-lead-form-fields__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.kv-lead-form-fields__row .kv-input {
  flex: 1 1 12rem;
  max-width: 24rem;
}

/* The reports, the funnel and the dashboards (ADR-0082): charts drawn as SVG in the business's skin, light and dark. */
:root,
[data-skin] {
    --kv-chart-1: var(--kv-brand-fill);
    --kv-chart-2: var(--kv-accent);
    --kv-chart-3: var(--kv-online-ink);
    --kv-chart-4: color-mix(in oklab, var(--kv-brand-fill) 50%, var(--kv-accent));
    --kv-chart-5: color-mix(in oklab, var(--kv-brand-fill) 45%, var(--kv-surface));
    --kv-chart-6: color-mix(in oklab, var(--kv-accent) 55%, var(--kv-surface));
    --kv-chart-7: var(--kv-danger);
    --kv-chart-8: color-mix(in oklab, var(--kv-online-ink) 50%, var(--kv-surface));
    --kv-chart-other: var(--kv-border-strong);
}

.kv-chart {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    min-width: 0;
    padding: var(--kv-space-4);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
    background: var(--kv-surface);
}

.kv-chart__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--kv-space-2);
}

.kv-chart__title {
    margin: 0;
    font-size: var(--kv-text-base);
    font-weight: var(--kv-weight-bold);
}

.kv-chart__actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

.kv-chart__subtitle {
    margin: 0;
    font-size: var(--kv-text-sm);
}

.kv-chart__body {
    min-width: 0;
    overflow-x: auto;
}

.kv-chart__figure {
    margin: 0;
}

.kv-chart__svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: 320px;
}

.kv-chart__svg--donut {
    max-width: 220px;
    margin-inline: auto;
}

.kv-chart__figure--donut {
    display: grid;
    grid-template-columns: minmax(140px, 220px) 1fr;
    align-items: center;
    gap: var(--kv-space-4);
}

.kv-chart__grid {
    stroke: var(--kv-border);
    stroke-width: 1;
}

.kv-chart__baseline {
    stroke: var(--kv-border-strong);
    stroke-width: 1;
}

.kv-chart__tick,
.kv-chart__category {
    fill: var(--kv-text-muted);
    font-size: 11px;
    font-family: var(--kv-font-sans);
}

.kv-chart__line {
    stroke-width: 2.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.kv-chart__bar:hover,
.kv-chart__slice:hover,
.kv-chart__point:hover {
    opacity: 0.8;
}

.kv-chart__donut-total {
    fill: var(--kv-text);
    font-size: 22px;
    font-weight: var(--kv-weight-bold);
    font-family: var(--kv-font-board);
}

.kv-chart__legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2) var(--kv-space-4);
    margin: var(--kv-space-2) 0 0;
    padding: 0;
    list-style: none;
    font-size: var(--kv-text-sm);
}

.kv-chart__legend--list {
    flex-direction: column;
}

.kv-chart__legend li {
    display: inline-flex;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-chart__swatch {
    display: inline-block;
    inline-size: 0.75rem;
    block-size: 0.75rem;
    border-radius: 3px;
    flex: none;
}

.kv-kpi {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
}

.kv-kpi__value {
    font-family: var(--kv-font-board);
    font-size: 2.25rem;
    font-weight: var(--kv-weight-bold);
    line-height: 1.1;
}

.kv-dashboard {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: var(--kv-space-4);
}

.kv-dashboard__tile--s {
    grid-column: span 2;
}

.kv-dashboard__tile--m {
    grid-column: span 3;
}

.kv-dashboard__tile--l {
    grid-column: span 6;
}

.kv-report-funnel {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-report-funnel__stage {
    display: grid;
    grid-template-columns: minmax(7rem, 11rem) 1fr minmax(8rem, auto);
    align-items: center;
    gap: var(--kv-space-3);
}

/* «Configuración → Integraciones»: API keys, outgoing webhooks and the public API's documentation. */
.kv-integrations__tabs {
    margin-bottom: var(--kv-space-4);
}

.kv-integrations__bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2) var(--kv-space-4);
}

.kv-integrations__bar > p {
    margin: 0;
    max-width: 60ch;
}

.kv-integrations__sub {
    display: block;
    font-size: var(--kv-text-xs);
}

.kv-integrations__chips {
    gap: var(--kv-space-1);
}

.kv-integrations__chip {
    min-height: 1.5rem;
    padding-inline: var(--kv-space-2);
    font-size: var(--kv-text-xs);
}

.kv-integrations__checks {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: var(--kv-space-2);
}

.kv-integrations__checks code {
    font-size: var(--kv-text-xs);
}

.kv-integrations__dialog {
    width: min(40rem, 100%);
}

.kv-integrations__key {
    white-space: nowrap;
}

.kv-integrations__error {
    max-width: 32ch;
    overflow-wrap: anywhere;
}

.kv-integrations__code {
    margin: 0;
    padding: var(--kv-space-3);
    overflow-x: auto;
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface-2);
    font-size: var(--kv-text-xs);
    line-height: 1.5;
    white-space: pre;
}

.kv-integrations__pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--kv-space-3);
}

.kv-report-funnel__track {
    position: relative;
    block-size: 1.5rem;
    border-radius: var(--kv-radius-sm);
    background: color-mix(in oklab, var(--kv-border) 60%, transparent);
}

.kv-report-funnel__bar {
    display: block;
    block-size: 100%;
    border-radius: var(--kv-radius-sm);
    background: var(--kv-funnel-color, var(--kv-chart-1));
}

.kv-report-funnel__step {
    font-size: var(--kv-text-xs);
    color: var(--kv-text-muted);
    padding-inline-start: 11.75rem;
}

.kv-builder {
    display: grid;
    grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
    gap: var(--kv-space-5);
    align-items: start;
}

.kv-builder__form {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
}

.kv-builder__filter {
    display: grid;
    grid-template-columns: 1fr 6rem 1fr auto;
    gap: var(--kv-space-2);
    align-items: end;
}

@media (max-width: 960px) {
    .kv-dashboard__tile--s,
    .kv-dashboard__tile--m {
        grid-column: span 6;
    }

    .kv-builder {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .kv-chart__figure--donut {
        grid-template-columns: minmax(0, 1fr);
    }

    .kv-report-funnel__stage {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--kv-space-1);
    }

    .kv-report-funnel__step {
        padding-inline-start: 0;
    }

    .kv-builder__filter {
        grid-template-columns: minmax(0, 1fr);
    }
}

.kv-report-name {
    padding: 0;
    border: 0;
    background: none;
    color: var(--kv-brand-ink);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.kv-report-list {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    margin: 0;
    padding: 0;
    list-style: none;
}
/* A secret shown once: the value selectable whole, the copy button beside it. */
.kv-secret {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-secret__value {
    flex: 1 1 16rem;
    padding: var(--kv-space-2) var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface-2);
    overflow-wrap: anywhere;
    user-select: all;
}

.kv-webhook[data-status="disabled"] {
    border-color: var(--kv-danger);
}

.kv-webhook__disabled {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-webhook__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-webhook__url {
    overflow-wrap: anywhere;
    font-weight: var(--kv-weight-medium);
}

.kv-webhook__badges,
.kv-webhook__actions,
.kv-webhook__facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-webhook__facts {
    margin: 0;
    font-size: var(--kv-text-sm);
}

.kv-webhook__failing {
    color: var(--kv-danger);
}

.kv-api-docs__facts {
    display: grid;
    grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: var(--kv-space-2) var(--kv-space-4);
    margin: 0;
}

.kv-api-docs__facts dt {
    font-weight: var(--kv-weight-medium);
}

.kv-api-docs__facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.kv-api-docs__subtitle {
    margin: var(--kv-space-2) 0 0;
    font-size: var(--kv-text-sm);
}

.kv-api-docs__method {
    display: inline-block;
    min-width: 4.25rem;
    padding: 0 var(--kv-space-2);
    border-radius: var(--kv-radius-sm);
    background: var(--kv-surface-2);
    font-size: var(--kv-text-xs);
    font-weight: var(--kv-weight-bold);
    text-align: center;
}

.kv-api-docs__endpoints code {
    white-space: nowrap;
}

.kv-api-docs__retries {
    margin: 0;
    padding-left: var(--kv-space-5);
}

@media (max-width: 40rem) {
    .kv-api-docs__facts {
        grid-template-columns: 1fr;
    }
}

/* The online store of a business (ADR-0085): the portal's frame with a search and the cart in its bar, a grid of
   product cards that goes from two columns on the phone to four on a wide screen, the product's gallery that scrolls
   sideways, the cart's lines and the checkout in one column. Its colors are the business's skin. */
.kv-store__bar {
    flex-wrap: wrap;
}

.kv-store__name {
    color: inherit;
    text-decoration: none;
}

.kv-store__cart {
    color: inherit;
    font-weight: var(--kv-weight-medium);
    white-space: nowrap;
}

.kv-store__search {
    display: flex;
    gap: var(--kv-space-2);
    flex: 1 1 100%;
}

.kv-store__search .kv-input {
    flex: 1;
    min-width: 0;
}

.kv-store__search-button {
    background: var(--kv-accent);
    color: var(--kv-on-accent);
}

.kv-store__main {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
    padding: var(--kv-space-5) var(--kv-space-4) var(--kv-space-10);
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-5);
    flex: 1;
}

.kv-store__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-3) var(--kv-space-5);
    padding: var(--kv-space-5) var(--kv-space-4);
    border-top: 1px solid var(--kv-border);
}

.kv-store__footer .kv-muted {
    flex: 1 1 100%;
    margin: 0;
    font-size: var(--kv-text-sm);
}

.kv-store__hero {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
}

.kv-store__hero h1 {
    margin: 0;
}

.kv-store__banner {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 5;
    object-fit: cover;
    border-radius: var(--kv-radius-lg);
}

.kv-store__tagline {
    margin: 0;
    color: var(--kv-text-muted);
    font-size: var(--kv-text-lg);
}

.kv-store__categories {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

.kv-store__categories a {
    display: inline-block;
    padding: var(--kv-space-2) var(--kv-space-3);
    border: 1px solid var(--kv-border-strong);
    border-radius: var(--kv-radius-pill);
    color: var(--kv-text);
    text-decoration: none;
}

.kv-store__grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--kv-space-3);
}

@media (min-width: 48rem) {
    .kv-store__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .kv-store__search {
        flex: 0 1 24rem;
    }
}

@media (min-width: 64rem) {
    .kv-store__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: var(--kv-space-4);
    }
}

.kv-store__card {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    padding: var(--kv-space-3);
}

.kv-store__card-link {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-2);
    color: var(--kv-text);
    text-decoration: none;
}

.kv-store__card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--kv-radius-md);
    background: var(--kv-bg);
}

.kv-store__card-name {
    font-weight: var(--kv-weight-medium);
    overflow-wrap: anywhere;
}

.kv-store__price {
    font-weight: var(--kv-weight-bold);
}

.kv-store__price--big {
    font-size: var(--kv-text-xl);
    margin: 0;
    display: flex;
    gap: var(--kv-space-2);
    align-items: baseline;
}

.kv-store__crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1) var(--kv-space-2);
    font-size: var(--kv-text-sm);
}

.kv-store__filters summary {
    cursor: pointer;
    font-weight: var(--kv-weight-medium);
}

.kv-store__filters form {
    margin-top: var(--kv-space-3);
}

.kv-store__pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--kv-space-3);
}

.kv-store__product {
    display: grid;
    gap: var(--kv-space-5);
}

@media (min-width: 56rem) {
    .kv-store__product {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
    }
}

.kv-store__gallery {
    display: flex;
    gap: var(--kv-space-2);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
}

.kv-store__gallery img {
    flex: 0 0 100%;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    scroll-snap-align: start;
    border-radius: var(--kv-radius-lg);
    background: var(--kv-bg);
}

.kv-store__details h1 {
    margin: 0;
}

.kv-store__description {
    white-space: pre-line;
    line-height: var(--kv-leading);
}

.kv-store__quantity .kv-input {
    max-width: 6rem;
}

.kv-store__lines {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--kv-space-3);
}

.kv-store__line {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: var(--kv-space-2) var(--kv-space-3);
    align-items: center;
    padding: var(--kv-space-3);
}

.kv-store__line img {
    width: 4.5rem;
    height: 4.5rem;
    object-fit: cover;
    border-radius: var(--kv-radius-md);
    grid-row: span 2;
}

.kv-store__line-text {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    min-width: 0;
}

.kv-store__line-total {
    text-align: end;
}

.kv-store__totals,
.kv-store .kv-dl {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--kv-space-1) var(--kv-space-4);
    margin: 0;
}

.kv-store .kv-dl dd {
    margin: 0;
    text-align: end;
    font-weight: var(--kv-weight-medium);
}

.kv-store__summary {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
    padding: var(--kv-space-4);
}

.kv-store__summary h2 {
    margin: 0;
    font-size: var(--kv-text-lg);
}

.kv-store__summary-lines {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--kv-space-2);
}

.kv-store__summary-lines li {
    display: flex;
    justify-content: space-between;
    gap: var(--kv-space-3);
}

.kv-store__checkout {
    max-width: 40rem;
}

/* Picked up at the branch: the delivery address does not apply, so it is not asked (no script: the page is static). */
.kv-store__checkout:has(input[name="fulfillment"][value="pickup"]:checked) .kv-store__address {
    display: none;
}

/* Configuración → Tienda en línea: its figures in a row of tiles and the products with their switches. */
.kv-store-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--kv-space-3);
    margin: 0;
}

@media (min-width: 48rem) {
    .kv-store-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.kv-store-stats div {
    display: flex;
    flex-direction: column-reverse;
    gap: var(--kv-space-1);
    padding: var(--kv-space-3) var(--kv-space-4);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface);
}

.kv-store-stats dd {
    margin: 0;
    font-size: var(--kv-text-xl);
    font-weight: var(--kv-weight-bold);
}

.kv-store-products td .kv-check {
    justify-content: center;
}

/* The e-mail campaigns' editor (ADR-0087): the blocks beside their preview on a wide screen, one under the other on a
   phone; the preview is the e-mail itself in a sandboxed frame, 600 px for a desktop or 375 px for a phone. */
.kv-email-editor {
  display: grid;
  gap: 1rem;
}

/* «Suscripción» (ADR-0090): the business's plan, how it pays, its fiscal data and its CFDI; the console's billing. */
.kv-subscription__fields {
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    display: grid;
    gap: var(--kv-space-3);
}

.kv-subscription__price,
.kv-subscription__paid {
    margin: 0;
    color: var(--kv-text-muted);
}

.kv-billing-console__facts {
    margin: var(--kv-space-2) 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
    padding: 0;
    list-style: none;
}

.kv-billing-invoice__actions {
    justify-content: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-1);
}

.kv-billing-invoice__message {
    display: block;
}

@media (min-width: 72rem) {
  .kv-email-editor {
    grid-template-columns: minmax(0, 1fr) minmax(0, 40rem);
    align-items: start;
  }

  .kv-email-editor__preview {
    position: sticky;
    top: 1rem;
  }
}

.kv-email-blocks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.kv-email-block {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem;
  border: 1px solid var(--kv-border);
  border-radius: 0.5rem;
}

.kv-email-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.kv-email-block__image {
  display: block;
  max-width: 100%;
  max-height: 12rem;
  border-radius: 0.5rem;
}

.kv-email-blocks__add {
  flex-wrap: wrap;
}

.kv-email-preview__subject {
  margin: 0;
  overflow-wrap: anywhere;
}

.kv-email-preview__frame {
  display: block;
  width: 100%;
  max-width: 600px;
  height: 40rem;
  margin: 0 auto;
  border: 1px solid var(--kv-border);
  border-radius: 0.5rem;
  background: #f6f5f1;
}

.kv-email-preview__frame--phone {
  max-width: 375px;
}

/* The help desk (ADR-0088): the ticket's timeline (public replies, internal notes, the customer's words, changes and
   files), the article editor with its preview, and the public help center. */
.kv-desk__timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--kv-space-3);
}

.kv-desk__entry {
  border: 1px solid var(--kv-border);
  border-radius: var(--kv-radius-md);
  padding: var(--kv-space-3);
  background: var(--kv-surface);
}

.kv-desk__entry--customer {
  background: var(--kv-surface-2);
}

.kv-desk__entry--internal {
  border-style: dashed;
  border-color: var(--kv-accent);
}

.kv-desk__entry--event {
  border: 0;
  padding-block: 0;
  background: transparent;
  color: var(--kv-text-muted);
  font-size: var(--kv-text-sm);
}

.kv-desk__entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--kv-space-2);
  font-size: var(--kv-text-sm);
}

.kv-desk__entry-text,
.kv-desk__description {
  margin: var(--kv-space-1) 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.kv-desk__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kv-space-1);
}

.kv-desk__reply-mode {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kv-space-3);
  margin-bottom: var(--kv-space-2);
}

.kv-desk__attach {
  position: relative;
  cursor: pointer;
}

.kv-desk__category {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: var(--kv-space-2);
  align-items: center;
}

.kv-desk__editor {
  display: grid;
  gap: var(--kv-space-4);
}

@media (min-width: 64rem) {
  .kv-desk__editor {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}

.kv-help__search {
  display: flex;
  gap: var(--kv-space-2);
  margin-block: var(--kv-space-3);
}

.kv-help__search .kv-input {
  flex: 1;
  min-width: 0;
}

.kv-help__categories {
  display: flex;
  flex-wrap: wrap;
  gap: var(--kv-space-2);
  margin-bottom: var(--kv-space-3);
}

.kv-help__categories .kv-chip {
  padding-right: var(--kv-space-3);
  color: var(--kv-text);
  text-decoration: none;
}

.kv-help__categories .kv-chip--on {
  border-color: var(--kv-brand);
  font-weight: var(--kv-weight-bold);
}

.kv-help__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--kv-space-2);
}

.kv-help__item {
  padding: var(--kv-space-3);
}

.kv-help__item p {
  margin: var(--kv-space-1) 0 0;
}

.kv-help__crumbs {
  font-size: var(--kv-text-sm);
  margin-bottom: var(--kv-space-2);
}

.kv-help__article {
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.kv-help__article code {
  font-family: ui-monospace, monospace;
  background: var(--kv-surface-2);
  border-radius: var(--kv-radius-sm);
  padding: 0 0.25em;
}

.kv-help__article blockquote {
  margin: 0;
  padding-left: var(--kv-space-3);
  border-left: 3px solid var(--kv-border);
  color: var(--kv-text-muted);
}

.kv-help__related {
  margin-top: var(--kv-space-4);
}

/* The forecast (ADR-0089): four figures in a row (fewer on a phone), the quota bars and the territories' rules. */
.kv-forecast__figures {
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    margin-block: var(--kv-space-4);
    display: grid;
    gap: var(--kv-space-3);
}

.kv-forecast__figure {
    background: var(--kv-surface);
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-1);
    padding: var(--kv-space-4);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-lg);
}

.kv-forecast__label {
    color: var(--kv-text-muted);
    font-size: var(--kv-text-sm);
}

.kv-forecast__category {
    font-size: var(--kv-text-sm);
    white-space: nowrap;
}

.kv-quota__list {
    display: flex;
    flex-direction: column;
    gap: var(--kv-space-3);
    margin: 0;
    padding: 0;
    list-style: none;
}

.kv-quota__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2) var(--kv-space-3);
}

.kv-quota__item > .kv-quota__bar {
    flex: 1 1 18rem;
}

.kv-quota__bar {
    grid-template-columns: minmax(6rem, 10rem) minmax(6rem, 1fr) auto;
    min-inline-size: 0;
    display: grid;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-quota__bar:not(:has(.kv-quota__name)) {
    grid-template-columns: minmax(6rem, 1fr) auto;
}

.kv-quota__bar[data-done] .kv-funnel__bar {
    background: var(--kv-success, var(--kv-brand));
}

.kv-quota__text {
    font-variant-numeric: tabular-nums;
    font-size: var(--kv-text-sm);
    white-space: nowrap;
}

.kv-quota__form,
.kv-territory__form {
    margin-block-start: var(--kv-space-4);
}

.kv-follow__forecast {
    margin-block-start: var(--kv-space-2);
    display: grid;
    gap: var(--kv-space-2);
}

.kv-territory__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-territory__head .kv-card__title {
    flex: 1 1 auto;
    margin: 0;
}

.kv-territory__rule {
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    align-items: end;
    padding-block: var(--kv-space-2);
    border-block-end: 1px solid var(--kv-border);
    display: grid;
    gap: var(--kv-space-2);
}

.kv-territory__rules {
    padding-inline-start: var(--kv-space-4);
    margin: var(--kv-space-2) 0 0;
}

@media (max-width: 40rem) {
    .kv-quota__bar {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .kv-quota__name {
        grid-column: 1 / -1;
    }
}

/* The console's «Actualizaciones» and what an upgrade changes (ADR-0096 V9): one business per row, its changes under it. */
.kv-upgrades__list {
    display: grid;
    gap: var(--kv-space-2);
    margin: var(--kv-space-3) 0 0;
    padding: 0;
    list-style: none;
}

.kv-upgrade {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--kv-space-2);
    padding: var(--kv-space-2) 0;
    border-bottom: 1px solid var(--kv-border);
}

.kv-upgrade__text {
    display: grid;
    gap: var(--kv-space-1);
    min-width: 0;
}

.kv-upgrade__actions {
    display: flex;
    gap: var(--kv-space-2);
}

.kv-upgrade-details {
    flex-basis: 100%;
    display: grid;
    gap: var(--kv-space-1);
}

.kv-upgrade-details__list {
    margin: 0;
    padding-inline-start: var(--kv-space-5);
}

.kv-upgrade-details code {
    margin-inline-start: var(--kv-space-1);
    font-size: 0.85em;
    color: var(--kv-text-muted);
}

.kv-upgrade-history {
    display: grid;
    gap: var(--kv-space-2);
    margin-top: var(--kv-space-5);
}

/* «Novedades» (ADR-0096 V11): once, above the first screen, for the owner and the administrators. */
.kv-whats-new {
    display: grid;
    gap: var(--kv-space-2);
    margin: var(--kv-space-3) 0;
    padding: var(--kv-space-3) var(--kv-space-4);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
    background: var(--kv-surface-2);
}

.kv-whats-new__head {
    display: flex;
    align-items: center;
    gap: var(--kv-space-2);
}

.kv-whats-new__title {
    margin: 0;
    font-size: 1rem;
}

.kv-whats-new__list {
    display: grid;
    gap: var(--kv-space-1);
    margin: 0;
    padding-inline-start: var(--kv-space-5);
}

.kv-whats-new__where {
    margin-inline-start: var(--kv-space-2);
}

.kv-whats-new__actions {
    display: flex;
    justify-content: flex-end;
}

/* The template's new rules the agent lacks, once the business changed its own (ADR-0096 V6, P5). */
.kv-agent__template-rules {
    display: grid;
    gap: var(--kv-space-2);
    padding: var(--kv-space-3);
    border: 1px solid var(--kv-border);
    border-radius: var(--kv-radius-md);
}

.kv-agent__template-rules p,
.kv-agent__template-rules ul {
    margin: 0;
    font-size: var(--kv-text-sm);
}

.kv-agent__template-rules ul {
    padding-inline-start: var(--kv-space-5);
}

.kv-agent__add-template-rules {
    justify-self: start;
}

/* «En desuso» (ADR-0096 V2, V8): the tag in the menu and beside a field, and the notice of a page. */
.kv-nav-item__tag,
.kv-field__deprecated {
    display: inline-block;
    padding: 0 var(--kv-space-1);
    border: 1px solid var(--kv-border-strong);
    border-radius: var(--kv-radius-sm, 0.375rem);
    color: var(--kv-text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

.kv-field__deprecated {
    margin-inline-start: var(--kv-space-1);
    vertical-align: middle;
}

.kv-field__deprecated-hint {
    display: block;
}

.kv-retiring {
    margin-block-end: var(--kv-space-3);
}

/* The console's «Negocio operador» and the «Plataforma» of an operator's ticket (ADR-0098). */
.kv-operator__choose {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--kv-space-2);
    margin-top: var(--kv-space-3);
}

.kv-operator__choose .kv-input {
    flex: 1 1 16rem;
    min-width: 0;
}

.kv-platform-ticket {
    display: grid;
    gap: var(--kv-space-2);
    margin-bottom: var(--kv-space-4);
}

.kv-platform-ticket p {
    margin: 0;
}

.kv-platform-ticket__plan,
.kv-platform-ticket__actions,
.kv-platform-ticket__console {
    display: flex;
    flex-wrap: wrap;
    gap: var(--kv-space-2);
}

.kv-platform-ticket__reject {
    display: grid;
    gap: var(--kv-space-2);
}

/* «Eliminar negocio» in Configuración → Negocio and the page of a business «Por eliminar» (ADR-0100). */
.kv-danger-zone {
    margin-top: var(--kv-space-4);
    border-color: var(--kv-danger);
}

.kv-danger-zone__form {
    margin-top: var(--kv-space-3);
}

.kv-pending-deletion {
    max-width: 42rem;
    margin: var(--kv-space-4) auto;
}

.kv-pending-deletion__date {
    font-weight: 600;
}

.kv-business__deletion {
    color: var(--kv-danger);
}
