.app-preferences { margin-top: 16px; }
.preference-help { padding: 16px; overflow-wrap: anywhere; }
.preference-help summary { cursor: pointer; font-weight: 600; min-height: 30px; }
.app-preferences .cardlist__row { gap: 16px; }
.app-preferences input[type=checkbox] { flex-shrink: 0; }
.app-preferences .plain-select { max-width: 55%; }
html[data-text-size="1"] { --preference-font-scale: 1.12; }
html[data-text-size="2"] { --preference-font-scale: 1.24; }
html[data-text-size="1"] body, html[data-text-size="2"] body { font-size: calc(14px * var(--preference-font-scale)); }
html[data-text-size="1"] :is(.settings, .settings .plain-select, .settings .group-title, .settings__tabs [role=tab], .field__value, .entry-row__title, .nav-row__label),
html[data-text-size="2"] :is(.settings, .settings .plain-select, .settings .group-title, .settings__tabs [role=tab], .field__value, .entry-row__title, .nav-row__label) { font-size: calc(14px * var(--preference-font-scale)); }
html[data-text-size="1"] :is(.entry-row__sub, .field__label, .general-preferences__help),
html[data-text-size="2"] :is(.entry-row__sub, .field__label, .general-preferences__help) { font-size: calc(12px * var(--preference-font-scale)); }
.tags.tags--dots { display: flex; flex-direction: column; align-items: stretch; }
.tags--dots .tag { background: transparent; border-color: transparent; justify-content: flex-start; border-radius: 6px; }
.tags--dots .tag::before { content: ''; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: currentColor; }
.tags--dots .tag--on { background: var(--kx-sub); }
.preference-tile { display: contents; }
.preference-tile--muted .tile--image img { filter: grayscale(1); }
.password-audit { margin: 12px 0; padding: 12px; background: var(--kx-sub); border-radius: 8px; }

/* A control hidden by host policy must not be revived by layout display rules. */
[hidden] { display: none !important; }

/* KeeWebX colors and flat surfaces for the shared interface. */
:root {
    --kx-bg: #ffffff;
    --kx-side: #f7f8fa;
    --kx-sub: #f4f6f9;
    --kx-text: #111a2b;
    --kx-muted: #5d6a7e;
    --kx-line: #e8ecf1;
    --kx-acc: #3373cb;
    --kx-acc-text: #ffffff;
    --kx-sel: #eaf2fd;
    --kx-error: #c0392b;
    --kx-ok: #2fb872;
    --kx-warn: #e8a10a;
    --kx-shadow: none;
    --kx-radius-control: 8px;
    --kx-radius-card: 10px;
    --kx-tile-blue-base: #dce8f5;
    --kx-tile-blue-ink: #4776a6;
    --kx-tile-amber-base: #f1e5cf;
    --kx-tile-amber-ink: #a77d35;
    --kx-tile-green-base: #dfebe2;
    --kx-tile-green-ink: #4b8564;
    --kx-tile-violet-base: #e8e1f1;
    --kx-tile-violet-ink: #876aa8;
    --kx-tile-slate-base: #deebed;
    --kx-tile-slate-ink: #518794;
    --kx-tile-coral-base: #f1e0e3;
    --kx-tile-coral-ink: #af7180;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-kx-theme="light"]) {
        --kx-bg: #17191f;
        --kx-side: #1b1e24;
        --kx-sub: #23262e;
        --kx-text: #f1f3f7;
        --kx-muted: #a0a8b6;
        --kx-line: #2c3039;
        --kx-acc: #85b3f1;
        --kx-acc-text: #0b1220;
        --kx-sel: #23304a;
        --kx-error: #ff7b72;
        --kx-tile-blue-base: #23384c;
        --kx-tile-blue-ink: #83aedb;
        --kx-tile-amber-base: #443823;
        --kx-tile-amber-ink: #d0a86a;
        --kx-tile-green-base: #273f33;
        --kx-tile-green-ink: #7db796;
        --kx-tile-violet-base: #383045;
        --kx-tile-violet-ink: #b39acb;
        --kx-tile-slate-base: #273b40;
        --kx-tile-slate-ink: #83b6bf;
        --kx-tile-coral-base: #443038;
        --kx-tile-coral-ink: #d299a6;
        color-scheme: dark;
    }
}

:root[data-kx-theme="dark"] {
    --kx-bg: #17191f;
    --kx-side: #1b1e24;
    --kx-sub: #23262e;
    --kx-text: #f1f3f7;
    --kx-muted: #a0a8b6;
    --kx-line: #2c3039;
    --kx-acc: #85b3f1;
    --kx-acc-text: #0b1220;
    --kx-sel: #23304a;
    --kx-error: #ff7b72;
    --kx-tile-blue-base: #23384c;
    --kx-tile-blue-ink: #83aedb;
    --kx-tile-amber-base: #443823;
    --kx-tile-amber-ink: #d0a86a;
    --kx-tile-green-base: #273f33;
    --kx-tile-green-ink: #7db796;
    --kx-tile-violet-base: #383045;
    --kx-tile-violet-ink: #b39acb;
    --kx-tile-slate-base: #273b40;
    --kx-tile-slate-ink: #83b6bf;
    --kx-tile-coral-base: #443038;
    --kx-tile-coral-ink: #d299a6;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    height: 100%;
    background: var(--kx-bg);
    color: var(--kx-text);
    font: 14px/1.4 -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, 'Segoe UI', sans-serif;
}
#root {
    height: 100%;
}
/* A waiting page has no vault or Connect actions until it owns the App lock. */
html[data-app-instance='checking'] #keewebx-userscript-connect,
html[data-app-startup='checking'] #keewebx-userscript-connect,
html[data-app-instance='secondary'] #keewebx-userscript-connect,
html[data-app-instance='error'] #keewebx-userscript-connect {
    display: none !important;
}
html[data-app-instance='departed'] #keewebx-userscript-connect { display: none !important; }
button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}
button {
    cursor: pointer;
}
:focus-visible {
    outline: 2px solid var(--kx-acc);
    outline-offset: 1px;
}
.muted {
    color: var(--kx-muted);
}
.sr-only {
    position: absolute;
    left: -9999px;
}

/* One button system: neutral actions, accent primary, red destructive. */
.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: var(--kx-radius-control);
    padding: 10px 16px;
    font-weight: 600;
    background: var(--kx-sub);
    color: var(--kx-text);
    transition: filter 140ms ease;
}
.pill--primary {
    background: var(--kx-acc);
    color: var(--kx-acc-text);
}
.pill--danger { color: var(--kx-error); }
.pill--primary.pill--danger { background: var(--kx-error); color: var(--kx-bg); }
.pill--block { width: 100%; }
/* Older secondary call sites share the same neutral appearance. */
.pill--tinted { background: var(--kx-sub); color: var(--kx-text); }
.pill--tinted.pill--danger { color: var(--kx-error); }
@media (hover: hover) { .pill:hover:not(:disabled) { filter: brightness(0.95); } }
.pill:active:not(:disabled) { filter: brightness(0.9); }
.pill:focus-visible { outline: 2px solid var(--kx-acc); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .pill { transition: none; } }
.pill:disabled { opacity: 0.55; cursor: default; }
.round {
    width: 36px;
    height: 36px;
    flex: none;
    border: 1px solid var(--kx-line);
    border-radius: var(--kx-radius-control);
    background: var(--kx-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.round:hover {
    color: var(--kx-acc);
}
.link {
    border: 0;
    background: none;
    padding: 0;
    color: var(--kx-acc);
    font-weight: 600;
}

/* Inputs */
.input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border: 1px solid transparent;
    border-radius: var(--kx-radius-control);
    background: var(--kx-sub);
    padding: 12px 16px;
    outline: none;
}
.input:focus {
    border-color: var(--kx-acc);
}
.input--error {
    border-color: var(--kx-error);
}
.error {
    color: var(--kx-error);
    font-size: 13px;
    margin: 6px 2px 0;
}
.field-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--kx-muted);
}

