/* ==========================================================================
   Synzel CRM — estilos base (mobile-first)
   Tokens do Cia Care; breakpoints por min-width: 640 · 960 · 1280.
   ========================================================================== */

/* ---------------------------------------------------------------- Tokens -- */
:root {
  --purple: #7A5AF8;
  --purple-hover: #6842F0;
  --purple-soft: #9D7BFF;
  --purple-tint: #F1EEFD;
  --purple-tint-2: #F3F0FF;
  --purple-border: #E2D8FF;

  --bg: #F4F5FA;
  --surface: #FFFFFF;
  --surface-2: #FAFAFE;
  --surface-3: #F4F4FA;
  --column: #EEEFF6;

  --ink: #2B2A3B;
  --ink-2: #5B5B72;
  --ink-3: #8A8AA0;
  --muted: #9C9CB2;
  --muted-2: #B4B4C6;

  --border: #ECEDF5;
  --border-2: #E3E4EF;
  --border-3: #D9DAE6;

  --red: #EF4444;    --red-ink: #DC2626;  --red-bg: #FEE2E2;
  --amber: #F59E0B;  --amber-ink: #B45309; --amber-bg: #FEF3C7;
  --blue: #3B82F6;   --blue-ink: #2563EB; --blue-bg: #DBEAFE;
  --teal: #14B8A6;   --teal-ink: #0F766E; --teal-bg: #CCFBF1;
  --green: #22C55E;  --green-ink: #15803D; --green-bg: #DCFCE7;
  --pink: #EC4899;   --pink-bg: #FCE7F3;
  --slate: #64748B;  --slate-bg: #F1F5F9;

  /* prioridades (fundo / texto) */
  --prio-urgente-bg: var(--red-bg);   --prio-urgente: var(--red-ink);
  --prio-alta-bg: var(--amber-bg);    --prio-alta: var(--amber-ink);
  --prio-media-bg: var(--blue-bg);    --prio-media: var(--blue-ink);
  --prio-garantia-bg: var(--teal-bg); --prio-garantia: var(--teal-ink);

  --r-badge: 6px;
  --r-btn: 10px;
  --r-card: 12px;
  --r-col: 15px;
  --r-panel: 16px;
  --r-modal: 20px;

  --shadow-card: 0 1px 3px rgba(43, 42, 59, .06);
  --shadow-hover: 0 6px 18px rgba(122, 90, 248, .14);
  --shadow-pop: 0 16px 40px rgba(20, 18, 40, .18);
  --shadow-modal: 0 30px 80px rgba(20, 18, 40, .35);
  --ring: 0 0 0 3px rgba(122, 90, 248, .22);

  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --topbar-h: 60px;
  --bottomnav-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sidebar-w: 272px;
  color-scheme: light;
}

html.tema-escuro {
  color-scheme: dark;
  --purple-tint: #2B2347;
  --purple-tint-2: #272045;
  --purple-border: #473A6E;

  --bg: #13131E;
  --surface: #1C1C2A;
  --surface-2: #212132;
  --surface-3: #262639;
  --column: #181824;

  --ink: #E9E9F4;
  --ink-2: #C6C6DA;
  --ink-3: #9E9EBB;
  --muted: #8B8BA8;
  --muted-2: #6C6C8A;

  --border: #2A2A40;
  --border-2: #34344E;
  --border-3: #3E3E5A;

  --red-ink: #F87171;   --red-bg: #3A2330;
  --amber-ink: #FBBF24; --amber-bg: #3D3220;
  --blue-ink: #60A5FA;  --blue-bg: #20304E;
  --teal-ink: #2DD4BF;  --teal-bg: #1C3B3A;
  --green-ink: #4ADE80; --green-bg: #1F3D2C;
  --pink-bg: #432233;
  --slate-bg: #2A3140;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, .35);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, .5);
}

