/* Pithy Vault: Pithy navy, one accent, quiet surfaces. System fonts (no third-party requests from a vault). */
:root {
  --bg: #0B1726; --bg2: #0F1D30; --panel: #12233A; --panel2: #172B45; --line: #213756; --line2: #2B4569;
  --text: #E8EEF7; --muted: #8FA2BF; --dim: #5F7392;
  --accent: #5B8CFF; --accent-2: #3E6FE6; --accent-soft: rgba(91, 140, 255, .14);
  --ok: #3FE0A8; --ok-soft: rgba(63, 224, 168, .12); --warn: #FFB443; --warn-soft: rgba(255, 180, 67, .13);
  --danger: #FF5C7A; --danger-soft: rgba(255, 92, 122, .12);
  --r: 12px; --r-sm: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* the `hidden` attribute must win over any display rule (search, filters, dialogs) */
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 13px; margin: 18px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.dim { opacity: .5; }
code { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
kbd { font: 11px var(--mono); border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--muted); }

.ic { width: 16px; height: 16px; flex: none; }
.ic-xs { width: 12px; height: 12px; }
.ic-lg { width: 28px; height: 28px; }

/* ---------- Buttons & fields */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line2);
  background: var(--panel2); color: var(--text); font: 600 13px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: #1D3454; border-color: #36547D; text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-danger { background: var(--danger-soft); border-color: rgba(255, 92, 122, .4); color: #FFB3C1; }
