/* ==========================================================================
   Segredia — sistema visual
   ========================================================================== */
@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/vendor/fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/vendor/fonts/inter-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  --bg: #F7F7FA; --surface: #FFFFFF; --surface-2: #F2F2F7; --surface-3: #EAEAF1;
  --border: #E5E5EC; --border-strong: #D2D2DC;
  --text: #15141D; --text-2: #5D5B6E; --text-3: #8C8A9C;
  --accent: #5B45F0; --accent-hover: #4B36DE; --accent-soft: #EFECFF; --accent-text: #4B36DE; --on-accent: #fff;
  --danger: #D92D3A; --danger-soft: #FDEDEF; --success: #10A160; --success-soft: #E7F7EF; --warning: #B86E00; --warning-soft: #FFF5E1;
  --ring: 0 0 0 3px rgb(91 69 240 / .22);
  --shadow-sm: 0 1px 2px rgb(20 18 40 / .06);
  --shadow-md: 0 4px 16px -4px rgb(20 18 40 / .10), 0 1px 3px rgb(20 18 40 / .06);
  --shadow-lg: 0 24px 64px -16px rgb(20 18 40 / .28), 0 2px 8px rgb(20 18 40 / .08);
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0D16; --surface: #15141F; --surface-2: #1C1B28; --surface-3: #242333;
    --border: #272636; --border-strong: #363547;
    --text: #EEEDF5; --text-2: #A7A5BA; --text-3: #75738A;
    --accent: #7563FF; --accent-hover: #8676FF; --accent-soft: #221E44; --accent-text: #ABA0FF;
    --danger: #FF5D6C; --danger-soft: #3A1820; --success: #3DD68C; --success-soft: #0F2E21; --warning: #F5B544; --warning-soft: #33260E;
    --ring: 0 0 0 3px rgb(117 99 255 / .35);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-md: 0 4px 16px -4px rgb(0 0 0 / .5), 0 1px 3px rgb(0 0 0 / .4);
    --shadow-lg: 0 24px 64px -16px rgb(0 0 0 / .7), 0 0 0 1px rgb(255 255 255 / .04);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
p { margin: 0; }
.muted { color: var(--text-2); }
.hint { color: var(--text-3); font-size: 12.5px; margin-top: 6px; }
.msg { min-height: 1.4em; color: var(--danger); font-size: 13px; margin-top: 10px; }
.msg:empty { min-height: 0; margin: 0; }
.icon { width: 18px; height: 18px; flex: none; fill: none; }
:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; letter-spacing: -0.02em; }
.brand img { border-radius: 8px; box-shadow: 0 2px 8px rgb(91 69 240 / .35); }

