:root {
    --ink: #1f1c19;
    --ink-hover: #36322d;
    --text-secondary: #4f4943;
    --text-muted: #655d56;
    --text-faint: #6f675f;
    --canvas: #f7f5f3;
    --paper: #ffffff;
    --surface-alt: #faf9f7;
    --tile: #f6f5f3;
    --tile-hover: #efece8;
    --hover-strong: var(--line);
    --field-bg: var(--tile);
    --border: #d3cdc5;
    --line: #e3dfd9;
    --control-border: #7a7169;
    --accent-strong: #1b8755;
    --accent-hover: #17734a;
    --accent-ink: #15603e;
    --accent-tint: #d9fdd3;
    --accent-tint-strong: #bdf3b4;
    --brand-green: #25D366;
    --brand-mark: #0078d7;
    --warning: #8a5a00;
    --warning-tint: #fbe8c6;
    --danger: #b3261e;
    --danger-tint: #fbe9e7;
    --danger-border: #f0c4c0;
    --warning-strong: #7a5b00;
    --danger-strong: #8c1d18;
    --on-color: #ffffff;
    --on-color-tint: rgba(255, 255, 255, .15);
    --scrim: rgba(0, 0, 0, .4);
    --avatar-blue: #3b82c4;
    --avatar-amber: #c9862a;
    --tick-read: #53bdeb;

    --radius-control: 8px;
    --radius-item: 10px;
    --radius-card: 12px;
    --radius-menu: 16px;
    --pill: 999px;

    --h-compact: 28px;
    --h-control: 32px;
    --h-touch: 36px;
    --header-h: 64px;
    --content-w: 760px;

    --shadow-card: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow-raised: 0 1px 2px rgba(0, 0, 0, .12);
    --shadow-menu: 0 12px 32px rgba(0, 0, 0, .10), 0 2px 6px rgba(0, 0, 0, .04);
    --shadow-dialog: 0 8px 24px rgba(0, 0, 0, .2);
    --shadow-picker: 0 10px 30px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .08);
    --ring-inset: inset 0 0 0 1px rgba(0, 0, 0, .08);

    --z-banner: 20;
    --z-dialog: 40;
    --z-dropdown: 80;
    --z-toast: 90;

    --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
}

body,
.card-canvas,
.list-detail-main {
    --field-bg: var(--tile-hover);
}

.card,
.card-canvas .add-form,
.dialog,
.sheet,
.menu,
.picker,
.tag-popover,
.calendar,
.header,
.list-detail-sidebar {
    --field-bg: var(--tile);
}

*, *::before, *::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    margin: 0;
    cursor: pointer;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline-offset: -1px;
}

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

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

.add-btn {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: var(--h-touch);
    height: var(--h-touch);
    border: 1.5px dashed var(--text-secondary);
    padding: 0;
    border-radius: var(--pill);
    background: transparent;
    color: var(--ink);
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.add-btn > .icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.add-btn:hover,
.add-labelled:hover > .add-btn,
.add-tile:hover > .add-btn,
.add-labelled[aria-expanded="true"] > .add-btn,
.add-tile[aria-expanded="true"] > .add-btn {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
    border-style: solid;
    color: var(--on-color);
}

.add-btn:focus-visible {
    outline-offset: 2px;
}

.add-btn.lg {
    width: 52px;
    height: 52px;
}

.add-btn.lg > .icon {
    width: 24px;
    height: 24px;
}

.add-labelled {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border-radius: var(--pill);
    color: var(--ink);
    font-size: .88rem;
    font-weight: 500;
    text-decoration: none;
}

.add-labelled:hover,
.add-labelled[aria-expanded="true"] {
    background: var(--tile-hover);
    text-decoration: none;
}

.add-labelled > .add-btn {
    pointer-events: none;
}

.add-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 96px;
    padding: 16px 12px;
    border: 1px dashed var(--control-border);
    border-radius: var(--radius-card);
    background: transparent;
    color: var(--ink);
    font-size: .88rem;
    text-align: center;
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.add-tile:hover {
    border-color: var(--text-secondary);
    background: var(--surface-alt);
    text-decoration: none;
}

.add-tile[aria-expanded="true"] {
    border-style: solid;
    border-color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--ink);
}

.add-tile > .add-btn {
    pointer-events: none;
}

.add-btn:disabled,
.add-labelled:disabled {
    opacity: .4;
    cursor: default;
    pointer-events: none;
}

.templates-toolbar > .add-labelled {
    flex: 0 0 auto;
    white-space: nowrap;
}

.avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--pill);
    background: var(--tile-hover);
    color: var(--text-secondary);
    font-size: .95rem;
    font-weight: 600;
    overflow: visible;
}

.avatar > img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.avatar.sm {
    width: 32px;
    height: 32px;
    font-size: .78rem;
}

.avatar.xs {
    width: 26px;
    height: 26px;
    font-size: .66rem;
}

.avatar.tile {
    border-radius: 30%;
    background: var(--accent-tint);
    color: var(--accent-ink);
}

.avatar.tile.neutral {
    background: var(--tile-hover);
    color: var(--text-secondary);
}

.avatar.sm > .icon {
    width: 16px;
    height: 16px;
}

.avatar.xs > .icon {
    width: 14px;
    height: 14px;
}

.avatar-dot {
    position: absolute;
    left: -1px;
    top: -1px;
    width: 11px;
    height: 11px;
    border: 2px solid var(--paper);
    border-radius: var(--pill);
    background: var(--text-faint);
}

.avatar-dot.ai {
    background: var(--avatar-blue);
}

.avatar-dot.human {
    background: var(--avatar-amber);
}

.avatar.lg {
    width: 80px;
    height: 80px;
    font-size: 1.6rem;
}

button.avatar {
    padding: 0;
    border: 0;
    cursor: pointer;
}

button.avatar:disabled {
    cursor: default;
    opacity: .6;
}

.avatar-edit {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--paper);
    border-radius: var(--pill);
    background: var(--ink);
    color: var(--on-color);
}

.avatar-edit > .icon {
    width: 14px;
    height: 14px;
}

@media (hover: hover) and (pointer: fine) {
    button.avatar:not(:disabled):hover > img {
        filter: brightness(.9);
    }

    button.avatar:not(:disabled):hover {
        background: var(--line);
    }
}

.count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: var(--pill);
    background: var(--accent-strong);
    color: var(--on-color);
    font-size: .68rem;
    font-weight: 700;
    line-height: 1;
}

.count.lg {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: .72rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: var(--pill);
    background: var(--tile-hover);
    color: var(--text-secondary);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.4;
}

.badge::before {
    content: '';
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: var(--pill);
    background: currentColor;
}

.badge.success {
    background: var(--accent-tint);
    color: var(--accent-ink);
}

.badge.warning {
    background: var(--warning-tint);
    color: var(--warning);
}

.badge.danger {
    background: var(--danger-tint);
    color: var(--danger);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    height: var(--h-control);
    padding: 0 12px;
    font-size: .8rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-control);
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.btn:hover {
    background: var(--tile-hover);
    border-color: var(--text-secondary);
}

.btn.primary {
    color: var(--on-color);
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn.danger:hover {
    color: var(--danger);
    background: var(--danger-tint);
    border-color: var(--danger-border);
}

.btn.danger-solid {
    color: var(--on-color);
    background: var(--danger);
    border-color: var(--danger);
}

.btn.danger-solid:hover {
    background: var(--danger-strong);
    border-color: var(--danger-strong);
}

.btn.primary:focus-visible,
.btn.danger-solid:focus-visible {
    outline-offset: 2px;
}

.btn:disabled,
.btn:disabled:hover {
    color: var(--text-faint);
    background: var(--surface-alt);
    border-color: var(--line);
    cursor: not-allowed;
    opacity: 1;
}

a.btn:hover {
    text-decoration: none;
}

.btn > .icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.btn.block {
    width: 100%;
}

.code-choices {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn.code {
    width: 72px;
    height: 56px;
    padding: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: .08em;
    font-variant-numeric: tabular-nums;
}

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--h-touch);
    padding: 7px 10px;
    border-radius: var(--radius-item);
    font-size: .88rem;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
}

.check:hover {
    background: var(--tile-hover);
}

.check > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.check > input {
    appearance: none;
    display: grid;
    place-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    background: var(--paper);
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease;
}

.check > input::before {
    content: '';
    width: 9px;
    height: 5px;
    margin-top: -2px;
    border: solid var(--on-color);
    border-width: 0 0 2px 2px;
    transform: rotate(-45deg) scale(0);
    transition: transform .12s ease;
}

.check > input:focus-visible {
    outline-offset: 2px;
}

.check > input:checked {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.check > input:checked::before {
    transform: rotate(-45deg) scale(1);
}

.check > input:disabled,
.check:has(> input:disabled) {
    opacity: .5;
    cursor: not-allowed;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    max-width: 100%;
    min-width: 0;
    height: 22px;
    padding: 0 3px 0 0;
    background: var(--accent-strong);
    border-radius: var(--pill);
    color: var(--on-color);
    font-size: .78rem;
    line-height: 1.3;
    white-space: nowrap;
    transition: background-color .15s ease, box-shadow .15s ease;
}

.chip:hover {
    background: var(--accent-hover);
}

.chip:has(> .chip-body[aria-expanded="true"]) {
    background: var(--accent-hover);
    box-shadow: 0 0 0 2px var(--ink);
}

.chip-body {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 2px 0 2px 9px;
    border: none;
    border-radius: var(--pill) 0 0 var(--pill);
    background: none;
    color: inherit;
}

.chip-key {
    flex-shrink: 0;
}

.chip-value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.chip-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: var(--pill);
    background: none;
    color: inherit;
    font-size: .95rem;
    line-height: 1;
}

.chip-remove:hover {
    background: var(--on-color-tint);
}