/* Start: vaults list and unlock card */
.start {
    display: flex;
    height: 100%;
}
.start__side {
    width: 360px;
    flex: none;
    padding: 30px 18px;
    background: var(--kx-side);
    border-right: 1px solid var(--kx-line);
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: auto;
}
.start__heading {
    margin: 0 10px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--kx-muted);
}
.start__heading + .start__heading,
.start__gap {
    margin-top: 18px;
}
.vault-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px;
    border: 0;
    border-radius: var(--kx-radius-control);
    background: transparent;
    text-align: left;
}
.vault-row:hover {
    background: var(--kx-sub);
}
.vault-row--on,
.vault-row--on:hover {
    background: var(--kx-sel);
}
.vault-row__icon {
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: var(--kx-radius-control);
    background: var(--kx-sub);
    color: var(--kx-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.vault-row--on .vault-row__icon {
    background: var(--kx-acc);
    color: var(--kx-acc-text);
}
.vault-row__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.vault-row__name {
    font-weight: 600;
    overflow-wrap: anywhere;
}
.vault-row__where {
    font-size: 12.5px;
    color: var(--kx-muted);
}
.add-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--kx-radius-control);
    background: transparent;
    font-weight: 600;
    text-align: left;
}
.add-row:hover {
    background: var(--kx-sub);
}
.add-row__icon {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: var(--kx-radius-control);
    background: var(--kx-sel);
    color: var(--kx-acc);
    display: flex;
    align-items: center;
    justify-content: center;
}
.start__main {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 24px;
    overflow: auto;
}
.card {
    width: 380px;
    max-width: 100%;
    min-width: 0;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-radius: var(--kx-radius-card);
}
.card__title {
    max-width: 100%;
    overflow-wrap: anywhere;
    margin: 18px 0 4px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.015em;
    text-align: center;
}
.card__sub {
    max-width: 100%;
    overflow-wrap: anywhere;
    margin: 0 0 24px;
    font-size: 13px;
    color: var(--kx-muted);
}
.card .pill {
    margin-top: 10px;
}
.card__form {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.unlock-key-file { display: flex; flex-wrap: wrap; gap: 12px; width: 100%; margin: 14px 0 4px; }
.unlock-key-file .link { min-width: 0; max-width: 100%; overflow-wrap: anywhere; text-align: left; }

/* Vault: three panes */
.vault {
    display: flex;
    height: 100%;
    overflow: hidden;
}
.side {
    width: var(--sidebar-width, 248px);
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 12px;
    background: var(--kx-side);
    border-right: 1px solid var(--kx-line);
    min-height: 0;
    overflow: hidden;
}
.side__content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}
.side__vault {
    flex: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    margin-bottom: 8px;
}
.side__vault-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.side__vault-name {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sync {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--kx-muted);
}
.sync__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--kx-ok);
}
.sync--offline .sync__dot {
    background: var(--kx-warn);
}
.sync--error .sync__dot {
    background: var(--kx-error);
}
.sync--syncing .sync__dot,
.sync--pending .sync__dot {
    background: var(--kx-muted);
}
.nav-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--kx-radius-control);
    background: transparent;
    text-align: left;
}
.nav-row:hover {
    background: var(--kx-sub);
}
.nav-row--on,
.nav-row--on:hover {
    background: var(--kx-sel);
    font-weight: 600;
}
.nav-row__label {
    flex-grow: 1;
}
.nav-row__count {
    font-size: 12px;
    color: var(--kx-muted);
}
.side__heading {
    margin: 14px 10px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--kx-muted);
}
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 2px 8px;
}
.group-branch__row { display: flex; align-items: center; min-width: 0; }
.group-branch__row .nav-row { flex: 1; min-width: 0; margin-left: 0; }
.group-branch__toggle, .group-branch__spacer { width: 24px; flex: 0 0 24px; }
.group-branch__toggle { display: grid; place-items: center; height: 32px; padding: 0; border: 0; background: transparent; color: var(--kx-muted); }
.group-branch__children { margin-left: 14px; }
.tag {
    min-width: 0;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    padding: 3px 10px;
    border-radius: var(--kx-radius-control);
    font-size: 12px;
    font-weight: 600;
    background: hsla(var(--tag-hue, 200), 24%, 55%, 0.1);
    color: var(--kx-text);
    border: 1px solid hsla(var(--tag-hue, 200), 24%, 55%, 0.16);
}
.tag::before {
    content: '';
    width: 7px;
    height: 7px;
    flex: none;
    border-radius: 50%;
    background: hsl(var(--tag-hue, 200), 35%, 55%);
}
.tag__text { min-width: 0; overflow-wrap: anywhere; text-align: left; }
.tag--on {
    outline: 2px solid hsl(var(--tag-hue, 200), 35%, 55%);
    outline-offset: 1px;
}
.side__foot {
    flex: none;
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 4px 0;
    border-top: 1px solid var(--kx-line);
}
.side__foot .link {
    flex-grow: 1;
    font-weight: 500;
    color: var(--kx-muted);
    text-align: left;
    padding-left: 6px;
}

.list {
    width: var(--list-width, 352px);
    flex: none;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--kx-line);
    min-height: 0;
}
.list__bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 14px 6px;
}
.search {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: var(--kx-radius-control);
    background: var(--kx-sub);
    color: var(--kx-muted);
}
.search input {
    flex-grow: 1;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--kx-text);
}
.list__meta {
    margin: 4px 18px 6px;
    font-size: 12px;
    color: var(--kx-muted);
}
.list__items {
    flex-grow: 1;
    overflow: auto;
    padding: 0 8px 12px;
}
.entry-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--kx-radius-control);
    background: transparent;
    text-align: left;
}
.entry-row:hover {
    background: var(--kx-sub);
}
.entry-row--on,
.entry-row--on:hover {
    background: var(--kx-sel);
}
.entry-row__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.entry-row__title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.entry-row__sub {
    font-size: 12.5px;
    color: var(--kx-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tile {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: var(--kx-radius-control);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tile--image {
    background: var(--kx-sub);
}
.tile--image img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}
.tile--large {
    width: 54px;
    height: 54px;
    border-radius: var(--kx-radius-card);
}
.tile--large img {
    width: 36px;
    height: 36px;
}

.detail {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px 28px;
    overflow: auto;
}
.detail__head {
    display: flex;
    align-items: center;
    gap: 14px;
}
.detail__title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.015em;
}
.detail__where {
    font-size: 13px;
    color: var(--kx-muted);
}
.fields {
    border-radius: var(--kx-radius-card);
    background: var(--kx-sub);
}
.field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--kx-line);
}
.field:last-child {
    border-bottom: 0;
}
.field__text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.field__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--kx-muted);
    overflow-wrap: anywhere;
}
.field__value {
    font-size: 15px;
    overflow-wrap: anywhere;
}
.field__value--mono {
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}
.field__action {
    border: 0;
    background: transparent;
    color: var(--kx-acc);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: var(--kx-radius-control);
}
.icon-btn {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: var(--kx-radius-control);
    background: transparent;
    color: var(--kx-muted);
    display: flex;
    align-items: center;
    justify-content: center;
}
.section-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--kx-muted);
}
.notes {
    margin: 0;
    line-height: 1.55;
    white-space: pre-wrap;
}
.notes__head,
.notes__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.notes__head {
    justify-content: space-between;
    margin-bottom: 8px;
}
.notes__head .section-title {
    margin: 0;
}
.notes__editor {
    display: block;
    min-height: 180px;
    resize: vertical;
    line-height: 1.55;
}
.notes__actions {
    justify-content: flex-end;
    margin-top: 10px;
}
.notes .markdown {
    white-space: normal;
    overflow-wrap: anywhere;
}
.notes .markdown > :first-child {
    margin-top: 0;
}
.notes .markdown > :last-child {
    margin-bottom: 0;
}
.notes .markdown a {
    color: var(--kx-acc);
}
.notes .markdown pre {
    overflow-x: auto;
    padding: 12px;
    border-radius: var(--kx-radius-card);
    background: var(--kx-sub);
}
.notes .markdown img {
    max-width: 100%;
}
.notes .markdown table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
}
.notes .markdown th,
.notes .markdown td {
    padding: 6px 10px;
    border: 1px solid var(--kx-line);
}
.attachment {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--kx-radius-control);
    border: 1px solid var(--kx-line);
    margin: 0 8px 8px 0;
}
.detail__foot {
    margin-top: auto;
    font-size: 12px;
    color: var(--kx-muted);
}
.empty {
    margin: auto;
    color: var(--kx-muted);
}

