/* Chaveiro — identidade: grafite quente + laranja Saymon Cunha.
   Troque --brand para mudar a cor da marca em todo o sistema. */

@font-face {
  font-family: 'Space Grotesk';
  src: url('/fonts/space-grotesk.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  --brand: #FF7A1A;
  --brand-hover: #FF8F3D;
  --brand-ink: #1A0E04;
  --brand-soft: rgba(255, 122, 26, .12);
  --brand-line: rgba(255, 122, 26, .38);

  --bg: #141210;
  --surface: #1B1815;
  --raised: #24201C;
  --raised-2: #2E2924;
  --line: #342E28;
  --line-strong: #4A4239;

  --text: #F2EBE1;
  --text-2: #C9BFB2;
  --muted: #998D7E;

  --num: #7CC4FF;
  --sym: #FFB067;
  --ok: #7BD389;
  --warn: #F2C14E;
  --danger: #FF6B5E;
  --danger-soft: rgba(255, 107, 94, .12);
  --danger-text: #FFB3AB;
  --placeholder: #6E6458;
  --shadow: 0 24px 80px rgba(0, 0, 0, .55);
  --backdrop: rgba(10, 8, 6, .72);
  color-scheme: dark;
}

/* Tema claro (botão de sol no menu). Mesmo laranja, um tom mais escuro para ter contraste no branco. */
:root[data-theme="light"] {
  --brand: #F26A00;
  --brand-hover: #E05F00;
  --brand-ink: #FFFFFF;
  --brand-soft: rgba(242, 106, 0, .10);
  --brand-line: rgba(242, 106, 0, .40);

  --bg: #F4F3F1;
  --surface: #FFFFFF;
  --raised: #EFEDEA;
  --raised-2: #E6E3DF;
  --line: #E4E0DB;
  --line-strong: #CEC8C1;

  --text: #1B1815;
  --text-2: #4A443D;
  --muted: #7A7268;

  --num: #0B63C4;
  --sym: #C2410C;
  --ok: #1E8A3C;
  --warn: #A16207;
  --danger: #D33A2C;
  --danger-soft: rgba(211, 58, 44, .09);
  --danger-text: #A3261A;
  --placeholder: #A59D93;
  --shadow: 0 24px 60px rgba(40, 30, 20, .18);
  --backdrop: rgba(30, 24, 18, .35);
  color-scheme: light;
}
:root {

  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --r-sm: 8px;
  --r: 10px;
  --r-lg: 18px;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01';
}
#app { height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); }
::selection { background: var(--brand); color: var(--brand-ink); }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 16px 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.icon { flex: none; display: block; }

.boot, .boot-error { height: 100%; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid transparent; background: none; font-weight: 500; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--text-2); background: var(--raised); }
.btn-quiet { color: var(--text-2); padding: 0 10px; height: 36px; }
.btn-quiet:hover { background: var(--raised); color: var(--text); }
.btn-quiet.danger, .btn-quiet.danger:hover { color: var(--danger); }
.btn-quiet.danger:hover { background: var(--danger-soft); }
.btn-danger { background: var(--danger); color: #210604; font-weight: 600; }
.btn-block { width: 100%; height: 46px; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: var(--r-sm); border: 0; background: none; color: var(--text-2);
}
.icon-btn:hover { background: var(--raised-2); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Campos ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field-hint { font-size: 13px; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 120px; gap: 12px; }
input:not([type=checkbox]):not([type=range]):not([type=file]), select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r);
  transition: border-color .15s;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:hover, select:hover, textarea:hover { border-color: #5E5449; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
select {
  appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23998D7E' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.input-group { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r); padding-right: 4px; }
.input-group:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input-group input { border: 0 !important; box-shadow: none !important; background: none !important; }
.input-addon { width: 34px; height: 34px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; color: var(--text-2); }
.check input { accent-color: var(--brand); width: 18px; height: 18px; }

.form-error { background: var(--danger-soft); color: var(--danger-text); border-left: 3px solid var(--danger); padding: 10px 12px; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 14px; }
.form-notice { background: var(--brand-soft); color: var(--text); border-left: 3px solid var(--brand); padding: 10px 12px; border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 14px; }
.warning { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-2); }
.warning .icon { color: var(--brand); margin-top: 2px; }

.meter-row { display: flex; align-items: center; gap: 12px; margin-top: -6px; }
.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex: 1; }
.meter span { height: 4px; border-radius: 2px; background: var(--line); transition: background .2s; }
.meter[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.meter[data-score="2"] span:nth-child(-n+2) { background: var(--warn); }
.meter[data-score="3"] span:nth-child(-n+3) { background: var(--ok); }
.meter[data-score="4"] span { background: var(--ok); }
.meter-label { font-size: 12px; color: var(--muted); min-width: 140px; text-align: right; }
.field > .meter { margin-top: 2px; }

/* ---------- Marca ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); }
.brand-lg { font-size: 22px; }
.brand-lg .brand-mark { width: 38px; height: 38px; border-radius: 11px; }

/* ---------- Telas de entrada ---------- */
.auth { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 520px); }
.auth-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 32px;
  padding: 40px clamp(28px, 5vw, 64px);
  background:
    radial-gradient(120% 80% at 0% 100%, rgba(255, 122, 26, .14), transparent 60%),
    var(--surface);
  border-right: 1px solid var(--line);
}
.auth-tagline { max-width: 34ch; font-size: clamp(22px, 2.4vw, 30px); line-height: 1.25; letter-spacing: -.02em; color: var(--text); font-weight: 500; }
.hero-key { width: min(100%, 620px); height: auto; margin: auto 0 auto -6px; overflow: visible; }
.hero-key-head { fill: none; stroke: var(--brand); stroke-width: 3; }
.hero-key-blade { fill: var(--brand); }
.hero-key-groove { stroke: var(--brand-ink); stroke-width: 3; stroke-linecap: round; opacity: .35; }
.hero-key-body { transform-box: fill-box; transform-origin: 18% 50%; }
.hero-key.turning .hero-key-body { animation: turn .52s var(--ease) forwards; }
@keyframes turn {
  0% { transform: translateX(0); }
  45% { transform: translateX(7%); }
  100% { transform: translateX(7%) rotateX(80deg); opacity: .25; }
}
.auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 48px clamp(24px, 4vw, 56px); }
.auth-panel h1 { font-size: 30px; letter-spacing: -.03em; }
.auth-form { display: grid; gap: 16px; margin-top: 8px; }
.auth-switch { color: var(--muted); font-size: 14px; }