.chip-remove > .icon {
    width: 12px;
    height: 12px;
    stroke-width: 2.4;
}

.tag {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    max-width: 160px;
    height: 22px;
    padding: 0 10px;
    border: none;
    border-radius: var(--pill);
    background: var(--tag-bg, var(--tile-hover));
    color: var(--tag-fg, var(--text-secondary));
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag[data-color] {
    --tag-bg: oklch(from var(--object-color) 94% calc(c * .25) h);
    --tag-fg: oklch(from var(--object-color) 38% c h);
}


button.tag:hover {
    filter: brightness(.92);
}

.tag-more {
    background: var(--tile-hover);
    color: var(--text-secondary);
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--h-touch);
    height: var(--h-touch);
    padding: 0;
    border-radius: var(--pill);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.icon-btn:active {
    background: var(--tile-hover);
}

.icon-btn[aria-pressed="true"],
.icon-btn[aria-expanded="true"] {
    color: var(--accent-ink);
}

.icon-btn[aria-pressed="true"] {
    background: var(--accent-tint);
}

@media (hover: hover) and (pointer: fine) {
    .icon-btn:hover {
        background: var(--tile-hover);
        text-decoration: none;
    }

    .icon-btn.success:hover {
        color: var(--accent-ink);
        background: var(--accent-tint);
    }

    .icon-btn.danger:hover {
        color: var(--danger);
        background: var(--danger-tint);
    }
}

.icon-btn:disabled {
    color: var(--text-faint);
    background: none;
    cursor: default;
    opacity: 1;
}

.icon-btn.busy {
    pointer-events: none;
}

.icon-btn.busy > svg {
    display: none;
}

.icon-btn.busy::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: var(--pill);
    opacity: .6;
    animation: spin .8s linear infinite;
}

.icon {
    display: block;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon.sm {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.icon.md {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.icon.xl {
    width: 48px;
    height: 48px;
    stroke-width: 1.2;
}

.brand-icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.brand-icon > svg {
    display: block;
    width: 100%;
    height: 100%;
}

.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 1px solid var(--control-border);
    border-radius: var(--pill);
    color: var(--text-muted);
    font: italic 700 .65rem Georgia, "Times New Roman", serif;
    line-height: 1;
}

.info-btn:hover,
.info-btn[aria-expanded="true"] {
    background: var(--tile-hover);
    border-color: var(--text-secondary);
    color: var(--ink);
}

.input {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 8px 10px;
    font-size: .85rem;
    line-height: 1.3;
    color: var(--ink);
    background: var(--paper);
    border: 1px solid var(--control-border);
    border-radius: var(--radius-control);
    transition: border-color .15s ease;
}

.input:hover {
    border-color: var(--text-secondary);
}

.input::placeholder {
    color: var(--text-faint);
}

.input.filled {
    background: var(--field-bg);
    border-color: transparent;
}

.input.filled:focus {
    border-color: var(--control-border);
}

.input.filled::placeholder {
    color: var(--text-secondary);
}

.input:disabled {
    color: var(--text-faint);
    background: var(--surface-alt);
    border-color: var(--line);
    cursor: not-allowed;
}

.input[readonly] {
    color: var(--text-secondary);
    background: var(--surface-alt);
    border-color: var(--line);
    cursor: default;
}

.input[readonly]:hover {
    border-color: var(--line);
}

.input.secret:not(:placeholder-shown) {
    -webkit-text-security: disc;
}

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

.input.compact {
    height: var(--h-control);
    padding: 0 8px;
    font-size: .8rem;
}

textarea.input {
    resize: vertical;
    line-height: 1.45;
}

.input[type="number"]::-webkit-inner-spin-button,
.input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    background: var(--paper);
    border: 1px solid var(--control-border);
    border-bottom-width: 2px;
    border-radius: 6px;
    color: var(--text-secondary);
    font: 600 .75rem/1 var(--font);
    white-space: nowrap;
}

.keys {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    color: var(--text-muted);
    font-size: .75rem;
}

[data-color="blue"] {
    --object-color: #2563eb;
}

[data-color="green"] {
    --object-color: #15803d;
}

[data-color="violet"] {
    --object-color: #7c3aed;
}

[data-color="orange"] {
    --object-color: #c2410c;
}

[data-color="pink"] {
    --object-color: #be185d;
}

[data-color="teal"] {
    --object-color: #0f766e;
}

[data-color="amber"] {
    --object-color: #a16207;
}

[data-color="red"] {
    --object-color: #b91c1c;
}

[data-color="slate"] {
    --object-color: #475569;
}

[data-color="brown"] {
    --object-color: #92400e;
}

.object-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: var(--object-color, var(--text-muted));
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.45;
}

.object-label::before,
.object-dot {
    content: '';
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: var(--pill);
    background: var(--object-color, var(--text-faint));
}

.object-dot {
    display: inline-block;
}

.object-label > a {
    color: inherit;
    text-decoration: none;
}

.object-label > a:hover {
    text-decoration: underline;
}

.object-label > .hint {
    font-weight: 400;
}

.segmented-option > .object-dot {
    margin-right: 6px;
    vertical-align: 1px;
}

.avatar[data-color] {
    background: var(--object-color);
    color: var(--on-color);
}

.color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.color-swatch {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 2px solid var(--tile);
    border-radius: var(--pill);
    background: var(--object-color);
    box-shadow: 0 0 0 1px var(--control-border);
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch[aria-checked="true"] {
    box-shadow: 0 0 0 2px var(--ink);
}

.color-swatch:disabled {
    cursor: progress;
}

.qr-code {
    display: block;
    width: 232px;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    image-rendering: pixelated;
}

.qr-code[aria-busy="true"] {
    opacity: .35;
}

.search-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    min-height: var(--h-touch);
    padding: 0 12px;
    background: var(--field-bg);
    border-radius: var(--pill);
    color: var(--text-secondary);
    cursor: text;
    transition: box-shadow .15s ease;
}

.search-field:focus-within {
    box-shadow: inset 0 0 0 2px var(--ink);
}

.search-field > input {
    flex: 1;
    min-width: 60px;
    padding: 0;
    border: none;
    background: none;
    outline: none;
    font-size: .9rem;
    color: var(--ink);
}

.search-field > input::placeholder {
    color: var(--text-secondary);
}

.search-field-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: var(--pill);
    color: var(--text-secondary);
}

.search-field-clear:hover {
    color: var(--ink);
}

.search-field-chips {
    display: contents;
}

.search-field.has-chips {
    padding-top: 6px;
    padding-bottom: 6px;
    padding-right: 38px;
    position: relative;
    border-radius: 18px;
}

.search-field.has-chips > .search-field-clear {
    position: absolute;
    top: calc((var(--h-touch) - 18px) / 2);
    right: 12px;
}

.search-field.stacked.has-chips {
    padding-right: 12px;
}

.search-field.stacked.has-chips::after {
    content: '';
    order: 0;
    flex-basis: 100%;
    height: 0;
    margin-top: -6px;
}

.search-field.stacked.has-chips > svg {
    order: 1;
}

.search-field.stacked.has-chips > input {
    order: 1;
}

.search-field.stacked.has-chips > .search-field-clear {
    order: 2;
    position: static;
}

.search-field.outlined {
    background: var(--tile);
    box-shadow: inset 0 0 0 1px var(--line);
}

.search-field.outlined:focus-within {
    box-shadow: inset 0 0 0 2px var(--ink);
}

.search-field.inset {
    min-height: 0;
    padding: 6px 10px;
    border-radius: var(--radius-item);
}

.search-field.inset > input {
    font-size: .85rem;
}

@media (hover: none), (pointer: coarse) {
    .search-field > input,
    .search-field.inset > input {
        font-size: 16px;
    }
}

.segmented {
    display: inline-flex;
    flex-shrink: 0;
    padding: 2px;
    background: var(--tile-hover);
    border-radius: var(--radius-control);
}

.segmented.scroll {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.segmented.scroll::-webkit-scrollbar {
    display: none;
}

.segmented-option {
    flex-shrink: 0;
    min-width: 52px;
    height: var(--h-compact);
    padding: 0 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 500;
    white-space: nowrap;
}

.segmented-option:hover:not([aria-checked="true"]) {
    color: var(--ink);
}

.segmented-option[aria-checked="true"] {
    background: var(--paper);
    color: var(--ink);
    font-weight: 600;
    box-shadow: var(--shadow-raised);
}

.segmented-option:disabled {
    background-color: transparent;
    color: var(--text-secondary);
    opacity: 1;
    cursor: progress;
}

.segmented-option[aria-checked="true"]:disabled {
    background-color: var(--paper);
    color: var(--ink);
}

.select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.select {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    min-height: var(--h-control);
    padding: 0 8px 0 10px;
    border: 1px solid var(--control-border);
    border-radius: var(--radius-control);
    background: var(--paper);
    color: var(--ink);
    font-size: .8rem;
    text-align: left;
    transition: border-color .15s ease;
}

.select:hover:not(:disabled),
.select[aria-expanded="true"] {
    border-color: var(--text-secondary);
}

.select:disabled,
.select.filled:disabled {
    color: var(--text-faint);
    background: var(--surface-alt);
    border-color: var(--line);
    cursor: not-allowed;
    opacity: 1;
}

.select:disabled > .icon {
    color: var(--text-faint);
}

.select.filled {
    background: var(--field-bg);
    border-color: transparent;
}

.select.filled:hover:not(:disabled) {
    border-color: transparent;
}

.select.filled[aria-expanded="true"]:not(:disabled) {
    border-color: var(--control-border);
}

.select-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select.placeholder .select-label {
    color: var(--text-secondary);
}

.select > .icon {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    color: var(--text-secondary);
    transition: transform .15s ease;
}

.select[aria-expanded="true"] > .icon {
    transform: rotate(180deg);
}

.menu {
    position: fixed;
    z-index: var(--z-dropdown);
    display: flex;
    flex-direction: column;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-menu);
    background: var(--paper);
    box-shadow: var(--shadow-menu);
    color: var(--ink);
    font-size: .9rem;
    overflow: hidden;
    animation: menu-in .12s ease-out;
}

