/* =========================================================================
   Eliot One — painel administrativo
   Direção: utilitário refinado · papel quente + tinta + um acento afiado
   ========================================================================= */

:root {
  --accent: #d9480f;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, #fff);
  --accent-line: color-mix(in srgb, var(--accent) 35%, #fff);
  --accent-strong: color-mix(in srgb, var(--accent) 82%, #000);

  --paper: #f5f3ee;
  --paper-2: #edeae3;
  --surface: #ffffff;
  --ink: #15171c;
  --ink-2: #363940;
  --muted: #6c685f;
  --faint: #9a958b;
  --line: rgba(21, 23, 28, 0.09);
  --line-strong: rgba(21, 23, 28, 0.16);

  --ok: #1f7a4d;
  --ok-soft: #e4f3ea;
  --warn: #9a6200;
  --warn-soft: #fbf0d9;
  --danger: #c0352b;
  --danger-soft: #fbe7e4;
  --info: #2b5c9e;
  --info-soft: #e5edf8;

  --font-display: "Bricolage Grotesque", "Geist", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.0625rem;
  --step-2: 1.375rem;
  --step-3: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);
  --step-4: clamp(2rem, 1.4rem + 2.4vw, 2.9rem);

  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
  --s5: 1.5rem;  --s6: 2rem;   --s7: 3rem;    --s8: 4rem;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 0 rgba(21, 23, 28, 0.04), 0 1px 2px rgba(21, 23, 28, 0.05);
  --shadow-2: 0 1px 2px rgba(21, 23, 28, 0.06), 0 10px 30px -8px rgba(21, 23, 28, 0.14);
  --shadow-3: 0 2px 6px rgba(21, 23, 28, 0.08), 0 24px 60px -12px rgba(21, 23, 28, 0.28);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --topbar-h: 64px;
  color-scheme: light;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}
img { max-width: 100%; display: block; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -0.025em; line-height: 1.15; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); font-size: 0.875em; }
code { background: var(--paper-2); padding: 0.1em 0.4em; border-radius: 5px; }
small { font-size: var(--step--1); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-line); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.block { display: block; }
.center { text-align: center; }
.t-right { text-align: right; }
.text-danger { color: var(--danger) !important; }
.mt-2 { margin-top: var(--s4); } .mt-3 { margin-top: var(--s5); } .mt-4 { margin-top: var(--s6); }
.mb-3 { margin-bottom: var(--s5); }
.row { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--s2); } .gap-2 { gap: var(--s3); } .gap-3 { gap: var(--s5); }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.stack-lg { display: flex; flex-direction: column; gap: var(--s5); }
.eyebrow {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: var(--s2);
}
.icon { flex-shrink: 0; }