/* Settings */
.vault--settings { height: 100dvh; }
.settings__header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: max(16px, env(safe-area-inset-top));
    background: var(--kx-side);
}
.settings__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 0;
    background: var(--kx-side);
    border-bottom: 1px solid var(--kx-line);
    scrollbar-width: thin;
}
.settings__tabs [role="tab"] {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
    border: 0;
    border-radius: var(--kx-radius-control);
    padding: 10px 12px;
    min-height: 44px;
    background: transparent;
    color: var(--kx-muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.settings__tabs [aria-selected="true"] {
    color: var(--kx-text);
    background: var(--kx-bg);
    box-shadow: inset 0 -2px var(--kx-acc);
}
.settings__shortcut { width: 100%; border: 0; background: var(--kx-bg); text-align: left; color: inherit; }
.settings [role="tabpanel"][hidden] { display: none; }
.database-passkey { scroll-margin-top: 68px; }

.settings {
    container-type: inline-size;
    min-width: 0;
    min-height: 0;
    flex-grow: 1;
    overflow: auto;
    background: var(--kx-side);
    padding: 0 max(24px, env(safe-area-inset-right)) max(48px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    scroll-padding-block: 190px 24px;
    overscroll-behavior: contain;
}
.settings__inner {
    max-width: 600px;
    margin: 0 auto;
}
.settings__title {
    min-width: 0;
    overflow-wrap: anywhere;
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.group-title {
    margin: 22px 4px 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--kx-muted);
}
.cardlist {
    border-radius: var(--kx-radius-card);
    background: var(--kx-bg);
    overflow: hidden;
}
.cardlist__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--kx-line);
}
.cardlist__row:last-child {
    border-bottom: 0;
}
.segmented {
    display: flex;
    padding: 3px;
    border-radius: var(--kx-radius-control);
    background: var(--kx-sub);
}
.segmented button {
    border: 0;
    background: transparent;
    padding: 6px 16px;
    border-radius: var(--kx-radius-control);
    font-size: 13px;
    font-weight: 600;
    color: var(--kx-muted);
}
.segmented .segmented--on {
    background: var(--kx-bg);
    color: var(--kx-text);
    box-shadow: none;
}
.plain-select {
    border: 0;
    background: transparent;
    color: var(--kx-muted);
    font-size: 13.5px;
    border-radius: var(--kx-radius-control);
}

/* Phone: one pane at a time */
.start__tools,
.settings__titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.start__tools { margin: 0 10px 16px; }
.settings__phone-back { display: none; }
.mobile-vault-header {
    display: none;
}
.vault-form__field { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 8px; margin-bottom: 14px; text-align: left; }
.vault-row-wrap { display: flex; align-items: center; gap: 4px; touch-action: pan-y; }
.vault-row-wrap .vault-row { flex: 1; min-width: 0; }
.vault-row__remove { opacity: 0; pointer-events: none; }
.vault-row-wrap:focus-within .vault-row__remove { opacity: 1; pointer-events: auto; }
@media (min-width: 701px), (hover: hover) and (pointer: fine) {
    .vault-row-wrap:hover .vault-row__remove { opacity: 1; pointer-events: auto; }
}
@media (max-width: 700px) and (hover: none), (max-width: 700px) and (pointer: coarse) {
    .vault-row-wrap .vault-row__remove { display: none; }
    .vault-row-wrap[data-revealed="true"] .vault-row__remove {
        display: flex; opacity: 1; pointer-events: auto; width: 44px; height: 44px;
    }
}
.database-advanced { margin: 12px 0; text-align: left; }
.database-advanced summary { cursor: pointer; font-weight: 600; padding: 12px 0; }
.database-settings { padding: 20px; margin-bottom: 16px; }
.database-settings fieldset { padding: 0; margin: 0; border: 0; min-width: 0; }
.database-settings__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.side__close, .navigation-backdrop { display: none; }
.panel-resizer { flex: 0 0 6px; cursor: col-resize; touch-action: none; user-select: none; background: var(--kx-bg); }
.panel-resizer:hover, .panel-resizer:focus-visible { background: var(--kx-sel); box-shadow: inset 2px 0 var(--kx-acc); }
@media (max-width: 760px) {
    .panel-resizer { display: none; }
    .vault { flex-direction: column; }
    .mobile-vault-header {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        gap: 10px;
        min-height: 52px;
        padding: env(safe-area-inset-top) 12px 0 8px;
        background: var(--kx-bg);
        border-bottom: 1px solid var(--kx-line);
    }
    .mobile-vault-header__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
    .mobile-vault-header__toggle, .vault--navigation .side__close {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        border: 0;
        background: transparent;
        color: var(--kx-text);
    }
    .mobile-vault-header__toggle:hover, .vault--navigation .side__close:hover { background: var(--kx-sub); }
    .mobile-vault-header__toggle:focus-visible, .vault--navigation .side__close:focus-visible { outline: 2px solid var(--kx-acc); outline-offset: -2px; }
    .vault > .detail { flex: 1 1 0; min-height: 0; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
    .settings__phone-back { display: flex; }
    .start {
        flex-direction: column-reverse;
        height: auto;
        min-height: 100%;
    }
    .start__main {
        flex: none;
        overflow: visible;
        padding: 24px 20px;
    }
    .start .input { font-size: 16px; }
    .start .card { margin: 0 auto; }
    .start .error { overflow-wrap: anywhere; max-width: 100%; }
    .start__side {
        overflow: visible;
        padding-bottom: max(30px, env(safe-area-inset-bottom));
    }
    .start__side {
        width: auto;
        border-right: 0;
        border-top: 1px solid var(--kx-line);
    }
    .side {
        display: none;
    }
    .vault--navigation .side {
        display: flex; position: fixed; inset: 0 auto 0 0; width: min(320px, 90vw); z-index: 30;
        padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom));
    }
    .vault--navigation .side__close { display: flex; margin-left: auto; }
    .vault--navigation .navigation-backdrop {
        display: block; position: fixed; inset: 0; z-index: 29; border: 0; padding: 0; background: rgba(0, 0, 0, 0.35);
    }
    .vault--detail .list {
        display: none;
    }
    .vault:not(.vault--detail) .detail {
        display: none;
    }
    .list {
        width: 100%;
        flex: 1 1 0;
        border-right: 0;
        overflow-y: auto;
        box-sizing: border-box;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        scroll-padding-block: 12px 16px;
    }
    /* Keep the navigation toggle above a single scroll surface for list tools and rows. */
    .list > * { flex-shrink: 0; }
    .list > .list__items { flex: 0 0 auto; overflow: visible; min-height: 120px; }
    .detail__head .round {
        display: flex !important;
    }
}

