/* COC Control — Quadro de recargas.
   Suas vilas como um grupo de raide: molduras do grupo, anéis de recarga, barra de vida.
   Cor com um só sentido: ciano = pronto/livre, violeta = em recarga, ouro = estrutura e custo,
   vermelho = erro. As duas magas (Soul Weaver e Void Archmage) enquadram tudo, voltadas ao centro. */

@font-face {
  font-family: 'Saira';
  src: url('/static/assets/branding/saira-latin-wdth.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --night: #080b10;
  --slate: #0d1117;
  --slate-2: #121822;
  --slate-3: #1a2230;
  --panel: rgba(13, 17, 24, 0.9);
  --panel-solid: #111721;
  --line: #263041;
  --line-strong: #3a4659;
  --gold: #f2c14e;
  --gold-soft: #d9ad4a;
  --gold-dim: #8a7038;
  --gold-ink: #1b1406;
  --ready: #5ad1e6;
  --ready-dim: #1d4b55;
  --busy: #b07cff;
  --busy-dim: #3a2a5c;
  --danger: #ff7a7a;
  --danger-dim: #4a1f24;
  --text: #edf1f6;
  --text-2: #b1bccb;
  --text-3: #8795a8;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --display: 'Saira', 'Segoe UI', system-ui, sans-serif;
  --ui: system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --r: 6px;
  --top: 60px;
  --rail: 284px;
  --shell: 1120px;
  --stage: var(--shell);
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); scrollbar-color: #3a4659 var(--night); scrollbar-width: thin; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font: 14px/1.5 var(--ui);
  background:
    radial-gradient(1100px 700px at 8% 18%, rgba(90, 209, 230, 0.10), transparent 62%),
    radial-gradient(1100px 700px at 92% 18%, rgba(176, 124, 255, 0.11), transparent 62%),
    linear-gradient(180deg, #0b0f15 0%, var(--night) 70%);
  isolation: isolate;
  font-variant-numeric: tabular-nums;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url('/static/assets/branding/stone.webp') center / 720px;
  opacity: 0.16;
  pointer-events: none;
}
::selection { background: rgba(242, 193, 78, 0.32); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2e394a; border-radius: 10px; border: 2px solid var(--night); }
a { color: var(--ready); text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, input, select, textarea { font: inherit; color: inherit; caret-color: var(--gold); accent-color: var(--gold); }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 16px; top: 12px; transform: translateY(-200%); z-index: 50; padding: 10px 16px; background: var(--gold); color: var(--gold-ink); font-weight: 700; border-radius: var(--r); text-decoration: none; }
.skip-link:focus { transform: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- as duas magas ----------
   Posição por fórmula: o rosto de cada uma cai no meio do vão lateral, voltado ao centro.
   Soul Weaver (espelhada): rosto a 53% da largura e 19% da altura da arte.
   Void Archmage: rosto a 49% e 25%. A arte tem largura = 2/3 da altura, então
   53% da largura = 0.353 da altura e 49% = 0.327. */
.scene {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
  --fig-h: min(115dvh, 1100px);
  --gutter: max(0px, (100vw - var(--stage)) / 2);
}
.scene-figure { position: absolute; top: 8px; height: var(--fig-h); aspect-ratio: 2 / 3; margin: 0; }
.scene-figure img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: top; }
.scene-figure.is-left { left: calc(var(--gutter) / 2 - var(--fig-h) * 0.353); }
.scene-figure.is-left img { transform: scaleX(-1); }
.scene-figure.is-right { left: calc(100vw - var(--gutter) / 2 - var(--fig-h) * 0.327); }
.scene-figure.is-left { -webkit-mask-image: linear-gradient(90deg, #000 62%, transparent 100%); mask-image: linear-gradient(90deg, #000 62%, transparent 100%); }
.scene-figure.is-right { -webkit-mask-image: linear-gradient(270deg, #000 60%, transparent 100%); mask-image: linear-gradient(270deg, #000 60%, transparent 100%); }
.page-app .scene-figure { opacity: 0.88; }
.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 38% 74% at 50% 46%, rgba(8, 11, 16, 0.72), rgba(8, 11, 16, 0.22) 72%, transparent 100%),
    linear-gradient(180deg, transparent 62%, rgba(8, 11, 16, 0.88));
}

/* ---------- barra superior ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 max(20px, calc(50% - var(--shell) / 2));
  background: linear-gradient(180deg, rgba(8, 11, 16, 0.96), rgba(8, 11, 16, 0.82));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; margin-right: auto; }
.brand img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)); }
.brand-name { font-family: var(--display); font-size: 20px; font-weight: 700; font-stretch: 108%; letter-spacing: 0.01em; line-height: 1; }
.brand-name span { color: var(--gold); }
.brand-line { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 3px; letter-spacing: 0.02em; }
.pass-chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 34px; padding: 6px 12px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: rgba(17, 23, 33, 0.9); color: var(--text-2); font-size: 12.5px;
  text-decoration: none;
}
.pass-chip b { color: var(--text); font-weight: 600; }
.pass-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ready); }
.pass-chip.is-warn .dot { background: var(--gold); }
.pass-chip.is-off .dot { background: var(--danger); }

/* ---------- botões e controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 15px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: linear-gradient(180deg, #1b2331, #141a25);
  color: var(--text); font-weight: 600; font-size: 13.5px; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary {
  border-color: #f7d27a;
  background: linear-gradient(180deg, #f6cf6c, #e2ac35);
  color: var(--gold-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 6px 14px -8px rgba(0, 0, 0, 0.8);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn-danger { border-color: #6b2c33; background: linear-gradient(180deg, #33161b, #251014); color: #ffc2c2; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: rgba(20, 26, 37, 0.9); color: var(--text-2);
  transition: transform 160ms var(--ease-out), color 160ms ease, border-color 160ms ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { border-color: #56657c; background: linear-gradient(180deg, #212b3b, #18202c); }
  .btn-primary:hover:not(:disabled) { border-color: #ffe29b; background: linear-gradient(180deg, #ffd978, #ecb740); }
  .btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.04); color: var(--text); }
  .btn-danger:hover:not(:disabled) { border-color: #93414a; background: linear-gradient(180deg, #43191f, #2d1216); }
  .icon-btn:hover { color: var(--text); border-color: #56657c; }
  .pass-chip:hover { border-color: #56657c; color: var(--text); }
}

.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field-row .field + .field { margin-top: 0; }
.field label, .field .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .help { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.input, .field input:not([type=checkbox]), .field select, .field textarea {
  width: 100%; min-height: 42px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: #0b1018; color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field textarea { min-height: 168px; resize: vertical; font: 12.5px/1.5 ui-monospace, 'Cascadia Mono', Consolas, monospace; }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: #6f7d90; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold-soft); box-shadow: 0 0 0 3px rgba(242, 193, 78, 0.14); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; flex: none; }
.check small { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }

.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #0b1018; gap: 2px; }
.segmented button {
  min-height: 34px; padding: 6px 14px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-3); font-weight: 600; font-size: 13px;
  transition: background-color 160ms ease, color 160ms ease;
}
.segmented button[aria-pressed=true] { background: var(--slate-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 10px 3px 6px; border: 1px solid var(--line); border-radius: 999px; background: rgba(17, 23, 33, 0.85); color: var(--text-2); font-size: 12.5px; white-space: nowrap; }
.chip img { width: 20px; height: 20px; object-fit: contain; }
.chip b { color: var(--text); font-weight: 600; }
.chip.plain { padding-left: 10px; }

.notice { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r); background: rgba(17, 23, 33, 0.9); color: var(--text-2); font-size: 13px; }
.notice b { color: var(--text); }
.notice.is-warn { border-color: #6d5724; background: rgba(46, 37, 15, 0.9); color: #f3dca3; }
.notice.is-error { border-color: #6b2c33; background: rgba(43, 17, 21, 0.92); color: #ffcaca; }

/* ---------- moldura HUD ---------- */
/* A moldura é o fio: ::before pinta o fio (ouro nos cantos chanfrados, ardósia no meio) e
   ::after, 1px para dentro, pinta o painel. O corte interno é 0,586px menor para o fio ter
   1px também nas diagonais. O elemento em si não tem fundo nem recorte. */
.frame {
  --cut: 11px;
  --in: calc(var(--cut) - 0.586px);
  --thread: linear-gradient(135deg, #9a7d3c 0%, #4a4a44 9%, #303b4d 24%, #2a3444 50%, #303b4d 76%, #4a4a44 91%, #9a7d3c 100%);
  position: relative;
  isolation: isolate;
}
.frame::before, .frame::after { content: ''; position: absolute; pointer-events: none; }
.frame::before {
  inset: 0; z-index: -2;
  background: var(--thread);
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
}
.frame::after {
  inset: 1px; z-index: -1;
  background: linear-gradient(180deg, rgba(21, 27, 38, 0.95), rgba(11, 15, 22, 0.93) 70%);
  clip-path: polygon(var(--in) 0, calc(100% - var(--in)) 0, 100% var(--in), 100% calc(100% - var(--in)), calc(100% - var(--in)) 100%, var(--in) 100%, 0 calc(100% - var(--in)), 0 var(--in));
}
.frame.is-tooled { --thread: linear-gradient(135deg, var(--gold) 0%, #a3843e 5%, #4a4a44 16%, #303b4d 30%, #2a3444 50%, #303b4d 70%, #4a4a44 84%, #a3843e 95%, var(--gold) 100%); }
.frame-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.frame-title { font-family: var(--display); font-size: 13px; font-weight: 700; font-stretch: 112%; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.frame-aside { margin-left: auto; font-size: 12px; color: var(--text-3); }
.frame-body { padding: 14px 18px 18px; }

/* ---------- casca ---------- */
.shell {
  width: min(var(--shell), 100% - 40px);
  margin: 0 auto;
  padding: 22px 0 56px;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.rail { position: sticky; top: calc(var(--top) + 22px); display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.main.is-switching { opacity: 0.55; transition: opacity 150ms var(--ease-out); }
/* sem grupo (passe inativo): uma coluna, card ao centro */
.shell:has(> .rail[hidden]) { grid-template-columns: minmax(0, 1fr); }
.shell:has(> .rail[hidden]) .main { justify-items: center; }
.shell:has(> .rail[hidden]) .empty { margin-top: 6vh; }
.main { transition: opacity 150ms var(--ease-out); }

/* ---------- molduras do grupo (vilas) ---------- */
.party-list { position: relative; list-style: none; margin: 0; padding: 10px; display: grid; gap: 8px; }
/* muitas vilas: a lista rola dentro da moldura; ordem, busca e ações ficam sempre à vista */
.rail > .frame { display: flex; flex-direction: column; max-height: calc(100dvh - var(--top) - 44px); }
.rail > .frame > * { flex: none; }
.rail > .frame > .party-list { flex: 0 1 auto; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.rail.is-crowded .rail-note { display: none; }
.party-list[data-fade=end] { -webkit-mask-image: linear-gradient(to bottom, var(--night) calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, var(--night) calc(100% - 32px), transparent); }
.party-list[data-fade=start] { -webkit-mask-image: linear-gradient(to top, var(--night) calc(100% - 32px), transparent); mask-image: linear-gradient(to top, var(--night) calc(100% - 32px), transparent); }
.party-list[data-fade=both] { -webkit-mask-image: linear-gradient(to bottom, transparent, var(--night) 32px, var(--night) calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, transparent, var(--night) 32px, var(--night) calc(100% - 32px), transparent); }
.party-tools { display: grid; gap: 8px; padding: 12px 10px 0; }
.party-sort { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.party-sort select {
  flex: 1; min-width: 0; min-height: 36px; padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: #0b1018; color: var(--text); font-size: 13px;
}
.party-tools .party-search { min-height: 36px; padding: 7px 10px; font-size: 13px; }
.party-none { padding: 6px 4px; }
/* arrastar para ordenar */
.party { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.party-list.is-sorting { cursor: grabbing; scroll-snap-type: none; }
.party-list.is-sorting > li { transition: transform 200ms var(--ease-out); }
.party-list > li.is-dragging { position: relative; z-index: 3; transition: none; }
.party-list > li.is-dragging .party {
  cursor: grabbing; border-color: var(--gold-soft); background: rgba(26, 34, 48, 0.96);
  box-shadow: 0 12px 20px -10px rgba(0, 0, 0, 0.7); transform: scale(1.02);
}
.party-list.is-sorting .party { transition: border-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out), box-shadow 160ms ease; }
.party {
  position: relative; width: 100%;
  display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 10px; text-align: left;
  border: 1px solid transparent; border-radius: var(--r);
  background: rgba(20, 26, 37, 0.65);
  transition: border-color 160ms ease, background-color 160ms ease;
}
.party[aria-current=true] { border-color: var(--gold-dim); background: linear-gradient(90deg, rgba(242, 193, 78, 0.09), rgba(20, 26, 37, 0.7) 55%); }
.party-portrait { width: 50px; height: 50px; padding: 4px; object-fit: contain; border: 1px solid var(--gold-dim); border-radius: 4px; background: radial-gradient(circle at 50% 38%, #27313f, #090c12 80%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.7); }
.party-body { min-width: 0; display: grid; gap: 4px; }
.party-name { font-weight: 650; font-size: 13.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-meta { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.party-next { align-self: start; font-family: var(--display); font-stretch: 78%; font-weight: 650; font-size: 15px; color: var(--busy); }
.party-next.is-ready { color: var(--ready); }
.pips { display: flex; gap: 3px; }
.pips i { width: 12px; height: 5px; border-radius: 2px; background: var(--busy-dim); }
.pips i.is-ready { background: var(--ready); }
.pips i.is-busy { background: var(--busy); }
@media (hover: hover) and (pointer: fine) {
  .party:hover { border-color: var(--line-strong); background: rgba(26, 34, 48, 0.85); }
  .party[aria-current=true]:hover { border-color: var(--gold-soft); }
}
.rail-actions { display: grid; gap: 8px; padding: 0 10px 12px; }
.rail-note { margin: 0; padding: 0 12px 12px; font-size: 12px; line-height: 1.55; color: var(--text-3); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.switch { position: relative; width: 38px; height: 22px; border-radius: 22px; border: 1px solid var(--line-strong); background: #0b1018; flex: none; transition: background-color 180ms ease, border-color 180ms ease; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); transition: transform 180ms var(--ease-out), background-color 180ms ease; }
.switch[aria-checked=true] { background: var(--ready-dim); border-color: var(--ready); }
.switch[aria-checked=true]::after { transform: translateX(16px); background: var(--ready); }

/* barra de vida */
/* barra de vida: calha emoldurada, marcas a cada 10%, ponta clara no fim do preenchimento */
.hp { position: relative; display: block; height: 9px; border: 1px solid #2f394a; border-radius: 2px; background: linear-gradient(180deg, #06090d, #111722); overflow: hidden; }
.hp i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--p, 0) * 1%); background: linear-gradient(180deg, #ffe08a, #e0a93a 55%, #a87a22); }
.hp i::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: #fff4cc; }
.hp::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(4, 6, 10, 0.7) calc(10% - 1px) 10%); }
.hp.is-full i { background: linear-gradient(180deg, #a8f3fb, #45bccd 55%, #2a8b99); }
.hp.is-full i::after { display: none; }
.hp.is-lg { height: 15px; }

/* ---------- cabeçalho da vila ---------- */
.village-head { display: grid; grid-template-columns: 104px minmax(0, 1fr); grid-template-areas: 'hall title' 'hall chips' 'hall actions'; gap: 12px 20px; align-items: center; padding: 20px 22px; }
.village-hall { grid-area: hall; width: 104px; height: 104px; object-fit: contain; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.7)); }
.village-title { grid-area: title; min-width: 0; display: grid; gap: 8px; }
.village-title h1 { font-size: clamp(24px, 2.4vw, 34px); font-weight: 650; font-stretch: 100%; line-height: 1.05; letter-spacing: -0.005em; overflow-wrap: break-word; }
.village-sub { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--text-3); font-size: 13px; }
.village-sub .tag { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; color: var(--text-2); }
.verified { display: inline-flex; align-items: center; gap: 4px; color: var(--ready); font-weight: 600; }
.verified svg { width: 14px; height: 14px; }
.village-chips { grid-area: chips; display: flex; flex-wrap: wrap; gap: 6px; }
.village-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-start; align-self: start; }

/* ---------- abas ---------- */
.tabs { position: relative; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); padding: 0 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none; min-height: 44px; padding: 10px 14px;
  border: 0; background: transparent; color: var(--text-3);
  font-family: var(--display); font-size: 14.5px; font-weight: 650; font-stretch: 104%;
  transition: color 160ms ease;
}
.tab[aria-selected=true] { color: var(--text); }
.tab:focus-visible { outline-offset: -4px; }
.tabs.has-more { -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent); mask-image: linear-gradient(90deg, #000 84%, transparent); }
.tabs-indicator {
  position: absolute; left: 0; width: var(--tabs-w, 100%); bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold-soft), var(--gold));
  clip-path: inset(0 var(--r-right, 100%) 0 var(--r-left, 0));
  transition: clip-path 250ms var(--ease-in-out);
}
@media (hover: hover) and (pointer: fine) { .tab:hover { color: var(--text-2); } }

/* ---------- recargas ---------- */
.cooldowns { display: grid; grid-template-columns: minmax(230px, 0.9fr) minmax(0, 2fr); }
.next-up { padding: 20px 22px; border-right: 1px solid var(--line); display: grid; align-content: start; gap: 12px; }
.next-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.next-time { font-family: var(--display); font-weight: 600; font-stretch: 72%; font-size: clamp(54px, 6vw, 76px); line-height: 0.9; letter-spacing: -0.01em; color: var(--busy); }
.next-time.is-ready { color: var(--ready); }
.next-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; align-items: center; }
.next-item img, .next-item .art-missing { width: 44px; height: 44px; object-fit: contain; }
.next-item b { display: block; font-size: 14px; }
.next-item small { color: var(--text-3); font-size: 12.5px; }
.builders-free { display: flex; align-items: baseline; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.builders-free b { font-family: var(--display); font-stretch: 78%; font-size: 30px; font-weight: 650; line-height: 1; color: var(--ready); }
.builders-free.is-none b { color: var(--text-3); }
.builders-free span { color: var(--text-2); font-size: 13px; }

.cd-groups { padding: 16px 18px 18px; display: grid; gap: 16px; }
.cd-group-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.cd-group-title small { color: var(--text-3); font-weight: 500; }
.cd-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px 8px; }
.cd { display: grid; justify-items: center; gap: 5px; text-align: center; min-width: 0; }
.ring { position: relative; width: 74px; height: 74px; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring-track { fill: rgba(9, 12, 18, 0.9); stroke: #202a39; stroke-width: 5; }
.ring-ticks { fill: none; stroke: #3a4659; stroke-width: 2.4; stroke-dasharray: 0.8 9.2; }
.ring-bevel { fill: none; stroke: rgba(255, 255, 255, 0.07); stroke-width: 1; }
.ring-fill { fill: none; stroke: var(--busy); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 100 100; }
.ring-art { position: absolute; inset: 13px; display: grid; place-items: center; }
.ring-art img, .ring-art .art-missing { width: 46px; height: 46px; object-fit: contain; }
.cd.is-ready .ring-fill { stroke: var(--ready); }
/* pronto = aceso: luz interna ciano (gradiente), não halo em volta */
.cd.is-ready .ring-track { stroke: #1f5963; fill: url(#ready-lit); }
.cd.is-ready .ring-ticks { stroke: #3fa7b6; }
.cd.is-idle .ring-fill { stroke: transparent; }
.cd-time { font-family: var(--display); font-stretch: 76%; font-weight: 650; font-size: 18px; line-height: 1; color: var(--text); }
.cd.is-ready .cd-time { color: var(--ready); }
.cd-name { display: grid; font-size: 11.5px; line-height: 1.3; color: var(--text-3); max-width: 100%; }
.cd-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-name small { font-size: 11px; color: var(--text-3); opacity: 0.85; }
.cd.just-ready .ring { animation: ready-pulse 520ms var(--ease-out) 1; }
@keyframes ready-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* próximo upgrade (espaço da barra de ações) */
.next-cast { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px 12px; align-items: center; padding-top: 14px; border-top: 1px solid var(--line); }
.next-cast > p, .next-cast > .cost { grid-column: 1 / -1; }
.nowrap { white-space: nowrap; }
.next-up .next-cast { grid-column: 1 / -1; }
.slot-art { position: relative; width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid var(--gold-dim); border-radius: var(--r); background: radial-gradient(circle at 50% 35%, #2a2416, #12100b); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6); }
.slot-art img, .slot-art .art-missing { width: 42px; height: 42px; object-fit: contain; }
.slot-art svg { width: 22px; height: 22px; color: var(--ready); }
.next-cast h3 { font-size: 15px; font-weight: 650; line-height: 1.25; }
.next-cast p { margin: 0; color: var(--text-3); font-size: 13px; line-height: 1.5; }
.cost { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.cost-item { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--gold); }
.cost-item img, .cost-item .art-missing { width: 22px; height: 22px; object-fit: contain; }
.cost-item span { color: var(--text-3); font-weight: 500; font-size: 12.5px; }

/* ---------- progresso por base ---------- */
.bases { display: grid; grid-template-columns: 1fr 1fr; }
.base-block { padding: 18px 20px 20px; display: grid; gap: 14px; align-content: start; }
.base-block + .base-block { border-left: 1px solid var(--line); }
.base-head { display: flex; align-items: center; gap: 12px; }
.base-head img, .base-head .art-missing { width: 40px; height: 40px; object-fit: contain; }
.base-head h2 { font-size: 16px; font-weight: 650; }
.base-head small { display: block; color: var(--text-3); font-size: 12px; }
.base-pct { margin-left: auto; font-family: var(--display); font-stretch: 80%; font-size: 30px; font-weight: 650; line-height: 1; }
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.cat { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.cat span { color: var(--text-2); }
.cat b { font-weight: 650; }
.cat .hp { grid-column: 1 / -1; height: 7px; }
.cat.is-max span, .cat.is-max b { color: var(--text-3); }
.muted { color: var(--text-3); }

/* ---------- arsenal ---------- */
.section-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.bag { padding: 6px 18px 18px; }
.bag h3 { display: flex; gap: 8px; align-items: baseline; margin: 18px 0 10px; font-size: 14px; font-weight: 650; font-stretch: 104%; color: var(--text); }
.bag h3 small { font-family: var(--ui); font-weight: 500; color: var(--text-3); font-size: 12px; }
.bag-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.item-slot { position: relative; display: grid; justify-items: center; gap: 4px; padding: 8px 6px 7px; border: 1px solid var(--line); border-radius: var(--r); background: linear-gradient(180deg, #151c28, #0f141d); text-align: center; min-width: 0; }
.item-slot img, .item-slot .art-missing { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.55)); }
.item-slot .lvl { position: absolute; top: 5px; right: 5px; min-width: 24px; padding: 1px 5px; border-radius: 4px; background: rgba(8, 11, 16, 0.92); border: 1px solid var(--line-strong); font-family: var(--display); font-stretch: 80%; font-weight: 650; font-size: 12.5px; line-height: 1.3; }
.item-slot.is-max { border-color: var(--gold-dim); }
.item-slot.is-max .lvl { color: var(--gold); border-color: var(--gold-dim); }
.item-slot .name { font-size: 11.5px; line-height: 1.25; color: var(--text-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.item-slot .count { font-size: 11px; color: var(--text-3); }

/* ---------- listas de upgrades ---------- */
.rows { list-style: none; margin: 0; padding: 0 8px 10px; }
.row-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border-radius: var(--r); }
.row-item + .row-item { border-top: 1px solid rgba(38, 48, 65, 0.6); }
.row-item img, .row-item .art-missing { width: 42px; height: 42px; object-fit: contain; }
.row-item b { display: block; font-size: 13.5px; font-weight: 650; }
.row-item small { color: var(--text-3); font-size: 12.5px; }
.row-item .right { text-align: right; display: grid; gap: 2px; justify-items: end; }
.row-item .time { font-family: var(--display); font-stretch: 80%; font-weight: 650; font-size: 17px; color: var(--busy); }
.row-item .time.is-ready { color: var(--ready); }
.mini-ring { width: 26px; height: 26px; transform: rotate(-90deg); }
.mini-ring circle { fill: none; stroke-width: 4; }
.mini-ring .t { stroke: #202a39; }
.mini-ring .f { stroke: var(--busy); stroke-linecap: round; }

/* ---------- planejador: faixas de lançamento ---------- */
.plan-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); margin-top: 14px; }
.plan-stat { padding: 12px 18px; }
.plan-stat + .plan-stat { border-left: 1px solid var(--line); }
.plan-stat small { display: block; font-size: 12px; color: var(--text-3); }
.plan-stat b { font-family: var(--display); font-stretch: 84%; font-size: 21px; font-weight: 650; }
.lanes { padding: 8px 18px 18px; display: grid; gap: 8px; }
.lane { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 12px; align-items: center; }
.lane-name { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.lane-track { position: relative; height: 26px; border-radius: 4px; background: #0b1018; border: 1px solid var(--line); overflow: hidden; }
.lane-seg { position: absolute; top: 3px; bottom: 3px; min-width: 3px; border-radius: 3px; background: linear-gradient(180deg, #9a6cf0, #7e53d6); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); }
.lane-seg:nth-child(even) { background: linear-gradient(180deg, #7d58c7, #6645ad); }
.lane-scale { display: flex; justify-content: space-between; margin-left: 120px; font-size: 11.5px; color: var(--text-3); }
.help-text { margin: 0; color: var(--text-3); font-size: 12.5px; line-height: 1.6; max-width: 72ch; }

/* ---------- histórico ---------- */
.trend { padding: 6px 18px 4px; }
.trend svg { width: 100%; height: 140px; display: block; }
.trend .axis { stroke: #202a39; stroke-width: 1; }
.trend .line { fill: none; stroke: var(--gold); stroke-width: 2; }
.trend .area { fill: url(#trend-fill); }
.trend .dot { fill: var(--gold); }
.trend text { fill: var(--text-3); font: 11px var(--ui); }
.change { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; padding: 7px 10px; font-size: 13px; }
.change .kind { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ready-dim); color: var(--ready); }
.change .kind svg { width: 14px; height: 14px; }
.change b { font-weight: 650; }
.change span { color: var(--text-3); }

/* ---------- estados vazios e passe inativo ---------- */
.empty { padding: 36px 30px; display: grid; gap: 16px; justify-items: start; max-width: 720px; }
.empty h1 { font-size: clamp(26px, 3.2vw, 38px); font-weight: 650; line-height: 1.1; }
.empty p { margin: 0; color: var(--text-2); font-size: 15px; line-height: 1.6; max-width: 60ch; }
.steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.steps li { counter-increment: step; position: relative; min-height: 28px; padding: 3px 0 0 40px; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--gold-dim); color: var(--gold); font-family: var(--display); font-weight: 700; font-size: 14px; }
.steps b { color: var(--text); }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.skeleton { height: 220px; border-radius: var(--r); background: linear-gradient(90deg, rgba(20, 26, 37, 0.7), rgba(30, 38, 52, 0.7), rgba(20, 26, 37, 0.7)); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* imagens que faltam */
.art-missing { display: inline-grid; place-items: center; border: 1px dashed #334055; border-radius: var(--r); color: var(--text-3); font-family: var(--display); font-weight: 700; font-size: 12px; background: rgba(11, 16, 24, 0.7); }

/* ---------- diálogos e folha lateral ---------- */
dialog { padding: 0; border: 0; background: transparent; color: var(--text); max-width: none; max-height: none; }
dialog::backdrop { background: rgba(4, 6, 10, 0.72); backdrop-filter: blur(3px); }
.dialog-panel {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel-solid);
  box-shadow: 0 6px 10px -4px rgba(0, 0, 0, 0.7);
}
.dialog-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.dialog-head h2 { font-size: 20px; font-weight: 650; }
.dialog-head .icon-btn { margin-left: auto; width: 36px; height: 36px; }
.dialog-body { padding: 16px 20px; display: grid; gap: 0; }
.dialog-body > p { margin: 0 0 14px; color: var(--text-2); line-height: 1.55; }
.dialog-foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.dialog-foot .spacer { flex: 1; }
dialog.is-sheet { margin: 0 0 0 auto; height: 100dvh; }
dialog.is-sheet .sheet {
  width: min(460px, 100vw); height: 100dvh; overflow: auto; overscroll-behavior: contain;
  border-left: 1px solid var(--line-strong); background: var(--panel-solid);
  box-shadow: -6px 0 10px -4px rgba(0, 0, 0, 0.7);
  display: flex; flex-direction: column;
}
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--panel-solid); border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 19px; font-weight: 650; }
.sheet-head .icon-btn { margin-left: auto; width: 36px; height: 36px; }
.sheet-section { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sheet-section > h3 { font-size: 14px; font-weight: 700; font-stretch: 106%; margin: 0 0 12px; }
.sheet-section > p { margin: 0 0 12px; color: var(--text-2); font-size: 13px; line-height: 1.55; }
.pass-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--gold-dim); border-radius: var(--r); background: linear-gradient(180deg, rgba(242, 193, 78, 0.08), rgba(17, 23, 33, 0.6)); }
.pass-card .pass-period { font-family: var(--display); font-weight: 700; font-stretch: 104%; font-size: 18px; }
.pass-card dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.pass-card dt { color: var(--text-3); }
.pass-card dd { margin: 0; color: var(--text); font-weight: 600; }
.key-once { margin-top: 12px; padding: 12px; border: 1px solid var(--ready-dim); border-radius: var(--r); background: rgba(13, 38, 44, 0.6); display: grid; gap: 8px; }
.key-once code { font: 12.5px/1.5 ui-monospace, 'Cascadia Mono', Consolas, monospace; color: var(--ready); word-break: break-all; }
.sub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sub { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r); background: rgba(11, 16, 24, 0.6); }
.sub b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub small { grid-column: 1; color: var(--text-3); font-size: 12px; }
.sub > .btn { grid-row: 1 / span 2; grid-column: 2; min-height: 34px; padding: 6px 12px; }
.sub.is-off b { color: var(--danger); }
.sub > .route { grid-column: 1 / -1; margin-top: 6px; border-top: 1px solid var(--line); }

/* destino de WhatsApp: disclosure nativo, editado no próprio item (sem segundo modal) */
.sheet-section > .route, .subrow-body > .route { border: 1px solid var(--line); border-radius: var(--r); background: rgba(11, 16, 24, 0.6); }
.route > summary, .legacy > summary {
  display: flex; align-items: center; gap: 8px; min-height: 40px; list-style: none; cursor: pointer;
  font-size: 13px; color: var(--text-2);
}
.route > summary { padding: 8px 2px; }
.sheet-section > .route > summary, .subrow-body > .route > summary { padding: 8px 12px; }
.route > summary::-webkit-details-marker, .legacy > summary::-webkit-details-marker { display: none; }
.route > summary::after, .legacy > summary::after {
  content: ''; flex: none; margin-left: auto; width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
  transform: translateY(-2px) rotate(45deg); transition: transform 160ms var(--ease-out);
}
.route[open] > summary::after, .legacy[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.route-title { font-weight: 600; color: var(--text); }
.route > summary small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 12px; }
.route .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.route .dot.is-on { background: var(--ready); }
.route .dot.is-off { background: var(--danger); }
.route .dot.is-none { box-shadow: inset 0 0 0 1.5px var(--text-3); }
.route-form { display: grid; gap: 14px; padding: 6px 2px 12px; }
.sheet-section > .route .route-form, .subrow-body > .route .route-form { padding: 6px 12px 14px; }
.route-form .field + .field { margin-top: 0; }
.choice { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; border: 0; min-width: 0; }
.choice legend { width: 100%; padding: 0; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.choice label { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13.5px; cursor: pointer; }
.choice input { width: 16px; height: 16px; margin: 0; }
.route-last { margin: 0; font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.route-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.route-intro { margin: 0 0 12px; }
.legacy { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line); }
.legacy > summary { font-weight: 600; }
.legacy > .help { display: block; margin: 4px 0 12px; font-size: 12px; color: var(--text-3); line-height: 1.5; }
.sheet-foot { margin-top: auto; padding: 16px 20px 24px; display: flex; gap: 8px; }

/* ---------- painel de assinantes (/admin) ---------- */
.admin-shell { grid-template-columns: minmax(0, 1fr); gap: 18px; }
.admin-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 22px; align-items: end; padding: 22px 24px; }
.admin-head h1 { font-size: clamp(24px, 2.4vw, 34px); font-weight: 650; line-height: 1.05; }
.admin-head p { margin: 6px 0 0; color: var(--text-2); font-size: 13.5px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-notices { grid-column: 1 / -1; display: grid; gap: 8px; }
.admin-notices:empty { display: none; }
.admin-notices .route-intro { margin: 0; }
.admin-pair { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
/* régua de números: uma moldura, divisões finas, nada de cartões */
.ledger { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 14px; border-top: 1px solid var(--line); }
.ledger > div { padding: 14px 18px; border-bottom: 1px solid var(--line); min-width: 0; }
.ledger > div:not(:nth-child(4n + 1)) { border-left: 1px solid var(--line); }
.ledger small { display: block; font-size: 12px; color: var(--text-3); }
.ledger b { display: block; margin: 4px 0 2px; font-family: var(--display); font-stretch: 84%; font-size: 21px; font-weight: 650; line-height: 1.1; }
.ledger b small { display: inline; font-family: var(--ui); font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.ledger b.is-money { color: var(--gold); }
.ledger span { font-size: 12px; color: var(--text-3); }
.ledger-foot { margin: 0; padding: 12px 18px 16px; font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.table-wrap { margin-top: 10px; overflow-x: auto; overscroll-behavior-x: contain; }
.months { width: 100%; border-collapse: collapse; font-size: 13px; }
.months th, .months td { padding: 9px 18px; text-align: left; border-bottom: 1px solid var(--line); }
.months thead th { padding-block: 6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.months tbody th { font-weight: 600; color: var(--text); white-space: nowrap; }
.months tbody tr:last-child > * { border-bottom: 0; }
.months .num { text-align: right; font-family: var(--display); font-stretch: 84%; font-weight: 650; }
.money-bar { display: grid; grid-template-columns: minmax(40px, 1fr) 7.5em; gap: 12px; align-items: center; }
.money-bar i { position: relative; height: 6px; border-radius: 2px; background: var(--slate-3); overflow: hidden; }
.money-bar i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: calc(var(--w, 0) * 1%); border-radius: 2px; background: var(--gold-soft); }
.money-bar b { font-family: var(--display); font-stretch: 84%; font-weight: 650; color: var(--gold); white-space: nowrap; text-align: right; }
.soon-list { list-style: none; margin: 10px 0 0; padding: 0 10px 10px; display: grid; gap: 4px; }
.soon {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 10px; border: 1px solid transparent; border-radius: var(--r); background: transparent; text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease;
}
.soon b { display: block; font-size: 13.5px; font-weight: 650; }
.soon small { display: block; font-size: 12px; color: var(--text-3); }
.due { font-family: var(--display); font-stretch: 78%; font-weight: 650; font-size: 17px; color: var(--busy); white-space: nowrap; }
/* lista de assinantes: cabeçalho de colunas no desktop, cartão por pessoa no celular */
.subs-tools { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.subs-tools .field + .field { margin-top: 0; }
.subs-cols {
  display: grid; gap: 12px; align-items: center;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 0.95fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 0.95fr) 12px;
}
.subs-head { padding: 10px 18px; font-size: 12px; font-weight: 600; color: var(--text-3); border-bottom: 1px solid var(--line); }
.subrow { border-bottom: 1px solid var(--line); }
.subrow:last-child { border-bottom: 0; }
.subrow > summary { padding: 12px 18px; cursor: pointer; list-style: none; transition: background-color 160ms ease; }
.subrow > summary::-webkit-details-marker { display: none; }
.subrow > summary::after {
  content: ''; justify-self: end; width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3);
  transform: translateY(-2px) rotate(45deg); transition: transform 160ms var(--ease-out);
}
.subrow[open] > summary { background: rgba(26, 34, 48, 0.55); }
.subrow[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.cell { min-width: 0; display: grid; gap: 2px; font-size: 13px; }
.cell > small { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell.who b { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cell .due { font-size: 16px; }
.price { font-weight: 650; color: var(--gold); }
.pass-state { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; }
.state-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.state-dot.is-on { background: var(--ready); }
.state-dot.is-off { background: var(--danger); }
.state-dot.is-none { box-shadow: inset 0 0 0 1.5px var(--text-3); }
.subrow-body { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px; padding: 14px 18px 18px; background: rgba(11, 16, 24, 0.35); }
.subrow-body h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 650; }
.subrow-body dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 13px; }
.subrow-body dt { color: var(--text-3); }
.subrow-body dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.subrow-actions { display: grid; gap: 10px; align-content: start; }
.subrow-actions h3 { margin-bottom: 0; }
.subrow-body > .route { grid-column: 1 / -1; }
@media (hover: hover) and (pointer: fine) {
  .subrow > summary:hover { background: rgba(26, 34, 48, 0.4); }
  .soon:hover { border-color: var(--line-strong); background: rgba(26, 34, 48, 0.6); }
}

/* ---------- avisos ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--panel-solid); color: var(--text); font-size: 13.5px; line-height: 1.45;
  box-shadow: 0 6px 10px -4px rgba(0, 0, 0, 0.7);
  opacity: 1; transform: translateY(0);
  transition: opacity 400ms ease, transform 400ms ease;
}
.toast.is-entering, .toast.is-leaving { opacity: 0; transform: translateY(100%); }
.toast-success { border-color: var(--ready-dim); }
.toast-success::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--ready); vertical-align: 1px; }
.toast-error { border-color: #6b2c33; background: #2b1115; color: #ffd0d0; }

.legal { margin: 26px 0 0; text-align: center; font-size: 12px; color: var(--text-3); }

/* ---------- login ---------- */
.page-login { display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh; }
.page-login .topbar { position: relative; background: transparent; border-bottom: 0; backdrop-filter: none; }
.page-login { --stage: 520px; }
.page-login .scene { --fig-h: min(100dvh, 1000px); }
.page-login .scene-figure { opacity: 0.95; }
.page-login .scene::after { background: radial-gradient(ellipse 30% 58% at 50% 50%, rgba(8, 11, 16, 0.86), rgba(8, 11, 16, 0.2) 72%, transparent), linear-gradient(180deg, transparent 72%, rgba(8, 11, 16, 0.9)); }
.gate { align-self: center; justify-self: center; width: min(420px, calc(100vw - 32px)); padding: 30px 28px 26px; display: grid; gap: 16px; }
.gate h1 { font-size: 30px; font-weight: 700; font-stretch: 104%; line-height: 1.1; }
.gate h1 span { color: var(--gold); }
.gate p { margin: 0; color: var(--text-2); line-height: 1.55; }
.gate form { display: grid; gap: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.gate .hint { font-size: 12.5px; color: var(--text-3); text-align: center; }
.gate-foot { font-size: 12px; color: var(--text-3); text-align: center; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  :root { --rail: 248px; }
  .cooldowns { grid-template-columns: 1fr; }
  .next-up { border-right: 0; border-bottom: 1px solid var(--line); grid-template-columns: auto minmax(0, 1fr); column-gap: 20px; }
  .next-up .next-label { grid-column: 1 / -1; }
  .next-up .builders-free { grid-column: 1 / -1; }
  .village-head { grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: 'hall title' 'chips chips' 'actions actions'; }
  .village-hall { width: 84px; height: 84px; }
}
@media (max-width: 860px) {
  :root { --top: 56px; }
  .shell { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 14px; width: min(var(--shell), 100% - 24px); }
  .shell > * { min-width: 0; }
  .rail { position: static; }
  .rail > .frame { max-height: none; }
  .admin-head { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .admin-pair { grid-template-columns: minmax(0, 1fr); }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger > div:not(:nth-child(4n + 1)) { border-left: 0; }
  .ledger > div:nth-child(2n) { border-left: 1px solid var(--line); }
  .subs-tools { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .subs-tools .subs-search { grid-column: 1 / -1; }
  .subs-head { display: none; }
  .months th, .months td { padding-inline: 12px; }
  .money-bar { grid-template-columns: auto; }
  .money-bar i { display: none; }
  .money-bar b { text-align: left; }
  .subrow > summary.subs-cols { position: relative; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; row-gap: 12px; padding-right: 40px; }
  .subrow > summary .who { grid-column: 1 / -1; }
  .subrow > summary::after { position: absolute; top: 20px; right: 20px; }
  .cell-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
  .subrow-body { grid-template-columns: minmax(0, 1fr); }
  .rail > .frame > .party-list { min-height: 0; overflow-y: hidden; }
  .party-list { grid-auto-flow: column; grid-auto-columns: minmax(230px, 78%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 12px; }
  .party-list[data-fade=end] { -webkit-mask-image: linear-gradient(to right, var(--night) calc(100% - 32px), transparent); mask-image: linear-gradient(to right, var(--night) calc(100% - 32px), transparent); }
  .party-list[data-fade=start] { -webkit-mask-image: linear-gradient(to left, var(--night) calc(100% - 32px), transparent); mask-image: linear-gradient(to left, var(--night) calc(100% - 32px), transparent); }
  .party-list[data-fade=both] { -webkit-mask-image: linear-gradient(to right, transparent, var(--night) 32px, var(--night) calc(100% - 32px), transparent); mask-image: linear-gradient(to right, transparent, var(--night) 32px, var(--night) calc(100% - 32px), transparent); }
  .party { scroll-snap-align: start; }
  .rail-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rail-actions .btn { font-size: 12.5px; padding-inline: 8px; white-space: normal; text-align: center; }
  .rail-note { display: none; }
  .bases { grid-template-columns: 1fr; }
  .base-block + .base-block { border-left: 0; border-top: 1px solid var(--line); }
  .plan-stats { grid-template-columns: 1fr 1fr; }
  .plan-stat:nth-child(3) { border-left: 0; }
  .plan-stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .brand-line, .pass-chip .pass-long { display: none; }
  /* palco: os rostos ficam na faixa acima do grupo, uma de cada lado */
  .page-app .shell { padding-top: 132px; }
  .scene { --fig-h: 62dvh; }
  .scene-figure { top: 14px; }
  .scene-figure.is-left { left: calc(20vw - var(--fig-h) * 0.353); }
  .scene-figure.is-right { left: calc(80vw - var(--fig-h) * 0.327); }
  .page-app .scene-figure { opacity: 0.92; }
  .scene::after { background: linear-gradient(180deg, transparent 0 180px, rgba(8, 11, 16, 0.7) 320px, rgba(8, 11, 16, 0.9)); }
}
@media (max-width: 560px) {
  .village-head { grid-template-columns: 64px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .village-hall { width: 64px; height: 64px; }
  .next-up { grid-template-columns: 1fr; padding: 16px; }
  .next-time { font-size: 56px; }
  .cd-groups { padding: 14px; }
  .cd-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ring { width: 62px; height: 62px; }
  .ring-art { inset: 11px; }
  .ring-art img, .ring-art .art-missing { width: 38px; height: 38px; }
  .next-cast { grid-template-columns: 52px minmax(0, 1fr); padding: 14px 16px; }
  .slot-art { width: 52px; height: 52px; }
  .next-cast .cost { grid-column: 1 / -1; }
  .bag-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
  .lane { grid-template-columns: 76px minmax(0, 1fr); gap: 8px; }
  .lane-scale { margin-left: 84px; }
  .field-row { grid-template-columns: 1fr; }
  .page-login .scene { --fig-h: 60dvh; }
  .page-login .scene-figure { opacity: 0.85; }
  .page-login .gate { margin-top: 110px; }
  .gate { padding: 24px 20px 20px; }
  .toasts { right: 16px; bottom: 16px; }
  .topbar .btn-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
  .cd.just-ready .ring { animation: none; }
  .tabs-indicator, .toast, .main { transition-duration: 1ms; }
  .toast { transform: none !important; }
  .route > summary::after, .legacy > summary::after { transition: none; }
  .subrow > summary::after { transition: none; }
  .party-list.is-sorting > li, .party-list.is-sorting .party { transition: none; }
  .party-list > li.is-dragging .party { transform: none; }
}

/* ---------- entrada e saída dos diálogos (mesmo caminho nos dois sentidos) ---------- */
.dialog-panel { transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out); }
dialog::backdrop { transition: opacity 250ms var(--ease-out); }
dialog.is-sheet .sheet { transition: transform 360ms var(--ease-drawer); }
/* is-entering vale um quadro: o JS tira a classe e a transição leva ao estado normal */
dialog.is-entering .dialog-panel, dialog.is-closing .dialog-panel { opacity: 0; transform: scale(0.96); }
dialog.is-entering::backdrop, dialog.is-closing::backdrop { opacity: 0; }
dialog.is-sheet.is-entering .sheet, dialog.is-sheet.is-closing .sheet { transform: translateX(100%); }
dialog.is-sheet.is-closing .sheet { transition-duration: 260ms; }
@media (prefers-reduced-motion: reduce) {
  .dialog-panel, dialog::backdrop { transition-duration: 1ms; }
  dialog.is-sheet .sheet { transition: none; }
}
