@font-face { font-family: 'Bricolage Grotesque'; src: url('bricolage.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('figtree.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }

/* ---------- Tema: escuro (padrão) e claro ---------- */
:root, :root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #080a10;
  --surface: #10131c;
  --surface-2: #171b27;
  --line: rgb(255 255 255 / .08);
  --line-strong: rgb(255 255 255 / .18);
  --ink: #f1f3f9;
  --ink-soft: #98a2b6;
  --ok: #34d399;
  --bad: #fb7185;
  --warn: #fbbf24;
  --off: #6b7385;
  --shadow: 0 18px 40px -20px rgb(0 0 0 / .8);
  --highlight: inset 0 1px 0 rgb(255 255 255 / .05);
  --a-text: var(--a);
  --atmos: .2;
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f2f3f9;
  --surface: #ffffff;
  --surface-2: #f5f6fb;
  --line: rgb(15 23 42 / .10);
  --line-strong: rgb(15 23 42 / .24);
  --ink: #0f1524;
  --ink-soft: #566178;
  --ok: #0b8f62;
  --bad: #d3304f;
  --warn: #b45309;
  --off: #8a93a6;
  --shadow: 0 16px 36px -22px rgb(15 23 42 / .35);
  --highlight: inset 0 1px 0 rgb(255 255 255 / .9);
  --a-text: color-mix(in srgb, var(--a) 52%, #000);
  --atmos: .13;
}

/* ---------- Cores de destaque ---------- */
:root, :root[data-accent='cyan'] { --a: #22d3ee; --b: #60a5fa; --on-a: #04141c; }
:root[data-accent='violet'] { --a: #a78bfa; --b: #818cf8; --on-a: #0e0a1f; }
:root[data-accent='pink'] { --a: #f472b6; --b: #fb7185; --on-a: #1d0612; }
:root[data-accent='blue'] { --a: #60a5fa; --b: #3b82f6; --on-a: #04101f; }
:root[data-accent='amber'] { --a: #fbbf24; --b: #f59e0b; --on-a: #1a1002; }
:root[data-accent='mono'] { --a: #e5e7eb; --b: #9ca3af; --on-a: #0b0d12; }
:root[data-theme='light'][data-accent='mono'] { --a: #1f2937; --b: #4b5563; --on-a: #ffffff; --a-text: #1f2937; }

:root {
  --glow: color-mix(in srgb, var(--a) 38%, transparent);
  --grad: linear-gradient(135deg, var(--a), var(--b));
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 18px;
  --radius-sm: 12px;
  --rail: 16rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1rem/1.5 var(--font-body); -webkit-font-smoothing: antialiased; position: relative; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 34rem at 88% -12%, color-mix(in srgb, var(--a) calc(var(--atmos) * 100%), transparent), transparent 70%),
    radial-gradient(46rem 30rem at -8% 112%, color-mix(in srgb, var(--b) calc(var(--atmos) * 70%), transparent), transparent 70%);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 650; line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.6rem); font-weight: 700; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: inherit; }
code { font-family: var(--font-mono); font-size: 0.88em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--a); outline-offset: 3px; border-radius: 6px; }
.muted { color: var(--ink-soft); }
.lead { max-width: 60ch; margin-bottom: 1.25rem; }
.hint { color: var(--ink-soft); font-size: 0.875rem; max-width: 62ch; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: .5rem 1rem; z-index: 50; }
.skip:focus { left: 0; }
.icon { flex: none; }

/* ---------- Estrutura ---------- */
#app { min-height: 100vh; }
.rail { position: fixed; z-index: 10; background: color-mix(in srgb, var(--surface) 78%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); border-color: var(--line); }
.rail ul { list-style: none; margin: 0; padding: 0; }
.rail a { text-decoration: none; display: flex; align-items: center; gap: .7rem; }
.brand { display: flex; align-items: center; gap: .6rem; font: 700 1.35rem var(--font-display); letter-spacing: -0.02em; }
.brand-mark { width: 1.55rem; height: 1.55rem; border-radius: 9px; background: var(--grad); box-shadow: 0 0 22px var(--glow); position: relative; flex: none; }
.brand-mark::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--on-a); opacity: .85; }
.content { padding: 1.25rem 1rem 6.5rem; max-width: 64rem; margin: 0 auto; outline: none; }
.content[aria-busy='true'] { opacity: .55; transition: opacity .15s .2s; }

@media (min-width: 760px) {
  .rail { top: 0; left: 0; bottom: 0; width: var(--rail); border-right: 1px solid var(--line); padding: 1.6rem 1rem; }
  .rail .brand { padding: 0 .65rem 1.8rem; }
  .rail li + li { margin-top: .2rem; }
  .rail li a { position: relative; padding: .65rem .8rem; border-radius: var(--radius-sm); color: var(--ink-soft); font-weight: 550; transition: background .15s, color .15s; }
  .rail li a:hover { background: var(--line); color: var(--ink); }
  .rail li a[aria-current='page'] { background: color-mix(in srgb, var(--a) 14%, transparent); color: var(--a-text); }
  .rail li a[aria-current='page']::before { content: ''; position: absolute; left: -1rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); box-shadow: 0 0 14px var(--glow); }
  /* Coluna única centralizada na área ao lado do menu, qualquer que seja a largura da tela. */
  .content { margin-left: var(--rail); padding: 2.4rem 2.6rem 4rem; max-width: none; display: grid; grid-template-columns: minmax(0, 64rem); justify-content: center; align-content: start; }
  .back { justify-self: start; }
}
@media (max-width: 759px) {
  .rail { left: 0; right: 0; bottom: 0; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .rail .brand { display: none; }
  .rail ul { display: grid; grid-template-columns: repeat(5, 1fr); }
  .rail li a { flex-direction: column; gap: .15rem; padding: .6rem .15rem .5rem; font-size: .7rem; color: var(--ink-soft); justify-content: center; text-align: center; }
  .rail li a[aria-current='page'] { color: var(--a-text); font-weight: 700; box-shadow: inset 0 2px 0 var(--a); }
  .rail li a[aria-current='page'] .icon { filter: drop-shadow(0 0 6px var(--glow)); }
}

/* ---------- Cabeçalho de página ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.4rem; }
.page-head h1 { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; overflow-wrap: anywhere; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: .25rem; text-decoration: none; color: var(--ink-soft); margin-bottom: .75rem; font-weight: 500; }
.back:hover { color: var(--ink); }
.status-line { margin: -.2rem 0 1.4rem; padding: .7rem 1rem; border: 1px solid var(--line); border-left: 3px solid var(--ok); background: var(--surface); border-radius: var(--radius-sm); font-weight: 550; box-shadow: var(--highlight); }
.status-line.warn { border-left-color: var(--warn); }
.status-line.bad { border-left-color: var(--bad); }
a.status-line { display: block; text-decoration: none; }

/* ---------- Botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 2.65rem; padding: .45rem 1.05rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font: 600 .95rem var(--font-body); text-decoration: none; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.btn:hover:not(:disabled) { border-color: var(--a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a) 16%, transparent); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--grad); color: var(--on-a); border-color: transparent; box-shadow: 0 8px 26px -8px var(--glow); }
.btn-primary:hover:not(:disabled) { border-color: transparent; box-shadow: 0 10px 32px -6px var(--glow); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-small { min-height: 2.15rem; padding: .25rem .8rem; font-size: .85rem; border-radius: 10px; }
.btn-wide { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border: 0; background: transparent; color: var(--ink-soft); border-radius: 10px; cursor: pointer; }
.icon-btn:hover:not(:disabled) { background: var(--line); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }

.field { display: grid; align-content: start; gap: .35rem; margin-bottom: .9rem; }
.field label, legend { font-weight: 600; font-size: .9rem; }
input[type='text'], input[type='password'], input[type='number'], input:not([type]), select {
  width: 100%; min-height: 2.8rem; padding: .5rem .8rem; font: 1rem var(--font-body); color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
input::placeholder { color: color-mix(in srgb, var(--ink-soft) 70%, transparent); }
input[type='password'], input[inputmode='url'], .slug-preview { font-family: var(--font-mono); font-size: .92rem; }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--a); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a) 22%, transparent); }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.form-error { margin: .5rem 0 1rem; padding: .7rem 1rem; border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--line)); border-left: 3px solid var(--bad); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); border-radius: var(--radius-sm); color: var(--bad); font-weight: 600; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: 1rem 0 2rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; margin-bottom: 1rem; }
.inline-form .field { margin: 0; flex: 1 1 16rem; }

.toggle { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-weight: 500; min-height: 2.25rem; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-track { position: relative; width: 2.65rem; height: 1.5rem; border-radius: 1rem; background: var(--line-strong); flex: none; transition: background .15s, box-shadow .15s; }
.toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgb(0 0 0 / .4); }
.toggle input:checked + .toggle-track { background: var(--grad); box-shadow: 0 0 14px var(--glow); }
.toggle input:checked + .toggle-track::after { transform: translateX(1.15rem); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--a); outline-offset: 3px; }

/* ---------- Blocos ---------- */
.block, .figures, .plain-list, .empty, .login-card, .link-row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--highlight), var(--shadow); }
.block { padding: 1.2rem 1.3rem 1.3rem; margin-bottom: 1rem; }
.block > h2 { margin-bottom: .85rem; }
.block > .muted { margin: -.4rem 0 .9rem; max-width: 62ch; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); }
.grid-2 .block { margin-bottom: 0; }
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin: 1.9rem 0 .85rem; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.seg { border: 0; background: transparent; color: var(--ink-soft); font: 600 .86rem var(--font-body); padding: .4rem .95rem; cursor: pointer; min-height: 2.15rem; border-radius: 999px; transition: color .15s; }
.seg:hover { color: var(--ink); }
.seg[aria-pressed='true'] { background: var(--grad); color: var(--on-a); box-shadow: 0 4px 16px -4px var(--glow); }
.tag { display: inline-block; padding: .1rem .6rem; border: 1px solid var(--line-strong); border-radius: 999px; font: 600 .74rem var(--font-body); color: var(--ink-soft); vertical-align: middle; }
.empty { border-style: dashed; padding: 2.2rem 1.4rem; display: grid; gap: .6rem; justify-items: start; box-shadow: none; }
.empty p { color: var(--ink-soft); max-width: 52ch; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

/* ---------- Lista de links ---------- */
.link-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.link-row { position: relative; padding: 1.1rem 1.25rem; display: grid; gap: .8rem 1.5rem; grid-template-columns: 1fr auto; transition: border-color .15s, box-shadow .2s; }
.link-row:hover { border-color: color-mix(in srgb, var(--a) 50%, var(--line)); box-shadow: var(--highlight), 0 0 0 1px color-mix(in srgb, var(--a) 22%, transparent), 0 18px 44px -20px var(--glow); }
.link-row.is-inactive { opacity: .62; }
.link-name { font-size: 1.15rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.link-name a { text-decoration: none; }
.link-name a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
.link-url { display: flex; align-items: center; gap: .15rem; color: var(--ink-soft); margin-top: .15rem; min-width: 0; }
.link-url .icon-btn { position: relative; z-index: 2; margin-block: -.4rem; }
.link-meta { color: var(--ink-soft); font-size: .88rem; }
.link-count { text-align: right; display: grid; align-content: start; }
.link-count strong { font: 700 2.1rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.link-count span { font-size: .8rem; color: var(--ink-soft); }
.link-route { grid-column: 1 / -1; padding-top: .85rem; border-top: 1px solid var(--line); }

/* ---------- Linha de rota ---------- */
.route { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.node { position: relative; padding: 0 0 1rem 1.95rem; min-width: 0; }
.node:last-child { padding-bottom: 0; }
.node::before { content: ''; position: absolute; left: .5rem; top: 1.05rem; bottom: -.1rem; border-left: 2px dashed var(--line-strong); }
.node:last-child::before { display: none; }
.node-active::before { border-left: 0; width: 2px; background: linear-gradient(var(--a), var(--b)); box-shadow: 0 0 10px var(--glow); }
.mark { position: absolute; left: 0; top: .2rem; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--surface); box-sizing: border-box; }
.state-up .mark { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent), 0 0 14px color-mix(in srgb, var(--ok) 70%, transparent); }
.state-down .mark { background: var(--bad); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 20%, transparent), 0 0 14px color-mix(in srgb, var(--bad) 70%, transparent); }
.state-down .mark::after { content: ''; position: absolute; left: 3px; right: 3px; top: 50%; height: 2px; margin-top: -1px; background: #fff; }
.state-unknown .mark { border: 2px solid var(--ink-soft); }
.state-off .mark { border: 2px dashed var(--off); }
.mark-end { border-radius: 4px; border: 2px solid var(--line-strong); transform: rotate(45deg) scale(.78); }
.node-active-end .mark-end { background: var(--warn); border-color: var(--warn); box-shadow: 0 0 14px color-mix(in srgb, var(--warn) 60%, transparent); }
.node-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.node-state, .node-role { display: block; font-size: .85rem; color: var(--ink-soft); }
.node-active .node-name, .node-active-end .node-name { font-weight: 750; }
.node-active .node-role { color: var(--a-text); font-weight: 650; }
.node-out .node-name { color: var(--ink-soft); font-weight: 500; text-decoration: line-through; text-decoration-thickness: 1px; }
.node-out .node-role, .node-out .node-state { text-decoration: none; }
.route-compact .node { padding-bottom: .55rem; }
.route-compact .node-role { display: none; }
.route-compact .node-name { font-size: .92rem; }
.route-compact .node-state { font-size: .8rem; }

@media (min-width: 760px) {
  .route { flex-direction: row; align-items: flex-start; }
  .node { flex: 1 1 0; padding: 1.7rem .9rem 0 0; }
  .node::before { left: 1.2rem; right: 0; top: .5rem; bottom: auto; border-left: 0; border-top: 2px dashed var(--line-strong); }
  .node-active::before { border-top: 0; width: auto; height: 2px; background: linear-gradient(90deg, var(--a), var(--b)); }
  .mark { top: 0; }
  .route-compact .node { padding-bottom: 0; }
  .route-compact .node-role { display: block; }
}

/* ---------- Detalhe do link ---------- */
.dest-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.dest { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0 .7rem 1.95rem; }
.dest + .dest { border-top: 1px solid var(--line); }
.dest .mark { top: 1.05rem; }
.dest-info { display: grid; gap: .1rem; min-width: 0; }
.dest-target { font-family: var(--font-mono); font-size: .85rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.dest-state { font-size: .88rem; }
.dest-warn { font-size: .85rem; color: var(--warn); font-weight: 600; }
@media (max-width: 520px) { .dest { flex-direction: column; align-items: flex-start; } }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); margin: 0 0 1rem; overflow: hidden; }
.figures > div { padding: 1rem 1.2rem; }
.figures > div + div { border-left: 1px solid var(--line); }
.figures dt { font-size: .85rem; color: var(--ink-soft); }
.figures dd { margin: 0; font: 700 2.15rem/1.15 var(--font-display); font-variant-numeric: tabular-nums; }
.figures dd small { display: block; font: 500 .8rem var(--font-body); color: var(--ink-soft); }
.figures .lead-figure dd { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
@media (max-width: 520px) { .figures > div + div { border-left: 0; border-top: 1px solid var(--line); } }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 10rem; padding-bottom: 1.4rem; }
.bar { position: relative; flex: 1 1 0; min-width: 2px; height: 100%; display: flex; align-items: flex-end; background: linear-gradient(var(--line), var(--line)) bottom / 100% 1px no-repeat; }
.bar-fill { display: block; width: 100%; background: linear-gradient(to top, var(--b), var(--a)); border-radius: 6px 6px 0 0; min-height: 0; transition: filter .15s; }
.bar:hover .bar-fill { filter: brightness(1.2) drop-shadow(0 0 8px var(--glow)); }
.bar-label { position: absolute; top: calc(100% + .25rem); left: 50%; transform: translateX(-50%); font-size: .72rem; color: var(--ink-soft); white-space: nowrap; }
.chart-hours { height: 7rem; }
.chart-hours .bar-fill { opacity: .72; }
.chart-hours .bar:hover .bar-fill { opacity: 1; }

.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.funnel li { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 0 1rem; align-items: baseline; padding: .6rem .85rem; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.funnel-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, color-mix(in srgb, var(--a) 30%, transparent), color-mix(in srgb, var(--b) 10%, transparent)); border-right: 2px solid var(--a); }
.funnel-label, .funnel-n, .funnel-pct { position: relative; }
.funnel-n { font: 700 1.25rem var(--font-display); font-variant-numeric: tabular-nums; }
.funnel-pct { grid-column: 1 / -1; font-size: .8rem; color: var(--ink-soft); }
.funnel-pct:empty { display: none; }
.revenue { margin-top: .9rem; font-weight: 650; }