.menu.above {
    animation-name: menu-in-above;
}

@keyframes menu-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
}

@keyframes menu-in-above {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
}

.menu-header {
    flex-shrink: 0;
    padding-bottom: 6px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.menu-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--control-border) transparent;
}

.menu-section + .menu-section {
    margin-top: 4px;
}

.menu-section.row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.menu-section.row > .menu-item {
    flex: 0 0 auto;
    width: auto;
}

.menu-section.row > .menu-item:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.menu-section-title {
    padding: 8px 10px 4px;
    color: var(--text-faint);
    font-size: .8rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: var(--h-touch);
    padding: 7px 10px;
    border-radius: var(--radius-item);
    color: inherit;
    text-align: left;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.menu-item[aria-selected="true"] {
    background: var(--tile-hover);
}

.menu-item[aria-disabled="true"],
.menu-item:disabled {
    color: var(--text-faint);
    background: none;
    opacity: 1;
    cursor: default;
}

.menu-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.menu-item-icon > svg {
    display: block;
    width: 18px;
    height: 18px;
}

.menu-item-icon > svg[viewBox="0 0 20 20"] {
    width: 20px;
    height: 20px;
}

.menu-item-text {
    flex: 1 1 auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.menu-item-label {
    flex: 0 0 auto;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-item-description {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-faint);
}

.menu-item-hint,
.menu-item-check {
    display: flex;
    flex-shrink: 0;
    color: var(--text-faint);
}

.menu-item-check {
    color: var(--ink);
}

.menu-item-check > svg,
.menu-item-hint > svg {
    width: 16px;
    height: 16px;
}

.menu-item.muted .menu-item-label,
.menu-item.muted .menu-item-icon {
    opacity: .5;
}

.menu-item.danger,
.menu-item.danger .menu-item-icon {
    color: var(--danger);
}

.menu-empty {
    padding: 10px;
    color: var(--text-faint);
    font-size: .85rem;
}

.color-dot {
    display: inline-block;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: var(--pill);
    background: var(--object-color, transparent);
    box-shadow: var(--ring-inset);
}

.spinner {
    display: inline-block;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: var(--pill);
    color: var(--text-secondary);
    opacity: .6;
    animation: spin .8s linear infinite;
}

.spinner.lg {
    width: 24px;
    height: 24px;
    border-width: 2.5px;
}

.dots span {
    display: inline-block;
    animation: dots-blink 1.4s infinite both;
}

.dots span:nth-child(2) {
    animation-delay: .2s;
}

.dots span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes dots-blink {
    0%, 100% {
        opacity: .2;
    }
    20% {
        opacity: 1;
    }
}

.tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    height: var(--h-control);
    padding: 0 14px;
    border-radius: var(--pill);
    background: var(--tile-hover);
    color: var(--text-secondary);
    font-size: .84rem;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
}

.tab:hover {
    background: var(--hover-strong);
    text-decoration: none;
}

.tab[aria-selected="true"],
.tab[aria-pressed="true"],
.tab[aria-current] {
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-weight: 600;
}

.tab:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--ink);
}

.tab[aria-selected="true"]:focus-visible,
.tab[aria-pressed="true"]:focus-visible,
.tab[aria-current]:focus-visible {
    box-shadow: inset 0 0 0 2px var(--accent-ink);
}

.tabs.sticky {
    position: sticky;
    top: var(--banner-h, 0px);
    z-index: 5;
    padding: 8px 0;
    border-radius: 0 0 4px 4px;
    background: var(--canvas);
    transition: box-shadow .15s ease, background-color .15s ease;
}

.tabs.sticky[data-stuck] {
    background: var(--paper);
    box-shadow: 0 -12px 0 12px var(--paper), 0 12px 16px -8px rgba(0, 0, 0, .12);
}

.tabs.compact .tab {
    height: var(--h-compact);
    padding: 0 12px;
    font-size: .78rem;
}

.title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.subtitle {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink);
}

.hint {
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.45;
}

.meta {
    color: var(--text-muted);
    font-size: .78rem;
}

.error {
    color: var(--danger);
    font-size: .85rem;
}

.success {
    color: var(--accent-ink);
    font-size: .85rem;
}

.link {
    display: inline;
    padding: 0;
    border-radius: 0;
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--text-secondary);
    text-underline-offset: 2px;
}

.link:hover {
    background: none;
    text-decoration: underline;
    text-decoration-color: currentColor;
}

.code-number {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: .12em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.time-wheel {
    --wheel-item: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
}

.time-wheel-column {
    display: flex;
    flex-direction: column;
    width: 72px;
    height: calc(var(--wheel-item) * 5);
    padding: calc(var(--wheel-item) * 2) 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-snap-type: y mandatory;
    scrollbar-width: none;
    border-radius: var(--radius-control);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.time-wheel-column::-webkit-scrollbar {
    display: none;
}

.time-wheel-column:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: -1px;
}

.time-wheel-item {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--wheel-item);
    scroll-snap-align: center;
    color: var(--text-faint);
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
    opacity: 0;
    transition: opacity .2s ease, color .2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.time-wheel-item[aria-current="true"],
.time-wheel-item[aria-current="true"] + .time-wheel-item,
.time-wheel-item:has(+ [aria-current="true"]) {
    opacity: 1;
}

.time-wheel-item[aria-current="true"] {
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 700;
}

.time-wheel-column[aria-busy="true"] {
    -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
    mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent);
}

.time-wheel-column[aria-busy="true"] > .time-wheel-item {
    opacity: .45;
    color: var(--accent-strong);
}

.time-wheel-column[aria-busy="true"] > .time-wheel-item[aria-current="true"] {
    opacity: 1;
}

.time-wheel-colon {
    color: var(--ink);
    font-size: 1.5rem;
    font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .time-wheel-item {
        transition: none;
    }
}

.access-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.access-list > .hint {
    margin: 0 0 4px;
    font-size: .8rem;
}

.access-list > .list > .list-item {
    min-height: 56px;
    padding: 10px 0;
}

.access-list > .list > .list-item:hover {
    background: none;
}

.access-list > .list > .list-item.flat::after {
    left: 44px;
    right: 0;
}

.access-list > .list > .hint {
    margin: 0;
    padding: 10px 0;
}

.access-list .list-item-end > .select {
    width: 150px;
}

.access-list .list-item-end > .hint {
    padding: 0 6px;
    font-size: .85rem;
}

.access-list > .add-labelled {
    margin-bottom: 8px;
}

.access-list > .access-add + .error:not([hidden]) {
    margin-bottom: 8px;
}

.access-add[hidden] {
    display: none;
}