/* ---------- botões ---------- */
button { font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
button:disabled { opacity: .55; cursor: progress; }
.btn, .sheet-actions > button, #tab-security button:not(.link):not(.icon-btn), label.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 560; font-size: 14px; background: var(--accent); color: var(--on-accent);
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:active, .sheet-actions > button:active { transform: translateY(1px); }
.btn.primary, button.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 1px 2px rgb(20 18 40 / .15), inset 0 1px 0 rgb(255 255 255 / .12); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary, button.secondary, label.button {
  background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm);
}
.btn.secondary:hover, button.secondary:hover, label.button:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--text-2); border-color: transparent; padding: 0 10px; box-shadow: none; }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.danger-text { color: var(--danger) !important; }
button.danger, .btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
button.small, .btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; height: 44px; font-size: 15px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent-text); font-weight: 560; }
button.link:hover { text-decoration: underline; }
.muted-link { color: var(--text-3) !important; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border-radius: 9px; border: 0; background: transparent; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.active { color: var(--accent-text); }
.icon-btn.ok { color: var(--success); }

/* ---------- formulários ---------- */
.field { display: block; margin: 0 0 14px; font-size: 13px; font-weight: 560; color: var(--text-2); }
.field input, .field textarea, dialog input:not([type=radio]):not([type=checkbox]):not([type=file]), dialog textarea {
  display: block; width: 100%; margin-top: 6px; height: 40px; padding: 0 12px;
  font: 14px var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
.field textarea, dialog textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, dialog input:focus, dialog textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
dialog label { display: block; margin: 0 0 14px; font-size: 13px; font-weight: 560; color: var(--text-2); }
.input-group { display: flex; align-items: center; gap: 2px; margin-top: 6px; padding-right: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; }
.input-group:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.input-group input { margin: 0 !important; border: 0 !important; box-shadow: none !important; background: transparent !important; font-family: var(--mono) !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.meter { height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin: -6px 0 14px; }
.meter > div { height: 100%; width: 0; border-radius: 4px; transition: width .25s, background .25s; }
.meter .bad { background: var(--danger); } .meter .mid { background: var(--warning); } .meter .good { background: var(--success); }
#register-extra .meter { margin-top: -6px; margin-bottom: 0; }
#register-extra .hint { margin-bottom: 12px; }
.callout { display: flex; gap: 10px; padding: 12px; border-radius: 10px; font-size: 13px; margin: 2px 0 16px; }
.callout .icon { width: 16px; height: 16px; margin-top: 2px; }
.callout.warn, .warn { background: var(--warning-soft); color: var(--text); }
p.warn { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin: 0 0 12px; }
.callout.warn .icon { color: var(--warning); }

/* ==========================================================================
   Autenticação (cartão centralizado)
   ========================================================================== */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; isolation: isolate; overflow-x: hidden;
  background:
    radial-gradient(60rem 40rem at 10% -10%, rgb(117 99 255 / .18), transparent 60%),
    radial-gradient(50rem 36rem at 110% 110%, rgb(91 69 240 / .14), transparent 60%),
    var(--bg); }
.auth::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .6;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px; mask-image: radial-gradient(70% 60% at 50% 40%, #000, transparent 75%); }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(18px, env(safe-area-inset-top)) clamp(16px, 4vw, 40px) 0; }
.auth-top .brand { color: var(--text); text-decoration: none; }
.auth-top-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 560; color: var(--text-2); text-decoration: none; }
.auth-top-link:hover { color: var(--accent-text); }
.auth-top-link .icon { width: 14px; height: 14px; }
.auth-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 420px; padding: 36px 32px 28px; border-radius: 22px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: 0 30px 80px -30px rgb(40 30 120 / .35), 0 2px 6px rgb(20 18 40 / .05); }
@media (prefers-color-scheme: dark) { .auth-card { box-shadow: 0 30px 80px -24px rgb(0 0 0 / .7), 0 0 0 1px rgb(255 255 255 / .03); } }
.auth-mark { display: block; margin: -2px auto 20px; border-radius: 18px; box-shadow: 0 14px 34px -10px rgb(91 69 240 / .6); }
.auth-card h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.03em; text-align: center; }
.auth-sub { margin: 8px 0 26px; text-align: center; color: var(--text-2); font-size: 14.5px; }
.switch { margin-top: 20px; text-align: center; color: var(--text-2); font-size: 13.5px; }
.trust { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.trust li { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 520;
  color: var(--text-2); background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--border); }
.trust .icon { width: 14px; height: 14px; color: var(--accent-text); }
.auth-foot { padding: 0 16px max(20px, env(safe-area-inset-bottom)); text-align: center; font-size: 12.5px; color: var(--text-3); }
.code-input { font-family: var(--mono) !important; font-size: 22px !important; letter-spacing: .35em; text-align: center; height: 52px !important; }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
#mfa-totp-form, #mfa-recovery-form { margin-bottom: 4px; }
#mfa-recovery-form { margin-top: 14px; }
.mfa-links { display: flex; justify-content: space-between; margin-top: 18px; font-size: 13.5px; }
@media (max-width: 480px) {
  .auth-center { justify-content: flex-start; padding-top: 20px; }
  .auth-card { padding: 28px 20px 22px; border-radius: 20px; }
  .auth-card h1 { font-size: 22px; }
  .auth-top-link span, .auth-top-link { font-size: 12.5px; }
}