/* ------------------------------------------------------------------ Base -- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 960px) { body { font-size: 13.5px; } }

a { color: var(--purple); text-decoration: none; }
a:hover { color: var(--purple-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

.i { width: 16px; height: 16px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.rel { position: relative; }
.truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 999; background: var(--purple); color: #fff; padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; color: #fff; }

@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes slide-left { from { transform: translateX(100%); } to { transform: none; } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

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

/* ----------------------------------------------------------------- Marca -- */
.brand-tile {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--purple), var(--purple-soft));
  box-shadow: 0 6px 16px rgba(122, 90, 248, .35);
  display: flex; align-items: center; justify-content: center;
}
.brand-tile span { color: #fff; font-weight: 700; font-size: 17px; }
.brand-tile.lg { width: 50px; height: 50px; border-radius: 15px; }
.brand-tile.lg span { font-size: 24px; }

/* ---------------------------------------------------------------- Botões -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 9px 16px;
  border: 1px solid transparent; border-radius: var(--r-btn);
  font-size: 13.5px; font-weight: 600; line-height: 1; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, opacity .15s;
  user-select: none;
}
.btn .i { width: 15px; height: 15px; }
.btn:disabled, .btn.is-busy { opacity: .6; pointer-events: none; }
.btn--primary { background: var(--purple); color: #fff; box-shadow: 0 6px 16px rgba(122, 90, 248, .28); }
.btn--primary:hover { background: var(--purple-hover); color: #fff; }
.btn--ghost { background: var(--surface); color: var(--ink-2); border-color: var(--border-2); }
.btn--ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn--danger { background: var(--red-bg); color: var(--red-ink); }
.btn--danger:hover { filter: brightness(.97); color: var(--red-ink); }
.btn--sm { min-height: 34px; padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn--block { width: 100%; }
@media (min-width: 960px) { .btn { min-height: 38px; } .btn--sm { min-height: 32px; } }

.icon-btn {
  position: relative; flex: none;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--ink-3);
  border: 1px solid var(--border); border-radius: 11px;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn .i { width: 17px; height: 17px; }
.icon-btn--ghost { background: transparent; border-color: transparent; }
.icon-btn--sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn--sm .i { width: 15px; height: 15px; }
.icon-btn__badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--purple); color: #fff; border: 2px solid var(--bg); border-radius: 9px;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.link-btn { background: none; border: 0; color: var(--purple); font-size: 12px; font-weight: 500; padding: 4px; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------- Formulários -- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field__label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field__hint { font-size: 11.5px; color: var(--muted); }
.field__error { margin: -6px 0 0; font-size: 12px; color: var(--red-ink); font-weight: 500; }
.field__wrap { position: relative; display: block; }
.input {
  width: 100%; min-height: 42px;
  padding: 10px 12px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border-2); border-radius: var(--r-btn);
  font-size: 16px; /* evita zoom no iOS */
  outline: none; transition: border-color .15s, box-shadow .15s;
}
@media (min-width: 960px) { .input { font-size: 13.5px; min-height: 38px; padding: 8px 12px; } }
.input::placeholder { color: var(--muted-2); }
.input:focus { border-color: var(--purple); box-shadow: var(--ring); }
.input--sm { min-height: 34px; padding: 6px 10px; border-radius: 8px; }
@media (min-width: 960px) { .input--sm { font-size: 12.5px; min-height: 30px; } }
.input.has-icon { padding-right: 44px; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }
select.input {
  appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%239C9CB2' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field__toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; color: var(--muted); border-radius: 8px;
}
.field__toggle:hover { color: var(--purple); background: var(--surface-3); }
.fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.fieldset legend { padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.fieldset:disabled { opacity: .55; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.form__actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.form--inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.form--inline .field { flex: 1 1 200px; }
.form--filters { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 14px; }
.form--filters .field { flex: 1 1 150px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--purple); }
.check input { width: 16px; height: 16px; margin: 0; }

.switch { appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--border-3); position: relative; flex: none; margin: 0; cursor: pointer; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch:checked { background: var(--purple); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.switch-row { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.switch-row--card, .check-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; align-items: flex-start; }
.switch-row span, .check-card span { display: flex; flex-direction: column; gap: 2px; }
.switch-row small, .check-card small { color: var(--muted); font-size: 12px; }
.check-card { display: flex; gap: 10px; cursor: pointer; }
.check-card input { margin-top: 3px; width: 16px; height: 16px; }
.check-card:has(input:checked) { border-color: var(--purple-border); background: var(--purple-tint-2); }

.segmented { display: inline-flex; background: var(--surface-3); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-card); font-weight: 600; }
.segmented input:focus-visible + span { box-shadow: var(--ring); }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { position: relative; }
.swatch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 9px; background: var(--c); border: 2px solid transparent; box-shadow: inset 0 0 0 2px var(--surface); }
.swatch input:checked + span { border-color: var(--c); box-shadow: inset 0 0 0 3px var(--surface); }
.swatch input:focus-visible + span { outline: 2px solid var(--purple); outline-offset: 2px; }