/* ------------------------------------------------------------------ loadbar */
.loadbar {
  position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 100;
  background: var(--accent); transform-origin: left; transform: scaleX(0); opacity: 0;
}
.loadbar.active { opacity: 1; animation: load 2.4s var(--ease) forwards; }
.loadbar.done { animation: none; transform: scaleX(1); opacity: 0; transition: transform 0.2s, opacity 0.3s 0.15s; }
@keyframes load { 0% { transform: scaleX(0); } 30% { transform: scaleX(0.55); } 100% { transform: scaleX(0.9); } }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background:
    radial-gradient(1200px 120px at 10% -40%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--ink);
  color: #e9e6df;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s5); padding: 0 var(--s5);
}
.brand { display: flex; align-items: center; gap: var(--s3); color: #fff; text-decoration: none !important; min-width: 0; }
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.brand-mark { display: inline-flex; align-items: center; }
.brand-logo { max-height: 30px; max-width: 140px; object-fit: contain; }
.brand-glyph {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.brand-mark-lg .brand-glyph { width: 52px; height: 52px; border-radius: 14px; font-size: 1.6rem; }
.brand-mark-lg .brand-logo { max-height: 56px; max-width: 220px; }

.mainnav { display: flex; align-items: center; gap: var(--s1); flex: 1; }
.navlink {
  display: inline-flex; align-items: center; gap: var(--s2);
  height: 38px; padding: 0 var(--s3); border-radius: 9px;
  color: #bdb8ae; font: 500 0.9rem/1 var(--font-body); background: none; border: 0; cursor: pointer;
  position: relative; text-decoration: none !important; transition: color 0.15s, background 0.15s;
}
.navlink:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.navlink.is-active { color: #fff; }
.navlink.is-active::after {
  content: ""; position: absolute; left: var(--s3); right: var(--s3); bottom: -13px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.navlink .icon:last-child:not(:first-child) { opacity: 0.6; transition: transform 0.2s var(--ease); }
.dropdown.open > .navlink .icon:last-child { transform: rotate(180deg); }

.nav-toggle { display: none; background: none; border: 0; color: #fff; padding: var(--s2); cursor: pointer; border-radius: 8px; }

.userbtn {
  display: flex; align-items: center; gap: var(--s2); background: none; border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e9e6df; padding: 4px var(--s3) 4px 4px; border-radius: 999px; cursor: pointer; font: 500 0.875rem var(--font-body);
  transition: background 0.15s, border-color 0.15s;
}
.userbtn:hover, .usermenu.open .userbtn { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.18); }
.userbtn .icon { opacity: 0.6; }
.username { max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000));
  color: #fff; font: 600 0.75rem var(--font-body); letter-spacing: 0.02em;
}
.avatar-sm { width: 34px; height: 34px; font-size: 0.75rem; background: var(--paper-2); color: var(--ink-2); }
.avatar-xl { width: 64px; height: 64px; font-size: 1.25rem; box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--line); }

/* ------------------------------------------------------------------ dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 60; min-width: 240px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-3); padding: var(--s2);
  opacity: 0; visibility: hidden; transform: translateY(-4px) scale(0.98); transform-origin: top left;
  transition: opacity 0.16s var(--ease), transform 0.16s var(--ease), visibility 0.16s;
}
.dropdown-menu.align-right { left: auto; right: 0; transform-origin: top right; }
.dropdown.open > .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.mainnav .dropdown-menu { min-width: 300px; }
.dropdown-head { padding: var(--s3); border-bottom: 1px solid var(--line); margin: calc(var(--s2) * -1) calc(var(--s2) * -1) var(--s2); display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }
.dropdown-head strong { font-size: 0.875rem; font-weight: 500; word-break: break-all; }

.menu-item {
  display: flex; align-items: center; gap: var(--s3); width: 100%; padding: var(--s3); border-radius: 8px;
  background: none; border: 0; color: var(--ink); font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer;
  text-decoration: none !important; transition: background 0.12s;
}
.menu-item:hover, .menu-item.is-active { background: var(--paper); }
.menu-item.compact { padding: 9px var(--s3); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-item strong { display: block; font-weight: 600; font-size: 0.9rem; }
.menu-item small { display: block; color: var(--muted); font-size: 0.8rem; }
.menu-icon { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex-shrink: 0; }
.menu-item .icon { color: var(--muted); }
.menu-item.danger .icon { color: inherit; }

/* ------------------------------------------------------------------ página */
.page { max-width: 1320px; margin: 0 auto; padding: var(--s6) var(--s5) var(--s8); outline: none; animation: page-in 0.32s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.page-title { font-size: var(--step-3); }
.page-title.display { font-size: var(--step-4); font-weight: 600; letter-spacing: -0.035em; }
.page-head .muted { margin-top: var(--s1); }
.page-actions { display: flex; gap: var(--s2); }
.profile-hero { display: flex; align-items: center; gap: var(--s5); }

.grid { display: grid; gap: var(--s5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid.gap-2 { gap: var(--s4); }
.span-2 { grid-column: span 2; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-1); padding: var(--s5);
}
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.card-head .muted { margin-top: var(--s1); max-width: 62ch; font-size: 0.9rem; }
.card-title { font-size: var(--step-1); display: flex; align-items: center; gap: var(--s2); font-weight: 600; }
.card-title .icon { color: var(--accent); }

.callout {
  display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5);
  background: linear-gradient(100deg, var(--accent-soft), var(--surface) 70%);
  border: 1px solid var(--accent-line); border-radius: var(--radius);
}
.callout > div { flex: 1; }
.callout strong { font-weight: 600; }
.callout-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--accent); color: #fff; flex-shrink: 0; }

/* ------------------------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: var(--s4); }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5);
  box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: var(--s2); min-width: 0;
}
.stat-feature {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(140deg, var(--accent-line), var(--line) 50%) border-box;
  border: 1px solid transparent;
}
.stat-label { display: flex; align-items: center; gap: var(--s2); font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.stat-value { font-family: var(--font-display); font-size: 2.5rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 1.25rem; color: var(--muted); margin-left: 2px; }
.stat-foot { font-size: 0.85rem; margin-top: auto; display: inline-flex; align-items: center; gap: var(--s1); }
.stat-bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--paper-2); gap: 2px; margin-top: var(--s2); }
.seg { display: block; height: 100%; transition: width 0.6s var(--ease); }
.seg-active, .dot-active { background: var(--ok); }
.seg-pending, .dot-pending { background: #e0a526; }
.seg-blocked, .dot-blocked { background: var(--danger); }
.stat-legend { list-style: none; margin: var(--s1) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); font-size: 0.8125rem; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.meter { height: 8px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin-top: auto; }
.meter span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width 0.6s var(--ease); }

.reveal { animation: reveal 0.5s var(--ease) both; }
.stats .reveal:nth-child(2) { animation-delay: 0.05s; }
.stats .reveal:nth-child(3) { animation-delay: 0.1s; }
.stats .reveal:nth-child(4) { animation-delay: 0.15s; }
.grid .reveal:nth-child(2) { animation-delay: 0.12s; }
@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ listas */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 1px; background: var(--line-strong); }
.timeline li { position: relative; padding: 0 0 var(--s4) var(--s5); display: flex; flex-direction: column; }
.timeline li:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: 0; top: 6px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li.is-danger .timeline-dot { border-color: var(--danger); background: var(--danger-soft); }
.timeline-text { font-size: 0.9rem; }
.timeline-text strong { font-weight: 600; }
.timeline-meta { font-size: 0.8rem; color: var(--faint); font-family: var(--font-mono); }