.passkey-setup-option { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13px; color: var(--kx-muted); }
.passkey-setup-option input { flex: 0 0 auto; accent-color: var(--kx-acc); }

/* Readable settings labels; secondary copy alone uses the muted color. */
.settings { font-size: 14px; line-height: 1.5; }
.settings .group-title { font-size: 14px; color: var(--kx-text); }
.settings .plain-select { font-size: 14px; color: var(--kx-text); }
.settings__tabs [role="tab"] { font-size: 14px; }
.settings .general-preferences__help,
.settings .database-passkey p { line-height: 1.6; max-width: 65ch; }

/* Settings controls and copy must fit the available pane, including iPad's sidebar. */
.settings__titlebar { min-height: 44px; margin-bottom: 8px; }
.settings__titlebar .round { width: 44px; height: 44px; }
.settings .cardlist__row { flex-wrap: wrap; }
.settings .cardlist__row > * { min-width: 0; max-width: 100%; }
.settings .cardlist__row > span { flex: 1 1 120px; overflow-wrap: anywhere; }
.settings .cardlist__row > :is(input, svg, .segmented) { flex-shrink: 0; }
.settings .cardlist__row > input[type="checkbox"] {
    width: 20px; height: 20px; margin: 0; accent-color: var(--kx-acc);
}
.settings .plain-select { min-height: 44px; max-width: 100%; }
.settings .segmented button { min-height: 44px; }
.settings :is(.pill, .vault-form__field, h2, h3, p, summary) { overflow-wrap: anywhere; }
.settings .pill { min-width: 0; max-width: 100%; }
.settings summary { min-height: 44px; }
.settings .database-settings dd { margin-inline-start: 16px; }
.settings .database-passkey { scroll-margin-top: 190px; }

@container (max-width: 560px) {
    .settings__tabs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .settings__tabs [role="tab"] { grid-column: span 2; padding: 8px 4px; }
    .settings__tabs [role="tab"]:nth-child(n + 4) { grid-column: span 3; }
    .settings .cardlist__row { padding-inline: 12px; gap: 8px; }
    .settings .cardlist__row > span { flex-basis: 100px; }
    .settings .cardlist__row > .plain-select { flex: 1 1 140px; width: 100%; }
    .settings .cardlist__row > div:not(.segmented) { flex: 1 1 160px; }
    .settings .cardlist__row > div:not(.segmented) .plain-select { width: 100%; }
    .settings .database-settings { padding: 16px; }
}

@media (pointer: coarse), (max-width: 760px) {
    .settings :is(input, select, textarea),
    html[data-text-size] .settings .plain-select { font-size: 16px; }
    .settings .vault-form__field:has(input[type="checkbox"]) { min-height: 44px; justify-content: center; }
    .vault--settings > .side { padding-top: max(14px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}

@media (max-width: 760px) {
    .settings { padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
}

.theme-picker {
    position: fixed;
    inset: auto;
    margin: 0;
    width: min(280px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    overflow: auto;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid var(--kx-line);
    border-radius: var(--kx-radius-card);
    background: var(--kx-bg);
    color: var(--kx-text);
    box-shadow: 0 8px 28px #0003;
}
.theme-picker__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-weight: 600;
}
.theme-picker__heading .round { width: 44px; height: 44px; }
.theme-picker .plain-select { width: 100%; min-height: 44px; }
.theme-picker label { display: flex; flex-direction: column; gap: 6px; }

.sidebar-toggle, .sidebar-rail { display: none; }
.start-sidebar-content { display: contents; }
@media (min-width: 761px) {
    .sidebar-toggle { display: flex; flex: 0 0 36px; margin-left: auto; }
    .side__vault-text { flex: 1; }
    .start--foldable > .start__side { width: var(--start-sidebar-width, 360px); }
    .sidebar-folded > .side, .sidebar-folded > .start__side {
        width: 64px; padding: 14px 8px; overflow-x: hidden;
    }
    .sidebar-folded > .side > .side__vault { padding: 8px 0; justify-content: center; }
    .sidebar-folded > .side > .side__vault > svg,
    .sidebar-folded > .side > .side__vault > .side__vault-text,
    .sidebar-folded > .side > .side__content,
    .sidebar-folded > .start__side > .start-sidebar-content,
    .sidebar-folded > .side + .panel-resizer,
    .sidebar-folded > .start__side + .panel-resizer { display: none; }
    .sidebar-folded .sidebar-toggle { margin: 0 auto; }
    .sidebar-folded .sidebar-rail { display: flex; flex-direction: column; align-items: center; gap: 8px; }
    .sidebar-folded > .side > .side__foot { flex-direction: column; padding: 10px 0 0; }
    .sidebar-folded > .side > .side__foot > span { display: none; }
}

.password-generator {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--kx-line);
    border-radius: var(--kx-radius-control, 8px);
    background: var(--kx-bg);
}
.password-generator__head,
.password-generator__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.password-generator__head .section-title {
    margin: 0;
}
.password-generator__options {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 12px;
}
.password-generator__sets {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--kx-line);
    border-radius: var(--kx-radius-control, 8px);
}
.password-generator__sets label {
    display: flex;
    align-items: center;
    gap: 6px;
}
.password-generator__advanced {
    min-width: 0;
    border-top: 1px solid var(--kx-line);
}
.password-generator summary {
    min-height: 44px;
    padding-block: 12px;
    cursor: pointer;
    overflow-wrap: anywhere;
}
.password-generator__advanced > summary {
    font-weight: 600;
}
.password-generator__advanced-options {
    display: grid;
    gap: 14px;
    padding-block: 4px 12px;
}
.password-generator .input {
    min-width: 0;
    color: var(--kx-text);
    font-size: 14px;
    font-weight: 400;
}
.password-generator__result {
    font-family: ui-monospace, monospace;
}
.password-generator__reveal {
    align-self: flex-start;
}

.password-generator__preview { position: sticky; top: 0; z-index: 1; display: grid; gap: 6px; padding: 8px 0; background: var(--kx-bg); }
.password-generator__output { position: relative; }
.password-generator__output .input { padding-right: 52px; }
.password-generator__output .password-generator__reveal { position: absolute; right: 0; top: 0; width: 44px; height: 100%; min-height: 44px; }
.password-generator--dialog { padding: 0; border: 0; border-radius: 0; }
.password-generator--dialog > .password-generator__actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex-wrap: wrap;
    padding-block: 12px;
    border-top: 1px solid var(--kx-line);
    background: var(--kx-bg);
}
.password-generator--dialog .password-generator__actions .pill { flex: 1 1 max-content; min-width: 0; padding-inline: 10px; }
@media (max-width: 760px) {
    .password-generator__head .link,
    .password-generator__sets label { min-height: 44px; }
    .password-generator__sets { row-gap: 0; }
}

.prompt-dialog--closable { max-width: calc(100vw - 24px); }
.prompt-dialog--closable > form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: calc(100dvh - 26px);
}
.prompt-dialog__header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    padding: 12px;
    border-bottom: 1px solid var(--kx-line);
}
.prompt-dialog__header h2 { flex: 1; min-width: 0; }
.prompt-dialog__close {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    font-size: 24px;
}
.prompt-dialog__body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 16px;
    scroll-padding-block: 88px 68px;
}

