/* "Caja fuerte": grafito azulado, papel cálido y un acento de latón. Claro u oscuro según el sistema. */
:root {
  --bg: #101319;
  --panel: rgba(25, 29, 37, .9);
  --panel-solid: #181c24;
  --line: rgba(255, 255, 255, .11);
  --text: #f1eee6;
  --text-2: #cfcbc1;
  --muted: #a6a9b0;
  --accent: #e0ae4f;
  --accent-strong: #c99432;
  --accent-rgb: 224, 174, 79;
  --accent-soft: rgba(224, 174, 79, .13);
  --on-accent: #1b1405;
  --ink-rgb: 255, 255, 255;
  --field: rgba(8, 10, 14, .55);
  --danger: #ff8d8d;
  --shadow: 0 24px 80px rgba(0, 0, 0, .42);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, var(--serif);
  font-family: "Segoe UI Variable Text", "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f1ea;
    --panel: rgba(255, 255, 255, .86);
    --panel-solid: #fffdf8;
    --line: rgba(32, 28, 20, .16);
    --text: #1d1a14;
    --text-2: #3e3a31;
    --muted: #5d5a52;
    --accent: #8a5a00;
    --accent-strong: #6f4800;
    --accent-rgb: 138, 90, 0;
    --accent-soft: rgba(138, 90, 0, .09);
    --on-accent: #fffaf0;
    --ink-rgb: 32, 28, 20;
    --field: rgba(255, 255, 255, .9);
    --danger: #b3261e;
    --shadow: 0 18px 50px rgba(60, 45, 10, .14);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; overflow-x: hidden; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
button:disabled { opacity: .5; cursor: not-allowed; }
.top-actions > a { color: var(--accent); font-size: .8rem; }
.text-button { border: 0; background: none; color: var(--accent); padding: 8px; cursor: pointer; font: inherit; font-size: .8rem; }
.demo-link { display: block; width: 100%; text-align: center; margin: 14px auto 0; padding: 9px; border: 0; background: transparent; color: var(--muted); font-size: .8rem; cursor: pointer; }
.demo-link:hover, .text-button:hover { color: var(--accent); text-decoration: underline; }
.demo-link:focus-visible, .text-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 5px; }
.help-content { padding: 30px; }
.help-content > p { color: var(--muted); line-height: 1.6; font-size: .86rem; }
.help-content > a { color: var(--accent); font-size: .85rem; }
.recovery-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.entry-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; margin-top: 10px; }
.page-summary { color: var(--muted); font-size: .8rem; }
.page-actions { display: flex; gap: 8px; }
.page-actions button { padding: 9px 12px; font-size: .8rem; }
.strength-line { min-height: 42px; }
#csvAcknowledge, #updateBackupAck { width: auto; }
#csvSummary { line-height: 1.6; color: var(--accent); }
#csvIssues { color: var(--muted); font-size: .8rem; padding-left: 20px; }
.profile-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.profile-picker[hidden], .profile-actions [hidden] { display: none; }
.profile-choice { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(var(--ink-rgb),.03); color: var(--text-2); font: inherit; font-size: .85rem; cursor: pointer; }
.profile-choice:hover { border-color: rgba(var(--accent-rgb),.4); color: var(--text); }
.profile-choice[aria-pressed="true"] { border-color: rgba(var(--accent-rgb),.6); background: var(--accent-soft); color: var(--text); }
.profile-choice-initials { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); border: 1px solid rgba(var(--accent-rgb),.3); color: var(--accent); font-size: .72rem; font-weight: 700; }
.profile-choice-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-actions { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.profile-actions .text-button:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }
.profile-avatar { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; background: var(--accent-soft); border: 1px solid rgba(var(--accent-rgb),.3); color: var(--accent); font-size: 1.4rem; font-weight: 700; margin-bottom: 22px; }
#authTitle { overflow-wrap: anywhere; }
.future-access { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 22px; }
.future-access span { float: right; color: var(--accent); font-size: .8rem; }
.future-access p { color: var(--muted); font-size: .8rem; margin-bottom: 0; }
.ambient { display: none; position: fixed; width: 420px; height: 420px; border-radius: 50%; filter: blur(100px); opacity: .13; pointer-events: none; }
.ambient-one { top: -180px; left: -80px; background: #46d79a; }
.ambient-two { right: -200px; bottom: -140px; background: #4083bb; }
.app-shell { width: min(1680px, calc(100% - 32px)); margin: 0 auto; min-height: 100vh; position: relative; z-index: 1; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 1.16rem; letter-spacing: -.02em; }
.brand strong { font-weight: 760; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(var(--accent-rgb),.4); border-radius: 10px; color: var(--accent); background: var(--accent-soft); }
.brand-mark svg { width: 21px; height: 21px; }
.top-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; align-items: center; }
.privacy-pill { color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; font-size: .8rem; letter-spacing: .02em; background: rgba(var(--ink-rgb),.025); }
.privacy-pill i, .sidebar-footer i { display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent); margin-right: 7px; }
.icon-button { border: 1px solid var(--line); background: rgba(var(--ink-rgb),.03); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; }
.icon-button:hover { border-color: rgba(var(--accent-rgb),.4); color: var(--accent); }
.welcome-view { min-height: calc(100vh - 64px); display: grid; grid-template-columns: 1.06fr .72fr; gap: clamp(50px, 9vw, 130px); align-items: center; padding: 64px 4vw 84px; }
.welcome-copy { max-width: 620px; }
.eyebrow, .card-kicker, .section-label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.welcome-copy h1 { font-family: var(--serif); font-weight: 400; line-height: 1.02; font-size: clamp(2.8rem, 5vw, 4.8rem); letter-spacing: -.03em; margin: 22px 0 25px; }
.welcome-copy h1 em { font-style: normal; color: var(--muted); }
.lead { color: var(--text-2); line-height: 1.75; font-size: 1.02rem; max-width: 520px; }
.benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 52px; padding-top: 27px; border-top: 1px solid var(--line); }
.benefits p { color: var(--muted); font-size: .88rem; line-height: 1.55; margin: 0; }
.benefits strong { display: block; color: var(--text-2); font-size: .8rem; margin-bottom: 3px; }
.glass-panel { background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow); }
.auth-card { padding: clamp(24px, 3vw, 36px); border-radius: 22px; position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb),.55), transparent); }
.auth-icon { width: 48px; height: 48px; border-radius: 14px; color: var(--accent); background: var(--accent-soft); display: grid; place-items: center; margin-bottom: 18px; }
.auth-icon svg { width: 25px; height: 25px; }
.card-kicker { color: var(--accent); margin: 0 0 8px; }
.auth-card h2, .dialog-header h2 { font-family: var(--serif); font-weight: 400; font-size: 2rem; margin: 0 0 10px; letter-spacing: -.03em; }
.muted { color: var(--muted); line-height: 1.55; margin: 0; }
.auth-card form { margin-top: 18px; }
label { display: block; color: var(--text-2); font-size: .8rem; margin: 16px 0 8px; font-weight: 600; }
input, select, textarea { width: 100%; color: var(--text); border: 1px solid var(--line); background: var(--field); border-radius: 10px; padding: 13px 14px; outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: rgba(var(--accent-rgb),.6); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.08); }
input::placeholder, textarea::placeholder { color: var(--muted); }
select { color-scheme: inherit; }
textarea { resize: vertical; }
.input-wrap { position: relative; }
input::-ms-reveal, input::-ms-clear { display: none; }
.input-wrap input { padding-right: 46px; }
.reveal-button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; border: 0; color: var(--muted); background: transparent; padding: 7px; cursor: pointer; }
.reveal-button:hover { color: var(--accent); }
.reveal-button svg { width: 18px; height: 18px; }
.primary-button, .secondary-button, .generator-shortcut { border-radius: 10px; border: 1px solid transparent; padding: 12px 17px; font-weight: 720; font-size: .8rem; cursor: pointer; transition: transform .16s, box-shadow .16s, border-color .16s; }
.primary-button { background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 28px rgba(var(--accent-rgb),.15); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 12px 32px rgba(var(--accent-rgb),.25); }
.primary-button.full { width: 100%; margin-top: 10px; display: flex; justify-content: center; gap: 10px; }
.secondary-button { background: rgba(var(--ink-rgb),.035); border-color: var(--line); color: var(--text-2); }
.secondary-button:hover, .generator-shortcut:hover { border-color: rgba(var(--accent-rgb),.35); color: var(--accent); }
.form-error { color: var(--danger); font-size: .8rem; min-height: 18px; margin: 10px 0 0; }
.password-policy { color: var(--muted); font-size: .8rem; line-height: 1.5; margin: 8px 0; }
.password-policy p { margin: 0 0 4px; }
.password-policy p:first-child { color: var(--text); }
.suggest-button { margin-top: 6px; padding: 9px 13px; font-size: .8rem; }
.suggestion-note { color: var(--accent); }
.suggestion-phrase { margin: 6px 0 0; padding: 10px 12px; border: 1px dashed rgba(var(--accent-rgb),.35); border-radius: 9px; color: var(--text); font: 600 .9rem/1.5 Consolas, "Courier New", monospace; overflow-wrap: anywhere; user-select: all; }
.check-line { display: flex; align-items: center; gap: 9px; margin: 8px 0 0; font-weight: 500; color: var(--text); }
#suggestionAck { width: auto; accent-color: var(--accent); }
.rekey-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.rekey-recovery { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 18px; }
.rekey-recovery h3 { margin: 0; }
.rekey-recovery p { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.rekey-recovery p:empty { display: none; }
.backup-reminder { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.backup-reminder p { color: var(--muted); font-size: .8rem; margin: 0 0 8px; }
.microcopy { display: flex; align-items: center; justify-content: center; gap: 7px; color: var(--muted); font-size: .8rem; margin: 22px 0 0; text-align: center; }
.microcopy svg { width: 14px; height: 14px; }

.vault-view { display: grid; grid-template-columns: 256px 1fr; gap: 0; min-height: calc(100vh - 64px); padding: 16px 0 24px; }
.sidebar { position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; border-radius: 16px 0 0 16px; padding: 20px 14px 14px; box-shadow: none; display: flex; flex-direction: column; justify-content: space-between; }
.section-label { padding: 0 12px; margin: 0 0 10px; }
.category-label { margin-top: 20px; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { width: 100%; border: 0; border-radius: 9px; padding: 10px 12px; display: grid; grid-template-columns: 25px 1fr auto; text-align: left; color: var(--muted); background: transparent; cursor: pointer; font-size: .8rem; }
.nav-item:hover { background: rgba(var(--ink-rgb),.035); color: var(--text-2); }
.nav-item.active { color: var(--accent); background: var(--accent-soft); }
.nav-item b { font-size: .8rem; min-width: 23px; padding: 2px 7px; border-radius: 99px; text-align: center; background: rgba(var(--ink-rgb),.06); }
.nav-icon { text-align: center; }
.sidebar-footer { border-top: 1px solid var(--line); padding: 14px 0 0; display: grid; gap: 14px; }
.sidebar-group { display: grid; gap: 2px; }
.sidebar-group-label { margin: 0 8px 4px; color: var(--muted); font-size: .8rem; font-weight: 600; }
.sidebar-footer button { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px; min-height: 38px; border: 0; border-radius: 9px; padding: 7px 10px; text-align: left; color: var(--text-2); background: transparent; font-size: .8rem; cursor: pointer; }
.sidebar-footer button svg { width: 18px; height: 18px; opacity: .85; }
.sidebar-footer button:hover:not(:disabled) { color: var(--accent); background: rgba(var(--ink-rgb),.035); }
.sidebar-footer button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sidebar-footer .sidebar-status { color: var(--muted); font-size: .8rem; margin: 0 10px; }
.menu-toggle { display: none; }
.first-steps { margin: 0 0 28px; padding: 20px 22px; border: 1px solid rgba(var(--accent-rgb),.22); border-radius: 14px; background: var(--accent-soft); }
.first-steps-head { display: flex; align-items: center; gap: 12px; }
.first-steps-head h3 { margin: 0; font-size: 1rem; }
.first-steps-progress { margin-right: auto; color: var(--accent); font-size: .8rem; }
.first-steps-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 10px; }
.first-steps-list li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; }
.first-steps-list .step-mark { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.first-steps-list li[data-done="true"] .step-mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.first-steps-list li[data-done="true"] .step-title { color: var(--muted); text-decoration: line-through; }
.first-steps-list .step-title { display: block; font-size: .86rem; font-weight: 600; }
.first-steps-list .step-hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.first-steps-list button { padding: 8px 12px; font-size: .8rem; }
.vault-content { min-width: 0; border: 1px solid var(--line); border-left: 0; border-radius: 0 16px 16px 0; background: var(--panel); padding: clamp(22px, 3vw, 40px); }
.vault-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.vault-header h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.02em; margin: 7px 0 7px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin: 20px 0 16px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 43px; }
.generator-shortcut { color: var(--accent); background: var(--accent-soft); border-color: rgba(var(--accent-rgb),.15); }
.generator-shortcut span { margin-right: 5px; }
.entry-list { display: grid; gap: 6px; }
.entry-card { display: grid; grid-template-columns: 38px minmax(120px,1.2fr) minmax(120px,1fr) auto; align-items: center; gap: 14px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(var(--ink-rgb),.022); transition: border-color .18s, transform .18s; }
.entry-card:hover { border-color: rgba(var(--accent-rgb),.4); }
.site-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--accent); background: var(--accent-soft); font-weight: 800; }
.entry-main strong, .entry-user strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.entry-main small, .entry-user small { color: var(--muted); font-size: .8rem; }
.entry-actions { display: flex; gap: 4px; }
.entry-actions button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); cursor: pointer; }
.entry-actions button:hover { color: var(--accent); background: var(--accent-soft); }
.entry-actions button.danger:hover { color: var(--danger); background: rgba(255,123,134,.1); }
.entry-actions button svg { width: 17px; height: 17px; }
.empty-state { text-align: center; max-width: 380px; margin: 66px auto 0; color: var(--muted); }
.empty-orbit { width: 98px; height: 98px; border: 1px dashed rgba(var(--accent-rgb),.25); border-radius: 50%; display: grid; place-items: center; margin: 0 auto 25px; box-shadow: inset 0 0 35px rgba(var(--accent-rgb),.05); }
.empty-orbit span { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); font-size: 1.5rem; }
.empty-state h3 { color: var(--text); font: 400 1.55rem var(--serif); margin: 0 0 8px; }
.empty-state p { font-size: .82rem; line-height: 1.6; margin: 0 0 22px; }