/* ==========================================================================
   App
   ========================================================================== */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.sidebar { display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px 12px; min-height: 0; }
.sidebar > .brand { padding: 2px 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 11px; font-weight: 620; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 18px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); font-weight: 520; text-align: left; transition: background .12s, color .12s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-item span:first-of-type { flex: 1; }
.count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-item.active .count { color: var(--accent-text); }
.scrim { display: none; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px; border-top: 1px solid var(--border); margin-top: 8px; }
.who { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* avatares */
.avatar { --h: 250; flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  font-weight: 650; font-size: 16px; color: hsl(var(--h) 70% 38%); background: hsl(var(--h) 80% 93%);
  box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 50% / .12); }
.avatar .icon { width: 20px; height: 20px; }
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 15px; font-size: 22px; }
.avatar.lg .icon { width: 26px; height: 26px; }
@media (prefers-color-scheme: dark) {
  .avatar { color: hsl(var(--h) 85% 78%); background: hsl(var(--h) 45% 20%); box-shadow: inset 0 0 0 1px hsl(var(--h) 60% 70% / .14); }
}

/* área principal */
.workspace { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); min-height: 0; }
.list-pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--bg); }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.menu-btn { display: none; }
.search { flex: 1; position: relative; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 34px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: 14px var(--font); transition: border-color .15s, box-shadow .15s; }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.list-title { display: flex; align-items: baseline; gap: 8px; padding: 12px 20px 8px; }
.list-title h2 { font-size: 15px; font-weight: 640; }
.list-title span { font-size: 13px; }
.item-list { list-style: none; margin: 0; padding: 0 10px 16px; overflow-y: auto; flex: 1; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; cursor: pointer; position: relative; transition: background .12s; }
.item:hover { background: var(--surface-2); }
.item.selected { background: var(--surface); box-shadow: var(--shadow-md); }
.item-text { flex: 1; min-width: 0; }
.item-name { display: flex; align-items: center; gap: 6px; font-weight: 580; overflow: hidden; }
.item-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-name .icon { width: 13px; height: 13px; color: #F5B000; fill: #F5B000; }
.item-sub { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-quick { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.item:hover .item-quick, .item.selected .item-quick, .item:focus-within .item-quick { opacity: 1; }
.item-quick .icon-btn { width: 30px; height: 30px; }
.item-quick .icon { width: 16px; height: 16px; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 32px; gap: 8px; }
.empty img { opacity: .9; margin-bottom: 8px; border-radius: 18px; }
.empty h3 { font-size: 16px; }
.empty p { max-width: 260px; font-size: 13.5px; }

/* detalhe */
.detail-pane { overflow-y: auto; min-height: 0; background: var(--bg); }
.detail { max-width: 640px; margin: 0 auto; padding: 32px 32px 48px; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.detail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.detail-head .titles { flex: 1; min-width: 0; }
.detail-head h2 { font-size: 22px; font-weight: 680; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; gap: 5px; margin-top: 6px; padding: 2px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 560; color: var(--text-2); background: var(--surface-3); }
.chip .icon { width: 12px; height: 12px; }
.detail-actions { display: flex; gap: 4px; }
.back-btn { display: none; }
.fields { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.frow { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 18px; min-height: 64px; }
.frow + .frow { border-top: 1px solid var(--border); }
.frow-main { flex: 1; min-width: 0; }
.flabel { font-size: 12px; font-weight: 560; color: var(--text-3); margin-bottom: 2px; }
.fvalue { font-size: 15px; overflow-wrap: anywhere; }
.fvalue.mono { font-family: var(--mono); font-size: 14.5px; letter-spacing: .02em; }
.fvalue.masked { letter-spacing: .18em; color: var(--text-2); }
.fvalue.locked { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-2); }
.fvalue.locked .icon { width: 16px; height: 16px; }
.fvalue.locked small { flex-basis: 100%; letter-spacing: 0; }
select.level { font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); max-width: 100%; }
.fvalue a { color: var(--accent-text); text-decoration: none; }
.fvalue a:hover { text-decoration: underline; }
.fvalue.notes { white-space: pre-wrap; font-size: 14px; line-height: 1.6; }
.frow-actions { display: flex; gap: 2px; }
.totp { display: flex; align-items: center; gap: 12px; }
.totp-code { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: .12em; color: var(--accent-text); }
.ring { width: 22px; height: 22px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring.low .bar { stroke: var(--danger); }
.pw-strength { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 560; margin-top: 4px; }
.pw-strength::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pw-strength.bad { color: var(--danger); } .pw-strength.mid { color: var(--warning); } .pw-strength.good { color: var(--success); }
.detail-meta { margin-top: 14px; padding: 0 6px; font-size: 12.5px; color: var(--text-3); }
.detail-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-3); text-align: center; padding: 32px; }
.detail-empty img { opacity: .35; filter: grayscale(.3); border-radius: 22px; margin-bottom: 6px; }
.detail-empty strong { color: var(--text-2); font-weight: 600; font-size: 15px; }

/* segurança */
.security { overflow-y: auto; min-height: 0; padding: 32px 40px 56px; }
.security > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-sub { margin-bottom: 24px; }
.security .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.security .card h2 { font-size: 16px; font-weight: 650; margin-bottom: 6px; }
.security .card h3 { font-size: 14px; font-weight: 620; margin: 20px 0 4px; }
.security .card > p { margin-bottom: 14px; font-size: 13.5px; }
.security .card p:not(.muted):not(.hint):not(.warn) { margin-bottom: 12px; }

/* listas internas (segurança, diálogos) */
ul.plain { list-style: none; padding: 0; margin: 8px 0 14px; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; font-size: 13.5px; }
ul.plain li:last-child { border-bottom: 0; }
ul.events li { flex-direction: column; align-items: flex-start; gap: 1px; }
ul.events small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
label.button { cursor: pointer; margin: 0; }
.report-block { margin: 12px 0; font-size: 13.5px; }
.report-block ul { margin: 6px 0; padding-left: 20px; color: var(--text-2); }
.report-block p { margin-top: 2px; }

/* ==========================================================================
   Diálogos
   ========================================================================== */
dialog.sheet { width: min(500px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--border);
  border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.sheet[open] { animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
dialog::backdrop { background: rgb(10 9 20 / .45); backdrop-filter: blur(3px); }
dialog.sheet form { padding: 24px; }
dialog.sheet h2 { font-size: 19px; font-weight: 660; margin-bottom: 16px; }
#modal-body > p { margin-bottom: 12px; font-size: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin-bottom: 16px; }
.sheet-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.sheet-actions > button { height: 38px; }
.fav-toggle { margin: 0 0 16px !important; cursor: pointer; color: var(--text-3); }
.fav-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.fav-toggle .icon { width: 22px; height: 22px; transition: color .12s, fill .12s; }
.fav-toggle input:checked + .icon { color: #F5B000; fill: #F5B000; }
.icon-btn.active .icon { fill: currentColor; color: #F5B000; }
.fav-toggle input:focus-visible + .icon { filter: drop-shadow(0 0 3px var(--accent)); }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; margin-bottom: 18px; background: var(--surface-2); border-radius: 12px; }
.segmented label { margin: 0 !important; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; justify-content: center; gap: 6px; height: 34px; border-radius: 9px;
  font-size: 13px; font-weight: 560; color: var(--text-2); cursor: pointer; transition: background .12s, color .12s; }
.segmented .icon { width: 15px; height: 15px; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { box-shadow: var(--ring); }
.qr { display: block; margin: 12px auto 16px; image-rendering: pixelated; background: #fff; padding: 10px; border-radius: 14px; box-shadow: var(--shadow-md); }
code.secret { display: block; text-align: center; font: 600 15px var(--mono); letter-spacing: .08em; padding: 10px; margin: 6px 0 16px;
  background: var(--surface-2); border-radius: 10px; word-break: break-all; }
pre.codes { font: 600 15px/2 var(--mono); text-align: center; background: var(--surface-2); padding: 14px; border-radius: 12px; user-select: all; columns: 2; margin: 0; }

/* toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 100;
  display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 12px;
  background: #15141D; color: #fff; font-size: 13.5px; font-weight: 520; box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px); animation: toast .2s ease-out; }
@media (prefers-color-scheme: dark) { #toast { background: #EEEDF5; color: #15141D; } }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px); } }
dialog[open] ~ #toast { display: none; }

/* ==========================================================================
   Responsivo
   ========================================================================== */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
  .detail { padding: 28px 24px; }
}
@media (max-width: 900px) {

  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 40; transform: translateX(-100%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg); padding-top: max(18px, env(safe-area-inset-top)); }
  .app.nav-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgb(10 9 20 / .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-grid; }

  .workspace { grid-template-columns: minmax(0, 1fr); }
  .list-pane { border-right: 0; }
  .detail-pane { position: fixed; inset: 0; z-index: 20; transform: translateX(100%); transition: transform .22s ease; }
  .app.show-detail .detail-pane { transform: none; }
  .back-btn { display: inline-grid; margin-left: -8px; }
  .detail { padding: max(16px, env(safe-area-inset-top)) 16px 40px; }
  .detail-head { flex-wrap: wrap; }
  .item-quick { opacity: 1; }
  .security { padding: 16px 16px 48px; }
  #add span { display: none; }
  #add { width: 38px; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- organizações ---------- */
.nav-group { display: contents; }
.nav-sub { height: 32px; padding-left: 38px; font-size: 13px; }
.badge { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 600;
  color: var(--accent-text); background: var(--accent-soft); vertical-align: 1px; }
.chip.org { margin-left: 6px; color: var(--accent-text); background: var(--accent-soft); }
.org-banner { display: flex; align-items: center; gap: 10px; margin: 4px 16px 0; padding: 10px 12px; border-radius: 12px;
  background: var(--accent-soft); color: var(--text); font-size: 13.5px; }
.org-banner span { flex: 1; }
.org-banner .icon { color: var(--accent-text); }
select, .field select, dialog select { display: block; width: 100%; margin-top: 6px; height: 40px; padding: 0 10px; font: 14px var(--font);
  color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; }
.table-wrap { overflow-x: auto; margin: 8px 0 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.actions-cell { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
label.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-weight: 500; color: var(--text); font-size: 13.5px; }
label.check input { width: auto; height: auto; margin: 0; }
label.check.muted { color: var(--text-2); }
.num { width: 64px !important; display: inline-block !important; height: 32px !important; margin: 0 4px !important; }
code.secret.link { font-size: 12px; text-align: left; letter-spacing: 0; }
.callout.ok { background: var(--success-soft); color: var(--text); }
.group-block { padding: 6px 0 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }

a.nav-item { text-decoration: none; }
.nav-logo { border-radius: 5px; flex: none; }

/* Tabelas viram cartões no celular */
@media (max-width: 640px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 2px 0; overflow-wrap: anywhere; }
  .table td:first-child { font-weight: 600; }
  .actions-cell { justify-content: flex-start; padding-top: 8px !important; }
  .detail-head h2 { white-space: normal; overflow-wrap: anywhere; }
}

/* ---------- painel de códigos 2FA ---------- */
.code-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; margin-top: 16px; }
.code-tile { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto; gap: 4px 12px; align-items: center;
  text-align: left; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--shadow-sm); }
.code-tile:hover { border-color: var(--accent, #6d5bd0); }
.code-tile .avatar { grid-row: span 2; }
.code-meta { display: flex; flex-direction: column; min-width: 0; }
.code-meta strong, .code-meta small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-val { display: flex; align-items: baseline; gap: 10px; grid-column: 2; }
.code-val .otp { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: .06em; }
.code-tile.low .otp { color: #d9534f; }