.start__tools { gap: 8px; flex-wrap: wrap; }
.start-flow-tools { position: relative; }
.start-tools > summary { cursor: pointer; min-height: 44px; line-height: 44px; font-size: 13px; color: var(--kx-muted); }
.start-tools__menu { position: absolute; top: 100%; right: 0; z-index: 5; width: max-content; max-width: calc(100vw - 40px); padding: 8px 12px; border: 1px solid var(--kx-line); border-radius: 8px; background: var(--kx-bg); box-shadow: 0 8px 24px #0002; }
.start-tools__menu > .link { display: inline-flex; align-items: center; min-height: 44px; text-align: left; overflow-wrap: anywhere; max-width: 100%; }
.start-flow-drop { margin: 8px 0 16px; padding: 12px; border: 1px dashed var(--kx-line); border-radius: 10px; overflow-wrap: anywhere; }
.start--dropping .start-flow-drop { outline: 2px solid var(--kx-accent); }
@media (max-width: 760px) {
    .start__tools > .link,
    .start-flow-tools > .link,
    .unlock-key-file > .link { display: inline-flex; align-items: center; min-height: 44px; }
    .start__tools > .round { width: 44px; height: 44px; }
    .start__main .icon-btn { width: 44px; height: 44px; }
}

.unlock-card { padding-block: 12px; }
.unlock-card__password { position: relative; width: 100%; }
.unlock-card__password > .input { width: 100%; padding-right: 52px; }
.unlock-card__password > .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; }
.unlock-card .unlock-card__action { min-height: 46px; margin-top: 12px; }
.unlock-card__help { width: 100%; margin: 12px 0 0; color: var(--kx-muted); font-size: 13px; line-height: 1.5; }
.unlock-card__options { width: 100%; min-width: 0; margin-top: 12px; border-block: 1px solid var(--kx-line); }
.unlock-card__options > summary { min-height: 44px; padding: 12px 0; cursor: pointer; font-size: 13px; }
.unlock-card__extras { display: flex; flex-direction: column; align-items: flex-start; padding-bottom: 8px; }
.unlock-card .unlock-key-file { margin: 4px 0; gap: 0 12px; }
.unlock-card .unlock-key-file > .link { display: inline-flex; align-items: center; min-height: 44px; }
.unlock-card .unlock-card__forget { min-height: 44px; color: var(--kx-error); text-align: left; }
.unlock-card__cancel { min-height: 44px; margin-top: 4px; }
.unlock-card__mode { min-height: 44px; margin-top: 4px; }
.unlock-card :is(summary, label, button, p) { max-width: 100%; overflow-wrap: anywhere; }
@media (pointer: coarse), (max-width: 600px) {
    .unlock-card__password > .input { font-size: 16px; }
}

.entry-more { position: relative; }
.entry-more__panel {
    position: fixed; z-index: 40;
    width: min(300px, calc(100vw - 32px)); max-height: min(520px, 65dvh); overflow-y: auto;
    padding: 8px; border: 1px solid var(--kx-line); border-radius: 12px;
    background: var(--kx-surface, var(--kx-bg)); color: var(--kx-text);
    box-shadow: 0 8px 28px #0003;
}
.entry-more__panel[hidden] { display: none; }
.entry-more__heading { display: flex; align-items: center; justify-content: space-between; padding-left: 10px; font-size: 12px; color: var(--kx-muted); }
.entry-more__panel > div:not(.entry-more__heading), .entry-more__panel > div > div:not([role]) { display: contents !important; }
.entry-more__panel > button, .entry-more__panel > div:not(.entry-more__heading) > button, .entry-more__panel > div > div > button {
    display: flex; align-items: center; width: 100%; min-height: 44px; margin: 0;
    padding: 10px 12px; border: 0; border-radius: 6px; text-align: left; justify-content: flex-start;
    background: transparent; color: inherit; font-size: 14px; white-space: normal;
}
.entry-more__panel button:hover { background: var(--kx-hover, #8882); }
.entry-more__panel button:focus-visible { outline: 2px solid var(--kx-acc); outline-offset: -2px; }
.entry-more__panel button.pill.pill--danger { color: var(--kx-error); border-top: 1px solid var(--kx-line); border-radius: 0 0 6px 6px; }

.entry-more__heading .icon-btn { flex: none; width: 44px; height: 44px; }

.entry-appearance { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--kx-line); border-radius: 12px; padding: 20px; background: var(--kx-bg); color: var(--kx-text); }
.entry-appearance::backdrop { background: #0007; }
.entry-appearance h2 { margin: 0 0 12px; font-size: 20px; }
.entry-appearance__scroll { overflow-y: auto; max-height: calc(100dvh - 190px); padding: 2px; }
.entry-appearance fieldset { border: 0; padding: 0; margin: 12px 0 20px; min-width: 0; }
.entry-appearance legend { font-weight: 600; margin-bottom: 10px; }
.entry-appearance__icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; }
.entry-appearance__icons label { position: relative; display: flex; align-items: center; justify-content: center; height: 44px; border: 1px solid var(--kx-line); border-radius: 7px; cursor: pointer; }
.entry-appearance__icons label:has(:checked) { background: var(--kx-sub); outline: 2px solid var(--kx-acc); outline-offset: 1px; }
.entry-appearance__icons label:focus-within { outline: 2px solid var(--kx-acc); }
.entry-appearance__icons input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.entry-appearance__icons img { object-fit: contain; }
.entry-appearance__preview { width: 64px; height: 64px; object-fit: contain; margin-bottom: 12px; }
.entry-appearance input[type=file] { max-width: 100%; }
.entry-appearance__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.entry-flag { display: inline-block; height: 10px; width: 10px; border-radius: 50%; flex: 0 0 10px; vertical-align: middle; }
.entry-color-filter { display: flex; align-items: center; gap: 10px; padding: 8px 16px; justify-content: space-between; }
.entry-color-filter select { min-width: 0; max-width: 75%; }

.entry-icon-trigger { display: inline-flex; flex: 0 0 auto; padding: 0; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.entry-icon-trigger:hover { outline: 2px solid var(--kx-acc); outline-offset: 3px; }
.entry-icon-trigger:focus-visible { outline: 2px solid var(--kx-acc); outline-offset: 3px; }
.entry-icon-trigger:disabled, .entry-icon-trigger[aria-disabled="true"] { cursor: default; opacity: .65; }

.entry-appearance__website { margin: 12px 0 20px; padding: 12px; border: 1px solid var(--kx-line); border-radius: 8px; overflow-wrap: anywhere; }
.entry-appearance__website p { margin: 0 0 12px; }
.entry-appearance__website p:last-child { margin-bottom: 0; }

.entry-table { width: 100%; table-layout: fixed; border-collapse: collapse; text-align: left; }
.entry-table th, .entry-table td { padding: 8px 6px; overflow-wrap: anywhere; vertical-align: middle; border-bottom: 1px solid var(--kx-line); }
.entry-table thead { position: sticky; top: 0; background: var(--kx-bg); z-index: 1; }
.entry-table th:first-child { width: 150px; }
.entry-table tbody th { padding: 0; }
.entry-table .entry-row { gap: 5px; padding: 8px 4px; font-size: 13px; align-items: flex-start; }
.entry-table .entry-row > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.entry-table .tile { width: 24px; height: 24px; flex-shrink: 0; }
.entry-table small { display: block; font-weight: 400; color: var(--kx-muted); }
.entry-table tr[data-selected=true] { background: var(--kx-sel); }
.entry-table td { font-size: 12px; }
.entry-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 10px; font-size: 12px; }
.entry-pages button { min-height: 44px; font-size: 12px; padding: 4px 8px; }
.entry-table td { white-space: pre-wrap; }
.entry-table th { min-width: 0; }

.entry-list-controls { flex: 0 0 auto; min-width: 0; padding: 8px 12px; }
.entry-list-controls__primary { display: flex; align-items: stretch; gap: 6px; min-width: 0; }
.entry-list-controls .search { min-width: 0; flex: 1 1 0; padding: 0 10px; }
.entry-list-controls .search input { width: 100%; min-height: 44px; padding: 0; }
.entry-list-controls .search svg { flex-shrink: 0; }
.entry-list-controls .search:focus-within { outline: 2px solid var(--kx-acc); outline-offset: -2px; }
.entry-list-controls .entry-list__create { min-height: 44px; margin: 0; padding: 8px 10px; justify-content: center; white-space: normal; overflow-wrap: anywhere; }
.entry-list-controls__primary > .entry-list__create { flex: 0 1 auto; max-width: 45%; }
.entry-list-controls__secondary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; margin-top: 6px; align-items: start; }
.entry-list-controls .entry-sort,
.entry-list-controls .entry-color-filter { display: grid; gap: 2px; min-width: 0; padding: 0; margin: 0; font-size: 12px; }
.entry-list-controls .entry-sort select,
.entry-list-controls .entry-color-filter select { width: 100%; max-width: none; min-width: 0; min-height: 44px; padding: 6px; font-size: 13px; }
.entry-list-controls .search-options { margin: 0; min-width: 0; }
.entry-list-controls .search-options summary { min-height: 44px; padding: 10px 6px; box-sizing: border-box; font-size: 12px; overflow-wrap: anywhere; }
.entry-list-controls .search-options[open] { grid-column: 1 / -1; }
.entry-list-controls .search-options__body { max-height: min(300px, 35dvh); }
.entry-list-controls .search-options__check { min-height: 44px; }
.entry-list-controls__secondary > .entry-list__create { width: 100%; font-size: 12px; }
.entry-list-controls .vault-filter { margin: 0 0 6px; }
.entry-list-controls .vault-filter select { min-height: 44px; }
.side__foot .sidebar-generator { min-width: 36px; min-height: 36px; }