.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.rank li { position: relative; display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .7rem; border-radius: 10px; overflow: hidden; }
.rank-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, color-mix(in srgb, var(--a) 24%, transparent), color-mix(in srgb, var(--b) 6%, transparent)); border-radius: 10px; }
.rank-name, .rank-n { position: relative; overflow-wrap: anywhere; }
.rank-n { font-variant-numeric: tabular-nums; font-weight: 650; }

.table-wrap { overflow-x: auto; margin: 0 -.15rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 650; color: var(--ink-soft); padding: .45rem .75rem .45rem 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: .55rem .75rem .55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .is-bot td { color: var(--ink-soft); font-style: italic; }

/* ---------- Visão geral: ranking ---------- */
.rtable th, .rtable td { text-align: right; }
.rtable th:first-child, .rtable td:first-child { text-align: left; min-width: 11rem; }
.rtable td { font-variant-numeric: tabular-nums; }
.rtable td:first-child { font-weight: 600; overflow-wrap: anywhere; }
.rtable td small { display: block; color: var(--ink-soft); font-size: .78rem; }
.rtable tbody tr:hover td { background: color-mix(in srgb, var(--a) 6%, transparent); }
.th-btn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .25rem; font-weight: 650; color: inherit; border-radius: 6px; }
.th-btn:hover { color: var(--ink); }
.th-btn:focus-visible { outline: 2px solid var(--a); outline-offset: 2px; }
th[aria-sort='descending'] .th-btn, th[aria-sort='ascending'] .th-btn { color: var(--a-text); }
.sort-mark { font-size: .7rem; }
.cell-bar { display: block; height: 3px; margin-top: .3rem; border-radius: 3px; background: var(--grad); opacity: .85; }
.overview-split { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); }
.overview-split .block { margin-bottom: 0; }