.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; padding-top: 0; }
.people-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.people-text strong { font-weight: 600; font-size: 0.9rem; }
.people-text small, .people-meta { color: var(--muted); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.kv { margin: 0 0 var(--s4); }
.kv div { display: flex; justify-content: space-between; padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: var(--s8) var(--s5); }
.empty-icon { width: 60px; height: 60px; border-radius: 16px; display: inline-grid; place-items: center; background: var(--paper); color: var(--faint); margin-bottom: var(--s4); }
.empty-title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; margin-bottom: var(--s1); }
.empty-inline { color: var(--muted); font-size: 0.9rem; padding: var(--s4) 0; }

/* ------------------------------------------------------------------ tabela */
.toolbar { display: flex; gap: var(--s3); margin-bottom: var(--s4); flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 200px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; display: flex; align-items: center; }
.search .icon { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search input { padding-left: 38px !important; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th {
  text-align: left; font-weight: 500; font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); padding: var(--s3) var(--s4); background: #faf9f6; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: #fbfaf7; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-muted td { opacity: 0.55; }
.card:not(.card-flush) .table th:first-child, .card:not(.card-flush) .table td:first-child { padding-left: 0; }
.card:not(.card-flush) .table th { background: none; }
.cell-user { display: flex; align-items: center; gap: var(--s3); }
.cell-user > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.cell-user strong { font-weight: 600; }
.cell-user small { color: var(--muted); }
.key-prefix { font-size: 0.8rem; }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-active { color: var(--ok); }
.status-pending { color: var(--warn); }
.status-blocked, .status-revoked { color: var(--danger); }
.status-expired { color: var(--faint); }

.badge { display: inline-flex; align-items: center; font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; letter-spacing: 0.01em; vertical-align: middle; }
.badge-soft { background: var(--accent-soft); color: var(--accent-strong); }
.badge-success { background: var(--ok-soft); color: var(--ok); }
.badge-muted { background: var(--paper-2); color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; font-weight: 500; padding: 2px 8px; border-radius: 6px; background: var(--paper); border: 1px solid var(--line); margin: 1px 2px 1px 0; }
.pill-ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s4); border-top: 1px solid var(--line); font-size: 0.875rem; }

