.account-entry { min-height: 100dvh; display: grid; place-items: center; padding: 25px 14px; background: radial-gradient(ellipse at 24% 16%, var(--accent-soft), transparent 56%), var(--canvas); }
.account-card { width: min(100%, 440px); padding: clamp(24px, 5vw, 39px); border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.account-brand { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; color: var(--text); }
.account-brand strong { font-size: 1.14rem; }
.account-card h1 { margin: 0 0 5px; font-size: clamp(1.49rem, 4vw, 1.81rem); }
.account-card > p { margin: 0 0 19px; color: var(--muted); font-size: .9rem; }
.account-card .form { gap: 13px; }
.account-card > .button { margin: 4px 5px 0 0; }
.account-submit { min-height: 43px; width: 100%; }
.account-loading { color: var(--muted); }

.dialog { width: min(490px, calc(100% - 26px)); max-height: calc(100dvh - 26px); padding: 0; border: 1px solid var(--line-strong); border-radius: 17px; background: var(--paper); color: var(--text); box-shadow: 0 24px 70px #080e2a45; overflow: auto; }
.dialog.wide-dialog { width: min(628px, calc(100% - 26px)); }
.dialog::backdrop { background: #151c385d; backdrop-filter: blur(2px); }
[data-theme="dark"] .dialog::backdrop { background: #070910ad; }
.dialog-header { position: sticky; z-index: 2; top: 0; display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 13px 19px; border-bottom: 1px solid var(--line); background: var(--paper); }
.dialog-heading { display: flex; align-items: center; gap: 9px; min-width: 0; }
.dialog-heading h2 { margin: 0; font-size: 1.13rem; overflow-wrap: anywhere; }
.dialog-glyph { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 9px; color: var(--accent-ink); background: var(--accent-soft); }
.dialog-glyph .icon { width: 18px; height: 18px; }
#dialog-body { padding: 17px 20px 20px; }
.dialog:has(.form-footer) #dialog-body { padding-bottom: 0; }
.dialog[aria-busy="true"] #close-dialog { opacity: .45; cursor: wait; }
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label, .form legend, .theme-custom > label { color: var(--text); font-size: .875rem; font-weight: 640; }
.field label small, .optional-field small { margin-left: 3px; color: var(--quiet); font-size: .74rem; font-weight: 400; }
.form input:not([type="radio"], [type="checkbox"], [type="color"]), .form select, .form textarea { width: 100%; min-width: 0; min-height: 41px; padding: 7px 9px; background: var(--paper); border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); }
.form select { padding-right: 31px; }
.form textarea { min-height: 74px; resize: vertical; }
.form input::placeholder, .form textarea::placeholder { color: var(--quiet); }
.form input[aria-invalid="true"] { border-color: var(--danger); }
.form fieldset { margin: 0; padding: 0; min-width: 0; border: 0; }
.form .form-group, .form .link-credentials { padding: 4px 10px 9px; border: 1px solid var(--line); background: var(--canvas); border-radius: 9px; }
.form :is(.form-group, .link-credentials) legend { padding-inline: 4px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form :is(.form-group, .link-credentials) .form-help { margin-top: 6px; }
.form-help { margin: 0; font-size: .8rem; color: var(--muted); }
.form-error, .folder-picker-error { margin: 0; border-radius: 7px; padding: 6px 9px; font-size: .875rem; background: var(--danger-soft); color: var(--danger); }
.dialog-message { margin: 0 0 5px; color: var(--muted); overflow-wrap: anywhere; font-size: .92rem; }
.form-footer { position: sticky; z-index: 2; bottom: 0; display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin: 0 -20px; padding: 11px 20px; border-top: 1px solid var(--line); background: var(--paper); }
.form-footer .push-left { margin-right: auto; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 39px !important; }
.password-wrap .icon-button { position: absolute; top: 50%; translate: 0 -50%; right: 4px; }
.optional-field { border-top: 1px solid var(--line); padding: 7px 0 0; }
.optional-field summary { display: flex; align-items: center; gap: 5px; cursor: pointer; list-style: none; font-size: .875rem; font-weight: 600; color: var(--muted); }
.optional-field summary::-webkit-details-marker { display: none; }
.optional-field summary .icon { width: 16px; height: 16px; rotate: -90deg; }
.optional-field[open] summary .icon { rotate: 0deg; }
.optional-field .field { margin-top: 6px; }
.swatches, .theme-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.swatch, .theme-swatch { display: grid; place-items: center; position: relative; width: 35px; height: 35px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--paper); cursor: pointer; }
.swatch input, .appearance-modes input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span, .theme-swatch span { width: 17px; height: 17px; border-radius: 50%; background: var(--swatch, var(--tone)); box-shadow: inset 0 0 0 1px #80808045; }
.swatch:has(:checked), .theme-swatch[aria-pressed="true"] { border-color: var(--focus); background: var(--accent-soft); }
.swatch:focus-within, .appearance-modes label:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }

.appearance-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 5px; }
.appearance-modes label { position: relative; display: flex; justify-content: center; align-items: center; min-height: 39px; padding: 5px 3px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; color: var(--muted); font-size: .875rem; cursor: pointer; }
.appearance-modes label:has(:checked) { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.theme-custom { display: grid; align-items: center; grid-template-columns: 1fr auto minmax(80px, 111px); gap: 8px; margin-top: 11px; }
.theme-custom input[type="color"] { width: 40px; height: 39px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); cursor: pointer; }
.theme-custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 1px; }
.theme-custom input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line-strong); border-radius: 4px; }
#theme-hex { font-family: Consolas, monospace; }
.theme-preview { display: flex; align-items: center; gap: 9px; padding: 12px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); }
.theme-preview-icon { width: 32px; height: 32px; border-radius: 8px; color: var(--accent-ink); background: var(--paper); }
.theme-preview > div { display: grid; flex: 1; }
.theme-preview strong { font-size: .89rem; }
.theme-preview small { font-size: .75rem; color: var(--muted); }

