/* Radar de Lives — identidade da casa WAP | WAAW */
:root {
  --font: "Segoe UI Variable", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --yellow: #FFB400;
  --amber: #FFB023;
  --lime: #D7FF1A;
  --ok: #4ADE80;
  --warn: #FBBF24;
  --bad: #F87171;
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme="dark"] {
  --bg: #0A0A0A;
  --surface: #121214;
  --surface-2: #19191C;
  --border: #27272A;
  --border-strong: #3F3F46;
  --text: #FAFAFA;
  --text-2: #D4D4D8;
  --muted: #A1A1AA;
  --on-yellow: #0A0A0A;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
  --skeleton: #1C1C1F;
  --skeleton-hi: #26262A;
  --live-bg: rgba(255, 180, 0, .08);
  --yellow-ink: #FFB400;
}

[data-theme="light"] {
  --bg: #F4F4F5;
  --surface: #FFFFFF;
  --surface-2: #FAFAFA;
  --border: #E4E4E7;
  --border-strong: #D4D4D8;
  --text: #0A0A0A;
  --text-2: #27272A;
  --muted: #52525B;
  --on-yellow: #0A0A0A;
  --shadow: 0 1px 2px rgba(10, 10, 10, .04);
  --skeleton: #EDEDEF;
  --skeleton-hi: #F6F6F7;
  --live-bg: rgba(255, 180, 0, .12);
  --yellow-ink: #A15C00;
  --ok: #15803D;
  --warn: #B45309;
  --bad: #DC2626;
}

[data-bw="1"] body { filter: grayscale(1); }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h2 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -.005em; }
button, input { font: inherit; color: inherit; }
img { display: block; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--yellow); color: var(--on-yellow); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: 64px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo { height: 20px; width: auto; }
[data-theme="dark"] .logo--light, [data-theme="light"] .logo--dark { display: none; }
.brand__sep { width: 1px; height: 26px; background: var(--border-strong); }
.brand__name { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name strong { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.brand__name span { font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.monitor {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.monitor__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.monitor.is-ok .monitor__dot { background: var(--ok); }
.monitor.is-running .monitor__dot { background: var(--yellow); animation: blink 1s ease-in-out infinite; }
.monitor.is-down .monitor__dot { background: var(--bad); }

.toolbar { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--text-2); cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.icon-btn[aria-pressed="true"], .icon-btn.is-on { color: var(--yellow-ink); }
.icon-btn.is-spinning svg { animation: spin .9s linear infinite; }
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- layout ---------- */
.shell { width: 100%; max-width: 1440px; margin: 0 auto; padding: 24px 28px 32px; flex: 1; }

.stats {
  display: grid; grid-template-columns: 1.4fr repeat(4, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
}
.stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; border-left: 1px solid var(--border); }
.stat:first-child { border-left: 0; }
.stat__value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__label { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.stat__label small { opacity: .7; }
.stat--hero { background: linear-gradient(90deg, var(--live-bg), transparent); }
.stat--hero .stat__value { font-size: 44px; color: var(--yellow-ink); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); position: relative; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--yellow); animation: ping 1.6s var(--ease) infinite; }

.block { margin-top: 28px; }
.block__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }

/* ---------- live cards ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.live-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.live-card:not(.skeleton) { border-top: 2px solid var(--yellow); }
.live-card:not(.skeleton):hover { transform: translateY(-2px); border-color: var(--border-strong); border-top-color: var(--yellow); }
.live-card.is-new { animation: enter .42s var(--ease) both; }
.live-card__media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.live-card__media img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.live-card__media .placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.live-card__media .placeholder svg { width: 36px; height: 36px; opacity: .5; }
.pill-live {
  position: absolute; top: 10px; left: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--yellow); color: var(--on-yellow);
  font-size: 11px; font-weight: 800; letter-spacing: .08em;
  padding: 4px 9px 4px 8px; border-radius: 4px;
}
.pill-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--on-yellow); animation: blink 1.2s ease-in-out infinite; }
.platform-tag {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(10, 10, 10, .72); color: #FAFAFA; backdrop-filter: blur(6px);
  font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 4px;
}
.platform-tag svg.i { width: 13px; height: 13px; }
.live-card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who__name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who__handle { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-card__title {
  margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta svg.i { width: 14px; height: 14px; }
.live-card__foot { margin-top: auto; display: flex; justify-content: flex-end; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted);
}

/* empty: radar */
.empty-live {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 28px;
  padding: 28px 32px; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface);
}
.radar { position: relative; width: 96px; height: 96px; flex: none; border-radius: 50%; border: 1px solid var(--border-strong); overflow: hidden; }
.radar::before, .radar::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid var(--border); }
.radar::before { inset: 16px; }
.radar::after { inset: 32px; }
.radar__sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255, 180, 0, .35), transparent 70deg);
  animation: spin 3.2s linear infinite;
}
.radar__center { position: absolute; inset: 44px; border-radius: 50%; background: var(--yellow); z-index: 1; }
.empty-live h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; }
.empty-live p { margin: 0; color: var(--muted); max-width: 52ch; }