/* ---------- Aplicação ---------- */
.app { height: 100%; display: grid; grid-template-columns: 236px minmax(0, 1fr); }

.sidebar {
  display: flex; flex-direction: column; gap: 24px; min-height: 0;
  padding: 20px 14px 14px; background: var(--surface); border-right: 1px solid var(--line);
}
.sidebar > .brand { padding: 0 6px; }
.nav { display: grid; gap: 22px; overflow-y: auto; flex: 1; align-content: start; }
.nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 6px 10px; font-size: 13px; color: var(--muted); font-weight: 500; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2);
}
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item.active { background: var(--raised-2); color: var(--text); box-shadow: inset 3px 0 0 var(--brand); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-shared { color: var(--muted); }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item.active .count { color: var(--brand); }

.me { display: flex; align-items: center; gap: 2px; border-top: 1px solid var(--line); padding-top: 12px; }
.me-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px; border-radius: var(--r-sm); text-align: left; }
.me-btn:hover { background: var(--raised); }
.me-text { display: grid; min-width: 0; }
.me-text strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 12px; }
.avatar {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--raised-2); color: var(--brand); font-size: 13px; font-weight: 700; border: 1px solid var(--line-strong);
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }

/* ---------- Lista (coluna única, centralizada) ---------- */
.list-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list-head {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
  width: 100%; max-width: 920px; margin: 0 auto; padding: 28px 28px 14px;
}
.list-title { display: flex; align-items: center; gap: 6px; min-height: 42px; }
.list-title h1 { flex: 1; min-width: 0; font-size: 26px; letter-spacing: -.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search { position: relative; display: flex; align-items: center; }
.search > .icon { position: absolute; left: 16px; color: var(--muted); pointer-events: none; }
.search input {
  min-height: 54px !important; padding-left: 50px !important; padding-right: 44px !important;
  font-size: 17px; border-radius: 14px !important; background: var(--surface) !important;
}
.search kbd { position: absolute; right: 14px; font: 12px var(--mono); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 7px; }
.search input::-webkit-search-cancel-button { filter: grayscale(1) opacity(.6); }

.uf-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.uf-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: none; color: var(--text);
  font: 600 13px var(--font);
}
.uf-pill span { font-weight: 400; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.uf-pill:hover { border-color: var(--text-2); }
.uf-pill.active { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.uf-pill.active span { color: var(--brand-ink); opacity: .75; }

.list-body { flex: 1; overflow-y: auto; padding: 0 28px 48px; }
.rows { list-style: none; margin: 0 auto; padding: 0; max-width: 864px; }
.list-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 2px 8px 4px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); }
.list-controls { display: flex; gap: 2px; }
.sort { field-sizing: content; width: auto !important; min-height: 30px !important; height: 30px; padding: 0 24px 0 8px !important; font-size: 13px; color: var(--text-2); border-color: transparent !important; background-color: transparent !important; background-position: right 6px center; }
.sort:hover { color: var(--text); }