.account { min-height: 188px; }
.account .record-open::after { content: none; }
.credentials-summary { margin: 11px 0 9px; padding: 4px 7px; border-radius: 8px; background: var(--panel); }
.credential-row { display: flex; min-width: 0; min-height: 33px; align-items: center; gap: 4px; font-size: .81rem; }
.credential-row + .credential-row { border-top: 1px solid var(--line); }
.credential-row > span { flex: none; width: 2.5em; color: var(--quiet); }
.credential-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.credential-row .icon-button { width: 29px; height: 29px; }
.account-website { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; font-size: .8rem; color: var(--accent-ink); white-space: nowrap; }
.account-website .icon { width: 15px; height: 15px; }
.account-website:hover { text-decoration: underline; }
.account .record-description { min-height: auto; margin-top: 1px; }
.folder-picker { --folder-option-size: 54px; --folder-list-padding: 5px; --folder-visible-rows: 5; }
.folder-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.folder-picker-new { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 3px 8px; border: 1px solid transparent; border-radius: 7px; color: var(--accent-ink); background: transparent; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.folder-picker-new:is(:hover, [aria-expanded="true"]) { border-color: var(--accent-line); background: var(--accent-soft); }
.folder-picker-new .icon { width: 15px; height: 15px; }
.folder-picker-input { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 5px 0 11px; background: var(--paper); }
.folder-picker-input > [data-icon] { color: var(--quiet); }
.folder-picker-input > [data-icon] .icon { width: 17px; height: 17px; }
.folder-picker-input:focus-within, .folder-picker-input:has([aria-expanded="true"]) { border-color: var(--focus); }
.folder-picker-input:has([aria-invalid="true"]) { border-color: var(--danger); }
.form .folder-picker-input input { min-width: 0; min-height: 43px; border: 0; padding: 5px 0; background: transparent; outline: 0; text-overflow: ellipsis; }
.folder-picker-input [aria-expanded="true"] + button .icon { rotate: 180deg; }
.folder-picker-panel { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--paper); }
.folder-picker-count { padding: 6px 11px; border-bottom: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: .78rem; line-height: 1.4; }
.folder-picker-panel.empty .folder-picker-count { border-bottom: 0; padding-block: 12px; }
.folder-options { max-block-size: calc(var(--folder-visible-rows) * var(--folder-option-size) + 2 * var(--folder-list-padding)); overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; scroll-snap-type: y proximity; scroll-padding-block: var(--folder-list-padding); padding: var(--folder-list-padding); }
.folder-options:empty { padding: 0; }
.folder-options button { display: flex; align-items: center; gap: 9px; width: 100%; block-size: var(--folder-option-size); padding: 6px 8px; border: 1px solid transparent; border-radius: 7px; color: var(--text); background: transparent; text-align: left; scroll-snap-align: start; }
.folder-options button:hover { background: var(--hover); }
.folder-options button:is(.active, [aria-selected="true"]) { border-color: var(--accent-line); color: var(--accent-ink); background: var(--accent-soft); }
.folder-choice-icon { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 7px; background: var(--panel); color: var(--accent-ink); }
.folder-choice-icon .icon, .folder-options button > .icon { width: 16px; height: 16px; }
.folder-choice-text { display: grid; flex: 1; min-width: 0; gap: 2px; }
.folder-choice-text strong, .folder-choice-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-choice-text strong { font-size: .9rem; line-height: 1.35; font-weight: 630; }
.folder-choice-text small, .folder-suggestion { color: var(--muted); font-size: .75rem; line-height: 1.35; }
.folder-suggestion { white-space: nowrap; }
.folder-picker-create { display: grid; gap: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.folder-picker-create-row { display: flex; align-items: center; gap: 7px; }
.folder-picker-create-row .button { flex: none; }
.search-folders h2 { font-size: 1.07rem; margin: 0 0 10px; }
.search-folders { margin: 0 0 15px; }

.toast { position: fixed; z-index: 20; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 32px); padding: 9px 13px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper); box-shadow: var(--shadow); color: var(--text); font-size: .875rem; }
.toast [data-icon] { color: var(--success); }
.toast.error [data-icon] { color: var(--danger); }
.clipboard-input { position: fixed; top: 0; left: 0; opacity: 0; pointer-events: none; }

@media (max-width: 520px) {
  .wide-dialog .field-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .folder-picker-new { min-height: 40px; }
  #dialog-body { padding: 13px 15px 15px; }
  .form-footer { margin-inline: -15px; padding-inline: 15px; }
  .dialog-header { padding-inline: 14px; }
}
@media (max-height: 820px) { .folder-picker { --folder-visible-rows: 4; } }
@media (max-height: 600px) { .folder-picker { --folder-visible-rows: 3; } }
@media (max-height: 440px) { .folder-picker { --folder-visible-rows: 2; } }