/* ---------- Editor ---------- */
.slug-line { margin: -.4rem 0 0; color: var(--ink-soft); }
.modes { border: 0; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.mode { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem .95rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s, background .15s; }
.mode:hover { border-color: color-mix(in srgb, var(--a) 55%, var(--line-strong)); }
.mode:has(input:checked) { border-color: var(--a); background: color-mix(in srgb, var(--a) 9%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a) 14%, transparent); }
.mode input { margin-top: .3rem; accent-color: var(--a); }
.mode-body { display: grid; gap: .1rem; }
.mode-body span { color: var(--ink-soft); font-size: .9rem; }
.preview-wrap { margin: 1.25rem 0; padding: 1.05rem 1.15rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.preview-wrap h3 { margin-bottom: .85rem; }
.dests { display: grid; gap: .9rem; margin-bottom: 1rem; }
.dest-edit { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: .5rem 1rem 1rem; margin: 0; min-width: 0; }
.dest-edit legend { padding: 0 .4rem; }
.dest-tools { position: absolute; top: -1.2rem; right: .5rem; display: flex; background: var(--surface); border-radius: 10px; }
.dest-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .25rem; }
.token-saved { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; padding: .65rem .85rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: .9rem; }
.with-button { display: flex; gap: .5rem; }
.with-button input { flex: 1 1 auto; min-width: 0; }
.with-button .btn { flex: none; }
.geo-status { font-weight: 600; margin-bottom: .75rem; }
.geo-status.ok { color: var(--ok); }
.block > .dest-warn { display: block; margin-bottom: .75rem; }