.group-state { display: flex; align-items: center; gap: 10px; padding: 22px 4px 2px; font-size: 16px; font-weight: 600; }
.group-label { padding: 14px 4px 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.group-state + .group-label { padding-top: 8px; }
.uf {
  display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px;
  font: 600 12px/1 var(--mono); color: var(--brand); background: var(--brand-soft); border: 1px solid var(--brand-line);
}

/* Linha */
.row { border-radius: 12px; border: 1px solid transparent; }
.row-line { display: flex; align-items: center; }
.row:not(.open):hover { background: var(--surface); }
.row-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 10px 6px 10px 10px; border: 0; border-radius: 12px; background: none;
}
.row-text { flex: 1; min-width: 0; display: grid; }
.row-title { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; align-items: center; gap: 6px; max-width: 38%; }
.row-meta .uf { height: 20px; min-width: 28px; font-size: 11px; }
.row-vault { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-chevron { color: var(--muted); transition: transform .15s var(--ease); }
.row.open .row-chevron { transform: rotate(90deg); color: var(--brand); }
.tag {
  display: inline-block; max-width: 100%; padding: 1px 8px; border-radius: 6px; font-size: 12px;
  background: var(--raised-2); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.row-copy { display: flex; gap: 2px; padding-right: 6px; }
.row-copy .icon-btn { width: 36px; height: 36px; color: var(--muted); }
.row-copy .icon-btn:hover:not(:disabled) { color: var(--brand); background: var(--brand-soft); }
.row-copy .icon-btn:disabled { opacity: .25; cursor: default; }
.row-copy .icon-btn.copied { color: var(--ok); }

/* Lâmina da chave */
.glyph { flex: none; width: 40px; height: 40px; border-radius: 11px; background: var(--raised); }
.row:hover .glyph, .row.open .glyph { background: var(--raised-2); }
.glyph-head { fill: none; stroke: var(--brand); stroke-width: 2.4; }
.glyph-blade { fill: var(--brand); }
.glyph-note .glyph-head { stroke: var(--text-2); }
.glyph-note .glyph-blade { fill: var(--text-2); }

/* Acesso aberto */
.row.open { background: var(--surface); border-color: var(--line-strong); margin: 8px 0; box-shadow: 0 1px 0 var(--line); }
.row-open { padding: 0 16px 14px 64px; display: grid; gap: 12px; }
.cf-list { display: grid; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.cf { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px 6px 16px; border-top: 1px solid var(--line); }
.cf:first-child { border-top: 0; }
.cf-label { font-size: 13px; color: var(--muted); }
.cf-value {
  min-width: 0; justify-self: start; max-width: 100%; text-align: left; overflow-wrap: anywhere;
  padding: 7px 10px; margin-left: -10px; border: 0; border-radius: 8px; background: none;
  font-size: 16px; cursor: copy;
}
.cf-value.mono { font-family: var(--mono); font-size: 15.5px; }
.cf-value:hover { background: var(--raised); }
.cf-value.masked { letter-spacing: .14em; color: var(--text-2); }
.cf.is-empty .cf-value { color: var(--placeholder); font-style: italic; cursor: default; font-size: 14px; }
.cf.is-empty .cf-value:hover { background: none; }
.cf-tools { display: flex; align-items: center; gap: 4px; }
.cf-copy {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; min-width: 104px; justify-content: center; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 500; font-size: 14px;
}
.cf-copy:hover { border-color: var(--brand); color: var(--brand); }
.cf.is-secret .cf-copy { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.cf.is-secret .cf-copy:hover { background: var(--brand-hover); color: var(--brand-ink); }
.cf-copy.copied, .cf.is-secret .cf-copy.copied { background: var(--ok); border-color: var(--ok); color: #0B1A0E; }
.ch-num { color: var(--num); }
.ch-sym { color: var(--sym); }
.cf-notes { display: grid; gap: 4px; }
.cf-notes p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.row-open-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.row-open-actions { display: flex; flex-wrap: wrap; gap: 2px; margin-right: -6px; }
.row-open-actions .btn { height: 32px; font-size: 13.5px; }

.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 64px 24px; }
.empty-key .glyph { width: 72px; height: 72px; border-radius: 20px; margin-bottom: 8px; }
.empty-title { font-size: 17px; font-weight: 600; }
.empty .muted { max-width: 34ch; }
.empty-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }

/* ---------- Gaveta de edição ---------- */
.scrim { display: none; }
.app.show-drawer .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: var(--backdrop); }
.drawer {
  position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(540px, 100vw);
  background: var(--surface); border-left: 1px solid var(--line-strong); box-shadow: var(--shadow);
  transform: translateX(100%); visibility: hidden; transition: transform .22s var(--ease), visibility .22s;
}
.app.show-drawer .drawer { transform: none; visibility: visible; }
.item-form { height: 100%; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 14px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 20px; letter-spacing: -.02em; }
.form-body { flex: 1; overflow-y: auto; padding: 20px 24px; display: grid; gap: 16px; align-content: start; }
.form-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); }
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; justify-self: start; }
.segmented button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: none; color: var(--text-2); }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--raised-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--brand); }