.vault .side__foot { gap: 1px; padding: 10px 0 0; flex-wrap: wrap; }
@media (max-width: 760px) {
    .vault .side__foot { gap: 0; margin-inline: -1px; }
    .vault .side__foot .round { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
}

.entry-editor__form {
    width: 100%;
    max-width: 760px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.entry-editor__head,
.entry-editor__actions,
.entry-detail__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.entry-editor__head {
    justify-content: space-between;
}
.entry-editor__field,
.entry-editor__custom-row .field-label {
    min-width: 0;
}
.entry-editor__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.entry-editor__field .input,
.entry-editor__custom-row .input {
    color: var(--kx-text);
    font-size: 14px;
    font-weight: 400;
}
.entry-editor__notes {
    min-height: 160px;
    resize: vertical;
}
.entry-editor__password-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.entry-editor__custom {
    min-width: 0;
    margin: 0;
    padding: 16px;
    border: 1px solid var(--kx-line);
    border-radius: var(--kx-radius-control, 8px);
}
.entry-editor__custom-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--kx-line);
}
.entry-editor__custom-row .link {
    justify-self: end;
}
.entry-editor__protect {
    display: flex;
    align-items: center;
    gap: 6px;
}
.entry-editor__custom-row textarea { min-height: 100px; resize: vertical; }
.entry-metadata { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 12px; }
.entry-metadata dd { margin: 0; overflow-wrap: anywhere; }
.entry-detail__actions {
    margin-left: auto;
    flex-basis: 100%;
}
.entry-detail__head {
    flex-wrap: wrap;
}
.entry-list__create {
    margin: 6px 14px;
    align-self: flex-start;
}
.entry-attachments__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}
.entry-attachments__head .section-title {
    margin: 0;
}
.entry-attachments__row {
    display: flex;
    flex-wrap: wrap;
}
.entry-attachments__name {
    flex: 1 1 140px;
    min-width: 0;
    overflow-wrap: anywhere;
}
.entry-attachments button:disabled {
    opacity: 0.55;
    cursor: default;
}
@media (max-width: 1000px) {
    .entry-detail__head {
        flex-wrap: wrap;
    }
}
@media (max-width: 760px) {
    .vault > .detail { padding-inline: 16px; }
    .detail .field { padding-inline: 12px; }
    .detail .round,
    .detail .icon-btn { width: 44px; height: 44px; flex: 0 0 44px; }
    .detail .field__action { min-width: 44px; min-height: 44px; flex-shrink: 0; }
    .detail .notes__head > .link { min-height: 44px; }
    .entry-editor .link,
    .entry-editor__protect { min-height: 44px; }
    .entry-editor {
        padding: 20px 16px;
    }
    .entry-editor__custom-row {
        grid-template-columns: minmax(0, 1fr);
    }
    /* Detail action row only: keep labels visible, shrink width not touch height. */
    .entry-detail__actions {
        gap: 6px;
    }
    .entry-detail__actions .pill--tinted {
        padding: 10px 12px;
        font-size: 13px;
        white-space: nowrap;
    }
}
@media (max-width: 350px) {
    .entry-detail__actions .pill--tinted {
        padding: 10px 10px;
    }
}