/* ---------- Aparência ---------- */
.appearance { display: grid; gap: 1.1rem; }
.appearance-row { display: grid; gap: .5rem; }
.appearance-row > span { font-weight: 600; font-size: .9rem; }
.swatches { display: flex; flex-wrap: wrap; gap: .75rem; }
.swatch { position: relative; display: grid; justify-items: center; gap: .3rem; cursor: pointer; font-size: .78rem; color: var(--ink-soft); }
.swatch input { position: absolute; opacity: 0; inset: 0; }
.swatch-dot { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px transparent; transition: box-shadow .15s, transform .15s; }
.swatch:hover .swatch-dot { transform: scale(1.06); }
.swatch input:checked + .swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink), 0 0 20px var(--glow); }
.swatch input:checked ~ .swatch-name { color: var(--ink); font-weight: 650; }
.swatch input:focus-visible + .swatch-dot { outline: 2px solid var(--a); outline-offset: 4px; }
.swatch-dot[data-swatch='cyan'] { background: linear-gradient(135deg, #22d3ee, #60a5fa); }
.swatch-dot[data-swatch='violet'] { background: linear-gradient(135deg, #a78bfa, #818cf8); }
.swatch-dot[data-swatch='pink'] { background: linear-gradient(135deg, #f472b6, #fb7185); }
.swatch-dot[data-swatch='blue'] { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.swatch-dot[data-swatch='amber'] { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.swatch-dot[data-swatch='mono'] { background: linear-gradient(135deg, #e5e7eb, #6b7280); }

/* ---------- Listas simples ---------- */
.plain-list { list-style: none; margin: 1rem 0 0; padding: 0; overflow: hidden; }
.plain-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .9rem 1.2rem; }
.plain-row + .plain-row { border-top: 1px solid var(--line); }
.plain-row.is-inactive { opacity: .62; }
.plain-main { display: grid; gap: .1rem; min-width: 0; flex: 1 1 14rem; overflow-wrap: anywhere; }
.alert-side { display: grid; justify-items: end; gap: .25rem; color: var(--ink-soft); font-size: .88rem; }

/* ---------- Login, aviso, diálogo ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(100%, 23rem); padding: 2rem 1.6rem; display: grid; gap: .6rem; box-shadow: var(--highlight), 0 30px 80px -30px var(--glow); }
.login-card .brand { font-size: 1.9rem; margin-bottom: .4rem; }
.login-card .brand-mark { width: 2.1rem; height: 2.1rem; border-radius: 12px; }
.login-card .brand-mark::after { inset: 9px; }
.login-card .field { margin: .5rem 0 0; }
.login-card .btn { margin-top: .4rem; }

#toasts { position: fixed; z-index: 60; left: 1rem; right: 1rem; bottom: 5.5rem; display: grid; justify-items: center; pointer-events: none; }
@media (min-width: 760px) { #toasts { bottom: 1.5rem; left: var(--rail); } }
.toast { pointer-events: auto; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-strong); padding: .7rem 1.15rem; border-radius: 999px; font-weight: 600; max-width: 32rem; box-shadow: 0 14px 40px -10px rgb(0 0 0 / .6), 0 0 24px -8px var(--glow); animation: pop .18s ease-out; }
.toast-error { background: var(--bad); border-color: var(--bad); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

.dialog { border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); color: var(--ink); padding: 1.5rem; width: min(92vw, 26rem); box-shadow: 0 40px 100px -30px rgb(0 0 0 / .8); }
.dialog::backdrop { background: rgb(4 6 12 / .62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.dialog-title { margin-bottom: .5rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

.block > .toolbar { margin: 0 0 .9rem; }

/* ---------- Situação, papéis e cabeçalhos de bloco ---------- */
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .12rem .7rem .12rem .55rem; border-radius: 999px; font: 650 .78rem/1.5 var(--font-body); letter-spacing: 0; vertical-align: middle; border: 1px solid transparent; }
.pill::before { content: ''; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.pill-ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.pill-bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.pill-off { color: var(--ink-soft); background: var(--line); border-color: var(--line-strong); }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .6rem; }
.block-head h2 { margin: 0; }
.block > .block-head + .dest-list { margin-top: .25rem; }
.dest-title { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; }
.role-badge { font: 650 .75rem var(--font-body); padding: .08rem .6rem; border-radius: 999px; background: var(--line); color: var(--ink-soft); }
.role-badge-active { background: color-mix(in srgb, var(--a) 16%, transparent); color: var(--a-text); }
.dest-note { font-size: .85rem; color: var(--ink-soft); }
.hint-warn { color: var(--warn); font-weight: 600; }
.block > .hint { margin-top: .85rem; }
.dest.role-out .dest-title strong { color: var(--ink-soft); }
.figures-note { margin: -.4rem 0 1rem; }

/* ---------- Editor em passos ---------- */
.step-title { display: flex; align-items: center; gap: .65rem; }
.step-n { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--grad); color: var(--on-a); font: 700 .85rem var(--font-display); flex: none; }
.form-grid { align-items: start; }
.url-card { display: grid; gap: .15rem; padding: .75rem 1rem; margin: .2rem 0 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.url-card .slug-preview { overflow-wrap: anywhere; color: var(--a-text); font-weight: 600; }
.step > .toggle { margin-top: .1rem; }
.step > .btn { margin-bottom: 1rem; }
details.step > summary { display: flex; align-items: center; gap: .65rem; cursor: pointer; list-style: none; font: 650 1.2rem var(--font-display); }
details.step > summary::-webkit-details-marker { display: none; }
details.step > summary::after { content: ''; margin-left: auto; width: .55rem; height: .55rem; border-right: 2px solid var(--ink-soft); border-bottom: 2px solid var(--ink-soft); transform: rotate(45deg); transition: transform .15s; }
details.step[open] > summary::after { transform: rotate(-135deg); }
details.step[open] > summary { margin-bottom: .75rem; }
.token-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.modes[hidden] { display: none; }
@media (min-width: 760px) {
  .editor .form-actions { position: sticky; bottom: 0; z-index: 5; margin: 1rem 0 0; padding: .9rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: var(--shadow); }
}
.empty { margin-bottom: 1rem; }
.segmented { flex-wrap: wrap; border-radius: 1.3rem; }

/* ---------- Lista de links em escala ---------- */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.search-wrap { position: relative; flex: 1 1 16rem; min-width: 0; }
.search-wrap .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
input.search { padding-left: 2.6rem; }
.sort-select { width: auto; flex: none; padding-right: 2rem; }
.list-count { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 0 0 .6rem .2rem; }
.link-results .more { margin-top: .85rem; }

.link-list.is-compact { gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--highlight), var(--shadow); overflow: hidden; }
.link-compact { display: grid; align-items: center; gap: .25rem 1rem; grid-template-columns: auto minmax(0, 1.7fr) minmax(0, .9fr) minmax(0, 1fr) auto; padding: .6rem 1.1rem; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.link-compact + .link-compact { border-top: 1px solid var(--line); }
.link-compact:hover { background: color-mix(in srgb, var(--a) 6%, transparent); box-shadow: none; border-color: var(--line); }
.link-compact .link-name { font-size: 1rem; flex-wrap: nowrap; }
.link-compact .link-name a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-compact .row-title { min-width: 0; }
.link-compact .link-url { margin-top: 0; font-size: .8rem; }
.link-compact .link-url code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-compact .link-url .icon-btn { width: 1.7rem; height: 1.7rem; margin-block: -.3rem; }
.row-where { grid-column: 4; grid-row: 1 / span 2; font-size: .88rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-compact.state-warn .row-where { color: var(--warn); font-weight: 600; }
.link-compact.state-bad .row-where { color: var(--bad); font-weight: 600; }
.row-meta { grid-column: 3; grid-row: 1 / span 2; align-self: center; font-size: .78rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-clicks { grid-column: 5; grid-row: 1 / span 2; text-align: right; display: grid; }
.row-clicks strong { font: 700 1.3rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.row-clicks span { font-size: .72rem; color: var(--ink-soft); }
.dot { width: .75rem; height: .75rem; border-radius: 50%; flex: none; grid-row: 1 / span 2; align-self: center; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent), 0 0 10px color-mix(in srgb, var(--ok) 60%, transparent); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 18%, transparent), 0 0 10px color-mix(in srgb, var(--warn) 60%, transparent); }
.dot-bad { background: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent), 0 0 10px color-mix(in srgb, var(--bad) 60%, transparent); }
.dot-off { background: transparent; border: 2px dashed var(--off); }
@media (max-width: 759px) {
  .link-compact { grid-template-columns: auto minmax(0, 1fr) auto; }
  .link-compact .row-where, .link-compact .row-meta { grid-column: 2; grid-row: auto; }
  .link-compact .row-title { grid-column: 2; }
  .row-clicks { grid-column: 3; grid-row: 1 / span 3; }
  .dot { grid-row: 1 / span 3; }
  .list-tools .segmented { width: 100%; justify-content: center; }
  .sort-select { flex: 1 1 auto; }
}
@media (max-width: 759px) { .list-tools .segmented .seg { padding: .4rem .6rem; font-size: .8rem; } }