.access-add {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.access-add > button.select:nth-of-type(1) {
    flex: 1 1 220px;
}

.access-add > button.select:nth-of-type(2) {
    flex: 0 0 150px;
}

.team-hint {
    display: block;
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: .8rem;
}

.team-hint > .link {
    display: inline;
    padding: 0;
    background: none;
}

.access-list > .error {
    margin: 0;
    font-size: .8rem;
}

@media (max-width: 640px) {
    .access-list > .list > .list-item {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .access-list .list-item-body {
        flex-basis: calc(100% - 44px);
    }

    .access-list .list-item-end:has(> .select) {
        width: 100%;
        padding-left: 44px;
    }

    .access-list .list-item-end > .select {
        flex: 1 1 auto;
        width: auto;
    }

    .access-add > button.select:nth-of-type(2) {
        flex: 1 1 auto;
    }
}

.access-roles {
    background: var(--surface-alt);
    border-radius: 0 0 calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px);
}

.access-roles[hidden] {
    display: none;
}

.access-roles > .label {
    margin: 0;
    color: var(--text-secondary);
    font-size: .75rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.access-roles > .hint {
    margin: 4px 0 12px;
    font-size: .8rem;
}

.access-roles > .error {
    margin: 0 0 12px;
    font-size: .8rem;
}

.access-roles .setting {
    padding-bottom: 10px;
}

.access-roles .setting + .setting {
    margin-top: 0;
    padding-top: 10px;
}

.access-roles .setting-label .hint {
    font-size: .8rem;
}

.access-roles .setting-main > .access-roles-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.access-roles > .add-labelled {
    margin: 2px 0 0 -4px;
}

.access-roles .add-form {
    margin: 4px 0 12px;
    background: var(--paper);
}

.role-form .fields {
    gap: 12px;
}

.role-form .check {
    margin: 0 -10px;
}

.role-form .card-actions {
    margin-top: 12px;
}

.add-form {
    padding: 16px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
}

.card > .add-labelled {
    margin-left: -4px;
}

.card > .add-labelled + *,
.card > .add-form + * {
    margin-top: 12px;
}

:where(.add-labelled) + .add-form,
.card > .add-labelled + .add-form {
    margin-top: 8px;
}

.add-form-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.add-form-head > .icon-btn {
    width: 28px;
    height: 28px;
    margin: -4px -4px 0 0;
}

.add-form-head .subtitle {
    font-size: .95rem;
}

.add-form-head .hint {
    margin-top: 2px;
    font-size: .8rem;
}

.add-form > .error {
    margin-top: 8px;
    font-size: .8rem;
}

@media (max-width: 640px) {
    .add-form .field-inline {
        flex-direction: column;
        align-items: stretch;
    }
}

.app-group + .app-group,
.card + .app-group {
    margin-top: 28px;
}

.app-group > .label {
    margin: 0 0 10px;
    color: var(--text-muted);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.app-tile {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 88px;
    padding: 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    color: var(--ink);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.app-tile:active {
    background: var(--tile);
}

.app-tile-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-item);
    background: color-mix(in srgb, var(--object-color, var(--text-muted)) 12%, var(--paper));
    color: var(--object-color, var(--text-muted));
}

.app-tile-icon > img {
    display: block;
    width: 24px;
    height: 24px;
}

.app-tile-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.app-tile-name {
    font-weight: 600;
    line-height: 1.3;
}

.app-tile-hint {
    color: var(--text-muted);
    font-size: .85rem;
    line-height: 1.4;
}

.app-tile-body > .badge {
    align-self: flex-start;
    margin-top: 6px;
}

.app-tile > .count {
    position: absolute;
    top: 12px;
    right: 12px;
}

.app-tile:has(> .count) {
    padding-right: 44px;
}

@media (hover: hover) and (pointer: fine) {
    .app-tile:hover {
        border-color: var(--border);
        text-decoration: none;
    }
}

@media (max-width: 480px) {
    .app-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .app-tile {
        align-items: center;
        min-height: 72px;
        padding: 14px;
    }
}

.banner {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: var(--z-banner);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 40px;
    padding: 10px 48px;
    background: var(--ink);
    color: var(--on-color);
    font-size: .9rem;
    text-align: center;
    opacity: 0;
    transform: translateY(-100%);
    transition: opacity .25s ease, transform .25s ease;
}

.banner.show {
    opacity: 1;
    transform: translateY(0);
}

.banner.warning {
    background: var(--warning-strong);
}

.banner.danger {
    background: var(--danger);
}

.banner-action {
    flex-shrink: 0;
    height: var(--h-compact);
    padding: 0 12px;
    border: 1px solid var(--on-color);
    border-radius: var(--radius-control);
    color: var(--on-color);
    font-size: .8rem;
    font-weight: 600;
}

.banner-action:hover {
    background: var(--on-color-tint);
}

.banner-close {
    position: absolute;
    top: 50%;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--pill);
    color: var(--on-color);
    transform: translateY(-50%);
}

.banner-close:hover {
    background: var(--on-color-tint);
}

.banner-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.banner.inline {
    position: static;
    z-index: auto;
    justify-content: space-between;
    padding: 10px 10px 10px 16px;
    border-radius: var(--radius-card);
    text-align: left;
    opacity: 1;
    transform: none;
    transition: none;
}

a.banner-action {
    display: inline-flex;
    align-items: center;
}

.card {
    padding: 20px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

.card + .card {
    margin-top: 16px;
}

.card > .subtitle {
    margin-bottom: 6px;
}

.card > .subtitle + .hint {
    margin-bottom: 14px;
}

.card > .subtitle + :not(.hint) {
    margin-top: 14px;
}

.card-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.card-toolbar.nowrap {
    flex-wrap: nowrap;
}

.card-toolbar.nowrap > .segmented.scroll {
    flex-shrink: 1;
    min-width: 0;
}

.card-toolbar.nowrap > .btn {
    flex-shrink: 0;
    margin-left: auto;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.card-actions > .error,
.card-actions > .success,
.card-actions > .hint,
.card-actions > .start {
    margin-right: auto;
}

.card-head {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.card-head > .hint,
.card-head > .object-label {
    margin: 4px 0 0;
}

.card > .error {
    margin-top: 12px;
    font-size: .8rem;
}

.card.flush {
    padding: 0;
}

.card-section {
    padding: 16px 20px;
}

.card-section.flush {
    padding: 0;
}

.card-toolbar > .search-field {
    flex: 1 1 240px;
}

.card-toolbar > .title {
    flex: 1 1 auto;
    min-width: 0;
}

.card-section + .card-section {
    border-top: 1px solid var(--line);
}

.card-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.card-head-row > :first-child {
    min-width: 0;
}

.card-head-row.toggles {
    cursor: pointer;
}

.card-head-tools {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 4px;
}

.card > .subtitle.with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-canvas {
    background: var(--canvas);
}

.card-canvas .add-form {
    background: var(--paper);
}

@media (max-width: 560px) {
    .cards-bleed > .card {
        margin-inline: -16px;
        padding: 16px;
        border-inline: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .cards-bleed > .card.flush {
        padding: 0;
    }

    .cards-bleed > .card .card-section {
        padding-inline: 16px;
    }
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-dialog);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--scrim);
}

.dialog {
    width: 400px;
    max-width: 100%;
    padding: 20px;
    background: var(--paper);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-dialog);
}

.dialog > .subtitle {
    margin-bottom: 8px;
}

.dialog-message {
    color: var(--text-muted);
    font-size: .88rem;
    line-height: 1.45;
}

.dialog-choice {
    display: flex;
    margin-top: 14px;
}

.dialog-choice > .segmented-option {
    flex: 1 1 0;
}

.dialog .field {
    margin-top: 14px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.name-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 14px;
    padding: 10px 12px;
    background: var(--surface-alt);
    border: 1px dashed var(--control-border);
    border-radius: var(--radius-control);
    font-family: monospace;
    font-size: .95rem;
    font-weight: 600;
}

.name-chip:hover {
    background: var(--tile-hover);
    border-color: var(--text-secondary);
}

.name-chip > .icon {
    color: var(--text-muted);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 100%;
    min-height: 200px;
    padding: 32px 16px;
    color: var(--text-secondary);
    text-align: center;
}

.empty-state > p {
    max-width: 36ch;
    font-size: .9rem;
}

.empty-state > .hint {
    margin-top: -6px;
}

.empty-state.boxed {
    gap: 6px;
    height: auto;
    min-height: 0;
    padding: 28px 20px;
    border: 1px dashed var(--text-faint);
    border-radius: var(--radius-item);
    background: var(--surface-alt);
    color: var(--ink);
}

.empty-state-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 4px;
    border: 1px solid var(--border);
    border-radius: var(--pill);
    background: var(--paper);
    color: var(--text-muted);
}

.empty-state.boxed > .empty-state-title {
    font-size: .9rem;
    font-weight: 600;
}

.empty-state.boxed > .hint {
    max-width: 46ch;
    margin-top: 0;
    text-wrap: balance;
}

.empty-state.boxed > .btn {
    margin-top: 12px;
}

.empty-state-suggestions {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 100%;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.empty-state-suggestions > p {
    max-width: none;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.suggestion-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.suggestion {
    height: var(--h-control);
    padding: 0 14px;
    border: 1px solid var(--control-border);
    border-radius: var(--pill);
    background: var(--paper);
    color: var(--ink);
    font-size: .85rem;
    cursor: pointer;
}

.suggestion:hover {
    background: var(--tile-hover);
}

@media (pointer: coarse) {
    .suggestion {
        height: var(--h-touch);
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-label-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.field > .hint,
.field > .error {
    font-size: .8rem;
}

.field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.field-inline > .input {
    flex: 1 1 auto;
}

.field-inline > .select {
    min-width: 140px;
}

.fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.fields-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 12px;
}

.fields-grid > .full {
    grid-column: 1 / -1;
}

.field > .select {
    width: 100%;
}


@media (max-width: 560px) {
    .fields-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.field-view {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.field-view > .label {
    font-size: .8rem;
    font-weight: 400;
    color: var(--text-faint);
}

.field-view.editable {
    position: relative;
    width: calc(100% + 16px);
    margin: -6px -8px;
    padding: 6px 8px;
    border-radius: var(--radius-control);
    text-align: left;
    cursor: pointer;
}

.field-view.editable:hover {
    background: var(--tile-hover);
}

.field-view-edit {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: none;
}

.field-view-edit ~ .field-value .link {
    position: relative;
    z-index: 1;
}

.field-value {
    margin: 0;
    color: var(--ink);
    line-height: 1.4;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.field-value.empty {
    color: var(--text-faint);
}

.fields-view {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 12px;
}

.fields-view > .full {
    grid-column: 1 / -1;
}

@media (max-width: 560px) {
    .fields-view {
        grid-template-columns: minmax(0, 1fr);
    }
}

.filter-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
    padding: 12px 12px 10px;
}

.header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    min-height: var(--header-h);
    padding: 0 12px 0 4px;
    background: var(--paper);
    border-bottom: 1px solid var(--border);
}

.header > .title {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.header-sub {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 400;
}

.header-sub-link {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.header-sub-link:hover {
    color: var(--text);
}

.header > .tabs {
    flex: 1 1 auto;
    min-width: 0;
}

.json-details {
    white-space: normal;
}

.json-details > summary {
    width: fit-content;
    color: var(--text-secondary);
    cursor: pointer;
}

.json-details > summary:hover {
    color: var(--ink);
}

.json-details[open] > summary {
    margin-bottom: 8px;
}

.json-view {
    display: grid;
    grid-template-columns: fit-content(40%) minmax(0, 1fr);
    gap: 4px 12px;
    margin: 0;
    font-size: .85rem;
    line-height: 1.4;
    white-space: normal;
}

.json-row {
    display: contents;
}

.json-key {
    color: var(--text-faint);
    overflow-wrap: anywhere;
}

.json-value {
    min-width: 0;
    margin: 0;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.json-value[data-type] {
    white-space: pre-wrap;
}

.json-value[data-type="number"],
.json-value[data-type="boolean"] {
    font-variant-numeric: tabular-nums;
}

.json-value[data-type="null"] {
    color: var(--text-faint);
}

.json-value > .json-view {
    padding-left: 12px;
    border-left: 1px solid var(--line);
}

@media (max-width: 560px) {
    .json-view {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .json-value {
        margin-bottom: 6px;
    }
}

.list {
    display: flex;
    flex-direction: column;
}

.list-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px;
    border-radius: 0;
    color: inherit;
    text-align: left;
    text-decoration: none;
}

.list-item::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    left: 68px;
    border-bottom: 1px solid var(--line);
}

.list-item:hover {
    background: var(--tile-hover);
    text-decoration: none;
}

.list-item[aria-disabled="true"] {
    cursor: default;
}

.list-item[aria-disabled="true"]:hover {
    background: none;
}

.list-item[aria-disabled="true"] > .brand-icon,
.list-item[aria-disabled="true"] > .avatar {
    opacity: .4;
    filter: grayscale(1);
}

.list-item[aria-disabled="true"] .list-item-title {
    color: var(--text-muted);
}

.list-item[aria-current="true"] {
    background: var(--hover-strong);
}

.list-item-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.list-item-top,
.list-item-bottom {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.list-item-bottom {
    align-items: center;
}

.list-item-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .95rem;
    font-weight: 600;
}

.list-item-time {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: .72rem;
    font-variant-numeric: tabular-nums;
}

.list-item.unread .list-item-time {
    color: var(--accent-strong);
    font-weight: 600;
}

.list-item-preview {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: .85rem;
}

.list-item-draft {
    color: var(--accent-strong);
    font-weight: 600;
}

.list-item-title mark,
.list-item-preview mark {
    padding: 0 1px;
    border-radius: 3px;
    background: var(--accent-tint-strong);
    color: var(--ink);
}

.list-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px 20px;
    color: var(--text-muted);
    font-size: .8rem;
    text-align: center;
}

.list-item.flat::after {
    left: 12px;
}

.list-item.flat:last-child::after {
    display: none;
}

.card.flush > .list > .list-item:first-child {
    border-top-left-radius: calc(var(--radius-card) - 1px);
    border-top-right-radius: calc(var(--radius-card) - 1px);
}

.card.flush > .list > .list-item:last-child {
    border-bottom-left-radius: calc(var(--radius-card) - 1px);
    border-bottom-right-radius: calc(var(--radius-card) - 1px);
}

.card.flush > .list > .list-item:last-child::after {
    display: none;
}

.list-item-end {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 6px;
    color: var(--text-secondary);
}

.list-item-link {
    padding: 0;
    border-radius: 0;
    color: inherit;
    text-align: inherit;
    text-decoration: none;
}

.list-item-link:hover,
.list-item-link:active {
    background: none;
    text-decoration: none;
}

.list-item-link::before {
    content: '';
    position: absolute;
    inset: 0;
}

.list-item-link:focus-visible {
    outline: none;
}

.list-item-link:focus-visible::before {
    outline: 2px solid var(--ink);
    outline-offset: -2px;
}

.list-item:has(.list-item-link) > .list-item-end,
.list-item:has(.list-item-link) > .drag-handle {
    position: relative;
    z-index: 1;
}

.list-item:has(.list-item-link) > .list-item-end:not(:has(button, a, input, select)) {
    position: static;
}

.list-item:has(.list-item-link) .tag-add-button {
    position: relative;
    z-index: 1;
}

.list-item-body > .tag {
    align-self: flex-start;
}

.list-item-tags {
    display: flex;
    gap: 4px;
    margin-top: 3px;
    overflow: hidden;
}

.list.sortable > .list-item {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.list.sortable > .list-item .tag {
    cursor: pointer;
}

.list.sortable.reordering,
.list.sortable.reordering > .list-item {
    cursor: grabbing;
}

.list.sortable.reordering > .list-item:not(.dragging):hover {
    background: transparent;
}

.list.sortable > .list-item.dragging {
    z-index: 2;
    background: var(--paper);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.list.sortable > .list-item.dragging::after {
    display: none;
}

.drag-handle {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 2px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    opacity: .6;
    cursor: grab;
    touch-action: none;
}

.list-item:hover .drag-handle,
.list-item.dragging .drag-handle,
.drag-handle:focus-visible {
    color: var(--ink);
    opacity: 1;
}

.list-item > .brand-icon {
    width: 32px;
    height: 32px;
}

.media-gallery {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.media-gallery-month {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: .8rem;
    font-weight: 600;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 4px;
}

.media-tile {
    position: relative;
    display: block;
    aspect-ratio: 1;
    padding: 0;
    overflow: hidden;
    border-radius: 4px;
    background: var(--tile);
    cursor: pointer;
}

.media-tile > img,
.media-tile > video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.media-tile:hover > img,
.media-tile:hover > video {
    opacity: .88;
}

.media-tile:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 3px var(--ink);
}

.media-tile-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: var(--pill);
    background: rgba(0, 0, 0, .55);
    color: var(--on-color);
}

.media-gallery-more {
    align-self: center;
}

@media (max-width: 640px) {
    .media-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2px;
    }

    .media-tile {
        border-radius: 0;
    }
}

.day-divider-row {
    display: flex;
    justify-content: center;
    margin: 12px 0;
    pointer-events: none;
}

.day-divider-row:first-child {
    margin-top: 0;
}

.day-divider-floating {
    position: absolute;
    top: 20px;
    left: 24px;
    right: 24px;
    z-index: 3;
    display: flex;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s ease;
}

.day-divider-floating.visible {
    opacity: 1;
}

.day-divider-floating .day-divider {
    pointer-events: none;
}

.day-divider {
    pointer-events: auto;
    background: var(--paper);
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 7.5px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .1);
    white-space: nowrap;
}

.bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 4px;
}

.bubble-row:not(.grouped):not(:first-child) {
    margin-top: 12px;
}

#chat-messages .day-divider-row + .bubble-row {
    margin-top: 0;
}

.bubble-actions {
    display: flex;
    flex-shrink: 0;
    gap: 4px;
    margin-bottom: 6px;
    opacity: 0;
    transform: scale(.85);
    transition: opacity .12s ease, transform .12s ease;
}

.bubble-row:hover .bubble-actions,
.bubble-row:focus-within .bubble-actions {
    opacity: 1;
    transform: scale(1);
}

.bubble-reply-btn,
.bubble-react-btn,
.bubble-edit-btn,
.bubble-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--pill);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    background: var(--paper);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

.bubble-reply-btn:hover,
.bubble-react-btn:hover,
.bubble-edit-btn:hover,
.bubble-delete-btn:hover {
    background: var(--tile-hover);
    color: var(--ink);
}

.bubble-row.highlight-flash {
    animation: bubble-highlight-flash 1.5s ease;
    border-radius: 8px;
}

.bubble-quote {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 2px 2px 8px;
    padding: 6px 10px;
    border-radius: 6px;
    border-left: 4px solid var(--accent-strong);
    background: rgba(0, 0, 0, .04);
    font-size: 0.82rem;
    overflow: hidden;
    cursor: pointer;
}

.bubble-quote-sender {
    font-weight: 600;
    color: var(--accent-ink);
}

.bubble-quote-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .75;
}

.bubble-row.has-reaction {
    margin-bottom: 12px;
}

.bubble-row.outbound {
    justify-content: flex-end;
}

.bubble-row.inbound {
    justify-content: flex-start;
}

.bubble {
    position: relative;
    max-width: 65%;
    padding: 6px 10px 8px;
    border-radius: 10px;
    font-size: 0.92rem;
    line-height: 1.4;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13);
    white-space: pre-wrap;
    overflow-wrap: break-word;
    touch-action: pan-y;
}