/* ------------------------------------------------------------------ formulários */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.narrow { max-width: 320px; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
label, .label { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea {
  width: 100%; font: inherit; font-size: 0.9375rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color 0.15s, box-shadow 0.15s; min-height: 42px;
}
textarea { resize: vertical; line-height: 1.5; }
select {
  appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236c685f' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
input:hover, select:hover, textarea:hover { border-color: rgba(21, 23, 28, 0.28); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input:disabled, select:disabled { background: var(--paper); color: var(--muted); cursor: not-allowed; }
::placeholder { color: var(--faint); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.has-error input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 16%, transparent); }
.field-error { color: var(--danger); font-size: 0.8125rem; margin: 0; }
.field-error:empty { display: none; }
.help { color: var(--muted); font-size: 0.8125rem; display: flex; align-items: center; gap: 6px; }
.form-alert { background: var(--danger-soft); color: var(--danger); padding: var(--s3) var(--s4); border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500; }
.form-foot { display: flex; justify-content: flex-end; padding-top: var(--s4); border-top: 1px solid var(--line); margin-top: var(--s2); }
.divider { height: 1px; background: var(--line); margin: var(--s2) 0; }

.input-group { display: flex; position: relative; }
.input-group input { padding-right: 84px !important; }
.input-addon {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; color: var(--muted); font: 500 0.8rem var(--font-body); padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.input-addon:hover { background: var(--paper); color: var(--ink); }

.otp-input { font-family: var(--font-mono) !important; font-size: 1.6rem !important; letter-spacing: 0.4em; text-align: center; padding: 14px !important; }
.otp-sm { font-size: 1.1rem !important; letter-spacing: 0.25em; max-width: 220px; padding: 8px !important; }

.color-field { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.color-field input[type=color] { width: 46px; height: 42px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }
.color-field input.mono { max-width: 130px; text-transform: uppercase; }

.segmented { display: inline-flex; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; width: fit-content; }
.segmented label { cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 500; color: var(--muted); transition: all 0.15s; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

.checks { display: flex; flex-direction: column; gap: var(--s2); }
.check { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400; transition: border-color 0.15s, background 0.15s; }
.check:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }

.switch-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding: var(--s4); border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.switch-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.switch-row strong { font-weight: 600; color: var(--ink); }
.switch { position: relative; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch-track { display: block; width: 44px; height: 26px; border-radius: 99px; background: var(--line-strong); transition: background 0.2s; position: relative; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.22s var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.test-row { display: flex; align-items: flex-end; gap: var(--s3); flex-wrap: wrap; }

.strength { height: 4px; border-radius: 99px; background: var(--paper-2); overflow: hidden; margin-top: 2px; }
.strength span { display: block; height: 100%; width: 0; background: var(--danger); transition: width 0.25s var(--ease), background 0.25s; }
.strength[data-score="3"] span { background: #e0a526; }
.strength[data-score="4"] span, .strength[data-score="5"] span { background: var(--ok); }
.rules { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s4); flex-wrap: wrap; font-size: 0.8rem; color: var(--faint); }
.rules li::before { content: "○ "; }
.rules li.ok { color: var(--ok); }
.rules li.ok::before { content: "● "; }

/* ------------------------------------------------------------------ botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  height: 40px; padding: 0 var(--s4); border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 500 0.9rem/1 var(--font-body); cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s; position: relative;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15), 0 1px 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover:not(:disabled) { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-danger-outline { background: var(--surface); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, #fff); }
.btn-danger-outline:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { height: 32px; padding: 0 var(--s3); font-size: 0.8125rem; }
.btn-xs { height: 26px; padding: 0 var(--s2); font-size: 0.75rem; border-radius: 6px; }
.btn-lg { height: 48px; font-size: 0.975rem; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: spin 0.6s linear infinite;
}
.btn-outline.is-loading::after, .btn-ghost.is-loading::after { border-color: var(--line-strong); border-top-color: var(--ink); }
.btn.is-copied { background: var(--ok) !important; color: #fff !important; border-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.link-sm { font-size: 0.85rem; font-weight: 500; }
.link-button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--accent-strong); font-family: inherit; display: inline-flex; align-items: center; gap: 4px; }
.link-button:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ alertas & toasts */
.alert { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--radius-sm); font-size: 0.875rem; margin-bottom: var(--s4); }
.alert .icon { margin-top: 2px; }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert code { background: rgba(255, 255, 255, 0.6); }

.toasts { position: fixed; right: var(--s5); bottom: var(--s5); z-index: 200; display: flex; flex-direction: column; gap: var(--s2); max-width: min(420px, calc(100vw - 2rem)); }
.toast {
  display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s3) var(--s3) var(--s4);
  background: var(--ink); color: #f1eee8; border-radius: 12px; box-shadow: var(--shadow-3); font-size: 0.9rem;
  animation: toast-in 0.28s var(--ease);
}
.toast svg { margin-top: 2px; flex-shrink: 0; }
.toast span { flex: 1; line-height: 1.45; }
.toast button { background: none; border: 0; color: inherit; opacity: 0.6; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.toast-success svg { color: #6fd79f; }
.toast-error svg { color: #ff8a7d; }
.toast-warning svg { color: #f3c55b; }
.toast-info svg { color: #8db8f5; }
.toast.leaving { animation: toast-out 0.22s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ------------------------------------------------------------------ modais */
.modal {
  border: 0; padding: 0; border-radius: 16px; width: min(520px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3);
}
.modal-sm { width: min(400px, calc(100vw - 2rem)); }
.modal[open] { animation: modal-in 0.22s var(--ease); }
.modal::backdrop { background: rgba(21, 23, 28, 0.45); backdrop-filter: blur(3px); animation: fade 0.2s; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes fade { from { opacity: 0; } }
.modal-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: var(--step-2); display: flex; align-items: center; gap: var(--s2); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--s2); padding-top: var(--s4); border-top: 1px solid var(--line); }

.key-reveal { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); background: var(--ink); border-radius: var(--radius-sm); }
.key-reveal code { flex: 1; background: none; color: #f6d9c8; word-break: break-all; font-size: 0.85rem; }

/* ------------------------------------------------------------------ configurações */
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: var(--s6); align-items: start; }
.tabs { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + var(--s5)); }
.tab {
  display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s3); border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500; font-size: 0.9rem; text-decoration: none !important; transition: background 0.12s, color 0.12s;
  border-left: 2px solid transparent;
}
.tab:hover { background: var(--paper-2); color: var(--ink); }
.tab .icon { color: var(--faint); }
.tab.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); border-left-color: var(--accent); border-radius: 4px var(--radius-sm) var(--radius-sm) 4px; }
.tab.is-active .icon { color: var(--accent); }

.brand-slot { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }
.brand-slot form { width: 100%; }
.dropzone {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 9; cursor: pointer; overflow: hidden;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background:
    repeating-conic-gradient(var(--paper) 0% 25%, var(--surface) 0% 50%) 50% / 18px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dropzone-favicon { aspect-ratio: 16 / 9; }
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dropzone.has-file { border-style: solid; }
.dropzone-preview { max-width: 70%; max-height: 62%; object-fit: contain; }
.dropzone-favicon .dropzone-preview { width: 72px; height: 72px; max-width: none; border-radius: 14px; box-shadow: var(--shadow-2); background: #fff; }
.dropzone-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); background: rgba(255, 255, 255, 0.85); padding: var(--s4) var(--s5); border-radius: 12px; }
.dropzone-empty strong { color: var(--ink); font-weight: 600; font-size: 0.9rem; }
.dropzone-overlay { position: absolute; inset: 0; display: grid; place-content: center; grid-auto-flow: column; gap: 6px; align-items: center; background: rgba(21, 23, 28, 0.55); color: #fff; font-weight: 500; opacity: 0; transition: opacity 0.18s; }
.dropzone:hover .dropzone-overlay { opacity: 1; }
.dropzone-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; overflow: hidden; opacity: 0; }
.dropzone-progress span { display: block; height: 100%; width: 40%; background: var(--accent); animation: indet 1s var(--ease) infinite; }
.dropzone.is-uploading .dropzone-progress { opacity: 1; }
.dropzone.is-uploading { pointer-events: none; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ------------------------------------------------------------------ 2FA */
.twofa-setup { display: grid; grid-template-columns: 1fr auto; gap: var(--s5); align-items: start; }
.twofa-setup .twofa-confirm { grid-column: 1 / -1; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: var(--s4); }
.steps li { counter-increment: s; position: relative; padding-left: 38px; display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; font-size: 0.8rem;
}
.steps strong { font-weight: 600; }
.secret-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.secret { font-size: 0.85rem; letter-spacing: 0.04em; word-break: break-all; }
.qr-box { width: 208px; height: 208px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); display: grid; place-items: center; }
.qr-box img, .qr-box canvas { width: 184px !important; height: 184px !important; }

.backup-codes { display: flex; flex-direction: column; gap: var(--s4); }
.codes-grid { list-style: none; margin: 0; padding: var(--s4); display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2) var(--s4); background: var(--ink); border-radius: var(--radius-sm); }
.codes-grid code { background: none; color: #f6d9c8; font-size: 0.95rem; letter-spacing: 0.06em; }

.disclosure { border-top: 1px solid var(--line); padding: var(--s3) 0; }
.disclosure summary { cursor: pointer; font-weight: 500; font-size: 0.9rem; display: flex; align-items: center; gap: var(--s2); list-style: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.hint { font-size: 0.85rem; color: var(--muted); }
.hint summary { cursor: pointer; font-weight: 500; color: var(--ink-2); }
.hint p { margin-top: var(--s2); }

/* ------------------------------------------------------------------ autenticação */
body.auth { background: var(--paper); }
.auth-shell { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-art {
  position: relative; overflow: hidden; background: var(--ink); color: #f1eee8;
  display: flex; flex-direction: column; justify-content: space-between; padding: var(--s7);
}
.auth-art-grid {
  position: absolute; inset: 0; opacity: 0.5;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
}
.auth-art-orb {
  position: absolute; width: 640px; height: 640px; right: -220px; bottom: -260px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent) 35%, transparent 68%);
  filter: blur(8px); opacity: 0.85; animation: orb 14s ease-in-out infinite alternate;
}
@keyframes orb { to { transform: translate(-40px, -30px) scale(1.06); } }
.auth-art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.18; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.auth-art-content { position: relative; z-index: 1; margin-top: auto; margin-bottom: auto; animation: reveal 0.7s var(--ease) both; }
.auth-art-title { font-family: var(--font-display); font-size: clamp(2.4rem, 1.5rem + 3vw, 4rem); font-weight: 600; letter-spacing: -0.045em; line-height: 1; margin-top: var(--s5); }
.auth-art-sub { color: #b9b4a9; font-size: var(--step-1); margin-top: var(--s3); max-width: 36ch; }
.auth-art-foot { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--s2); font-size: 0.8125rem; color: #b9b4a9; }

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--s6) var(--s5); }
.auth-card { width: 100%; max-width: 400px; animation: reveal 0.5s 0.05s var(--ease) both; }
.auth-head { margin-bottom: var(--s5); }
.auth-title { font-size: var(--step-3); margin-bottom: var(--s2); }
.auth-icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); margin-bottom: var(--s4); }
.auth-icon-success { background: var(--ok-soft); color: var(--ok); }
.auth-icon-danger { background: var(--danger-soft); color: var(--danger); }
.auth-foot { margin-top: var(--s7); font-size: 0.8rem; color: var(--faint); }
.auth-brand-mobile { display: none; align-items: center; gap: var(--s3); margin-bottom: var(--s6); }
.auth-brand-mobile .brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.1rem; }
.auth .twofa-setup { grid-template-columns: 1fr; justify-items: start; }
.auth .qr-box { justify-self: center; }

.error-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s4); text-align: center; padding: var(--s5); }
.error-code { font-family: var(--font-display); font-size: clamp(5rem, 3rem + 10vw, 9rem); font-weight: 700; letter-spacing: -0.06em; line-height: 0.9; color: var(--accent); }
.error-title { font-size: var(--step-2); max-width: 30ch; }