/* --------------------------------------------------------------- Alertas -- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; margin-bottom: 14px;
  border: 1px solid transparent; border-radius: 12px;
  font-size: 13px; line-height: 1.45; animation: fade .25s ease both;
}
.alert .i { margin-top: 1px; }
.alert--erro { background: var(--red-bg); color: var(--red-ink); }
.alert--ok { background: var(--green-bg); color: var(--green-ink); }
.alert--info { background: var(--purple-tint-2); border-color: var(--purple-border); color: var(--purple); }
.alert--warn { background: var(--amber-bg); color: var(--amber-ink); }

/* ---------------------------------------------------------------- Badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
}
.badge--ok { background: var(--green-bg); color: var(--green-ink); border-color: transparent; }
.badge--warn { background: var(--amber-bg); color: var(--amber-ink); border-color: transparent; }
.badge--danger { background: var(--red-bg); color: var(--red-ink); border-color: transparent; }
.badge--purple { background: var(--purple-tint); color: var(--purple); border-color: var(--purple-border); }
.badge--muted { color: var(--muted); }

.avatar {
  --av: var(--purple);
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  background: color-mix(in srgb, var(--av) 20%, var(--surface));
  color: var(--av);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: .2px;
}
.avatar--sm { width: 26px; height: 26px; border-radius: 8px; font-size: 10.5px; }
.who { display: inline-flex; align-items: center; gap: 9px; }

/* ================================================================ SHELL === */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; min-width: 0; padding: 4px 14px calc(var(--bottomnav-h) + var(--safe-bottom) + 20px); animation: fade .25s ease both; }
@media (min-width: 640px) { .content { padding-left: 20px; padding-right: 20px; } }
@media (min-width: 960px) { .content { padding: 4px 24px 28px; } }