.swipe-reply-icon {
    position: absolute;
    top: 50%;
    left: -22px;
    transform: translateY(-50%);
    opacity: 0;
    color: var(--text-secondary);
    pointer-events: none;
}

@media (hover: none), (pointer: coarse) {
    .bubble-reactable {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}

.bubble-reaction {
    position: absolute;
    right: 2px;
    bottom: -12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    min-width: 1.5em;
    height: 1.5em;
    padding: 0 4px;
    background: var(--paper);
    border-radius: var(--pill);
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}

.bubble-reaction-count {
    margin-left: 3px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.bubble.inbound {
    background: var(--paper);
    color: var(--ink);
    border-top-left-radius: 2px;
}

.bubble.outbound {
    background: var(--accent-tint);
    color: var(--ink);
    border-top-right-radius: 2px;
}

.bubble.bubble-call {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    padding: 8px 8px 6px;
    white-space: normal;
}

.bubble-call-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--pill);
    background: rgba(0, 0, 0, .05);
    color: var(--text-secondary);
}

.bubble-call-icon.bubble-call-missed {
    color: var(--danger);
}

.bubble-call-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    line-height: 1.3;
}

.bubble-call-title {
    font-weight: 500;
}

.bubble-call-detail {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.bubble-call > .bubble-meta {
    align-self: flex-end;
    margin-left: 2px;
}

.attachment-location {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 0;
    color: inherit;
    text-decoration: none;
    white-space: normal;
}

.attachment-location-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--pill);
    background: rgba(0, 0, 0, .05);
    color: var(--accent-ink);
}

.attachment-location-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    line-height: 1.3;
}

.attachment-location-title {
    font-weight: 500;
}

.attachment-location-detail {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.attachment-location-action {
    margin-top: 2px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--accent-ink);
}

.attachment-location:hover .attachment-location-action,
.attachment-location:focus-visible .attachment-location-action {
    text-decoration: underline;
}

