/* Passada — componentes */

/* ---------- barra superior ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--chalk) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.topbar .wrap { height: 100%; display: flex; align-items: center; gap: 28px; }
.topnav { display: flex; gap: 4px; align-items: center; }
.topnav a {
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  font-weight: 600;
  font-stretch: var(--w-semi);
  font-size: var(--fs-14);
}
.topnav a:hover { background: var(--chalk-deep); color: var(--ink); }
.topnav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.server-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-tint); }
.server-dot.off { background: var(--priority); box-shadow: 0 0 0 3px var(--priority-tint); }

/* ---------- botões ---------- */
.btn {
  --h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--h);
  padding: 0 18px;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  background: transparent;
  font-weight: 650;
  font-stretch: var(--w-semi);
  font-size: var(--fs-16);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--ink); color: var(--chalk); }
.btn-primary:hover { background: #000; }
.btn-quiet { border-color: var(--rule-strong); color: var(--ink); background: transparent; }
.btn-quiet:hover { background: var(--chalk-deep); border-color: var(--ink-3); }
.btn-text { padding: 0 10px; color: var(--ink-2); }
.btn-text:hover { color: var(--ink); background: var(--chalk-deep); }
.btn-ghost { background: var(--ghost-ink); color: #fff; }
.btn-ghost:hover { background: #4A2FD6; }
.btn-lg { --h: 56px; font-size: var(--fs-18); padding: 0 26px; border-radius: 12px; }
.btn-sm { --h: 34px; font-size: var(--fs-14); padding: 0 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-plate { background: rgba(255, 255, 255, .08); color: var(--plate-text); border-color: var(--plate-line); }
.btn-plate:hover { background: rgba(255, 255, 255, .15); }
.btn-plate.is-on { background: var(--plate-text); color: #000; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-ctl);
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  transition: background var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--chalk-deep); }
.plate .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- campos ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--ink-2);
  font-stretch: var(--w-semi);
}
.field small { color: var(--ink-3); font-size: var(--fs-13); }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.45; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ghost-tint); outline: none; }
.input-unit { position: relative; }
.input-unit .input { padding-right: 52px; }
.input-unit em {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-style: normal; color: var(--ink-3); font-size: var(--fs-14); pointer-events: none;
}
.grid-fields { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* controle segmentado */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--chalk-deep);
}
.seg button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  font-weight: 600;
  font-stretch: var(--w-semi);
  color: var(--ink-2);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--rule); }
.seg--block { display: flex; }
.seg--block button { flex: 1; }
.plate .seg { background: rgba(255, 255, 255, .07); }
.plate .seg button { color: var(--plate-text-2); }
.plate .seg button:hover { color: var(--plate-text); }
.plate .seg button[aria-pressed="true"] { background: var(--plate-text); color: #000; box-shadow: none; }

/* chips de opção (múltipla escolha) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--rule-strong);
  background: var(--paper);
  font-weight: 550;
  font-size: var(--fs-14);
  color: var(--ink-2);
  transition: all var(--t-fast) var(--ease);
}
.choice:hover { border-color: var(--ink-3); color: var(--ink); }
.choice[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--chalk); }

/* ---------- etiquetas ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--chalk-deep);
  color: var(--ink-2);
  font-size: var(--fs-13);
  font-weight: 600;
  font-stretch: var(--w-semi);
  white-space: nowrap;
}
.chip b { color: var(--ink); font-weight: 750; }
.plate .chip { background: rgba(255, 255, 255, .09); color: var(--plate-text-2); }
.plate .chip b { color: var(--plate-text); }

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--fs-13); font-weight: 700; font-stretch: var(--w-semi);
  padding: 3px 10px 3px 8px; border-radius: var(--r-pill);
  white-space: nowrap;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status--priority { color: var(--priority); background: var(--priority-tint); }
.status--watch { color: var(--watch); background: var(--watch-tint); }
.status--ok { color: var(--ok); background: var(--ok-tint); }
.status--info { color: var(--ink-2); background: var(--chalk-deep); }

.side-tag {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; border-radius: 6px;
  font-size: 11px; font-weight: 800; color: #fff; line-height: 1;
  font-stretch: var(--w-cond);
}
.side-tag--L { background: var(--left-ink); }
.side-tag--R { background: var(--right-ink); }

/* ---------- superfícies ---------- */
.plate {
  position: relative;
  background: var(--plate);
  color: var(--plate-text);
  border-radius: var(--r-plate);
  overflow: hidden;
  isolation: isolate;
  box-shadow: var(--shadow-plate);
}
.panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-panel);
}
.panel-pad { padding: 20px; }
.section { padding-block: clamp(40px, 6vw, 88px); }
.section + .section { border-top: 1px solid var(--rule); }
.section-head { display: flex; align-items: end; gap: 24px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 28px; }
.section-head p { color: var(--ink-3); max-width: 60ch; }
.kicker { font-size: var(--fs-14); color: var(--ink-3); font-weight: 600; font-stretch: var(--w-semi); }