.entry-history {
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    margin: auto;
    overflow: hidden;
    overflow-wrap: anywhere;
    border: 1px solid var(--kx-line);
    border-radius: var(--kx-radius-card);
    background: var(--kx-bg);
    color: var(--kx-text);
}
/* Keep the native closed-dialog display:none behavior. Only the body scrolls. */
.entry-history[open] { display: flex; flex-direction: column; }
.entry-history__header { flex: none; padding: 16px 24px; border-bottom: 1px solid var(--kx-line); }
.entry-history__close { flex: none; min-width: 44px; min-height: 44px; }
.entry-history__body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 24px 24px; }
.entry-history h2 { margin: 0; flex-grow: 1; }
.entry-history select { width: 100%; min-width: 0; }
.entry-history__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.entry-history__fields { margin: 16px 0; }
.entry-history__field { border-top: 1px solid var(--kx-line); padding: 12px 0; }
.entry-history__field dt { font-weight: 600; }
.entry-history__field dd { margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.entry-templates { width: min(800px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid var(--kx-line); border-radius: 12px; padding: 20px; background: var(--kx-bg); color: var(--kx-text); overflow-wrap: anywhere; }
.entry-templates::backdrop { background: #0007; }
.entry-templates__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.entry-templates h2 { font-size: 20px; margin: 0; }
.vault .entry-templates .detail.entry-editor { display: block; padding: 20px 0 0; overflow: visible; width: 100%; }
.entry-templates .input { width: 100%; min-width: 0; }
.entry-templates .vault-form__field { margin-bottom: 12px; }
.entry-templates__list { list-style: none; padding: 0; }
.entry-templates__list li { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--kx-line); }
.entry-templates__list li > div { flex: 1 1 220px; min-width: 0; }
.entry-templates__list small { display: block; color: var(--kx-muted); margin-top: 6px; }
@media (max-width: 760px) { .entry-templates { padding: 16px; } }
.entry-templates .entry-editor__head { position: sticky; top: 0; z-index: 1; padding: 10px 0; background: var(--kx-bg); }

.phone-groups { box-sizing: border-box; width: min(100vw, 440px); height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; background: var(--kx-bg); color: var(--kx-text); }
.phone-groups[open] { display: flex; flex-direction: column; }
.phone-groups::backdrop { background: #0006; }
.phone-groups button:disabled { opacity: .45; cursor: default; }
.phone-groups__header { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px; border-bottom: 1px solid var(--kx-line); }
.phone-groups__header h2 { font-size: 16px; margin: 0; }
.phone-groups__icon { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 6px; background: transparent; font-size: 24px !important; }
.phone-groups__icon:hover, .phone-groups__icon[aria-expanded=true], .phone-groups__row:hover { background: var(--kx-hover, #8881); }
.phone-groups__location { padding: 8px 8px 12px; border-bottom: 1px solid var(--kx-line); }
.phone-groups__title { display: flex; align-items: center; gap: 4px; }
.phone-groups__title h3 { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-size: 15px; margin: 0; overflow-wrap: anywhere; }
.phone-groups__name { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.phone-groups__path { font-size: 12px; line-height: 1.5; color: var(--kx-muted); overflow-wrap: anywhere; margin: 4px 12px 0; max-height: 5.5em; overflow: auto; }
.phone-groups__scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.phone-groups__caption { margin: 16px 20px 8px; font-size: 12px; color: var(--kx-muted); }
.phone-groups__row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 12px 20px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--kx-line); }
.phone-groups__row > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.phone-groups__row small { display: block; font-size: 12px; color: var(--kx-muted); margin-top: 3px; }
.phone-groups__empty, .phone-groups__message { font-size: 13px; margin: 20px; overflow-wrap: anywhere; }
.phone-groups__footer { padding: 8px 16px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--kx-line); }
.phone-groups__footer > button { width: 100%; min-height: 44px; background: transparent; border: 0; font-size: 14px; font-weight: 600; }
.phone-groups__actions { padding: 4px 12px 12px; }
.phone-groups__actions > [role=group] { margin-top: 0 !important; }
.phone-groups__actions > [role=group] > div:first-child { display: flex !important; flex-direction: column; gap: 0 !important; }
.phone-groups__actions > [role=group] > div:first-child > .group-icon { display: none !important; }
.phone-groups__actions > [role=group] > div:first-child > button { width: 100%; min-height: 44px; padding: 8px 12px; text-align: left; justify-content: flex-start; border: 0; border-radius: 0; background: transparent; font-size: 14px; font-weight: 400; }
.phone-groups__actions > [role=group] > div:first-child > button:hover { background: var(--kx-hover, #8881); }
.phone-groups__actions > [role=group] > p { font-size: 12px; }
.group-branch__manage { flex: 0 0 32px; width: 32px; height: 32px; background: transparent; color: inherit; font-size: 22px; border: 0; border-radius: 6px; opacity: 0; cursor: pointer; }
.group-branch__row:hover .group-branch__manage, .group-branch__row:focus-within .group-branch__manage { opacity: 1; }
.group-branch__manage:hover { background: var(--kx-hover, #8881); }
@media (min-width: 761px) {
    .phone-groups { width: min(440px, calc(100vw - 48px)); height: min(680px, calc(100dvh - 64px)); max-height: calc(100dvh - 64px); margin: auto; border: 1px solid var(--kx-line); border-radius: 12px; box-shadow: 0 16px 64px #0003; }
}
@media (max-width: 760px) {
    .vault--navigation .nav-row,
    .vault--navigation button.tag { min-height: 44px; }
    .group-branch__toggle, .group-branch__spacer { width: 44px; flex-basis: 44px; }
    .group-branch__toggle { height: 44px; }
    .group-branch__row .nav-row { min-height: 44px; padding: 8px 4px; }
    .group-branch__row .nav-row__label { white-space: normal; overflow-wrap: anywhere; }
    .group-branch__children { margin-left: 10px; }
    .group-branch__children .group-branch__children .group-branch__children { margin-left: 0; }
    .group-branch__manage { opacity: 1; display: block; flex: 0 0 44px; width: 44px; height: 44px; background: transparent; color: inherit; font-size: 22px; border: 0; }
}
.phone-groups__actions > [role=group] > div:first-child > .pill--danger { color: var(--kx-error); border-top: 1px solid var(--kx-line); }

.search-options { flex: 0 0 auto; margin: 0 14px 6px; min-width: 0; }
.search-options summary { cursor: pointer; padding: 8px 0; }
.search-options__body { max-height: min(430px, 45dvh); overflow: auto; padding: 2px 2px 8px; overflow-wrap: anywhere; }
.search-options fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.search-options__check { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.search-options__body .input { width: 100%; min-width: 0; }
.vault-commands { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 14px 6px; }
.command-status { position: fixed; bottom: 72px; left: 12px; max-width: calc(100vw - 24px); padding: 10px; border: 1px solid var(--kx-line); border-radius: 8px; background: var(--kx-bg); z-index: 40; }
@media (max-width: 760px) {
    .search-options__body { max-height: min(430px, max(80px, calc(100dvh - 500px))); }
}

.vault-filter { display: grid; gap: 6px; margin: 8px 14px; flex: 0 0 auto; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
.vault-filter select { min-width: 0; width: 100%; }
.open-vaults { display: grid; gap: 8px; margin-bottom: 16px; }
.open-vaults__item { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--kx-line); border-radius: 8px; min-width: 0; }
.open-vaults__select { display: grid; gap: 4px; flex: 1; min-width: 0; padding: 0; background: transparent; color: inherit; border: 0; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.open-vaults__select[aria-pressed="true"] { color: var(--kx-accent); }
.open-vaults__select [role="status"] { font-size: 12px; color: var(--kx-muted); }
.open-vaults__item > .entry-more { flex: none; }

/* Keep the original icon shortcuts in a single responsive menu. */
.mobile-toolbar-region { display: none; }
@media (max-width: 760px) {
    .vault { --mobile-toolbar-height: calc(54px + env(safe-area-inset-bottom)); }
    .vault[data-toolbar-dock="top"] { --mobile-toolbar-height: calc(54px + env(safe-area-inset-top)); }
    .vault[data-toolbar-hidden="true"], .vault[data-toolbar-dock="floating"] { --mobile-toolbar-height: 0px; }
    .mobile-toolbar-region { position: relative; display: flex; flex: 0 0 var(--mobile-toolbar-height); min-height: var(--mobile-toolbar-height); order: 10; z-index: 31; }
    .vault[data-toolbar-dock="top"] > .mobile-toolbar-region { order: -1; }
    .mobile-toolbar { position: fixed; left: 0; right: 0; bottom: max(6px, env(safe-area-inset-bottom)); margin-inline: auto; display: flex; align-items: center; gap: 0; width: max-content; max-width: calc(100% - 12px); padding: 4px; border: 1px solid var(--kx-line); border-radius: 12px; background: var(--kx-side); box-shadow: 0 2px 8px #0002; }
    .vault[data-toolbar-dock="top"] .mobile-toolbar { top: max(6px, env(safe-area-inset-top)); bottom: auto; }
    .vault:not([data-toolbar-dock="floating"]):not([data-toolbar-dragging="true"]) .mobile-toolbar { width: 100%; max-width: none; bottom: 0; padding: 4px max(6px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); border-inline: 0; border-bottom: 0; border-radius: 0; box-shadow: none; }
    .vault[data-toolbar-dock="top"]:not([data-toolbar-dragging="true"]) .mobile-toolbar { top: 0; bottom: auto; padding-top: calc(4px + env(safe-area-inset-top)); padding-bottom: 4px; border-top: 0; border-bottom: 1px solid var(--kx-line); }
    .mobile-toolbar > .round, .mobile-toolbar > .entry-more > .round { flex: 0 0 36px; width: 36px; height: 36px; min-width: 36px; min-height: 36px; border: 0; background: transparent; }
    .mobile-toolbar > .round > svg { width: 22px; height: 22px; }
    .mobile-toolbar > .entry-more > .round > span { font-size: 26px; line-height: 1; }
    .vault:not([data-toolbar-dock="floating"]):not([data-toolbar-dragging="true"]) .mobile-toolbar > :is(.round, .entry-more) { flex: 1 1 0; width: auto; }
    .vault:not([data-toolbar-dock="floating"]):not([data-toolbar-dragging="true"]) .mobile-toolbar > .round,
    .vault:not([data-toolbar-dock="floating"]):not([data-toolbar-dragging="true"]) .mobile-toolbar > .entry-more > .round { width: 100%; height: 44px; min-height: 44px; }
    .mobile-toolbar > .round:hover, .mobile-toolbar > .entry-more > .round:hover { background: var(--kx-sub); }
    .mobile-toolbar__handle, .mobile-toolbar__reveal { touch-action: none; cursor: grab; }
    .mobile-toolbar__handle:active, .mobile-toolbar__reveal:active { cursor: grabbing; }
    .mobile-toolbar__reveal { position: fixed; right: 8px; bottom: max(6px, env(safe-area-inset-bottom)); width: 44px; height: 44px; background: var(--kx-side); box-shadow: 0 1px 6px #0002; }
    .vault[data-toolbar-dock="top"] .mobile-toolbar__reveal { top: max(6px, env(safe-area-inset-top)); bottom: auto; }
    .vault[data-toolbar-hidden="true"] > :is(.list, .detail) { padding-bottom: max(56px, env(safe-area-inset-bottom)); scroll-padding-bottom: 56px; }
    .vault[data-toolbar-hidden="true"][data-toolbar-dock="top"] > .list .entry-list-controls__primary { padding-right: 48px; }
    .vault[data-toolbar-hidden="true"][data-toolbar-dock="top"] > .detail .detail__head { padding-right: 56px; }
    .vault--navigation[data-toolbar-dock="bottom"] > .side { bottom: var(--mobile-toolbar-height); padding-bottom: 12px; }
    .vault--navigation[data-toolbar-dock="top"] > .side { top: var(--mobile-toolbar-height); padding-top: 12px; }
    .vault--navigation[data-toolbar-dock="bottom"] > .navigation-backdrop { bottom: var(--mobile-toolbar-height); }
    .vault--navigation[data-toolbar-dock="top"] > .navigation-backdrop { top: var(--mobile-toolbar-height); }
}

.general-preferences .cardlist__row { flex-wrap: wrap; }
.general-preferences .cardlist__row > span { min-width: 0; overflow-wrap: anywhere; }
.general-preferences .plain-select { max-width: 100%; min-height: 32px; }
.general-preferences input[type='checkbox'] { width: 20px; height: 20px; accent-color: var(--kx-accent); }
.general-preferences__help { margin: 0; padding: 10px 16px; font-size: 12px; line-height: 1.5; color: var(--kx-muted); white-space: pre-wrap; overflow-wrap: anywhere; border-bottom: 1px solid var(--kx-line); }

.diagnostics-help pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 280px; overflow: auto; padding: 12px; background: var(--kx-sub); }
.diagnostics-help__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.diagnostics-help__logs { padding-left: 24px; max-height: 400px; overflow: auto; overflow-wrap: anywhere; }
.diagnostics-help__logs li { padding: 8px 0; border-bottom: 1px solid var(--kx-line); }
.diagnostics-help__logs [data-level=error] strong { color: var(--kx-error); }
.diagnostics-help__logs [data-level=warn] strong { color: var(--kx-text); text-decoration: underline; }
.diagnostics-help__logs time { font-size: 0.85em; }
.shortcut-reference dl { margin: 0; }
.shortcut-reference dl > div { padding: 8px 0; border-bottom: 1px solid var(--kx-line); }
.shortcut-reference dt { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 600; }
.shortcut-reference dd { margin: 4px 0; color: var(--kx-muted); }
.shortcut-reference kbd { font-size: 0.85em; background: var(--kx-sub); padding: 2px 5px; border: 1px solid var(--kx-line); border-radius: 4px; overflow-wrap: anywhere; }

.remote-key-notices { position: fixed; z-index: 40; right: 16px; bottom: 76px; width: min(380px, calc(100vw - 32px)); max-height: 35dvh; overflow: auto; }
/* Reserve the notice's actual height instead of covering Settings controls. */
:has(> .remote-key-notices):has(> .vault--settings) { display: flex; flex-direction: column; max-height: 100dvh; }
.remote-key-notices:has(~ .vault--settings) { position: static; order: 1; flex: none; align-self: flex-end; margin: 0 max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)); }
.remote-key-notices ~ .vault--settings { flex: 1 1 0; min-height: 0; height: auto; }
@media (max-height: 480px) {
    .remote-key-notices ~ .vault--settings .settings__header { padding-top: max(4px, env(safe-area-inset-top)); }
    .remote-key-notices ~ .vault--settings .settings__titlebar { margin-bottom: 0; }
    .remote-key-notices ~ .vault--settings .settings__tabs { padding-block: 4px; }
    .remote-key-notices ~ .vault--settings .settings__tabs [role="tab"] { padding-block: 0; }
}
.remote-key-notice { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; margin-top: 8px; background: var(--kx-bg); color: var(--kx-text); border: 1px solid var(--kx-line); border-radius: var(--kx-radius-card); font-size: 13px; overflow-wrap: anywhere; }
.remote-key-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; box-sizing: border-box; padding: 20px; border: 1px solid var(--kx-line); border-radius: var(--kx-radius-card); background: var(--kx-bg); color: var(--kx-text); }
.remote-key-dialog::backdrop { background: #0008; }
.remote-key-dialog h2 { font-size: 21px; margin-top: 0; }
.remote-key-dialog p { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.remote-key-dialog__name { font-weight: 600; }
.remote-key-dialog fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.remote-key-dialog input, .remote-key-dialog select { max-width: 100%; min-width: 0; box-sizing: border-box; }
.remote-key-dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.close-vault { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-sizing: border-box; margin: auto; padding: 24px; overflow: auto; overflow-wrap: anywhere; color: var(--kx-text); background: var(--kx-bg); border: 1px solid var(--kx-line); border-radius: var(--kx-radius-card); }
.close-vault__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.multi-vault-open { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--kx-bg); color: var(--kx-text); box-sizing: border-box; }
.multi-vault-open[open] { display: flex; flex-direction: column; }
.multi-vault-open::backdrop { background: var(--kx-bg); }
.multi-vault-open__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; padding: 12px 20px; border-bottom: 1px solid var(--kx-line); }
.multi-vault-open__header h1 { margin: 0; font-size: 20px; }
.multi-vault-open__header p { margin: 4px 0 0; font-size: 13px; }
.multi-vault-open > .start { flex: 1; min-height: 0; height: auto; overflow: auto; }
@media (max-width: 760px) { .multi-vault-open__header { padding: 10px 12px; } .multi-vault-open__header h1 { font-size: 17px; } }

.app-instance-notice.start__main {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 24px 20px;
    overflow: auto;
    background: var(--kx-bg);
    color: var(--kx-text);
}

.app-instance-notice__card.card {
    width: 320px;
    margin: auto;
    gap: 16px;
    text-align: center;
    overflow-wrap: anywhere;
}

.app-instance-notice__title {
    max-width: 100%;
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: -0.015em;
}

.app-instance-notice__body,
.app-instance-notice__status {
    max-width: 100%;
    margin: 0;
    color: var(--kx-muted);
}

.app-instance-notice__action.pill {
    width: 100%;
    min-height: 44px;
    margin-top: 0;
    white-space: normal;
}