.thread-load-older {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.thread-load-older-status {
    max-width: 320px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: center;
}

.thread-load-older-status:empty {
    display: none;
}

.bubble-preview {
    padding: 12px;
    border-radius: var(--radius-card);
    background: var(--canvas);
}

.bubble-preview .bubble {
    max-width: 85%;
}

.bubble-deleted {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    font-size: 0.72rem;
    font-style: italic;
    color: var(--text-secondary);
}

.bubble-deleted > svg {
    flex-shrink: 0;
}

.bubble-sender {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.7;
    margin-bottom: 2px;
}

.bubble-meta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.bubble-edited {
    font-style: italic;
}

.bubble-meta-block {
    display: flex;
    justify-content: flex-end;
    margin-top: 2px;
}

.bubble-body {
    display: grid;
}

.bubble-body > * {
    grid-area: 1 / 1;
}

.bubble-body > .bubble-meta {
    align-self: end;
    justify-self: end;
}

.bubble.bubble-has-email {
    width: min(680px, 85%);
    max-width: 85%;
}

.bubble-email {
    display: flex;
    flex-direction: column;
    gap: 6px;
    white-space: normal;
}

.bubble-email-subject {
    font-weight: 600;
}

.bubble-email-frame {
    display: block;
    width: 100%;
    min-height: 120px;
    border: 0;
    border-radius: 6px;
    background: #fff;
}

.bubble-link {
    padding: 0;
    border-radius: 0;
    color: var(--accent-ink);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
    transition: text-decoration-color .15s ease, color .15s ease;
}

.bubble-link:hover,
.bubble-link:active {
    background-color: transparent;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-decoration-color: currentColor;
}

.bubble-link:active {
    color: var(--accent-hover);
}

.bubble-link:focus-visible {
    border-radius: 2px;
}

.bubble-meta-spacer {
    margin-left: 8px;
    visibility: hidden;
    user-select: none;
}

.bubble-meta-overlay {
    position: absolute;
    right: 6px;
    bottom: 6px;
    color: var(--on-color);
    background: rgba(0, 0, 0, .45);
    padding: 1px 6px;
    border-radius: 8px;
}

.bubble-ticks {
    display: inline-flex;
}

.bubble-ticks svg {
    width: auto;
    height: 12px;
}

.bubble-ticks-read {
    color: var(--tick-read);
}

.bubble-ticks-failed,
.bubble-ticks-unsent {
    color: var(--danger);
}

.bubble-unsent {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(176, 0, 32, 0.2);
    font-size: 0.78rem;
    color: var(--danger);
}

.bubble-unsent-hint {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.bubble-unsent-actions {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
}

.bubble-unsent-btn {
    padding: 2px 12px;
    border: 1px solid var(--danger);
    border-radius: 999px;
    background: var(--paper);
    color: var(--danger);
    font: inherit;
    font-size: 0.75rem;
    cursor: pointer;
}

.bubble-unsent-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.bubble-unsent-discard {
    border-color: var(--border);
    color: var(--ink);
}

.phone-list {
    display: grid;
    grid-template-columns: max-content minmax(0, max-content) max-content;
    justify-content: start;
    gap: 2px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
    white-space: normal;
}

.phone-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
}

.phone-number {
    color: var(--ink);
    white-space: nowrap;
}

.phone-label {
    min-width: 0;
    overflow: hidden;
    color: var(--text-faint);
    font-size: .8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phone-actions {
    display: flex;
    grid-column: 3;
    gap: 2px;
}

.phone-actions .brand-icon {
    width: 20px;
    height: 20px;
}

.email-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    white-space: normal;
}

.email-row > .link {
    min-width: 0;
    overflow-wrap: anywhere;
}

.email-row .brand-icon {
    width: 20px;
    height: 20px;
}

.field-view-edit ~ .field-value .phone-actions {
    position: relative;
    z-index: 1;
}

.phone-edit,
.phone-edit-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.phone-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 560px;
}

.phone-edit-row > .drag-handle {
    align-self: stretch;
}

.phone-edit-row:hover > .drag-handle,
.phone-edit-row.dragging > .drag-handle {
    color: var(--ink);
    opacity: 1;
}

.phone-edit-rows.reordering,
.phone-edit-rows.reordering .phone-edit-row {
    cursor: grabbing;
}

.phone-edit-row.dragging {
    position: relative;
    z-index: 2;
    border-radius: var(--radius-control);
    background: var(--paper);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.phone-edit-number {
    flex: 1 1 auto;
    min-width: 0;
}

.phone-edit-label {
    flex: 0 1 auto;
    field-sizing: content;
    min-width: 112px;
    max-width: 240px;
}

.phone-edit > .add-labelled {
    align-self: flex-start;
}

.phone-duplicate-head {
    align-items: center;
}

.picker {
    width: 280px;
    max-width: 100%;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: var(--shadow-picker);
    box-sizing: border-box;
}

.picker-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: var(--field-bg);
}

.picker-search:focus-within {
    box-shadow: inset 0 0 0 2px var(--ink);
}

.picker-search > .icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-faint);
}

.picker-search > input,
.picker-search > input:focus,
.picker-search > input:focus-visible {
    flex: 1;
    min-width: 0;
    padding: 9px 0;
    border: none;
    outline: none;
    background: transparent;
    font: inherit;
    font-size: .88rem;
    color: var(--ink);
}

.picker-search > input::placeholder {
    color: var(--text-faint);
}

.picker-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    max-height: 232px;
    overflow-y: auto;
    padding: 2px 0;
}

.picker-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--ink);
    font-size: .88rem;
    text-align: left;
    cursor: pointer;
}

.picker-option:hover,
.picker-option[aria-selected="true"],
.picker-option:focus-visible {
    background: var(--tile-hover);
}

.picker-option-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid var(--pick-color, var(--text-secondary));
    border-radius: 6px;
    box-sizing: border-box;
    color: var(--pick-fg, var(--on-color));
    transition: background-color .12s ease;
}

.picker-option-check > svg {
    width: 12px;
    height: 12px;
    opacity: 0;
}

.picker-option[data-color] {
    --pick-color: var(--object-color);
}


.picker-option[aria-checked="true"] .picker-option-check {
    background: var(--pick-color, var(--ink));
    border-color: var(--pick-color, var(--ink));
}

.picker-option[aria-checked="true"] .picker-option-check > svg {
    opacity: 1;
}

.picker-option > .avatar {
    margin: -2px 0;
}

.picker-option-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.picker-option-label,
.picker-option-description {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.picker-option-label {
    flex: 1;
}

.picker-option-description {
    color: var(--text-faint);
    font-size: .78rem;
}

.picker-option:has(.picker-option-description) {
    padding: 9px 10px;
}

.picker.single .picker-option-check {
    order: 1;
    border-color: transparent;
    background: none;
    color: var(--ink);
}

.picker.single .picker-option[aria-checked="true"] {
    font-weight: 600;
}

.picker.single .picker-option[aria-checked="true"] .picker-option-description {
    font-weight: 400;
}

.picker.single .picker-option[aria-checked="true"] .picker-option-check {
    border-color: transparent;
    background: none;
}

.picker-option-drill {
    flex-shrink: 0;
    color: var(--text-faint);
}

.picker-option > .object-dot {
    flex-shrink: 0;
}

.picker .picker-back {
    margin-bottom: 4px;
    color: var(--text-muted);
    font-weight: 600;
}

.picker .picker-back .picker-option-check {
    order: 0;
    border-color: transparent;
    background: none;
    color: inherit;
}

.picker .picker-back .picker-option-check > svg {
    width: 16px;
    height: 16px;
    opacity: 1;
}

.picker-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.picker-group + .picker-group,
.picker-option + .picker-group {
    margin-top: 6px;
}

.picker-group-label {
    position: sticky;
    top: -2px;
    z-index: 1;
    padding: 6px 10px 4px;
    background: var(--paper);
    color: var(--text-faint);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.picker-empty {
    padding: 10px;
    color: var(--text-muted);
    font-size: .85rem;
}

.picker.flat {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: auto;
    min-height: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    box-shadow: none;
}

.picker.flat .picker-search {
    flex: none;
}

.picker.flat .picker-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
}

@media (hover: none), (pointer: coarse) {
    .picker.flat .picker-option {
        min-height: 48px;
    }
}

.picker-footer {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
}

.plan-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.plan-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.plan-price {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin: 18px 0 0;
}

.plan-amount {
    color: var(--ink);
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.plan-period {
    color: var(--text-secondary);
    font-size: .9rem;
}

.plan-price + .hint {
    margin-top: 6px;
}

.plan-features {
    display: grid;
    gap: 8px;
    margin: 18px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    list-style: none;
}

.plan-features > li {
    position: relative;
    padding-left: 26px;
    color: var(--ink);
    font-size: .875rem;
    line-height: 1.45;
}

.plan-features > li::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 0;
    width: 16px;
    height: 16px;
    border-radius: var(--pill);
    background: var(--accent-tint);
}

.plan-features > li::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 5px;
    width: 6px;
    height: 3.5px;
    border-left: 1.75px solid var(--accent-ink);
    border-bottom: 1.75px solid var(--accent-ink);
    transform: rotate(-45deg);
}

.plan-reason {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: var(--radius-item);
    background: var(--tile);
}

.plan-reason > .label {
    display: block;
    margin-bottom: 2px;
}

.plan-reason > .hint {
    margin: 0;
}