/* ------------------------------------------------------------------ responsivo */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2-1 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .settings-layout { grid-template-columns: 1fr; gap: var(--s4); }
  .tabs { position: static; flex-direction: row; overflow-x: auto; gap: var(--s1); padding-bottom: var(--s1); scrollbar-width: none; }
  .tab { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; }
  .tab.is-active { border-left: 0; border-bottom-color: var(--accent); border-radius: var(--radius-sm); }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-brand-mobile { display: flex; }
  .twofa-setup { grid-template-columns: 1fr; }
  .qr-box { justify-self: center; }
}

@media (max-width: 760px) {
  :root { --topbar-h: 58px; }
  .topbar-inner { gap: var(--s3); padding: 0 var(--s4); }
  .nav-toggle { display: inline-flex; order: -1; }
  .brand { flex: 1; }
  .mainnav {
    position: fixed; top: var(--topbar-h); left: 0; right: 0; flex-direction: column; align-items: stretch;
    background: var(--ink); padding: var(--s3) var(--s4) var(--s5); gap: var(--s1); border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: all 0.2s var(--ease);
  }
  body.nav-open .mainnav { transform: none; opacity: 1; visibility: visible; }
  .navlink { height: 44px; }
  .navlink.is-active::after { display: none; }
  .navlink.is-active { background: rgba(255, 255, 255, 0.08); }
  .mainnav .dropdown-menu { position: static; box-shadow: none; border: 0; background: rgba(255, 255, 255, 0.04); margin-top: var(--s1); display: none; opacity: 1; visibility: visible; transform: none; min-width: 0; }
  .mainnav .dropdown.open .dropdown-menu { display: block; }
  .mainnav .menu-item { color: #e9e6df; }
  .mainnav .menu-item:hover, .mainnav .menu-item.is-active { background: rgba(255, 255, 255, 0.07); }
  .mainnav .menu-item small { color: #9b968c; }
  .username { display: none; }
  .userbtn { padding: 3px; }
  .userbtn > .icon { display: none; }
  .page { padding: var(--s5) var(--s4) var(--s7); }
  .page-head { margin-bottom: var(--s5); }
  .stats { grid-template-columns: 1fr; }
  .callout { flex-wrap: wrap; }
  .card { padding: var(--s4); }
  .card-flush { padding: 0; }
  .profile-hero { gap: var(--s4); }
  .toolbar select { min-width: 0; flex: 1; }
  .search { max-width: none; }
  .toasts { left: var(--s4); right: var(--s4); bottom: var(--s4); max-width: none; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  .btn, .menu-item.compact { min-height: 44px; }
  .btn-sm, .btn-xs { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