/* ---------- Janelas ---------- */
.modal {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
}
.modal[open] { display: flex; flex-direction: column; animation: pop .18s var(--ease); }
.modal-wide { width: min(720px, calc(100vw - 32px)); }
.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(3px); }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 14px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 19px; letter-spacing: -.02em; }
.modal-body { padding: 20px 24px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--line); }
.modal .lead { font-size: 16px; }
.stack { display: grid; gap: 24px; }
.stack-sm { display: grid; gap: 12px; }
.stack h3, .modal-body h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.split-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.inline-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }

.people { list-style: none; margin: 0; padding: 0; display: grid; }
.people li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; }
.people li.is-disabled { opacity: .55; }
.people select { width: auto; min-width: 150px; }
.person { flex: 1; min-width: 0; display: grid; }
.person strong { font-weight: 500; }
.person small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.share-form { display: grid; gap: 8px; padding: 16px; background: var(--bg); border-radius: var(--r-lg); border: 1px dashed var(--line-strong); }
.share-form h3 { margin: 0; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.share-row > input, .share-row > select { flex: 1 1 160px; width: auto; }
.share-row > select:nth-child(2) { flex: 0 1 160px; }
.invite-code { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 8px; padding: 14px 16px; border-radius: var(--r); background: var(--brand-soft); border: 1px solid var(--brand-line); }
.invite-code .big { display: block; font-size: 20px; color: var(--brand); margin-top: 4px; }

.gen-box { display: flex; align-items: center; gap: 8px; padding: 18px 12px 18px 20px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-lg); }
.gen-output { flex: 1; min-width: 0; font-size: 20px; overflow-wrap: anywhere; line-height: 1.4; }
.gen-meta { font-size: 13px; color: var(--muted); margin-top: -8px; }
.gen-length { display: flex; align-items: center; gap: 14px; }
.gen-length input { flex: 1; accent-color: var(--brand); }
.gen-length strong { font-family: var(--mono); min-width: 2ch; text-align: right; }
.gen-options { display: grid; gap: 10px; }