/* --- Sidebar: gaveta no celular, fixa a partir de 960px --- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 90;
  width: min(86vw, var(--sidebar-w));
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .22s ease;
  padding-top: env(safe-area-inset-top, 0px);
}
html.is-drawer-open .sidebar { transform: none; box-shadow: var(--shadow-modal); }
.drawer-backdrop { position: fixed; inset: 0; z-index: 85; background: rgba(10, 10, 20, .5); animation: fade .2s; }
html.is-drawer-open { overflow: hidden; }

@media (min-width: 960px) {
  .sidebar { position: sticky; top: 0; height: 100vh; transform: none; flex: none; width: var(--sidebar-w); transition: width .18s ease; }
  .drawer-backdrop { display: none !important; }
  html.is-drawer-open { overflow: auto; }
}

.sidebar__brand { display: flex; align-items: center; gap: 11px; padding: 16px 14px 8px; }
.sidebar__brand-text { min-width: 0; flex: 1; }
.sidebar__brand-text strong { display: block; font-size: 16px; font-weight: 700; letter-spacing: -.3px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__brand-text small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
@media (min-width: 960px) { .sidebar__close { display: none; } }

.sidebar__collapse {
  display: none; align-items: center; gap: 11px;
  margin: 0 12px 4px; padding: 8px 11px;
  border: 0; background: transparent; border-radius: 10px; color: var(--ink-3);
  font-size: 12.5px; font-weight: 500;
}
.sidebar__collapse:hover { background: var(--surface-3); color: var(--ink); }
.sidebar__collapse .i { transition: transform .18s; }
@media (min-width: 960px) { .sidebar__collapse { display: flex; } }

.sidebar__nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px 16px; overscroll-behavior: contain; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  min-height: 40px; padding: 8px 11px; margin-bottom: 2px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
}
.nav-item .i { color: var(--ink-3); }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.is-active { background: var(--purple-tint); color: var(--ink); font-weight: 600; }
.nav-item.is-active .i { color: var(--purple); }
@media (min-width: 960px) { .nav-item { min-height: 36px; font-size: 13px; } }

.crm-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 11px 6px; }
.crm-head span { font-size: 10.5px; font-weight: 600; color: var(--muted-2); letter-spacing: .6px; text-transform: uppercase; }
.crm-add { width: 26px; height: 26px; border-radius: 7px; background: none; border: 0; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.crm-add:hover { background: var(--purple-tint); color: var(--purple); }

.tree__empty { font-size: 12px; color: var(--muted); padding: 4px 11px 8px; line-height: 1.5; }
.folder__row {
  display: flex; align-items: center; gap: 7px;
  min-height: 38px; padding: 6px 8px 6px 9px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; user-select: none;
}
.folder__row:hover { background: var(--surface-3); }
.folder__caret { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; }
.folder.is-closed .folder__caret { transform: rotate(-90deg); }
.folder.is-closed .folder__lists { display: none; }
.folder__icon { width: 15px; height: 15px; color: var(--ink-3); }
.folder__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder__count, .list-row__count { font-size: 11.5px; font-weight: 500; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.folder__lock { width: 13px; height: 13px; color: var(--amber); }

.list-row { display: flex; align-items: center; border-radius: 9px; margin-bottom: 1px; }
.list-row__link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 5px 8px 5px 28px; color: var(--ink-2); font-size: 13px; }
.list-row:hover { background: var(--surface-3); }
.list-row:hover .list-row__link { color: var(--ink); }
.list-row.is-active { background: var(--purple-tint); }
.list-row.is-active .list-row__link { color: var(--ink); font-weight: 600; }
.list-row.is-active .list-row__icon { color: var(--purple); }
.list-row.is-hidden .list-row__name { opacity: .6; font-style: italic; }
.list-row__icon { width: 13px; height: 13px; color: var(--muted-2); }
.list-row__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row__tag { font-size: 10px; color: var(--muted); border: 1px solid var(--border-2); border-radius: 5px; padding: 0 4px; }
.list-row__partial { color: var(--amber); padding: 0 8px; }
.list-row__partial .i { width: 13px; height: 13px; }

.perm-eye {
  width: 28px; height: 28px; flex: none; margin-right: 4px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 7px; color: var(--muted);
}
.perm-eye .i { width: 14px; height: 14px; }
.perm-eye:hover { background: var(--purple-tint); color: var(--purple); }
.perm-eye.is-restricted { color: var(--amber); }
@media (hover: hover) and (min-width: 960px) {
  .perm-eye:not(.is-restricted) { opacity: 0; }
  .folder__row:hover .perm-eye, .list-row:hover .perm-eye, .perm-eye:focus-visible { opacity: 1; }
  .folder__row:hover .perm-eye:not(.is-restricted) ~ .folder__count { display: none; }
}

.sidebar__user { border-top: 1px solid var(--border); padding: 10px 12px calc(10px + var(--safe-bottom)); display: flex; align-items: center; gap: 6px; }
.sidebar__user-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; color: var(--ink); }
.sidebar__user-btn:hover { background: var(--surface-3); color: var(--ink); }
.sidebar__user-info { min-width: 0; display: flex; flex-direction: column; }
.sidebar__user-info strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar__user-info small { font-size: 11px; color: var(--muted); }
.sidebar__logout { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--muted); border-radius: 9px; }
.sidebar__logout:hover { background: var(--red-bg); color: var(--red-ink); }

/* recolhida (só desktop) */
@media (min-width: 960px) {
  html.is-sidebar-collapsed .sidebar { width: 76px; }
  html.is-sidebar-collapsed .sidebar__brand { justify-content: center; padding-left: 0; padding-right: 0; }
  html.is-sidebar-collapsed .sidebar__brand-text,
  html.is-sidebar-collapsed .sidebar__collapse span,
  html.is-sidebar-collapsed .nav-item__label,
  html.is-sidebar-collapsed .crm-head,
  html.is-sidebar-collapsed .tree,
  html.is-sidebar-collapsed .sidebar__user-info { display: none; }
  html.is-sidebar-collapsed .sidebar__collapse { justify-content: center; margin: 0 10px 4px; }
  html.is-sidebar-collapsed .sidebar__collapse .i { transform: rotate(180deg); }
  html.is-sidebar-collapsed .sidebar__nav { padding: 4px 10px; }
  html.is-sidebar-collapsed .nav-item { justify-content: center; padding: 8px 0; }
  html.is-sidebar-collapsed .sidebar__user { flex-direction: column; padding: 10px 8px; }
}

/* --- Topbar --- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  min-height: var(--topbar-h); padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
@media (min-width: 640px) { .topbar { padding-left: 20px; padding-right: 20px; } }
@media (min-width: 960px) { .topbar { position: static; min-height: 72px; padding: 12px 24px; background: transparent; backdrop-filter: none; } }
.topbar__menu { flex: none; }
@media (min-width: 960px) { .topbar__menu { display: none; } }
.topbar__title { min-width: 0; flex: 1; }
.topbar__title h1 { font-size: 17px; font-weight: 700; letter-spacing: -.3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__title p { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 960px) { .topbar__title h1 { font-size: 19px; } .topbar__title p { font-size: 12.5px; } }

.topbar__search { display: none; position: relative; width: 300px; max-width: 32vw; }
.topbar__search > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.topbar__search .input { padding-left: 36px; padding-right: 34px; background: var(--surface); border-color: var(--border); }
.topbar__kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font: 600 11px var(--mono); color: var(--muted); border: 1px solid var(--border-2); border-radius: 5px; padding: 1px 5px; pointer-events: none; }
@media (min-width: 960px) { .topbar__search { display: block; } .topbar__search-btn { display: none; } }
.topbar__actions { display: flex; align-items: center; gap: 8px; }
.topbar__search-btn { display: none; }
@media (min-width: 640px) and (max-width: 959.98px) { .topbar__search-btn { display: inline-flex; } }

/* busca aberta no celular: vira uma barra que cobre o topo */
html.is-search-open .topbar__search {
  display: block; position: fixed; z-index: 120; left: 10px; right: 10px; top: calc(10px + env(safe-area-inset-top, 0px));
  width: auto; max-width: none;
}
html.is-search-open .topbar__search .input { min-height: 46px; box-shadow: var(--shadow-pop); }
html.is-search-open .topbar__kbd { display: none; }