/* ---------- panels ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; margin-top: 28px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }

.filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: 999px; background: transparent; color: var(--text-2);
  font-size: 12px; cursor: pointer; transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.chip b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip svg.i { width: 14px; height: 14px; }
.chip:hover { border-color: var(--border-strong); }
.chip.is-on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.is-on b { color: inherit; opacity: .7; }
.search { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); min-width: 200px; }
.search:focus-within { border-color: var(--yellow); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--text); }

.profiles { list-style: none; margin: 0; padding: 4px 0; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px 124px 136px 84px; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  transition: background-color .15s var(--ease);
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.is-paused .who, .row.is-paused .plat { opacity: .5; }
.row.is-leaving { opacity: 0; transform: translateX(8px); transition: opacity .18s ease, transform .18s ease; }
.row__err { font-size: 11px; color: var(--bad); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.checked { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.actions { display: flex; justify-content: flex-end; gap: 2px; }
.actions .icon-btn { width: 32px; height: 32px; }
.actions .icon-btn[data-act="remove"]:hover { color: var(--bad); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.status svg.i { width: 13px; height: 13px; }
.status--live { color: var(--on-yellow); background: var(--yellow); border-color: var(--yellow); }
.status--offline { color: var(--muted); }
.status--error { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.status--pending { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.status--paused { color: var(--muted); border-style: dashed; }

.empty-list { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty-list strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty-list .btn { margin-top: 14px; }

.history { list-style: none; margin: 0; padding: 8px 16px 12px; max-height: 560px; overflow: auto; }
.history li { position: relative; padding: 10px 0 10px 20px; border-left: 1px solid var(--border); margin-left: 5px; }
.history li::before { content: ""; position: absolute; left: -5px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.history li.is-on::before { background: var(--yellow); border-color: var(--yellow); }
.history__title { font-weight: 600; font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history__title a { text-decoration: none; }
.history__title a:hover { text-decoration: underline; text-decoration-color: var(--yellow); }
.history__meta { font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.history__meta b { color: var(--yellow-ink); font-weight: 600; }
.history-empty { padding: 28px 0; color: var(--muted); text-align: center; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
}
.btn:active { transform: scale(.98); }
.btn--primary { background: var(--yellow); color: var(--on-yellow); }
.btn--primary:hover { background: var(--amber); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn--ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn[aria-busy="true"] { pointer-events: none; opacity: .75; }
.btn[aria-busy="true"] svg { animation: spin .9s linear infinite; }

/* ---------- footer ---------- */
.foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 28px; border-top: 1px solid var(--border); max-width: 1440px; width: 100%; margin: 0 auto;
}
.channels { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.channel { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; }
.channel svg.i { width: 13px; height: 13px; }
.channel.is-on { color: var(--text-2); }
.channel.is-on svg { color: var(--ok); }
.channel.is-off { opacity: .6; }
.foot__actions { display: flex; align-items: center; gap: 14px; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 40; animation: fade .2s ease both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 41;
  background: var(--surface); border-left: 1px solid var(--border);
  animation: slide-in .26s var(--ease) both;
}
.drawer form { height: 100%; display: flex; flex-direction: column; gap: 20px; padding: 0 22px 22px; overflow: auto; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; height: 64px; border-bottom: 1px solid var(--border); margin: 0 -22px; padding: 0 16px 0 22px; }
.drawer__head h2 { font-size: 17px; }
.drawer__foot { margin-top: auto; display: flex; justify-content: flex-end; gap: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
.seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg legend { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; padding: 0; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label > span {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; color: var(--text-2);
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.seg input:checked + span { border-color: var(--yellow); background: var(--live-bg); color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--yellow); outline-offset: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field input {
  height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); outline: 0;
}
.field input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(255, 180, 0, .18); }
.field input[aria-invalid="true"] { border-color: var(--bad); }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.error { margin: 0; font-size: 12px; color: var(--bad); min-height: 0; }
.error:empty { display: none; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 40px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); animation: toast-in .25s var(--ease) both;
}
.toast.is-out { animation: toast-out .17s ease both; }
.toast__icon { margin-top: 1px; }
.toast--ok .toast__icon { color: var(--ok); }
.toast--bad .toast__icon { color: var(--bad); }
.toast--live { border-left: 3px solid var(--yellow); }
.toast--live .toast__icon { color: var(--yellow); }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font-weight: 650; }
.toast__text { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.toast__actions { display: flex; gap: 6px; align-items: center; }

/* ---------- skeleton ---------- */
.skeleton, .skeleton-row { background: linear-gradient(90deg, var(--skeleton) 25%, var(--skeleton-hi) 50%, var(--skeleton) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.live-card.skeleton { height: 290px; border-color: transparent; }
.skeleton-row { height: 53px; margin: 6px 16px; border-radius: var(--radius-sm); border: 0; }

/* ---------- motion ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(2.6); opacity: 0; } }
@keyframes enter { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(6px); opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }

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

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat--hero { grid-column: 1 / -1; border-bottom: 1px solid var(--border); }
  .stat:nth-child(2) { border-left: 0; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .brand__sep, .brand__name, .monitor__text { display: none; }
  .monitor { padding: 8px; }
  .shell { padding: 16px 14px 24px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { border-left: 0; border-top: 1px solid var(--border); }
  .stat--hero { border-top: 0; }
  .row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "who status" "meta actions"; row-gap: 6px; }
  .row .plat, .row .checked { font-size: 11px; }
  .row > :nth-child(1) { grid-area: who; }
  .row > :nth-child(3) { grid-area: status; justify-self: end; }
  .row > :nth-child(2) { display: none; }
  .row > :nth-child(4) { grid-area: meta; }
  .row > :nth-child(5) { grid-area: actions; }
  .empty-live { flex-direction: column; text-align: center; }
  .foot { padding: 14px; }
  .toolbar { gap: 0; }
  .icon-btn { width: 44px; height: 44px; }
}
