:root {
  color-scheme: light;
  --ink: #101113;
  --muted: #666771;
  --surface: #fff;
  --canvas: #f2f2f2;
  --line: #e8e8eb;
  --accent: #087cf5;
  --accent-dark: #075db7;
  --tint: #eaf3ff;
  --radius: 14px;
  --surface-shadow: 0 1px 3px #00000008;
  font-family: "Instrument Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; }
a { color: var(--accent-dark); }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid #2465ae; outline-offset: 3px; }
:where(h1, h2, h3, p) { margin: 0; }
h1 { font-size: clamp(1.8rem, 4vw, 2.65rem); line-height: 1.2; letter-spacing: -.035em; }
h2, h3 { font-size: 1.15rem; line-height: 1.4; overflow-wrap: anywhere; }
button {
  min-height: 44px; padding: 8px 17px; border: 1px solid transparent; border-radius: 8px;
  background: var(--accent); color: white; font-weight: 650;
}
button:hover { background: var(--accent-dark); }
.skip, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { z-index: 2; width: auto; height: auto; clip-path: none; background: white; margin: 8px; padding: 8px; }
.brand {
  display: flex; gap: 10px; align-items: center; font-weight: 750; font-size: .95rem;
  color: var(--ink); text-decoration: none; min-height: 44px;
}
.brand-mark, .avatar {
  display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 9px;
  color: white; background: var(--accent); font-size: 1.15rem;
}
.identity { display: flex; gap: 8px; align-items: center; }
.identity div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.identity strong, .identity small { display: block; }
.identity small { color: var(--muted); }
.muted { color: var(--muted); }
.avatar { background: var(--tint); color: var(--accent-dark); font-size: .9rem; }
.quiet { background: transparent; color: var(--accent-dark); padding-inline: 9px; }
.quiet:hover { background: var(--tint); }
.danger { color: #962f29; }
.danger:hover { background: #fbe9e7; }

.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.heading-copy { flex: 1 1 230px; }
.page-head p, .login-card p { margin-top: 8px; color: var(--muted); }
.add-button { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.chip, .count {
  font-size: .84rem; font-weight: 680; color: var(--accent-dark); background: var(--tint);
  border-radius: 30px; padding: 2px 9px; white-space: nowrap;
}
.count { border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.list-filter { margin-bottom: 14px; }
.filter-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.filter-fields > label { flex: 1 1 125px; min-width: min(100%, 125px); max-width: 240px; }
.filter-fields > .filter-search { flex-basis: 225px; max-width: 420px; }
.filter-fields > button:disabled { cursor: default; }
.filter-search > span { position: relative; min-width: 0; }
.filter-search svg { position: absolute; inset: 12px auto auto 12px; color: var(--muted); pointer-events: none; }
.filter-search input { padding-inline-start: 40px; }
.filter-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.filter-date-error { color: #962f29; font-size: .9rem; }
.record, .login-card, .table-wrap, .empty {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.editor { margin: 14px 0; border: 1px solid var(--line); background: var(--surface); border-radius: 9px; }
.editor summary { min-height: 44px; padding: 9px 14px; color: var(--accent-dark); font-weight: 650; }
.editor-body { padding: 12px 14px; border-top: 1px solid var(--line); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.field-actions, .wide { grid-column: 1 / -1; }
.delete-form, .reset { margin-top: 12px; }
label { display: grid; min-width: 0; gap: 5px; color: var(--ink); font-size: .9rem; font-weight: 650; }
input, select, textarea {
  min-width: 0; width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid #c6c6cc;
  color: var(--ink); background: var(--surface); border-radius: 8px; font-size: 1rem;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; }
.stack { display: grid; gap: 12px; }
.record { padding: 18px; min-width: 0; overflow-wrap: anywhere; }
.record-title { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.record p { margin-top: 8px; }
.record dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 12px; margin-bottom: 10px; }
.record dt { color: var(--muted); font-size: .88rem; }
.record dd { margin: 0; overflow-wrap: anywhere; }
.notes { white-space: pre-wrap; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); margin-top: 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 13px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
thead th { background: #f7f7f8; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow: auto; }
.narrow { max-width: 500px; }
.auth { display: grid; place-items: center; padding: 18px; background: var(--canvas); }
.auth main { width: min(100%, 420px); }
.login-card { padding: clamp(20px, 6vw, 36px); box-shadow: var(--surface-shadow); }
.login-card h1 { margin-top: 22px; font-size: 1.9rem; }
.login-card .stack { margin-top: 22px; }
.alert { background: #f9e9e6; padding: 10px; border-radius: 8px; color: #852b25 !important; }
html:has(dialog[open]) { overflow: hidden; }
.create-dialog {
  width: min(570px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: 0 24px 72px #14274e52; overflow: hidden;
}
.create-dialog[open] { display: flex; flex-direction: column; }
.create-dialog form { display: flex; flex-direction: column; min-height: 0; }
.create-dialog::backdrop { background: #0e1c39bf; }
.dialog-header { display: flex; flex-shrink: 0; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { flex: 1; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px; color: var(--accent-dark); background: var(--tint); border-radius: 11px; }
.icon-button, .secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.icon-button { display: grid; place-items: center; width: 44px; padding: 0; border-color: transparent; }
.icon-button:hover, .secondary:hover { background: var(--tint); color: var(--accent-dark); }
.dialog-body { padding: 22px; overflow: auto; overscroll-behavior: contain; }
.dialog-body .alert { margin-bottom: 12px; }
.dialog-actions { display: flex; flex-shrink: 0; justify-content: end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--canvas); }
button:disabled { cursor: wait; opacity: .65; }
@media (max-width: 520px) {
  .dialog-header, .dialog-body, .dialog-actions { padding-inline: 16px; }
}
@media (max-width: 440px) {
  th, td { padding: 8px 5px; font-size: .83rem; }
}

.dialog-delete { margin-inline-end: auto; }
@media (max-width: 520px) {
  .dialog-actions { flex-wrap: wrap; }
}

.directory-fields { margin: 0; color: var(--ink); }
.directory-field {
  display: grid; grid-template-columns: 86px minmax(0, 1fr); min-height: 44px;
  align-items: center; gap: 10px; border-top: 1px solid var(--line); font-size: .9rem;
}
.directory-field:first-child { border-top: 0; }
.directory-field dt { color: var(--muted); }
.directory-field dd {
  margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  overflow-wrap: anywhere; white-space: pre-wrap;
}
.directory-field a { color: var(--accent-dark); text-underline-offset: 3px; }
.directory-copy { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; font-size: .82rem; }
.directory-copy svg { width: 16px; height: 16px; }
.directory-copy[data-copied] { background: var(--tint); }
@media (max-width: 550px) {
  .directory-field { grid-template-columns: 66px minmax(0, 1fr); gap: 6px; }
  .directory-field dd { gap: 4px; }
  .directory-copy { width: 44px; padding-inline: 0; justify-content: center; }
  .directory-copy span { display: none; }
}
.link-credentials {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 10px;
  min-width: 0; margin: 4px 0 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
}
.link-credentials legend { font-weight: 650; padding: 0 5px; }
.link-credentials p { font-size: .85rem; color: var(--muted); }
.credential-clear { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.credential-clear input { width: 17px; height: 17px; min-height: 0; }
.employee-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-hint { font-size: .875rem; color: var(--muted); }
.employee-tools .form-hint { flex-basis: 100%; }
.employee-tools .form-hint:empty { display: none; }
.alert.success { color: #176037 !important; background: #e0f4e5; }

.directory-header-actions, .bulk-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.bulk-links {
  margin-top: 12px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface);
}
.bulk-links [role="status"] { margin-inline-end: auto; color: var(--muted); font-size: .875rem; }
.bulk-links button:disabled { cursor: default; }
.link-selection { flex: 0 0 18px; width: 18px; min-height: 18px; margin: 0; accent-color: var(--accent); }
.link-optional { border-top: 1px solid var(--line); }
.link-optional summary { min-height: 44px; padding: 10px 0; color: var(--accent-dark); font-weight: 650; }
.link-optional .fields { padding-top: 6px; }

.trash-link {
  display: inline-flex; align-items: center; min-height: 44px; padding: 5px 13px;
  border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 650;
}
.trash-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.trash-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.trash-row form { flex-shrink: 0; }

.share-panel {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px;
  align-items: center; max-width: 690px;
}
.share-qr { display: grid; justify-items: center; gap: 4px; }
.share-qr img { width: 208px; max-width: 100%; height: auto; }
.share-qr a { padding: 6px 0; }
.share-details { min-width: 0; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
#share-status:empty { display: none; }
@media (max-width: 650px) {
  .share-panel { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

.private-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.vault-gate { width: min(100%, 490px); }
.vault-gate p { margin: 0; }
.vault-layout {
  display: grid; grid-template-columns: minmax(240px, 1fr) minmax(0, 2fr); gap: 14px; align-items: start;
}
.vault-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vault-actions button { padding-inline: 10px; }
.vault-list { display: grid; gap: 6px; list-style: none; padding: 0; margin: 0; }
.vault-list:not(:empty) { margin-top: 12px; }
.vault-folder-button { width: 100%; text-align: left; overflow-wrap: anywhere; }
.vault-folder-button[aria-pressed="true"] { border-color: var(--accent); background: var(--tint); color: var(--accent-dark); }
@media (max-width: 1000px) { .vault-layout { grid-template-columns: minmax(0, 1fr); } }