.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-2); }
.dropzone {
  display: grid; justify-items: center; gap: 8px; padding: 32px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--brand-line); border-radius: var(--r-lg); color: var(--brand); background: var(--brand-soft); font-weight: 500;
}
.dropzone:hover { border-color: var(--brand); }
.dropzone:focus-within { box-shadow: var(--focus); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.preview { display: grid; gap: 8px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 10px; border-bottom: 1px solid var(--line-strong); }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.filters { display: flex; gap: 8px; }
.filters select { width: auto; flex: 1; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.timeline li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline li.is-alert .avatar { color: var(--danger); border-color: var(--danger); }
.timeline strong { font-weight: 500; }

.versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.versions li { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); display: grid; gap: 8px; }
.version-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.version-values { margin: 0; display: grid; grid-template-columns: 80px 1fr; gap: 4px 12px; font-size: 14px; }
.version-values dt { color: var(--muted); }
.version-values dd { margin: 0; display: flex; align-items: center; gap: 4px; overflow-wrap: anywhere; }

.account-head { display: flex; align-items: center; gap: 16px; }
.account-head strong { font-size: 18px; }
.ok-line { display: flex; align-items: center; gap: 8px; color: var(--ok); }
.totp-setup { display: grid; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }
.qr { background: #F2EBE1; border-radius: 12px; padding: 8px; }
.qr svg { display: block; width: 100%; height: auto; }
.secret-code { display: block; padding: 8px 10px; background: var(--bg); border-radius: var(--r-sm); word-break: break-all; color: var(--brand); }

/* ---------- Avisos ---------- */
.toasts { position: fixed; z-index: 100; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r);
  background: var(--raised-2); border: 1px solid var(--line-strong); box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  font-size: 14px; animation: rise .2s var(--ease); pointer-events: auto;
}
.toast-ok .icon { color: var(--ok); }
.toast-error { border-color: var(--danger); }
.toast-warn { border-color: var(--warn); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Responsivo ---------- */
.only-sm { display: none; }

@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px; gap: 16px; }
  .auth-tagline { font-size: 18px; }
  .hero-key { width: 220px; }
  .auth-panel { justify-content: flex-start; padding: 28px 20px 40px; }

  .app { grid-template-columns: 1fr; position: relative; overflow: hidden; }
  .only-sm { display: inline-grid; }
  .hide-sm { display: none; }
  .sidebar {
    position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .25s var(--ease);
  }
  .app.show-sidebar .sidebar { transform: none; box-shadow: var(--shadow); }
  .app.show-sidebar .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: var(--backdrop); }
  .list-head { padding: 14px 14px 10px; gap: 12px; }
  .list-title h1 { font-size: 22px; }
  .search input { min-height: 50px !important; font-size: 16px; }
  .uf-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .list-body { padding: 0 10px 40px; }
  .row-meta { display: none; }
  .row-chevron { display: none; }
  .row-main { gap: 12px; padding-left: 8px; }
  .row-open { padding: 0 10px 12px; }
  .cf { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 8px 8px 12px; row-gap: 0; }
  .cf-label { grid-column: 1 / -1; }
  .cf-value { grid-column: 1; }
  .cf-copy { min-width: 0; }
  .cf-copy span { display: none; }
  .cf-copy { width: 44px; height: 40px; padding: 0; }
  .field-row { grid-template-columns: 1fr 96px; }
  .totp-setup { grid-template-columns: 1fr; }
  .qr { width: 200px; }
  .form-body { padding: 16px; }
  .form-foot { padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Pares de campos e botões que não devem esticar */
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack-sm > .btn { justify-self: start; }
@media (max-width: 560px) { .field-pair { grid-template-columns: 1fr; } }

/* Importação */
.import-summary { font-size: 16px; }
.map-details { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 16px; display: grid; gap: 12px; }
.map-details[open] { padding-bottom: 16px; }
.map-details summary { cursor: pointer; color: var(--text-2); font-weight: 500; }
.map-details summary:hover { color: var(--text); }
ul.steps { list-style: disc; }
.warn-text { color: var(--warn); }

/* =====================================================================
   Layout A: cada cliente é um bloco; acessos em linhas compactas
   ===================================================================== */
.list-summary { padding: 6px 2px 10px 4px; border-bottom: 0; }
.group-state {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; padding: 0 4px;
  font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em;
}
.group-state::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.list-body > .group-state:first-of-type, .list-summary + .group-state { margin-top: 4px; }

.client-block {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  overflow: hidden; margin-bottom: 10px;
}
.client-block.flat { margin-top: 2px; }
.client-head {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: var(--raised); border-bottom: 1px solid var(--line);
}
.client-head h3 { margin: 0; flex: 1; min-width: 0; font-size: 15.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-count { font-size: 12px; color: var(--muted); white-space: nowrap; }

.access-list { list-style: none; margin: 0; padding: 0; }
.access-list > .row { border-radius: 0; border: 0; margin: 0; box-shadow: none; }
.access-list > .row + .row { border-top: 1px solid var(--line); }
.access-list > .row:not(.open):hover { background: var(--raised); }
.access-list > .row.open { background: var(--bg); }
.access-list > .row.open + .row { border-top-color: var(--line-strong); }

.row-line { display: flex; align-items: center; gap: 6px; padding-right: 10px; }
.row-main {
  flex: 1; min-width: 0; display: grid; align-items: center; gap: 12px;
  grid-template-columns: 46px minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, .9fr);
  padding: 8px 4px 8px 14px; border: 0; border-radius: 0; background: none; text-align: left;
}
.kind {
  justify-self: start; font: 600 10.5px/1 var(--mono); letter-spacing: .02em; padding: 4px 6px; border-radius: 5px;
  color: var(--text-2); background: var(--raised-2); border: 1px solid var(--line);
}
.row.open .kind { color: var(--brand); border-color: var(--brand-line); background: var(--brand-soft); }
.row-text { display: grid; min-width: 0; }
.row-title { font-size: 14.5px; font-weight: 500; }
.row-client { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-host { font: 13px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-user { font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.row-copy { display: flex; gap: 6px; padding: 0; flex-shrink: 0; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line-strong); background: transparent; color: var(--text); font: 500 12.5px var(--font); white-space: nowrap;
}
.copy-btn .icon { color: var(--muted); }
.copy-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.copy-btn:hover:not(:disabled) .icon { color: var(--brand); }
.copy-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.copy-btn.primary .icon { color: var(--brand-ink); }
.copy-btn.primary:hover:not(:disabled) { background: var(--brand-hover); color: var(--brand-ink); }
.copy-btn.primary:hover:not(:disabled) .icon { color: var(--brand-ink); }
.copy-btn:disabled { opacity: .3; cursor: default; }
.copy-btn.copied, .copy-btn.primary.copied { background: var(--ok); border-color: var(--ok); color: #0B1A0E; }
.copy-btn.copied .icon { color: #0B1A0E; }

.row-open { padding: 2px 14px 14px 72px; }

/* Ações extras na Equipe (Zerar 2FA, Excluir conta) */
.split-right { display: flex; gap: 6px; flex-wrap: wrap; }
.more-menu { position: relative; }
.more-menu > summary {
  list-style: none; cursor: pointer; display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: var(--r-sm); color: var(--text-2);
}
.more-menu > summary::-webkit-details-marker { display: none; }
.more-menu > summary:hover, .more-menu[open] > summary { background: var(--raised-2); color: var(--text); }
.more-pop {
  position: absolute; right: 0; top: 38px; z-index: 5; min-width: 250px; padding: 6px;
  display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); box-shadow: var(--shadow);
}
.more-pop .btn { justify-content: flex-start; width: 100%; }

@media (max-width: 860px) {
  .row-main { grid-template-columns: 40px minmax(0, 1fr); padding-left: 10px; gap: 10px; }
  .row-host, .row-user { display: none; }
  .copy-btn { padding: 0 9px; height: 34px; }
  .copy-btn span { display: none; }
  .row-open { padding: 2px 10px 12px; }
  .client-head { padding: 9px 12px; }
}
.list-inner { max-width: 864px; margin: 0 auto; }
.list-inner > .group-state:first-child, .list-inner > .list-summary + .group-state { margin-top: 4px; }
.list-summary { flex-wrap: wrap; row-gap: 2px; }
.list-summary > span:first-child { white-space: nowrap; }
.row.open .row-copy { visibility: hidden; }

/* ---------- Entrar com conta Microsoft ---------- */
/* Segue o padrão do botão da Microsoft: fundo branco, borda cinza, texto #5E5E5E. */
.btn-microsoft {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; height: 46px; padding: 0 16px; cursor: pointer;
  background: #FFFFFF; color: #5E5E5E; border: 1px solid #8C8C8C; border-radius: var(--r-sm, 8px);
  font: 600 15px/1 "Segoe UI", system-ui, -apple-system, sans-serif;
  transition: background .15s ease;
}
.btn-microsoft:hover { background: #F3F3F3; }
.btn-microsoft:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-microsoft:disabled { opacity: .7; cursor: progress; }
.btn-microsoft .spinner { border-color: rgba(0,0,0,.2); border-top-color: #5E5E5E; }
.ms-logo { display: inline-grid; grid-template-columns: 9px 9px; gap: 2px; }
.ms-logo i { width: 9px; height: 9px; display: block; }
.ms-logo i:nth-child(1) { background: #F25022; }
.ms-logo i:nth-child(2) { background: #7FBA00; }
.ms-logo i:nth-child(3) { background: #00A4EF; }
.ms-logo i:nth-child(4) { background: #FFB900; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0 4px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--line, rgba(255,255,255,.12)); }