.btn-danger:hover { background: rgba(255, 92, 122, .22); }
.btn-danger-ghost { background: transparent; border-color: rgba(255, 92, 122, .35); color: #FF9AAE; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; height: 42px; font-size: 14px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--panel2); color: var(--text); border-color: var(--line); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.accent { color: var(--accent); }
.icon-btn.done { color: var(--ok); }

label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; margin: 0; }
input, select, textarea { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r-sm); color: var(--text); font: 14px var(--font); padding: 9px 11px; min-height: 38px; }
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input[type=checkbox] { width: 16px; height: 16px; min-height: 0; accent-color: var(--accent); }
input[type=file] { padding: 7px; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; margin: 0 0 14px; }
legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 6px; }
.hint { font-size: 12px; color: var(--dim); margin-top: 10px; }
.err { display: flex; gap: 8px; align-items: flex-start; background: var(--danger-soft); border: 1px solid rgba(255, 92, 122, .3); color: #FFC2CD; padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; }
.note { display: flex; gap: 8px; align-items: center; background: var(--accent-soft); border: 1px solid rgba(91, 140, 255, .3); padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; }

/* ---------- Auth screens */
.auth-body { min-height: 100vh; background: radial-gradient(1200px 600px at 50% -10%, #17335A 0%, var(--bg) 60%); }
.auth-wrap { max-width: 440px; margin: 0 auto; padding: 56px 16px 32px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; justify-content: center; }
.auth-brand strong { display: block; font-size: 18px; }
.auth-brand span { color: var(--muted); font-size: 13px; }
.logo { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), #8A6CFF); color: #fff; }
.auth-card { padding: 28px; }
.auth-card h1 { font-size: 21px; }
.auth-card.center { text-align: center; max-width: 480px; margin: 40px auto; }
.auth-foot { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--dim); font-size: 11.5px; margin-top: 18px; text-align: center; }
.code-input { text-align: center; font-size: 26px !important; letter-spacing: .3em; height: 56px; margin-bottom: 14px; }
.totp-key { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: var(--bg2); border: 1px dashed var(--line2); border-radius: var(--r-sm); padding: 12px; margin: 6px 0 8px; }
.totp-key code { background: none; border: 0; font-size: 15px; letter-spacing: .05em; padding: 0; word-break: break-all; }
.steps { padding-left: 20px; color: var(--muted); margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }
.steps.compact { font-size: 13px; }

/* ---------- App shell */
.app-body { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--text); text-decoration: none !important; }
.side-brand .logo { width: 34px; height: 34px; border-radius: 9px; }
.side-brand strong { display: block; font-size: 14.5px; }
.side-brand small { color: var(--muted); font-size: 11.5px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; text-decoration: none; }
.side-nav a:hover { background: var(--panel); color: var(--text); }
.side-nav a.on { background: var(--accent-soft); color: #fff; }
.side-nav a.on .ic { color: var(--accent); }
.side-nav .count { margin-left: auto; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); padding: 18px 10px 6px; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 6px; }
.me { flex: 1; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; color: var(--text); min-width: 0; text-decoration: none !important; }
.me:hover, .me.on { background: var(--panel); }
.me span { min-width: 0; }
.me strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--muted); font-size: 11.5px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 54px; display: flex; align-items: center; gap: 12px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(11, 23, 38, .85); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(8px); }
.crumb { font-weight: 600; color: var(--muted); }
.menu-btn { display: none; }
.session-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font: 12px var(--mono); color: var(--muted); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; }
.session-pill.low { color: var(--warn); border-color: rgba(255, 180, 67, .4); }
.content { padding: 26px 28px 60px; max-width: 1320px; width: 100%; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head .actions form { margin: 0; }
.head-with-ic { display: flex; gap: 14px; align-items: center; }
.back { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 12px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card-danger { border-color: rgba(255, 92, 122, .45); background: linear-gradient(180deg, rgba(255, 92, 122, .07), var(--panel) 120px); }
.card-danger h2 { color: #FFB3C1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid-2 > .card { margin-bottom: 18px; }
.grid-2.wide-left { grid-template-columns: 1.4fr 1fr; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.inline-form.wrap { flex-wrap: wrap; }
.inline-form input, .inline-form select { flex: 1; min-width: 120px; width: auto; }
.form-card { max-width: 900px; }

/* ---------- Flash & toast */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 16px; border: 1px solid; font-size: 13.5px; }
.flash p { margin: 0; }
.flash-ok { background: var(--ok-soft); border-color: rgba(63, 224, 168, .35); }
.flash-ok > .ic { color: var(--ok); }
.flash-warn { background: var(--warn-soft); border-color: rgba(255, 180, 67, .35); }
.flash-warn > .ic { color: var(--warn); }
.flash-extra { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.flash-extra code { word-break: break-all; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #0A1424; border: 1px solid var(--line2); color: var(--text); padding: 10px 16px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; font-size: 13px; z-index: 50; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(255, 92, 122, .5); }

/* ---------- Tiles */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.tile { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; color: var(--text); text-align: left; font: inherit; }
button.tile { cursor: pointer; }
button.tile:hover { border-color: var(--line2); }
.tile strong { display: block; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile small { color: var(--muted); font-size: 12px; }
.tile-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.tile-warn .tile-ic { background: var(--warn-soft); color: var(--warn); }
.tile-warn:not(.is-zero) strong { color: var(--warn); }
.tile.active { border-color: var(--warn); }

/* ---------- Vault list */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { flex: 1; min-width: 260px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 0 12px; }
.search:focus-within { border-color: var(--accent); }
.search input { border: 0; background: transparent; padding: 11px 0; min-height: 44px; font-size: 14.5px; }
.search input:focus-visible { outline: none; }
.search .ic { color: var(--muted); }
.toolbar select { width: auto; min-width: 190px; min-height: 44px; }
.toggle { flex-direction: row; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--text); font-weight: 500; background: var(--panel); border: 1px solid var(--line2); border-radius: 10px; padding: 0 12px; min-height: 44px; cursor: pointer; }

.list-card { padding: 6px 0; }
.list-head, .item { display: grid; grid-template-columns: minmax(260px, 2.2fr) minmax(170px, 1.3fr) minmax(220px, 1.3fr) minmax(140px, .9fr); gap: 14px; align-items: center; padding: 0 18px; }
.list-head { height: 36px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--dim); border-bottom: 1px solid var(--line); }
.item { min-height: 64px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item:hover { background: rgba(255, 255, 255, .015); }
.item-main { display: flex; gap: 12px; align-items: center; min-width: 0; }
.item-title { min-width: 0; }
.item-title > a { color: var(--text); font-weight: 600; font-size: 14px; }
.item-sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 3px; }
.host { color: var(--muted); font-size: 12px; display: inline-flex; gap: 3px; align-items: center; }
.item-user, .item-pass, .pass-cell { display: flex; align-items: center; gap: 4px; min-width: 0; }
.secret-val { color: var(--muted); letter-spacing: .04em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 4px; }
.secret-val.shown { color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: 6px; padding: 2px 7px; letter-spacing: 0; user-select: all; }
.item-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 12px; color: var(--muted); }
.cat-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--panel2); color: var(--accent); border: 1px solid var(--line); flex: none; }
.cat-ic.lg { width: 48px; height: 48px; border-radius: 12px; }
.cat-ic.lg .ic { width: 22px; height: 22px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty .ic { opacity: .5; margin-bottom: 8px; }

/* ---------- Chips, badges, avatars */
.chip { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip-client { background: rgba(138, 108, 255, .14); border-color: rgba(138, 108, 255, .3); color: #C9BCFF; }
.chip-cat { background: transparent; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge .ic { width: 12px; height: 12px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(63, 224, 168, .3); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(255, 180, 67, .35); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(255, 92, 122, .35); }
.badge-edit { background: var(--accent-soft); color: #9DBBFF; border-color: rgba(91, 140, 255, .35); }
.count-pill { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg2); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; margin-left: auto; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); margin-right: 6px; }
.dot-ok { background: var(--ok); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-size: 12px; font-weight: 700; color: #fff; flex: none; background: #3B5B8C; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; margin-right: -6px; border: 2px solid var(--panel); }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.hue-0 { background: #B5476B; } .hue-30 { background: #B5673A; } .hue-60 { background: #8D7B25; } .hue-90 { background: #5B8A2E; }
.hue-120 { background: #2E8A4E; } .hue-150 { background: #278A76; } .hue-180 { background: #23808E; } .hue-210 { background: #2F6CB0; }
.hue-240 { background: #4659C2; } .hue-270 { background: #6A4FC2; } .hue-300 { background: #9046B0; } .hue-330 { background: #AD437F; }

/* ---------- Key/value, tables, lists */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; padding-top: 2px; }
.kv dd { margin: 0; min-width: 0; word-break: break-word; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kv.big dd { font-size: 14px; }
.notes { width: 100%; }
.notes-val { white-space: pre-wrap; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r-sm); padding: 10px; margin: 8px 0 0; font: 13px var(--mono); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.hot td { background: rgba(255, 92, 122, .06); }
.table.audit tr.sens .act { color: var(--warn); }
.table.audit tr.act-login_fail .act, .table.audit tr.act-2fa_fail .act, .table.audit tr.act-access_denied .act { color: var(--danger); }
.act { font-weight: 600; }
.person { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.person strong { display: block; }
.person small { color: var(--muted); }
.people { list-style: none; padding: 0; margin: 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.people li:last-child { border-bottom: 0; }
.people li > div { flex: 1; min-width: 0; }
.people strong { display: block; font-size: 13.5px; color: var(--text); }
.people small { color: var(--muted); font-size: 12px; }
.people form { margin: 0; }
.grants { list-style: none; margin: 0 0 8px; padding: 0; }
.grants li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.grants form { margin: 0 0 0 auto; }
.g-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--bg2); color: var(--accent); flex: none; }
.g-txt strong { display: block; font-size: 13.5px; font-weight: 600; }
.g-txt small { color: var(--muted); font-size: 12px; }
.grant-form .grid-4 label { margin-bottom: 10px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.check { flex-direction: row; align-items: flex-start; gap: 10px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg2); cursor: pointer; color: var(--text); font-weight: 500; }
.check:has(input:checked) { border-color: rgba(91, 140, 255, .55); background: var(--accent-soft); }
.check strong { display: block; font-size: 13px; }
.check small { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 18px; }
.group-card { color: var(--text); text-decoration: none !important; margin: 0; transition: border-color .15s, transform .15s; }
.group-card:hover { border-color: var(--line2); transform: translateY(-1px); }
.group-card header { display: flex; align-items: center; gap: 8px; }
.group-card h2 { margin: 0; }
.avatars { display: flex; padding-left: 4px; margin: 6px 0 10px; min-height: 26px; }
.mini { list-style: none; padding: 0; margin: 0; font-size: 12.5px; color: var(--muted); }
.mini li { padding: 3px 0; border-top: 1px dashed var(--line); }
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.cat-list strong { display: block; font-size: 13.5px; }
.cat-list small { color: var(--muted); font-size: 12px; }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; margin-bottom: 12px; }

.integrity { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-sm); margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.integrity.ok { background: var(--ok-soft); border: 1px solid rgba(63, 224, 168, .3); }
.integrity.ok .ic { color: var(--ok); }
.integrity.bad { background: var(--danger-soft); border: 1px solid rgba(255, 92, 122, .5); color: #FFC2CD; }
.filters { display: grid; grid-template-columns: repeat(5, 1fr) auto; gap: 0 12px; align-items: end; }
.filters label { margin-bottom: 0; }
.filter-btns { display: flex; gap: 8px; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.danger-zone { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-top: 1px solid var(--line); }

/* ---------- Dialog & password tools */
.dlg { border: 1px solid var(--line2); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .55); }
.dlg::backdrop { background: rgba(5, 10, 18, .7); backdrop-filter: blur(3px); }
.dlg form { padding: 22px; }
.dlg header h2 { margin: 0 0 2px; font-size: 18px; }
.dlg header { margin-bottom: 14px; }
.dlg footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.pw-field { display: flex; align-items: center; gap: 4px; background: var(--bg2); border: 1px solid var(--line2); border-radius: var(--r-sm); padding-right: 4px; }
.pw-field:focus-within { border-color: var(--accent); }
.pw-field input { border: 0; background: transparent; font-family: var(--mono); }
.pw-field input:focus-visible { outline: none; }
.pw-meter { height: 4px; background: var(--bg2); border-radius: 4px; overflow: hidden; margin: -8px 0 14px; }
.pw-meter span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s, background .2s; }
.pw-meter.s1 span { width: 25%; } .pw-meter.s2 span { width: 50%; background: var(--warn); }
.pw-meter.s3 span { width: 75%; background: #9BD35A; } .pw-meter.s4 span { width: 100%; background: var(--ok); }

/* ---------- Responsive */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .list-head { display: none; }
  .item { grid-template-columns: 1fr auto; grid-template-areas: "main pass" "user meta"; padding: 12px 16px; gap: 6px 12px; }
  .item > .item-main { grid-area: main; } .item > .item-pass { grid-area: pass; justify-self: end; } .item > .item-user { grid-area: user; padding-left: 46px; } .item > .item-meta { grid-area: meta; align-items: flex-end; }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .app-body { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  .side.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 48px; }
  .grid-2, .grid-2.wide-left { grid-template-columns: 1fr; }
  .page-head .actions { width: 100%; }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { padding: 12px; } .tile-ic { display: none; }
  .grid-4, .filters { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; grid-template-areas: "main" "user" "pass" "meta"; }
  .item > .item-pass { justify-self: start; padding-left: 46px; } .item > .item-meta { align-items: flex-start; padding-left: 46px; flex-direction: row; gap: 8px; }
  .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 10px; }
  .toolbar select, .toggle { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Google sign-in */
.btn-google { background: #fff; color: #1F2937; border-color: #fff; height: 44px; font-size: 14.5px; }
.btn-google:hover { background: #EEF2F7; border-color: #EEF2F7; }
.btn-google .ic { width: 18px; height: 18px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 12px; margin: 18px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Latest changes */
.changes { padding: 16px 20px; }
.changes h2 { margin-bottom: 8px; }
.changes ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.changes li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; min-width: 0; }
.changes li > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.changes time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.changes .dot { margin: 0; flex: none; }
@media (max-width: 860px) { .changes ul { grid-template-columns: 1fr; } }

/* ---------- Stored-credential inputs: masked with CSS, not type=password, so browsers don't offer to save them */
.masked { -webkit-text-security: disc; text-security: disc; }

/* ---------- Quick filter chips (Registro) */
.chips-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip-link { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line2); background: var(--panel); color: var(--muted); font-weight: 600; font-size: 12.5px; text-decoration: none !important; }
.chip-link:hover { color: var(--text); border-color: #36547D; }
.chip-link.on { background: var(--accent-soft); color: #fff; border-color: rgba(91, 140, 255, .55); }
a.plain { color: var(--text); }
a.plain:hover { color: var(--accent); }

/* ---------- Client status, review flags, clients page */
.chip-inactive { background: var(--panel2); color: var(--dim); border-style: dashed; }
.chip-review { background: var(--warn-soft); color: var(--warn); border-color: rgba(255, 180, 67, .35); }
a.chip-client { text-decoration: none !important; }
a.chip-client:hover { border-color: rgba(138, 108, 255, .6); color: #fff; }
.note.subtle { background: transparent; border-style: dashed; color: var(--muted); }
.note a { font-weight: 600; }
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 18px; }
.client-card { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; color: var(--text); text-decoration: none !important; }
.client-card:hover { border-color: var(--line2); }
.client-card header { display: flex; align-items: center; gap: 8px; }
.client-card strong { font-size: 14px; flex: 1; min-width: 0; }
.client-card small { color: var(--muted); font-size: 12px; }
.client-card.off { opacity: .72; }
.client-card .row-end { justify-content: space-between; margin-top: 4px; }
.client-card form { margin: 0; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.section-title h2 { margin: 0; }
.kind-head { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); margin: 18px 0 10px; }
.member-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg2); margin-bottom: 12px; }
.member-picker label { flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 6px 8px; border-radius: 6px; color: var(--text); font-weight: 500; cursor: pointer; }
.member-picker label:hover { background: var(--panel); }
.member-picker small { color: var(--dim); font-weight: 400; }
.access-table td, .access-table th { padding: 6px 8px; }
.access-table select { min-height: 32px; padding: 4px 28px 4px 8px; font-size: 13px; }
.filter-input { margin-bottom: 8px; }
.until { color: var(--warn); font-size: 11.5px; }

.grid-4 > .span-2 { grid-column: span 2; }
@media (max-width: 560px) { .grid-4 > .span-2 { grid-column: auto; } }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }
.scroll { max-height: 380px; overflow-y: auto; }
.card-preview { border-color: rgba(63, 224, 168, .45); }
.card h2 .btn { margin-left: auto; }

/* ---------- Search in the top bar (every page) */
.top-search { flex: 1; max-width: 520px; margin-left: 18px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line2); border-radius: 9px; padding: 0 10px; }
.top-search:focus-within { border-color: var(--accent); }
.top-search .ic { color: var(--muted); }
.top-search input { border: 0; background: transparent; min-height: 34px; padding: 6px 0; font-size: 13.5px; }
.top-search input:focus-visible { outline: none; }
.item-extra { background: rgba(255, 255, 255, .015); }
@media (max-width: 860px) { .top-search { margin-left: 0; } .crumb { display: none; } }
/* notes are running text: icon inline, words wrap normally */
.note { display: block; }
.note > .ic { display: inline-block; vertical-align: -3px; margin-right: 6px; }

.import-actions { margin-top: 14px; }
.import-actions form { margin: 0; }

.item > .item-note { grid-column: 1 / -1; margin: 0 0 12px 46px; }
.chip-note { background: var(--bg2); border: 1px solid var(--line2); }
.totp-qr { display: flex; justify-content: center; margin: 4px 0 12px; }
.totp-qr svg { width: 220px; height: 220px; border-radius: var(--r-sm); }
.totp-manual { margin: 0 0 12px; }
.totp-manual summary { cursor: pointer; color: var(--muted, inherit); font-size: 13px; }