.app-dialog { width: min(620px, calc(100% - 30px)); max-height: calc(100vh - 30px); overflow: auto; color: var(--text); background: var(--panel-solid); border: 1px solid rgba(var(--ink-rgb),.12); border-radius: 18px; padding: 0; box-shadow: var(--shadow); }
.app-dialog::backdrop { background: rgba(8,9,12,.72); }
.app-dialog form { padding: 30px; }
.update-dialog { width: min(440px, calc(100% - 30px)); }
.update-dialog form { padding: 22px; }
.update-dialog h2 { margin: 0 0 12px; font-size: 1.25rem; }
.update-dialog p { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.update-dialog .dialog-actions { margin-top: 16px; }
.update-dialog details { margin-top: 12px; color: var(--muted); font-size: .84rem; }
.update-dialog summary { color: var(--accent); cursor: pointer; }
#updateNotes { margin-top: 8px; max-height: 9rem; overflow: auto; white-space: pre-wrap; }
.update-backup { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.update-backup p { color: var(--muted); font-size: .82rem; }
.update-backup .text-button { padding: 8px 0 0; }
.update-backup label { display: flex; align-items: flex-start; gap: 8px; margin-top: 10px; }
.update-backup input { flex: none; margin: 2px 0 0; accent-color: var(--accent); }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.dialog-header h2 { margin: 0; }
.dialog-close { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); background: rgba(var(--ink-rgb),.03); font-size: 1.35rem; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.span-two { grid-column: 1 / -1; }
.strength-line { height: 27px; position: relative; margin-top: 9px; border-top: 3px solid rgba(var(--ink-rgb),.07); }
.strength-line span { position: absolute; left: 0; top: -3px; height: 3px; width: 0; background: var(--accent); transition: width .2s, background .2s; }
.strength-line small { display: block; text-align: right; margin-top: 7px; color: var(--muted); font-size: .8rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.generated-output { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; border: 1px solid rgba(var(--accent-rgb),.22); background: var(--field); padding: 15px; border-radius: 12px; }
.generated-output output { font: 600 1rem ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; color: var(--accent); }
.generated-output button { border: 0; color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: .8rem; }
.generator-strength { margin: 10px 0 22px; }
.range-heading { display: flex; justify-content: space-between; align-items: center; }
.range-heading label { margin: 0; }
.range-heading strong { color: var(--accent); }
input[type="range"] { accent-color: var(--accent); padding: 0; background: transparent; border: 0; box-shadow: none; }
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 19px; }
.option-grid label { margin: 0; display: flex; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.option-grid input { width: auto; accent-color: var(--accent); }
.option-grid label:has(input:checked) { border-color: rgba(var(--accent-rgb),.24); background: var(--accent-soft); color: var(--text-2); }
.toast { position: fixed; z-index: 30; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; color: var(--text); background: var(--panel-solid); border: 1px solid rgba(var(--accent-rgb),.22); box-shadow: var(--shadow); border-radius: 10px; padding: 11px 16px; font-size: .8rem; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 900px) and (min-width: 901px) {
  .welcome-view { padding-top: 28px; align-items: start; }
  .auth-card .auth-icon { display: none; }
  .auth-card label { margin-top: 12px; }
}

@media (max-width: 900px) {
  .ambient { display: none; } /* Decorative glows extend past the viewport and inflate the page width on phones. */
  .welcome-view { grid-template-columns: 1fr; padding: 60px 0 80px; }
  /* On narrow screens the form comes before the benefits so nobody has to scroll past marketing copy to start. */
  .welcome-view { gap: 0; }
  .welcome-copy { display: contents; }
  .welcome-copy > :not(.benefits) { order: 1; }
  .auth-card { order: 2; max-width: 560px; width: 100%; margin-top: 28px; }
  .welcome-copy > .benefits { order: 3; margin-top: 36px; }
  .vault-view { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; display: block; padding: 14px 14px 10px; border-radius: 16px 16px 0 0; }
  .sidebar > div:first-child { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
  .sidebar > div:first-child .section-label { display: none; }
  .sidebar > div:first-child nav { display: flex; gap: 8px; }
  .sidebar .nav-item { width: auto; flex: none; white-space: nowrap; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px; min-height: 40px; }
  .sidebar .nav-item.active { border-color: rgba(var(--accent-rgb),.35); }
  .menu-toggle { display: flex; width: 100%; align-items: center; justify-content: space-between; min-height: 44px; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(var(--ink-rgb),.025); color: var(--text-2); font-size: .8rem; cursor: pointer; }
  .menu-toggle[aria-expanded="true"] span { transform: rotate(180deg); }
  .menu-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .sidebar-footer { display: none; border-top: 0; padding-top: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .sidebar-footer.open { display: grid; }
  .sidebar-footer button { min-height: 44px; }
  .sidebar-footer .sidebar-status { grid-column: 1 / -1; }
  .vault-content { border-left: 1px solid var(--line); border-radius: 0 0 16px 16px; border-top: 0; }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 26px, 1260px); }
  .topbar { height: 60px; }
  .privacy-pill { display: none; }
  .welcome-view { min-height: calc(100vh - 60px); padding-top: 42px; }
  .welcome-copy h1 { font-size: 3.35rem; }
  .benefits { grid-template-columns: 1fr; gap: 15px; margin-top: 35px; }
  .vault-view { padding-top: 16px; }
  .vault-content { padding: 24px 16px; }
  .vault-header { align-items: flex-start; }
  .vault-header .primary-button { padding: 11px; font-size: 0; }
  .vault-header .primary-button::first-letter { font-size: 1rem; }
  .search-row { grid-template-columns: 1fr; }
  .first-steps-list li { grid-template-columns: 28px minmax(0, 1fr); }
  .first-steps-list li button { grid-column: 2; justify-self: start; }
  .entry-card { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; }
  .entry-main { min-width: 0; }
  .entry-user { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .option-grid { grid-template-columns: 1fr; }
  .dialog-actions { flex-wrap: wrap; }
}

.health-dialog { width: min(700px, calc(100% - 30px)); height: min(720px, calc(100vh - 30px)); overflow: hidden; }
.health-dialog[open] { display: flex; }
.health-content { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.health-head { padding: 24px 28px 0; border-bottom: 1px solid var(--line); }
.health-head .dialog-header { margin-bottom: 14px; }
.health-verdict { margin: 0 0 12px; font: 400 1.35rem/1.25 var(--serif); letter-spacing: -.01em; }
.health-meter { height: 6px; border-radius: 99px; background: rgba(var(--ink-rgb), .1); overflow: hidden; }
.health-meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.health-summary { margin: 10px 0 16px; color: var(--muted); font-size: .85rem; line-height: 1.4; }
.health-tabs { display: flex; gap: 4px; margin-bottom: -1px; overflow-x: auto; }
.health-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font: inherit; font-size: .88rem; cursor: pointer; }
.health-tab:hover { color: var(--text); }
.health-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.health-tab b { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: rgba(var(--ink-rgb), .08); font-size: .8rem; text-align: center; }
.health-tab[aria-selected="true"] b { background: var(--accent-soft); color: var(--accent); }
.health-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 28px; }
.health-foot { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 28px; border-top: 1px solid var(--line); }
.health-foot .microcopy { margin: 0; font-size: .8rem; max-width: 46ch; }
.health-foot button { flex: none; }
.health-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.health-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: var(--text); font: inherit; font-size: .9rem; text-align: left; cursor: pointer; }
.health-row:hover { border-color: rgba(var(--accent-rgb), .5); background: var(--accent-soft); }
.health-row strong, .health-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.health-row span { color: var(--muted); font-weight: 400; }
.health-group { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 0 0 10px; }
.health-group p { margin: 0 0 10px; color: var(--text); font-size: .9rem; font-weight: 600; }
.health-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.health-chip { max-width: 100%; padding: 6px 11px; border: 1px solid var(--line); border-radius: 99px; background: rgba(var(--ink-rgb), .04); color: var(--text-2); font: inherit; font-size: .84rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health-chip:hover { border-color: rgba(var(--accent-rgb), .6); color: var(--text); }
.health-group .text-button { margin-top: 8px; }
.health-empty { color: var(--muted); font-size: .9rem; margin: 8px 0; }
@media (max-width: 560px) { .health-foot { flex-direction: column; align-items: stretch; } .health-row { grid-template-columns: 1fr; gap: 2px; } }

.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; }
.generator-mode { border: 0; margin: 0 0 12px; padding: 0; }
#passphraseSeparator { margin-bottom: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
@media (max-width: 900px) { .sidebar { position: static; max-height: none; overflow-y: visible; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Escritorio: la app ocupa la ventana y solo la lista tiene scroll visible. El menú es compacto y,
   si la ventana es muy baja, se desplaza sin barra para no duplicar los desplazamientos. */
@media (min-width: 901px) {
  body:has(#vaultView:not(.hidden)) { height: 100vh; overflow: hidden; }
  body:has(#vaultView:not(.hidden)) .app-shell { height: 100vh; }
  .vault-view { height: calc(100vh - 64px); min-height: 0; padding: 12px 0 16px; }
  .sidebar { position: static; height: 100%; max-height: none; overflow-y: auto; scrollbar-width: none; padding: 16px 12px 12px; }
  .sidebar::-webkit-scrollbar { display: none; }
  .category-label { margin-top: 14px; }
  .sidebar nav { gap: 2px; }
  .nav-item { padding: 7px 12px; }
  .sidebar-footer { gap: 8px; padding-top: 10px; }
  .sidebar-footer button { min-height: 34px; padding: 5px 10px; }
  .vault-content { height: 100%; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
}

/* Avisos más bajos para que la lista quede a la vista en ventanas de 768 px de alto. */
@media (min-width: 901px) {
  .sidebar-status { display: none; }
  .backup-reminder { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 8px 8px 16px; margin-bottom: 12px; }
  .backup-reminder p { margin: 0; }
  .first-steps { margin-bottom: 18px; padding: 14px 18px; }
  .first-steps-list { margin-top: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .first-steps-list li { grid-template-columns: 24px minmax(0, 1fr); align-items: start; }
  .first-steps-list li button { grid-column: 2; justify-self: start; margin-top: 6px; }
}
.health-foot .microcopy { text-align: left; justify-content: flex-start; }

/* Favoritas con estado visible, confirmaciones propias y textos de ayuda alineados. */
.entry-actions button.favorite-toggle.on { color: var(--accent); }
.entry-actions button.favorite-toggle.on svg path { fill: currentColor; }
.entry-card:has(.favorite-toggle.on) { border-color: rgba(var(--accent-rgb), .28); }
.confirm-dialog { width: min(440px, calc(100% - 30px)); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h2 { margin: 0 0 10px; font-size: 1.3rem; overflow-wrap: anywhere; }
.confirm-dialog p { margin: 0 0 20px; color: var(--text-2); line-height: 1.5; }
.confirm-dialog .dialog-actions { justify-content: flex-end; }
.danger-button { background: var(--danger); border-color: var(--danger); color: #1a0709; }
.danger-button:hover { filter: brightness(1.08); }
.app-dialog .microcopy { justify-content: flex-start; text-align: left; }
#appVersionLine { text-align: left; justify-content: flex-start; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .danger-button { color: #fff; } }

.danger-text { color: var(--danger); }
.profile-actions { flex-wrap: wrap; }
#profileDialog .danger-text { margin: 0 0 12px; padding: 0; }
.recovery-dialog section > p:first-child { margin-top: 0; }
.recovery-dialog .microcopy { margin: 10px 0 0; }
.recovery-dialog label { display: block; margin-top: 16px; }
.recovery-sheet { margin: 18px 0 6px; padding: 18px; border: 1px dashed rgba(var(--accent-rgb),.45); border-radius: 12px; background: rgba(var(--ink-rgb),.03); }
.recovery-sheet-title, .recovery-sheet-note { margin: 0; color: var(--muted); font-size: .8rem; }
.recovery-key { margin: 10px 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.15rem; letter-spacing: .06em; line-height: 1.6; word-break: break-word; user-select: all; }
.recovery-dialog .recovery-actions { margin: 12px 0 0; }
.recovery-v1 { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--text-2); }
.recovery-input { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .06em; text-transform: uppercase; }
#recoveryCheckA, #recoveryCheckB { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; text-transform: uppercase; letter-spacing: .1em; max-width: 10ch; }
/* Printing the recovery key shows only its sheet, never the rest of the vault. */
@media print {
  body.print-recovery * { visibility: hidden !important; }
  body.print-recovery #recoveryPrintSheet, body.print-recovery #recoveryPrintSheet * { visibility: visible !important; color: #000 !important; }
  body.print-recovery #recoveryPrintSheet { position: fixed; inset: 0 auto auto 0; width: 100%; border-color: #000; background: #fff; }
}
.confirm-dialog label { display: block; margin: 0 0 6px; font-weight: 600; }
.confirm-dialog input[type="text"] { width: 100%; box-sizing: border-box; }
.confirm-dialog .form-error { min-height: 1.2em; margin: 8px 0 12px; }