.theme-ico--sun { display: none; }
html.tema-escuro .theme-ico--sun { display: block; }
html.tema-escuro .theme-ico--moon { display: none; }

/* --- Bottom nav (celular) --- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottomnav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(20, 18, 40, .08);
}
.bottomnav__item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: 0; color: var(--ink-3); font-size: 10.5px; font-weight: 500;
}
.bottomnav__item .i { width: 20px; height: 20px; }
.bottomnav__item.is-active { color: var(--purple); }
.bottomnav__item.is-active::before { content: ''; position: absolute; top: 7px; width: 42px; height: 28px; border-radius: 14px; background: var(--purple-tint); z-index: -1; }
.bottomnav__dot { position: absolute; top: 9px; left: calc(50% + 6px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--surface); }
@media (min-width: 960px) { .bottomnav { display: none; } }

/* --------------------------------------------------------------- Popover -- */
.popover {
  position: absolute; z-index: 100; top: calc(100% + 8px); left: 0;
  min-width: 220px; max-width: min(92vw, 380px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-pop); animation: pop .16s ease both;
}
.popover--right { left: auto; right: 0; }
.search-pop { left: 0; right: 0; max-width: none; max-height: min(70vh, 460px); overflow-y: auto; padding: 6px; }
.search-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--ink); }
.search-item:hover, .search-item.is-focus { background: var(--surface-3); color: var(--ink); }
.search-item__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.search-item__body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.search-item__body strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item__body small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.notif-pop { width: min(92vw, 360px); }
@media (max-width: 959.98px) {
  .notif-pop { position: fixed; top: auto; bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 8px); left: 8px; right: 8px; width: auto; max-width: none; }
}
.notif-pop__head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 8px; border-bottom: 1px solid var(--border); }
.notif-pop__list { max-height: min(60vh, 420px); overflow-y: auto; padding: 6px; }
.notif { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; border-radius: 9px; font-size: 13px; color: var(--ink-2); }
.notif a, .notif span { color: inherit; }
.notif:hover { background: var(--surface-3); }
.notif.is-unread { color: var(--ink); background: var(--purple-tint-2); }
.notif time { font-size: 11px; color: var(--muted); }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.empty-mini { padding: 14px 10px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ----------------------------------------------------------------- Menu -- */
.menu {
  position: fixed; z-index: 200; min-width: 190px; max-width: 92vw;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 5px; box-shadow: var(--shadow-pop); animation: pop .14s ease both;
}
.menu__item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  min-height: 38px; padding: 8px 11px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font-size: 13px; text-align: left;
}
.menu__item .i { color: var(--ink-3); width: 15px; height: 15px; }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-3); outline: none; }
.menu__item--danger, .menu__item--danger .i { color: var(--red-ink); }
.menu__item--danger:hover { background: var(--red-bg); }
.menu__sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu__label { padding: 6px 11px 4px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 639.98px) {
  .menu.menu--sheet {
    left: 0 !important; right: 0; top: auto !important; bottom: 0;
    border-radius: 18px 18px 0 0; padding: 8px 8px calc(8px + var(--safe-bottom));
    animation: slide-up .2s ease both;
  }
  .menu.menu--sheet .menu__item { min-height: 46px; font-size: 14.5px; }
}