.plan + .fields {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.field-samples {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.field-sample {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    max-width: 220px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-item);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.field-sample:hover {
    border-color: var(--control-border);
    background: var(--tile);
}

.field-sample-label {
    font-size: .78rem;
    font-weight: 600;
}

.field-sample-value {
    max-width: 100%;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .74rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.conditions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.condition {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) auto;
    align-items: center;
    gap: 6px;
}

.condition > .select,
.condition > select {
    width: 100%;
}

.condition-join {
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
}

.share-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.share-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px 52px;
    align-items: center;
    gap: 8px;
}

.share-weight {
    text-align: right;
}

.share-pct {
    color: var(--text-muted);
    font-size: .8rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.share-row.gone {
    min-height: var(--h-touch);
}

.share-gone-name {
    padding: 0 10px 0 38px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: .88rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.share-row.gone > .badge {
    grid-column: 2 / -1;
    justify-self: end;
}

.route-result {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-item);
    background: var(--accent-tint);
    color: var(--ink);
    font-size: .85rem;
}

.route-result.unassigned {
    background: var(--warning-tint);
}

.route-result-label {
    color: var(--text-muted);
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
}

.route-result-person {
    display: flex;
    align-items: center;
    gap: 10px;
}

.route-result-person > .avatar {
    background: var(--paper);
    color: var(--accent-ink);
}

.route-result-title {
    min-width: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.route-result-why {
    color: var(--text-secondary);
    font-size: .8rem;
}

.route-result-why + .route-trace {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--line);
}

.route-trace {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .8rem;
}

.route-trace li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

@media (max-width: 640px) {
    .condition {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    }

    .condition > .condition-value {
        grid-column: 1 / -1;
        grid-row: 2;
    }
}

.setting {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting + .setting,
.setting-nested + .setting {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.setting-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 12px;
}

.setting-main > .select {
    min-width: 140px;
}

.setting-label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 8px;
    min-width: 0;
    font-size: .88rem;
}

.setting > .hint {
    font-size: .8rem;
}

.setting-nested {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
    padding-left: 12px;
    border-left: 2px solid var(--line);
}

.fields + .setting {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

@keyframes sheet-up {
    from {
        transform: translateY(24px);
        opacity: 0;
    }
}

.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-dialog);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: var(--scrim);
}

.sheet {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    max-height: 90dvh;
    background: var(--paper);
    border-radius: var(--radius-menu) var(--radius-menu) 0 0;
    box-shadow: var(--shadow-dialog);
    animation: sheet-up .2s ease-out;
}

.sheet-header {
    display: flex;
    flex: none;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 20px;
    border-bottom: 1px solid var(--line);
}

.sheet-header > h3 {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 1rem;
}

.sheet-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
    padding: 16px 20px max(20px, env(safe-area-inset-bottom));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.sheet-footer {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 10px;
    padding: 12px 20px max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
}

.sheet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.sheet-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.sheet-footer-row > .when-summary {
    flex: 1 1 auto;
    min-width: 0;
}

.sheet-footer-row > .sheet-actions {
    flex: none;
}

.sheet-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sheet-section > h3 {
    margin: 0;
    font-size: .95rem;
}

.sheet-section > h3 + .hint {
    margin: -8px 0 0;
}

.sheet-body .picker.flat {
    margin: 0 -10px;
}

.sheet-section + .sheet-section {
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

@media (min-width: 641px) {
    .sheet-overlay {
        align-items: center;
        padding: 16px;
    }

    .sheet {
        max-height: min(860px, 100%);
        border-radius: var(--radius-card);
    }
}

@media (max-width: 640px) {
    .sheet-overlay.full {
        top: var(--viewport-top, 0);
        bottom: auto;
        height: 100vh;
        height: var(--viewport-height, 100dvh);
        align-items: stretch;
        background: var(--paper);
    }

    .sheet-overlay.full > .sheet {
        max-width: none;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }

    .sheet-overlay.full .sheet-header {
        padding-top: max(8px, env(safe-area-inset-top));
    }

    .sheet-overlay.full .sheet-actions > .btn {
        flex: 1 1 0;
        height: 44px;
        font-size: .92rem;
    }
}

@media (hover: none), (pointer: coarse) {
    .sheet .input,
    .sheet .picker-search > input {
        font-size: 16px;
    }

    .sheet .segmented-option {
        height: var(--h-touch);
    }

    .sheet .tag-bar > button.tag {
        height: var(--h-control);
        padding: 0 12px;
        font-size: .82rem;
    }
}

.shortcut-list {
    margin: 12px 0 0;
}

.shortcut {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-top: 1px solid var(--line);
    font-size: .88rem;
}

.shortcut:first-child {
    border-top: 0;
}

.shortcut > dd {
    margin: 0;
}

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

.tag-add-button,
.tag-history-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    min-width: 22px;
    padding: 0 8px;
    border: 1px dashed var(--control-border);
    border-radius: var(--pill);
    background: transparent;
    color: var(--text-secondary);
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    box-sizing: border-box;
}

.tag-add-button:hover,
.tag-history-button:hover {
    background: var(--tile-hover);
    color: var(--ink);
}

.tag-history-button {
    margin-left: auto;
    padding: 0;
    border-style: none;
}

.tag-popover {
    position: fixed;
    z-index: var(--z-dropdown);
    width: 260px;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    padding: 12px;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .08);
    box-sizing: border-box;
    animation: tag-popover-in .12s ease-out;
}

@keyframes tag-popover-in {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(.98);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tag-popover {
        animation: none;
    }
}

.tag-popover-wide {
    width: 340px;
    max-height: min(460px, calc(100vh - 16px));
}

.tag-popover.picker {
    width: 280px;
    padding: 6px;
}

.tag-popover-close {
    display: none;
}

@media (max-width: 830px) {
    .tag-popover,
    .tag-popover.picker,
    .tag-popover-wide {
        inset: 0;
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 12px 16px;
        padding-top: calc(max(8px, env(safe-area-inset-top)) + 48px);
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        overscroll-behavior: contain;
    }

    .tag-popover-close {
        position: fixed;
        top: max(8px, env(safe-area-inset-top));
        right: 8px;
        z-index: calc(var(--z-dropdown) + 1);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        color: var(--text-secondary);
        cursor: pointer;
    }

    .tag-popover-close:hover {
        background: var(--tile-hover);
    }
}

.tag-popover-heading {
    margin: 0 0 8px;
    font-size: .88rem;
    font-weight: 700;
    color: var(--ink);
}

.tag-popover-heading + .tag-history > .tag-history-day:first-child {
    margin-top: 0;
}

.tag-popover-note {
    font-size: .85rem;
    color: var(--text-muted);
}

.picker-list .tag-form-error {
    padding: 10px;
}

.tag-create-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border-radius: 8px;
    text-align: left;
    font-size: .88rem;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
}

.tag-create-row span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-create-row:hover {
    background: var(--tile-hover);
}

.tag-create-row.tag-manage-row {
    font-weight: 500;
    color: var(--text-muted);
}

.tag-create-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.tag-form-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.tag-back-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
}

.tag-back-button:hover {
    background: var(--tile-hover);
    color: var(--ink);
}

.tag-form-title {
    font-size: .88rem;
    font-weight: 700;
}

.tag-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 4px 4px;
}

.tag-name-input {
    font: inherit;
    font-size: .88rem;
    padding: 8px 10px;
    border: 1px solid var(--control-border);
    border-radius: 8px;
    color: var(--ink);
    box-sizing: border-box;
    width: 100%;
}

.tag-swatches {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tag-swatch {
    position: relative;
    display: block;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid var(--paper);
    border-radius: var(--pill);
    box-shadow: 0 0 0 1px var(--control-border);
    cursor: pointer;
    box-sizing: border-box;
}

.tag-swatch:hover {
    transform: scale(1.1);
}

.tag-swatch[aria-checked="true"],
.tag-swatches:not(:has([aria-checked="true"])) > .tag-swatch-custom {
    box-shadow: 0 0 0 2px var(--ink);
}

.tag-swatch-custom {
    background: conic-gradient(#ef4444, #eab308, #22c55e, #3b82f6, #8b5cf6, #ef4444);
}

.tag-color-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.tag-form-preview {
    display: flex;
    align-items: center;
    min-height: 22px;
}

.tag-form-error {
    margin: 0;
    font-size: .78rem;
    color: var(--danger);
}

.tag-submit-button {
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--accent-strong);
    color: var(--on-color);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
}

.tag-submit-button:disabled {
    opacity: .6;
    cursor: default;
}

.tag-history-day {
    margin: 12px 0 2px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.tag-history-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tag-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 6px 0;
}

.tag-history-text {
    min-width: 0;
    font-size: .85rem;
    color: var(--text-secondary);
}

.tag-history-who {
    font-weight: 600;
    color: var(--ink);
}

.tag-history-time {
    font-size: .75rem;
    line-height: 1.6;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.tag-history-tags {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.toast-region {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--keyboard-inset, 0px));
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    max-width: min(420px, 100%);
    min-height: 44px;
    padding: 8px 8px 8px 16px;
    border-radius: var(--radius-card);
    background: var(--ink);
    color: var(--on-color);
    box-shadow: var(--shadow-menu);
    font-size: .88rem;
    line-height: 1.35;
    pointer-events: auto;
    animation: toast-in .16s ease-out;
}

.toast[data-kind="error"] {
    background: var(--danger);
}

.toast-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.toast-action,
.toast-close {
    flex-shrink: 0;
    height: var(--h-touch);
    border-radius: var(--radius-control);
    color: inherit;
    font-weight: 600;
}

.toast-action {
    padding: 0 12px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--h-touch);
    opacity: .7;
}

.toast-close > .icon {
    width: 16px;
    height: 16px;
}

.toast-action:focus-visible,
.toast-close:focus-visible {
    outline-color: var(--on-color);
}

@media (hover: hover) and (pointer: fine) {
    .toast-action:hover,
    .toast-close:hover {
        background: var(--on-color-tint);
        opacity: 1;
    }
}

.toast[data-swapped] {
    animation: none;
}

.toast[data-leaving] {
    animation: toast-out .12s ease-in forwards;
}

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

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

.when-picker {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.quick-picks-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px 12px;
    border-radius: var(--radius-card);
    background: var(--surface-alt);
}

.quick-picks-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.quick-picks-caption {
    color: var(--text-secondary);
    font-size: .75rem;
    font-weight: 600;
}

.quick-picks {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.quick-picks.more {
    mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}

.quick-picks::-webkit-scrollbar {
    display: none;
}

.quick-picks > .chip {
    height: var(--h-control);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--control-border);
    background: var(--paper);
    color: var(--ink);
    font-size: .8rem;
}

.quick-picks > .chip:hover {
    background: var(--tile-hover);
}