/* ---------- interruptor (toggles do palco) ---------- */
.switch {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 36px; padding: 0 12px 0 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--plate-line);
  background: rgba(255, 255, 255, .04);
  color: var(--plate-text-2);
  font-size: var(--fs-14); font-weight: 600; font-stretch: var(--w-semi);
  transition: all var(--t-fast) var(--ease);
}
.switch i {
  width: 26px; height: 16px; border-radius: 99px; position: relative;
  background: rgba(255, 255, 255, .18);
  transition: background var(--t-fast) var(--ease);
}
.switch i::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; transition: transform var(--t) var(--ease);
}
.switch[aria-pressed="true"] { color: var(--plate-text); border-color: rgba(255, 255, 255, .28); }
.switch[aria-pressed="true"] i { background: var(--sw, var(--plate-text-2)); }
.switch[aria-pressed="true"] i::after { transform: translateX(10px); }
.switch:hover { color: var(--plate-text); }

/* ---------- progresso ---------- */
.bar { height: 6px; border-radius: 99px; background: var(--chalk-deep); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: inherit; transition: width var(--t) var(--ease); }
.plate .bar { background: rgba(255, 255, 255, .12); }
.plate .bar > i { background: var(--ghost); box-shadow: 0 0 12px var(--ghost-glow); }

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

/* ---------- notificações ---------- */
.toasts {
  position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(560px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: var(--chalk);
  box-shadow: var(--shadow-pop);
  font-weight: 550; font-size: var(--fs-14);
  animation: toast-in var(--t) var(--ease);
}
.toast--error { background: var(--priority); color: #fff; }
.toast--ok::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5BE3A1; flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- modal / gaveta ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(12, 14, 18, .48);
  display: grid; place-items: center;
  padding: 16px;
  animation: fade-in var(--t) var(--ease);
}
.dialog {
  width: min(960px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: var(--chalk);
  border-radius: var(--r-plate);
  box-shadow: var(--shadow-pop);
  animation: dialog-in var(--t-slow) var(--ease);
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }

/* ---------- tabelas ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.table th { text-align: left; font-weight: 650; color: var(--ink-3); font-stretch: var(--w-semi); padding: 10px 12px; border-bottom: 1px solid var(--rule); }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tr.is-link { cursor: pointer; }
.table tr.is-link:hover td { background: var(--paper); }

/* ---------- vazio ---------- */
.empty {
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-panel);
  padding: 32px;
  display: grid; gap: 12px; justify-items: start;
  color: var(--ink-2);
}

/* ---------- utilidades de layout responsivo ---------- */
.only-mobile { display: none; }
@media (max-width: 760px) {
  .only-desktop { display: none !important; }
  .only-mobile { display: initial; }
  .topbar .wrap { gap: 12px; }
  .topnav a { padding: 8px 8px; }
}

/* trava (29/11/2026): enquanto uma tarefa prioritária roda (conferir o vídeo, procurar o trecho, medir na imagem), o resto da tela fica parado; inert tira o toque e o foco */
.lock { transition: opacity .2s; }
.lock.is-locked { opacity: .45; pointer-events: none; user-select: none; }