/* ---------------------------------------------------------------- Modal -- */
.modal { position: fixed; inset: 0; z-index: 150; display: flex; align-items: flex-end; justify-content: center; background: rgba(10, 10, 20, .55); animation: fade .18s; }
.modal__panel {
  position: relative; width: 100%; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-modal) var(--r-modal) 0 0;
  box-shadow: var(--shadow-modal); animation: slide-up .22s ease both;
  padding-bottom: var(--safe-bottom);
}
@media (min-width: 640px) {
  .modal { align-items: center; padding: 20px; }
  .modal__panel { width: min(100%, var(--w, 520px)); border-radius: var(--r-modal); animation: pop .2s ease both; max-height: 88vh; padding-bottom: 0; }
}
.modal__head { display: flex; align-items: flex-start; gap: 10px; padding: 18px 18px 10px; }
.modal__head h2 { font-size: 16.5px; font-weight: 700; letter-spacing: -.2px; }
.modal__head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal__head > div { flex: 1; min-width: 0; }
.modal__body { padding: 6px 18px 16px; overflow-y: auto; overscroll-behavior: contain; }
.modal__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
.modal__foot .btn { flex: 1 1 auto; }
@media (min-width: 640px) { .modal__foot .btn { flex: 0 0 auto; } }
.modal__grab { width: 40px; height: 4px; border-radius: 2px; background: var(--border-3); margin: 8px auto 0; }
@media (min-width: 640px) { .modal__grab { display: none; } }