.quick-picks .chip-body {
    height: 100%;
    padding: 0 12px;
    border-radius: var(--pill);
    font-variant-numeric: tabular-nums;
}

.quick-picks .chip-value {
    font-weight: 500;
}

.quick-picks .chip-body[aria-pressed="true"] {
    background: var(--accent-tint);
    color: var(--accent-ink);
}

.quick-picks > .chip:has(> [aria-pressed="true"]) {
    border-color: var(--accent-strong);
}

.quick-picks > .chip.removing {
    border-style: dashed;
}

.quick-picks > .chip.removing:hover {
    border-color: var(--danger);
    background: var(--danger-tint);
    color: var(--danger);
}

.quick-picks-edit {
    flex: none;
    margin: -4px -6px -4px 0;
    padding: 4px 6px;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    color: var(--text-secondary);
    font-size: .8rem;
    font-weight: 500;
}

.quick-picks-edit:hover,
.quick-picks-edit[aria-pressed="true"] {
    color: var(--ink);
    background: var(--tile-hover);
}

.when-date-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.when-date-row > .check {
    margin-right: -10px;
}

.calendar {
    padding: 10px 12px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--paper);
}

.calendar-head {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 4px;
}

.calendar-month {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: auto;
    padding: 4px 8px;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    color: var(--ink);
    font-size: .92rem;
    font-weight: 600;
}

.calendar-month[aria-expanded="true"] > .icon {
    rotate: 180deg;
}

.calendar-today {
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--control-border);
    border-radius: var(--pill);
    background: none;
    color: var(--ink);
    font-size: .78rem;
    font-weight: 500;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-width: 294px;
    margin: 4px auto 0;
}

.calendar-cell {
    height: 44px;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    color: var(--ink);
    font-size: .85rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.calendar-cell[aria-current="date"] {
    box-shadow: inset 0 0 0 1px var(--control-border);
}

.calendar-cell[aria-pressed="true"],
.calendar-cell[aria-pressed="true"]:hover {
    background: var(--accent-strong);
    color: var(--on-color);
}

.calendar-cell:disabled {
    color: var(--text-faint);
    cursor: default;
}

.calendar-week,
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    max-width: 294px;
    margin: 0 auto;
    gap: 4px;
    text-align: center;
}

.calendar-week {
    color: var(--text-faint);
    font-size: .72rem;
    font-weight: 600;
}

.calendar-week > span {
    padding: 4px 0;
}

.calendar-day {
    position: relative;
    justify-self: center;
    width: 100%;
    max-width: 36px;
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    font-size: .8rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.calendar-week > .weekend,
.calendar-day.weekend:not(.outside, :disabled, [aria-pressed="true"]) {
    color: var(--text-secondary);
}

.calendar-day.outside {
    color: var(--text-faint);
    font-weight: 500;
}

.calendar-day:disabled {
    background: none;
    color: var(--text-secondary);
    font-weight: 400;
    opacity: 1;
    cursor: default;
}

.calendar-day[aria-current="date"]::after {
    content: "";
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 50%;
    background: currentColor;
}

.calendar-day[aria-pressed="true"],
.calendar-day[aria-pressed="true"]:hover {
    background: var(--accent-strong);
    color: var(--on-color);
}

.when-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.when-inline-part {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 0;
    min-width: 0;
    min-height: var(--h-touch);
    padding: 0 14px;
    border: 1px solid var(--control-border);
    border-radius: var(--pill);
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-size: .92rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    transition: background-color .24s ease, border-color .24s ease, color .24s ease;
    -webkit-tap-highlight-color: transparent;
}

.when-inline-part > .icon {
    color: var(--text-secondary);
    transition: color .24s ease;
}

.when-inline-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.when-inline-part.date {
    flex: 3 1 140px;
}

.when-inline-part.time,
.when-inline-time {
    flex: 2 1 96px;
}

.when-inline-part.repeat {
    flex: 3 1 150px;
}

.when-inline-time {
    position: relative;
    display: flex;
    min-width: 0;
}

.when-inline-time > .icon {
    position: absolute;
    top: 50%;
    left: 14px;
    translate: 0 -50%;
    color: var(--text-secondary);
    pointer-events: none;
}

.when-inline-time > .when-inline-part {
    width: 100%;
    padding-left: 38px;
    text-align: center;
}

.when-inline-part.typed:focus {
    outline: none;
}

.when-inline-part[aria-expanded="true"] {
    border-color: var(--accent-strong);
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-weight: 700;
}

.when-inline-part[aria-expanded="true"] > .icon,
.when-inline-time:has(> [aria-expanded="true"]) > .icon {
    color: var(--accent-ink);
}

.when-inline-part[aria-invalid="true"] {
    border-color: var(--danger);
}

.when-inline-part.placeholder {
    border-style: dashed;
    color: var(--text-secondary);
    font-weight: 400;
}

.when-inline-clear {
    flex: none;
    align-self: center;
}

.when-inline-smart {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.when-inline-smart-box {
    position: relative;
    display: flex;
}

.when-inline-smart-box > .icon {
    position: absolute;
    top: 50%;
    left: 12px;
    translate: 0 -50%;
    color: var(--text-secondary);
    pointer-events: none;
}

.when-inline-smart-box > .input {
    flex: 1;
    min-width: 0;
    padding-left: 38px;
}

.when-inline-smart-box > .input[aria-invalid="true"] {
    box-shadow: inset 0 0 0 1px var(--warning);
}

.when-inline-smart-preview {
    margin: 0;
    padding-left: 12px;
    color: var(--accent-ink);
    font-size: .8rem;
    font-weight: 500;
}

.when-inline-smart-preview.late {
    color: var(--warning);
    font-weight: 400;
}

.date-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.when-repeat > .when-inline-panel {
    margin-top: -4px;
}

.when-repeat-row > .when-inline {
    flex: 1 1 160px;
}

.when-inline-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 12px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--paper);
}

.when-inline-panel > .calendar {
    padding: 0;
    border: 0;
}

.time-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    max-height: 248px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.time-list-option {
    height: 36px;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    color: var(--ink);
    font-size: .85rem;
    font-variant-numeric: tabular-nums;
}

.time-list-option:hover {
    background: var(--tile-hover);
}

.time-list-option[aria-pressed="true"],
.time-list-option[aria-pressed="true"]:hover {
    background: var(--accent-strong);
    color: var(--on-color);
}

.when-repeat-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.repeat-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.repeat-option {
    min-height: 40px;
    padding: 8px 12px;
    border: 0;
    border-radius: var(--radius-control);
    background: none;
    color: var(--ink);
    font-size: .88rem;
    text-align: left;
}

.repeat-option:hover {
    background: var(--tile-hover);
}

.repeat-option[aria-checked="true"],
.repeat-option[aria-checked="true"]:hover {
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-weight: 600;
}

.when-repeat-field > .when-repeat {
    margin-top: 0;
}

.when-inline-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: .8rem;
}

.when-inline-hint.late {
    color: var(--warning);
}

.when-fix {
    height: 28px;
    padding: 0 10px;
    border-color: currentColor;
    background: none;
    color: inherit;
    font-weight: 600;
}

.when-repeat {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--paper);
}

.when-repeat-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    font-weight: 500;
}

.when-repeat-row > .input[type="number"] {
    width: 76px;
    font-variant-numeric: tabular-nums;
}

.when-repeat-row > .input[type="date"] {
    width: auto;
}

.weekday-toggles {
    display: flex;
    gap: 4px;
}

.weekday-toggle {
    flex: 1 1 0;
    max-width: 40px;
    aspect-ratio: 1;
    padding: 0;
    border-radius: var(--pill);
    background: var(--tile-hover);
    color: var(--text-secondary);
    font-size: .72rem;
    font-weight: 600;
}

.weekday-toggle[aria-pressed="true"],
.weekday-toggle[aria-pressed="true"]:hover {
    background: var(--accent-strong);
    color: var(--on-color);
}

.when-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-item);
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-size: .85rem;
    font-weight: 500;
}

.when-summary > .icon,
.when-summary > .when-fix {
    flex: none;
}

.when-summary > .when-fix {
    margin-left: auto;
}

.when-summary.late {
    background: var(--warning-tint);
    color: var(--warning);
}

.when-push {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-item);
    background: var(--surface-alt);
}

@media (hover: hover) and (pointer: fine) {
    .calendar-day:hover:not(:disabled, [aria-pressed="true"]),
    .calendar-cell:hover:not(:disabled, [aria-pressed="true"]),
    .calendar-month:hover,
    .calendar-today:hover {
        background: var(--tile-hover);
    }
}

@media (prefers-reduced-motion: reduce) {
    .when-inline-part,
    .when-inline-part > .icon {
        transition: none;
    }
}

.list-detail {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

.list-detail-sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 360px;
    background: var(--paper);
    border-right: 1px solid var(--border);
}

.list-detail-sidebar > .list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.list-detail-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    background: var(--canvas);
}

@media (max-width: 830px) {
    .list-detail-sidebar {
        width: 100%;
        border-right: none;
    }

    .list-detail-main {
        display: none;
    }

    .list-detail.detail-open .list-detail-sidebar {
        display: none;
    }

    .list-detail.detail-open .list-detail-main {
        display: flex;
    }
}

.settings-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    background: var(--canvas);
}

.settings-page > .header {
    padding: 0 24px 0 8px;
}

.settings-page > .header > .tabs {
    max-width: var(--content-w);
    margin: 0 auto;
}

.settings-page-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px;
}

.settings-page-body > * {
    max-width: var(--content-w);
    margin-left: auto;
    margin-right: auto;
}

.settings-page-body > * + * {
    margin-top: 16px;
}

@media (max-width: 640px) {
    .settings-page > .header {
        padding-right: 12px;
    }

    .settings-page-body {
        padding: 16px;
    }
}

