:root {
  --bg: #f4f6fa; --panel: #ffffff; --sidebar: #0f1729; --sidebar-2: #18233b; --sidebar-text: #c7d0e3;
  --text: #172033; --muted: #6a7489; --border: #e3e7ef; --hover: #f1f4f9; --accent: #2f5bea; --accent-2: #2448c4;
  --accent-soft: #eaf0ff; --green: #13804b; --green-soft: #e6f6ee; --amber: #9a6100; --amber-soft: #fff4dd;
  --red: #c42b3a; --red-soft: #fdecee; --purple: #6a3fd1; --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.06);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0d1220; --panel: #151c2e; --sidebar: #0a0f1b; --sidebar-2: #131b2e; --text: #e6eaf3; --muted: #95a0b8;
    --border: #263049; --hover: #1c2539; --accent: #5b82ff; --accent-2: #476ef0; --accent-soft: #1d2a52; --green: #4fd08f; --green-soft: #12301f;
    --amber: #f2b84b; --amber-soft: #33270d; --red: #ff6b78; --red-soft: #3a1419; --purple: #a98bff; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 15px; margin: 0; }
a { color: var(--accent); }
pre { margin: 0; font-family: inherit; }
code, .mono { font-family: var(--mono); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.wrap { white-space: pre-wrap; word-break: break-word; }
.offscreen { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.icon { flex: none; vertical-align: middle; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }

/* ---------- form controls */
input, select, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled, select:disabled { opacity: .7; background: var(--hover); }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); flex: none; }
input[type=range] { padding: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > .field-name { font-weight: 600; font-size: 13px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check.policy { align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.check.policy input { margin-top: 3px; }
.input-with-btn { position: relative; display: flex; align-items: center; }
.input-with-btn input { padding-right: 70px; }
.input-with-btn .icon-btn.inline { position: relative; margin-left: -34px; }
.input-with-btn .icon-btn.inline + .icon-btn.inline { margin-left: 0; }
label.inline { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
label.inline input { width: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--border)); }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { border-style: dashed; background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; flex: none; text-decoration: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.tiny { width: 22px; height: 22px; }
.icon-btn.starred { color: #e8a300; }
.icon-btn.starred svg { fill: currentColor; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; font: inherit; text-align: left; }
.dots { font-size: 20px; line-height: 1; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--hover); color: var(--muted); margin-right: 4px; text-transform: none; white-space: nowrap; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.badge.purple { background: color-mix(in srgb, var(--purple) 15%, transparent); color: var(--purple); }
.amber-text { color: var(--amber); }

.callout { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; }
.callout.success { background: var(--green-soft); color: var(--green); }
.callout.warn { background: var(--amber-soft); color: var(--amber); }
.callout.error { background: var(--red-soft); color: var(--red); }
.callout .icon { margin-top: 2px; }
.form-error { padding: 9px 12px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 13px; }

.meter { display: flex; flex-direction: column; gap: 4px; }
.meter-track { height: 5px; background: var(--border); border-radius: 9px; overflow: hidden; }
.meter-bar { height: 100%; width: 0; border-radius: 9px; transition: width .2s; }
.s0 { background: var(--red); } .s1 { background: #e5632a; } .s2 { background: #e0a41b; } .s3 { background: #3ea76a; } .s4 { background: var(--green); }
.strength-tag { margin-left: 10px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 99px; color: #fff; font-family: inherit; }

/* ---------- auth */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 30px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.auth-card h1 { margin-top: 6px; }
.auth-foot { margin-top: 18px; text-align: center; max-width: 420px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand.big { font-size: 20px; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; }
.org-chip { align-self: flex-start; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.locked-user { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 8px; background: var(--hover); }
.steps { margin: 0; padding-left: 20px; }
.qr-wrap { display: grid; place-items: center; padding: 8px; }
.qr { border-radius: 8px; border: 1px solid var(--border); }
.secret-box { display: block; padding: 10px 12px; background: var(--hover); border-radius: 8px; font-size: 13px; word-break: break-all; user-select: all; }
.secret-box.big { font-size: 17px; letter-spacing: .04em; text-align: center; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px; background: var(--hover); border-radius: 8px; font-size: 14px; }

/* ---------- emergency kit */
.kit { display: flex; flex-direction: column; gap: 12px; }
.kit-head { display: flex; gap: 12px; align-items: center; padding-bottom: 12px; border-bottom: 2px solid var(--accent); }
.kit-grid { display: grid; grid-template-columns: 150px 1fr; gap: 0; margin: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.kit-grid dt, .kit-grid dd { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.kit-grid dt { font-weight: 600; background: var(--hover); }
.kit-grid dd.sk { font-size: 16px; font-weight: 700; letter-spacing: .03em; color: var(--accent); word-break: break-all; }
.write-line { min-height: 46px; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: fixed; inset: 0; padding: 32px; background: #fff; color: #000; }
  .no-print { display: none !important; }
  .overlay { background: none !important; }
}

/* ---------- shared item viewer */
.shared-fields { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.shared-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.shared-row:last-child { border-bottom: 0; }
.shared-row .label { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-weight: 600; }
.shared-row .value { word-break: break-word; }
.mono.big { font-size: 20px; }

/* ---------- app shell */
.app { display: grid; grid-template-columns: 250px 1fr; height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); padding: 16px 10px; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .brand { color: #fff; padding: 0 8px; }
.org-name { font-size: 12px; color: #8592ad; padding: 4px 8px 14px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--sidebar-text); font: inherit; cursor: pointer; text-align: left; }
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.active { background: #26345a; color: #fff; }
.nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { font-size: 11.5px; color: #8592ad; }
.nav-section { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #6d7a96; padding: 16px 10px 6px; }
.nav-section .icon-btn { color: #8592ad; }
.nav-section .icon-btn:hover { background: var(--sidebar-2); color: #fff; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--border); }
.menu-btn { display: none; }
.search-wrap { position: relative; flex: 1; max-width: 560px; display: flex; align-items: center; }
.search-wrap .icon { position: absolute; left: 11px; color: var(--muted); }
.search { padding-left: 34px; background: var(--hover); border-color: transparent; }
.search.small { padding-left: 11px; max-width: 280px; background: var(--panel); border-color: var(--border); }
.content { flex: 1; overflow: auto; min-height: 0; }
.avatar-btn { border: 0; background: none; cursor: pointer; padding: 0; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 12.5px; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.group { background: var(--purple); }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(16,24,40,.16); padding: 6px; z-index: 50; }
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head .badge { align-self: flex-start; margin-top: 4px; }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; border-radius: 6px; cursor: pointer; }
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--red); }

/* ---------- list / detail */
.split { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; height: 100%; }
.list-pane { border-right: 1px solid var(--border); background: var(--panel); overflow-y: auto; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 18px 12px; flex-wrap: wrap; }
.list-head h1 { font-size: 19px; }
.item-list { list-style: none; margin: 0; padding: 0 8px 20px; }
.item-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.item-row:hover { background: var(--hover); }
.item-row.selected { background: var(--accent-soft); }
.item-row:focus-visible { outline: 2px solid var(--accent); }
.item-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); flex: none; }
.item-icon.lg { width: 52px; height: 52px; border-radius: 12px; }
.t-note, .t-identity { background: #fff3d6; color: #a06b00; }
.t-card, .t-bank { background: #e5f6ee; color: #13804b; }
.t-server, .t-database, .t-ssh { background: #efe8ff; color: #6a3fd1; }
.t-api { background: #ffe9e3; color: #c2410c; }
.t-wifi { background: #e0f4fb; color: #0e7490; }
@media (prefers-color-scheme: dark) { .t-note, .t-identity, .t-card, .t-bank, .t-server, .t-database, .t-ssh, .t-api, .t-wifi { background: var(--hover); } }
.item-text { min-width: 0; flex: 1; }
.item-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.item-title .icon { color: #e8a300; fill: currentColor; }
.item-sub { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vault-tag { font-size: 11px; color: var(--muted); background: var(--hover); padding: 1px 7px; border-radius: 99px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.detail { overflow-y: auto; }
.detail-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 8px; opacity: .7; }
.detail-inner { max-width: 760px; padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 16px; }
.back-btn { display: none; align-self: flex-start; }
.detail-head { display: flex; align-items: center; gap: 14px; }
.detail-title { flex: 1; min-width: 0; }
.detail-title h2 { font-size: 21px; word-break: break-word; }
.detail-actions { display: flex; align-items: center; gap: 4px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.card-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.card.fields { padding: 4px 0; gap: 0; }
.field-row { display: grid; grid-template-columns: 1fr auto; padding: 9px 16px; border-bottom: 1px solid var(--border); gap: 0 8px; }
.field-row:last-child { border-bottom: 0; }
.field-row:hover { background: var(--hover); }
.field-label { grid-column: 1 / 2; font-size: 12px; color: var(--muted); font-weight: 600; }
.field-value { grid-column: 1 / 2; min-width: 0; word-break: break-word; }
.field-actions { grid-column: 2; grid-row: 1 / 3; display: flex; align-items: center; gap: 2px; opacity: .55; }
.field-row:hover .field-actions { opacity: 1; }
.value.mono { font-size: 14px; letter-spacing: .02em; }
.totp-wrap { display: flex; align-items: center; gap: 10px; }
.totp { font-size: 18px; font-weight: 700; color: var(--accent); }
.totp-ring { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--accent); font-size: 11px; font-weight: 700; color: var(--accent); }
.totp-ring.low { border-color: var(--red); color: var(--red); }
.notes { font-size: 14px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { border: 0; background: var(--accent-soft); color: var(--accent); padding: 3px 10px; border-radius: 99px; font: inherit; font-size: 12.5px; cursor: pointer; }
.attach-row { display: flex; align-items: center; gap: 8px; }
.attach-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
label.btn { align-self: flex-start; }
.meta { display: flex; flex-direction: column; gap: 2px; padding: 0 4px; }

/* ---------- editor */
.editor { display: flex; flex-direction: column; gap: 14px; }
.custom-fields { display: flex; flex-direction: column; gap: 8px; }
.custom-row { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 8px; align-items: center; }

/* ---------- generator */
.generator { display: flex; flex-direction: column; gap: 14px; }
.seg { display: inline-flex; background: var(--hover); border-radius: 9px; padding: 3px; gap: 2px; align-self: flex-start; }
.seg button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 7px; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.gen-box { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--hover); }
.gen-output { flex: 1; font-size: 18px; word-break: break-all; letter-spacing: .02em; }
.gen-opts { display: flex; flex-direction: column; gap: 12px; }

/* ---------- pages */
.page { padding: 24px 28px 60px; display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.page.narrow { max-width: 720px; }
.page.wide { max-width: 1300px; }
.empty-card { padding: 40px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius); }
.kv { display: grid; grid-template-columns: 200px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; background: var(--hover); border-bottom: 1px solid var(--border); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td { padding: 7px 10px; }
.card .table { border: 0; }
.table tr.dim td { opacity: .6; }
.table.audit td.details { max-width: 380px; word-break: break-word; }
.person { display: flex; align-items: center; gap: 10px; }
.version-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.version-row:last-child { border-bottom: 0; }
.access-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.access-row select { width: auto; }
.access-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.access-add { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-top: 8px; }
.access-add select { width: auto; min-width: 0; }
.access-add select:first-child { width: 100%; }

/* ---------- watchtower */
.wt-hero { display: flex; gap: 22px; align-items: center; }
.score-ring { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; border: 8px solid; font-size: 28px; font-weight: 800; flex: none; }
.score-ring.sgood { border-color: var(--green); color: var(--green); }
.score-ring.sfair { border-color: #e0a41b; color: var(--amber); }
.score-ring.sbad { border-color: var(--red); color: var(--red); }
.wt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.wt-card { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; text-align: left; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; font: inherit; color: var(--text); }
.wt-card:hover:not(:disabled) { box-shadow: var(--shadow); }
.wt-card:disabled { cursor: default; }
.wt-card.bad { border-left-color: var(--red); }
.wt-card.warn { border-left-color: #e0a41b; }
.wt-card.info { border-left-color: var(--accent); }
.wt-card.ok { border-left-color: var(--green); }
.wt-count { font-size: 28px; font-weight: 800; }
.wt-title { font-weight: 700; }

/* ---------- admin */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { display: flex; align-items: center; gap: 6px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); padding: 9px 12px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-body { display: flex; flex-direction: column; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-value { font-size: 26px; font-weight: 800; }
.stat-label { font-weight: 600; color: var(--muted); font-size: 12.5px; }
.stat.good .stat-value { color: var(--green); }
.stat.bad .stat-value { color: var(--red); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar.wrap { flex-wrap: wrap; justify-content: flex-start; }
.toolbar.wrap select { width: auto; }
.toolbar p { margin: 0; }
.invite-result { display: flex; align-items: center; gap: 8px; }
.invite-result strong { flex: 1; }
.checklist { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.group-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.sticky-save { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }

/* ---------- overlays */
.overlay { position: fixed; inset: 0; background: rgba(10,15,27,.5); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .12s; }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 40px); background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); display: flex; flex-direction: column; }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal-body { padding: 10px 18px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-body > p { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.modal-actions .btn.danger:first-child { margin-right: auto; }
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #172033; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); max-width: 380px; font-size: 13px; transition: opacity .3s, transform .3s; }
.toast.success { background: #10633b; }
.toast.error { background: #a31f2e; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes fade { from { opacity: 0; } }

/* ---------- responsive */
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .split.has-detail .list-pane { display: none; }
  .split:not(.has-detail) .detail { display: none; }
  .back-btn { display: inline-flex; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 25% 0 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.4); }
  .menu-btn { display: inline-grid; }
  .hide-sm { display: none; }
  .grid2, .custom-row { grid-template-columns: 1fr; }
  .detail-inner, .page { padding: 16px; }
  .kv { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
  .group-grid { grid-template-columns: 1fr; }
  .kit-grid { grid-template-columns: 1fr; }
}

/* ---------- use-only (hidden) values */
.hidden-secret { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-style: italic; }
.access-row select, .access-add select { max-width: 190px; }

/* ---------- scale: virtual list, bulk actions, access panel */
.list-pane { display: flex; flex-direction: column; overflow: hidden; }
.list-head .row { gap: 6px; }
.vlist { flex: 1; overflow-y: auto; position: relative; min-height: 0; contain: strict; }
.vinner { position: relative; width: 100%; }
.vinner .item-row { position: absolute; left: 8px; right: 8px; height: 54px; }
.row-check { margin-right: 2px; pointer-events: none; }
.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin: 0 8px 8px; background: var(--accent-soft); border-radius: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.row.center { justify-content: center; }
.nav-add { color: #8592ad; font-size: 13px; }
.nav-add .icon { opacity: .8; }
.vault-filter { margin: 2px 4px 6px; width: calc(100% - 8px); padding: 6px 9px; font-size: 12.5px; background: var(--sidebar-2); border-color: transparent; color: #fff; }
.vault-scroll { max-height: 280px; overflow-y: auto; }
.card.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--hover); white-space: nowrap; }
.chip.group { background: color-mix(in srgb, var(--purple) 12%, transparent); }
.chip em { font-style: normal; color: var(--muted); }
.access-table td:first-child, .access-table th:first-child { width: 34px; }

/* ---- admin: credentials inventory */
.cred-groups { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.cred-group { border: 1px solid var(--border); border-radius: 10px; background: var(--panel, #fff); overflow: hidden; }
.cred-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.cred-toggle { flex: 1; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.cred-toggle .count { margin-left: 4px; color: var(--muted); font-size: 12px; }
.cred-toggle .caret { width: 12px; color: var(--muted); }
.cred-group table { margin: 0; border-top: 1px solid var(--border); }
.cred-row .item-icon.small { display: inline-flex; width: 22px; height: 22px; vertical-align: middle; }
.warn-text { color: #b45309; margin-top: 2px; }

/* ---- sign-in page suggestions in the item editor */
.url-suggest { display: flex; flex-direction: column; gap: 4px; }
.url-suggest:empty { display: none; }
.suggest-row { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; background: var(--panel, #fff);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; color: inherit; }
.suggest-row:hover, .suggest-row:focus { border-color: var(--accent, #2b59ff); background: #f4f7ff; }
.suggest-url { font-size: 13px; word-break: break-all; }

/* ======================================================= v2 layout: dashboard, vaults, team, sites, categories */
.sidebar nav { flex: 1; }
.nav-bottom { border-top: 1px solid rgba(255,255,255,.08); padding-top: 8px; margin-top: 8px; }
.page { padding: 24px 28px 40px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0 0 2px; }
.page-head p { margin: 0; max-width: 680px; }
.page-head .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page-head .row select, .page-head .row .search { width: auto; min-width: 170px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.crumbs .link { font-size: 13px; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); font: inherit; color: inherit; }
button.kpi { cursor: pointer; } button.kpi:hover { border-color: var(--accent); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 28px; line-height: 1.15; font-weight: 700; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; }
.dash-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.dash-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dash-card-head h3 { margin: 0; font-size: 15px; }
.barlist { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 56px; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; border-radius: 8px; font: inherit; color: inherit; text-align: left; }
button.bar-row { cursor: pointer; } button.bar-row:hover { background: var(--hover); }
.bar-label { display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.bar-track { height: 10px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.health-bar { display: flex; gap: 2px; height: 16px; border-radius: 4px; overflow: hidden; margin: 6px 0 12px; }
.hb-ok { background: #1f9d63; } .hb-weak { background: #d64545; } .hb-reused { background: #e08a1e; } .hb-old { background: #8a94a8; }
.health-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 13px; }
.health-legend span { display: flex; align-items: center; gap: 5px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.activity-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.activity-who { font-weight: 600; }

.vault-grid, .people-grid, .dept-grid, .cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.vault-card, .person-card, .dept-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; cursor: pointer; font: inherit; color: inherit; box-shadow: var(--shadow); }
.vault-card:hover, .person-card:hover, .dept-card:hover, .site-card:hover, .cat-site:hover { border-color: var(--accent); }
.vault-card-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.vault-card-meta { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-top: 6px; font-size: 13px; }
.vault-card-sites { display: flex; gap: 4px; align-items: center; margin-top: 6px; }
.dept-avatars { display: flex; gap: 4px; margin: 6px 0; align-items: center; }
.avatar.small { width: 26px; height: 26px; font-size: 11px; }
.avatar.large { width: 52px; height: 52px; font-size: 18px; }
.person-head { display: flex; gap: 14px; align-items: center; }
.person-meta { display: flex; gap: 4px; margin-top: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
button.chip { border: 1px solid var(--border); cursor: pointer; font: inherit; font-size: 12.5px; padding: 4px 10px; color: var(--text); }
button.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.cell-site { display: inline-flex; gap: 8px; align-items: center; }

.site-icon { display: inline-grid; place-items: center; border-radius: 10px; font-weight: 700; overflow: hidden; flex: none; border: 1px solid var(--border); }
.site-icon img { width: 100%; height: 100%; object-fit: contain; padding: 12%; }
.site-group { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.site-group h3 { font-size: 14px; margin: 0 0 10px; }
.site-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.site-card { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 112px; padding: 12px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); cursor: pointer; font: inherit; color: inherit; }
.site-name { font-size: 12.5px; font-weight: 600; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.cat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.cat-head { display: flex; justify-content: space-between; align-items: center; }
.cat-head .row { display: flex; gap: 2px; }
.cat-sites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cat-site { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border: 1px solid var(--border); border-radius: 99px; background: var(--panel); cursor: pointer; font: inherit; font-size: 12.5px; color: inherit; }
.cat-site .site-icon { border-radius: 50%; }
.import-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.import-row { display: grid; grid-template-columns: 20px 1fr 190px 1fr; gap: 8px; align-items: center; }
.small-input { padding: 6px 8px; }
@media (max-width: 720px) { .page { padding: 16px; } .dash-grid { grid-template-columns: 1fr; } .import-row { grid-template-columns: 20px 1fr; } }
.list-chips { margin: 8px 0 0; }
.nav-with-toggle { position: relative; }
.nav-toggle { position: absolute; right: 34px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--sidebar-text); cursor: pointer; font-size: 12px; padding: 4px 6px; border-radius: 6px; opacity: .7; }
.nav-toggle:hover { opacity: 1; background: rgba(255,255,255,.08); }
.nav-sub { margin-left: 14px; padding-left: 6px; border-left: 1px solid rgba(255,255,255,.1); }
.nav-sub .nav-item { padding-top: 5px; padding-bottom: 5px; font-size: 13px; }

.ok-text { color: var(--green); display: inline-flex; gap: 4px; align-items: center; }
.err-text { color: var(--red); }
.plain-list { list-style: none; padding: 0; margin: 6px 0; } .plain-list li { padding: 3px 0; }

/* Network tab */
.radio-row { display: flex; gap: 12px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.radio-row input { width: auto; margin-top: 4px; flex: none; }
.net-add { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) auto auto; gap: 8px; align-items: center; }
.net-add.two { grid-template-columns: minmax(220px, 1fr) auto; }
@media (max-width: 760px) { .net-add, .net-add.two { grid-template-columns: 1fr; } }
.rec-people { margin-top: 8px; width: 100%; }
.rec-people summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.rec-people table { margin-top: 6px; background: var(--surface, #fff); border-radius: 8px; }
.callout.warn.stack { flex-direction: column; align-items: stretch; }
.trash-wrap { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.trash-wrap .trash-bin .card { margin: 0; }
.trash-items-head { padding: 2px 4px; }
.trash-bin .card { padding-bottom: 6px; }
.trash-row { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-top: 1px solid var(--border, #e5e7eb); }
.trash-row:first-of-type { border-top: 0; }
.trash-bin { max-height: 45vh; overflow: auto; }