/* --------------------------------------------------------------- Toasts -- */
.toasts { position: fixed; z-index: 300; left: 10px; right: 10px; bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 10px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
@media (min-width: 960px) { .toasts { left: auto; right: 20px; bottom: 20px; width: 360px; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 11px 12px 11px 14px; border-radius: 12px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-pop);
  font-size: 13px; animation: pop .2s ease both;
}
.toast--erro { background: var(--red-ink); color: #fff; }
html.tema-escuro .toast--erro { background: #B91C1C; }
.toast__msg { flex: 1; }
.toast__btn { background: none; border: 0; color: inherit; font-weight: 700; padding: 4px 6px; text-decoration: underline; }

/* ----------------------------------------------------- Painéis e tabelas -- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-panel); padding: 14px; margin-bottom: 14px; min-width: 0; }
@media (min-width: 640px) { .panel { padding: 18px 20px; } }
.panel__head { display: flex; flex-direction: column; gap: 3px; margin-bottom: 14px; }
.panel__head h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.panel__head h3 .i { color: var(--purple); }
.panel__head small { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.panel__head--row { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel--danger { border-color: color-mix(in srgb, var(--red) 30%, var(--border)); }
.subhead { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 18px 0 8px; }
.page-narrow { max-width: 720px; }
.lead-text { color: var(--ink-3); font-size: 13px; margin-bottom: 14px; max-width: 760px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }
.back-link:hover { color: var(--purple); }

.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
@media (min-width: 640px) { .table-wrap { margin: 0; padding: 0; } }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.table tr.is-off td { opacity: .6; }
.table__empty { text-align: center; color: var(--muted); padding: 24px !important; }

/* tabela vira lista de cartões no celular */
@media (max-width: 639.98px) {
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; }
  .table--cards td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table--cards td::before { content: attr(data-label); font-size: 12px; color: var(--muted); text-align: left; }
  .table--cards td.actions { justify-content: flex-end; padding-top: 8px; }
  .table--cards td.actions::before { content: none; }
}

.kv { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.kv li { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv li:last-child { border-bottom: 0; }
.kv span { color: var(--muted); flex: none; }
.kv strong { font-weight: 500; text-align: right; word-break: break-word; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 0 -14px 16px; padding: 0 14px 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .tabs { margin: 0 0 16px; padding: 0; flex-wrap: wrap; } }
.tab { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 500; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); }
.tab:hover { color: var(--ink); }
.tab.is-active { background: var(--purple); color: #fff; border-color: var(--purple); }
.tab.is-active .i { color: #fff; }

.admin-grid { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; }
.admin-grid > .panel { margin-bottom: 0; }
@media (min-width: 1280px) { .admin-grid { grid-template-columns: 1fr 1fr; } }
.danger-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.danger-row:first-of-type { border-top: 0; }
.danger-row > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.danger-row small { color: var(--muted); font-size: 12px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.details { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.details summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--purple); padding: 4px 0 10px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2); }
.status-line.is-on { color: var(--green-ink); }
.status-line.is-on .status-dot { background: var(--green); box-shadow: 0 0 0 4px var(--green-bg); }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; font-size: 12.5px; }
.audit-meta { max-width: 420px; word-break: break-word; }

.role-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.role-card { border: 1px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.role-card header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.role-card header strong { font-size: 14.5px; margin-right: auto; }
.role-card footer { margin-top: auto; }
.caps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted-2); }
.caps li { display: flex; align-items: center; gap: 6px; }
.caps li .i { width: 13px; height: 13px; }
.caps li.is-on { color: var(--ink-2); }
.caps li.is-on .i { color: var(--green); }

.ipbox { background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; text-align: left; }
.ipbox small { font-size: 11px; color: var(--muted); }
.ipbox__row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.ipbox__value { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 960px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat__label { font-size: 12px; color: var(--muted); }
.stat__value { font-size: 24px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat--red .stat__value { color: var(--red-ink); }
.stat--amber .stat__value { color: var(--amber-ink); }
.stat--purple .stat__value { color: var(--purple); }

/* ---------------------------------------------------------------- Início -- */
.hello { margin: 4px 0 14px; }
.hello h2 { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.hello p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.home-grid { display: grid; gap: 14px; grid-template-columns: 1fr; align-items: start; }
.home-grid > .panel { margin: 0; }
@media (min-width: 960px) { .home-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1280px) { .home-grid { grid-template-columns: 1fr 1fr 1fr; } }
.mini-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mini-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--ink); }
.mini-card:hover { border-color: var(--purple-border); color: var(--ink); box-shadow: var(--shadow-hover); }
.mini-card__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.mini-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mini-card__body strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-card__body small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.date-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: var(--r-badge); background: var(--purple-tint); color: var(--purple); font-size: 11px; font-weight: 700; flex: none; font-variant-numeric: tabular-nums; }
.date-chip .i { width: 11px; height: 11px; }
.date-chip--today { background: var(--amber-bg); color: var(--amber-ink); }
.date-chip--late { background: var(--red-bg); color: var(--red-ink); }

.empty { max-width: 460px; margin: 8vh auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty__icon { width: 60px; height: 60px; border-radius: 18px; background: var(--purple-tint); color: var(--purple); display: flex; align-items: center; justify-content: center; }
.empty__icon .i { width: 28px; height: 28px; }
.empty h2 { font-size: 18px; }
.empty p { color: var(--ink-3); font-size: 13.5px; line-height: 1.55; }

/* ------------------------------------------------------ Login / blank -- */
.auth-body { background: var(--surface); }
.auth { display: flex; min-height: 100vh; min-height: 100dvh; }
.auth__form-col { flex: 1; display: flex; align-items: center; justify-content: center; padding: 28px 18px; background: var(--surface); }
.auth__wrap { width: 100%; max-width: 420px; animation: pop .35s ease both; }
.auth__logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.auth__logo h1 { font-size: 19px; font-weight: 700; letter-spacing: -.3px; }
.auth__logo p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.auth__title { font-size: 22px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 6px; }
.auth__sub { font-size: 13.5px; color: var(--ink-3); margin-bottom: 22px; line-height: 1.5; }
.auth__art { display: none; }
@media (min-width: 960px) {
  .auth__form-col { flex: 0 0 46%; max-width: 580px; padding: 40px; }
  .auth__art {
    flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--purple) 0%, var(--purple-soft) 100%);
  }
  .auth__art::before, .auth__art::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .09); }
  .auth__art::before { width: 420px; height: 420px; top: -120px; right: -110px; }
  .auth__art::after { width: 300px; height: 300px; bottom: -90px; left: -70px; }
}
.auth__art-inner { position: relative; z-index: 1; max-width: 400px; color: #fff; text-align: center; }
.auth__art-inner h2 { font-size: 26px; font-weight: 700; line-height: 1.3; letter-spacing: -.4px; margin-bottom: 12px; }
.auth__art-inner p { font-size: 14px; line-height: 1.65; color: rgba(255, 255, 255, .9); }
.auth__art-badge { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 22px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .25); padding: 7px 14px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.reqs { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 4px; grid-template-columns: 1fr; font-size: 12.5px; }
@media (min-width: 640px) { .reqs { grid-template-columns: 1fr 1fr; } }
.reqs__item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.reqs__item .i { width: 14px; height: 14px; }
.reqs__item.is-ok .i { color: var(--green); }
.reqs__item.is-bad { color: var(--red-ink); font-weight: 600; }
.reqs__item small { width: 100%; padding-left: 20px; font-weight: 400; color: var(--muted); }

.blank { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; background: var(--bg); }
.blank__card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 28px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; animation: pop .3s ease both; }
.blank__icon { width: 56px; height: 56px; border-radius: 17px; background: var(--purple-tint); color: var(--purple); display: flex; align-items: center; justify-content: center; }
.blank__icon .i { width: 26px; height: 26px; }
.blank__icon--warn { background: var(--amber-bg); color: var(--amber-ink); }
.blank__icon--danger { background: var(--red-bg); color: var(--red-ink); }
.blank__title { font-size: 20px; font-weight: 700; }
.blank__text { color: var(--ink-3); font-size: 13.5px; line-height: 1.55; }
.blank__card .ipbox { width: 100%; }

/* ------------------------------------------------------------- Skeleton -- */
.sk { background: linear-gradient(90deg, var(--surface-3) 0, var(--surface-2) 40%, var(--surface-3) 80%); background-size: 800px 100%; animation: shimmer 1.2s infinite linear; }

/* ==================================================== Workspaces ======= */
.ws-switch { position: relative; flex: 1; min-width: 0; }
.ws-switch__btn {
  display: flex; align-items: center; gap: 10px; width: 100%; min-width: 0;
  padding: 6px 8px 6px 6px; margin: -6px 0 -6px -6px; border: 0; border-radius: 12px; background: none; color: var(--ink); text-align: left;
}
.ws-switch__btn:hover, .ws-switch__btn[aria-expanded="true"] { background: var(--surface-3); }
.ws-switch__caret { width: 14px; height: 14px; color: var(--muted); flex: none; }
.ws-switch__pop { top: calc(100% + 10px); left: -6px; width: min(86vw, 290px); padding: 6px; }
.ws-switch__pop form { margin: 0; }
.ws-switch__pop .menu__item { min-height: 42px; }
.ws-switch__pop .menu__item.is-current { background: var(--purple-tint); }
.ws-switch__pop .menu__item > .i:last-child { margin-left: auto; color: var(--purple); }
.ws-switch__name { display: flex; flex-direction: column; min-width: 0; }
.ws-switch__name strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-switch__name small { font-size: 11px; color: var(--muted); }
@media (min-width: 960px) {
  html.is-sidebar-collapsed .ws-switch__caret { display: none; }
  html.is-sidebar-collapsed .ws-switch__btn { justify-content: center; margin: 0; padding: 4px; }
}
.ws-dot {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--purple), var(--purple-soft)); color: #fff; font-size: 13px; font-weight: 700;
}
.ws-dot--lg { width: 52px; height: 52px; border-radius: 15px; font-size: 22px; }
.ws-list { margin-top: 22px; display: flex; flex-direction: column; gap: 6px; }
.ws-list form { margin: 0; }
.ws-list__item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); text-align: left; }
.ws-list__item:hover { border-color: var(--purple-border); background: var(--purple-tint-2); }
.ws-list__item > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ws-list__item small { color: var(--muted); font-size: 12px; }
.ws-list__item > .i { color: var(--muted); }

.lock { display: flex; flex-direction: column; align-items: flex-start; }
.lock__icon { width: 52px; height: 52px; border-radius: 15px; background: var(--purple-tint); color: var(--purple); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.lock__icon .i { width: 24px; height: 24px; }
.lock__icon--warn { background: var(--amber-bg); color: var(--amber-ink); }
.auth__alt { margin-top: 18px; font-size: 13px; color: var(--ink-3); text-align: center; }
.auth__alt--muted { margin-top: 6px; font-size: 12px; color: var(--muted); }
.auth__alt .link-btn { font-size: 13px; }
.code-input { text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.code-big { font-size: 22px; letter-spacing: .12em; }

.invite-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px; margin-bottom: 18px; border: 1px solid var(--purple-border); background: var(--purple-tint-2); border-radius: 16px; }
.invite-card .auth__title { margin-bottom: 2px; }
.invite-card .auth__sub { margin-bottom: 0; }
.invite-card__kicker { font-size: 12px; color: var(--purple); font-weight: 600; margin-bottom: 2px; }
.invite-link { border-color: var(--purple-border); }
.invite-link__url { font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.invite-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.invite-list__item { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.invite-list__item:last-child { border-bottom: 0; }
.invite-list__item form { margin: 0; }
.invite-list__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.invite-list__main strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.invite-list__main small { font-size: 11.5px; color: var(--muted); }

.who__text { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.who__text small { font-size: 11.5px; color: var(--muted); }
.inline-form { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0; }
.inline-form .input { width: auto; }
.table .actions form { margin: 0 0 0 4px; }
.row-menu { position: relative; display: inline-block; }
.row-menu summary { list-style: none; cursor: pointer; }
.row-menu summary::-webkit-details-marker { display: none; }
.row-menu__pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 240px; padding: 10px; display: flex; flex-direction: column; gap: 8px; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-pop); }
.row-menu__pop form { margin: 0 !important; }
