/* Nextra Media — console de operação */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f3f5fa;
  --surface-3: #e9edf5;
  --border: #e3e7ef;
  --border-strong: #cfd6e3;
  --text: #0d1424;
  --text-2: #354056;
  --muted: #6a7389;
  --accent: #3355ff;
  --accent-2: #7b5cff;
  --accent-soft: #edf0ff;
  --accent-ink: #ffffff;
  --grad: linear-gradient(135deg, #3355ff 0%, #7b5cff 100%);
  --ok: #0c9b6a;
  --ok-bg: #e5f6ef;
  --bad: #e0464c;
  --bad-bg: #fdecec;
  --warn: #b97409;
  --warn-bg: #fdf3e1;
  --sidebar: #0a0f1e;
  --sidebar-2: #141b2f;
  --sidebar-text: #9aa4bc;
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 5%);
  --shadow: 0 1px 2px rgb(15 23 42 / 4%), 0 4px 16px -4px rgb(15 23 42 / 8%);
  --shadow-lg: 0 24px 64px -12px rgb(15 23 42 / 28%);
  --radius: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090d18; --surface: #10172a; --surface-2: #151d33; --surface-3: #1c2540; --border: #212b45; --border-strong: #2d3956;
    --text: #e9edf6; --text-2: #c2c9d9; --muted: #8791a8; --accent: #6c84ff; --accent-2: #9a80ff; --accent-soft: #1a2348;
    --grad: linear-gradient(135deg, #4d6bff 0%, #8f6fff 100%);
    --ok: #3fd29a; --ok-bg: #0e2b22; --bad: #ff6b70; --bad-bg: #3a161a; --warn: #f3b648; --warn-bg: #33270f;
    --sidebar: #060912; --sidebar-2: #10172a;
    --shadow-sm: none; --shadow: 0 1px 0 rgb(255 255 255 / 3%) inset; --shadow-lg: 0 24px 64px -12px rgb(0 0 0 / 70%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01"; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 700; }
h2 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 16px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h4 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; }
h4 small { text-transform: none; letter-spacing: 0; font-weight: 400; }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 14px;
  background: var(--sidebar); color: var(--sidebar-text); border-right: 1px solid rgb(255 255 255 / 4%); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand strong { display: block; color: #fff; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 12px; color: var(--sidebar-text); }
.logo { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--grad); color: #fff;
  font-weight: 800; font-size: 18px; box-shadow: 0 8px 20px -6px rgb(80 90 255 / 60%), inset 0 1px 0 rgb(255 255 255 / 25%); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #5d6782; padding: 14px 12px 6px; font-weight: 600; }
.tab { display: flex; align-items: center; gap: 12px; border: 0; background: none; color: var(--sidebar-text); padding: 10px 12px;
  border-radius: 10px; font-weight: 550; cursor: pointer; text-align: left; transition: background .15s, color .15s; }
.tab:hover { background: rgb(255 255 255 / 5%); color: #e6e9f2; }
.tab.active { background: var(--sidebar-2); color: #fff; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 6%); }
.tab.active .i { color: #8ea0ff; }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: rgb(255 255 255 / 7%); color: #c9d0e2; }
.nav-count:empty { display: none; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
  background: var(--sidebar-2); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 5%); }
.side-foot b { display: block; color: #fff; font-size: 13px; font-weight: 600; }
.side-foot small { display: block; font-size: 12px; color: var(--sidebar-text); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #5d6782; flex: none; }
.live-dot.ok { background: #34d399; box-shadow: 0 0 0 4px rgb(52 211 153 / 18%); animation: pulse 2.4s infinite; }
.live-dot.bad { background: #f87171; box-shadow: 0 0 0 4px rgb(248 113 113 / 18%); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgb(52 211 153 / 0%); } }

.content { min-width: 0; padding: 32px 40px 72px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.panel { animation: fade .25s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

/* ---------- botões e controles ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; font-weight: 600;
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px -6px rgb(60 80 255 / 55%), inset 0 1px 0 rgb(255 255 255 / 18%); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: transparent; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: none; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; background: none; color: var(--muted);
  cursor: pointer; border-radius: 9px; transition: background .15s, color .15s; }
.icon-btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn .i { width: 17px; height: 17px; }
.icon-btn.danger:hover { background: var(--bad-bg); color: var(--bad); }
.row-gap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
input:not([type=checkbox]):not([type=range]):not([type=file]), select, textarea {
  height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
input[type=range] { width: 100%; accent-color: var(--accent); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-3); }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); padding: 6px 14px;
  border-radius: 8px; font-weight: 600; cursor: pointer; transition: all .15s; }
.seg button .i { width: 15px; height: 15px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(15 23 42 / 12%); }
.seg.small button { padding: 5px 11px; font-size: 13px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { display: block; color: var(--muted); font-size: 13px; }
.kpi small { display: block; font-size: 12px; }
.kpi.ok b { color: var(--ok); } .kpi.bad b { color: var(--bad); }
.ico-tile { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; flex: none; background: var(--surface-3); color: var(--text-2); }
.ico-tile .i { width: 20px; height: 20px; }
.ico-tile.accent, .kpi .ico-tile.accent { background: var(--accent-soft); color: var(--accent); }
.ico-tile.ok { background: var(--ok-bg); color: var(--ok); }
.ico-tile.bad { background: var(--bad-bg); color: var(--bad); }
.ico-tile.warn { background: var(--warn-bg); color: var(--warn); }
.ico-tile.violet { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); }
.ico-tile.big { width: 52px; height: 52px; border-radius: 14px; }
.title-icon { display: flex; align-items: center; gap: 12px; }
.title-icon .ico-tile { width: 38px; height: 38px; border-radius: 11px; }

/* ---------- status ---------- */
.pill { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.online { color: var(--ok); background: var(--ok-bg); }
.pill.online::before { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.pill.offline { color: var(--bad); background: var(--bad-bg); }
.pill.auth_failed { color: var(--warn); background: var(--warn-bg); }
.pill.unknown { color: var(--muted); background: var(--surface-3); }
.pill.busy { color: var(--accent); background: var(--accent-soft); }
.pill.busy::before { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 550;
  background: var(--surface-3); color: var(--text-2); }
.tag .i { width: 13px; height: 13px; }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.warn-text { color: var(--warn); font-weight: 600; }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); }
.err { font-size: 12.5px; color: var(--bad); background: var(--bad-bg); border-radius: 9px; padding: 8px 10px; margin: 0; overflow-wrap: anywhere; }

/* ---------- faciais ---------- */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 20px; }
.device { display: grid; grid-template-columns: 210px 1fr; gap: 24px; padding: 22px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s; }
.device:hover { box-shadow: 0 2px 4px rgb(15 23 42 / 4%), 0 16px 40px -12px rgb(15 23 42 / 16%); }

/* aparelho desenhado */
.terminal { position: relative; padding: 16px 12px 30px; border-radius: 26px;
  background: linear-gradient(160deg, #2a2f3b 0%, #12151c 55%, #0b0d12 100%);
  box-shadow: 0 18px 36px -14px rgb(10 14 30 / 55%), inset 0 1px 0 rgb(255 255 255 / 10%), inset 0 0 0 1px rgb(255 255 255 / 5%); }
.terminal::before { content: ""; position: absolute; top: 6px; left: 50%; width: 46px; height: 5px; margin-left: -23px; border-radius: 3px;
  background: radial-gradient(circle at 30% 50%, #2c3a5c 0 2px, transparent 2.5px), radial-gradient(circle at 70% 50%, #3a2a1f 0 2px, transparent 2.5px), #05070b; }
.terminal::after { content: ""; position: absolute; bottom: 11px; left: 50%; width: 30px; height: 4px; margin-left: -15px; border-radius: 2px; background: rgb(255 255 255 / 9%); }
.screen { position: relative; aspect-ratio: 580 / 884; background: #000; border-radius: 8px; overflow: hidden; }
.screen .slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s; }
.screen .on { opacity: 1; }
.screen video.slide { object-fit: contain; background: #000; }
.screen .placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 14px;
  text-align: center; color: #aeb7cb; font-size: 12px; background: radial-gradient(120% 80% at 50% 0%, #1f2a4a 0%, #0b0f1c 70%); }
.screen .placeholder .i { width: 26px; height: 26px; color: #8ea0ff; }
.terminal.off .screen { filter: grayscale(1) brightness(.45); }
.screen-clock { position: absolute; left: 20px; bottom: 36px; z-index: 2; color: #fff; font-size: 13px; font-weight: 600;
  text-shadow: 0 1px 4px rgb(0 0 0 / 70%); font-variant-numeric: tabular-nums; pointer-events: none; }
.screen-caption { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.screen-caption .live-dot { width: 6px; height: 6px; }
.screen-caption .live-dot.ok { box-shadow: 0 0 0 3px rgb(52 211 153 / 18%); }

.device-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.device-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.device-head h3 { font-size: 18px; }
.device-head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.now { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.now .eyebrow { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; margin-bottom: 4px; }
.now b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.strip:empty { display: none; }
.strip .chip { position: relative; width: 34px; aspect-ratio: 580 / 884; border-radius: 6px; overflow: hidden; background: var(--surface-3);
  outline: 2px solid transparent; outline-offset: 1px; transition: outline-color .3s; border-bottom: 3px solid transparent; }
.strip .chip.on { outline-color: var(--accent); }
.strip .chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.fact { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
.fact .i { width: 16px; height: 16px; color: var(--muted); margin-top: 2px; }
.fact dt { font-size: 12px; color: var(--muted); }
.fact dd { margin: 1px 0 0; font-size: 13px; font-weight: 550; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.meter span { display: block; height: 100%; border-radius: 3px; background: var(--grad); }
.meter.full span { background: var(--warn); }
.device-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.device-actions .spacer { flex: 1; }
.empty-state { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; text-align: center; padding: 56px 24px; background: var(--surface);
  border: 1.5px dashed var(--border-strong); border-radius: 20px; color: var(--muted); }
.empty-state b { color: var(--text); font-size: 15px; }

/* ---------- mural de locais ---------- */
.board { display: flex; flex-direction: column; gap: 18px; }
.site { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.site-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; flex-wrap: wrap;
  background: linear-gradient(180deg, var(--surface-2), transparent); border-bottom: 1px solid var(--border); }
.site.collapsed .site-head { border-bottom-color: transparent; }
.site.collapsed .tiles { display: none; }
.site-head .chevron .i { transition: transform .2s var(--ease); }
.site.collapsed .chevron .i { transform: rotate(-90deg); }
.site-id { min-width: 180px; flex: 1; }
.site-id h2 { font-size: 16.5px; }
.site-id p { display: flex; align-items: center; gap: 5px; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.site-id p .i { width: 13px; height: 13px; }
.site-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 9px; background: var(--surface-3);
  font-size: 12.5px; color: var(--text-2); }
.stat b { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.stat i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stat.ok { background: var(--ok-bg); color: var(--ok); }
.stat.bad { background: var(--bad-bg); color: var(--bad); }
.stat.ok b, .stat.bad b { color: inherit; }
.site-now { display: flex; flex-direction: column; min-width: 0; max-width: 260px; padding: 0 14px; border-left: 1px solid var(--border); }
.site-now small { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.site-now b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; padding: 18px 20px 20px; }
.tile { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease); min-width: 0; }
.tile:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: 0 2px 4px rgb(15 23 42 / 4%), 0 16px 32px -14px rgb(15 23 42 / 22%); }
.tile.is-off { background: color-mix(in srgb, var(--bad-bg) 35%, var(--surface)); }
.terminal.mini { padding: 10px 8px 20px; border-radius: 18px; }
.terminal.mini::before { top: 4px; width: 30px; height: 4px; margin-left: -15px; }
.terminal.mini::after { bottom: 7px; width: 20px; height: 3px; margin-left: -10px; }
.terminal.mini .screen { border-radius: 6px; }
.tile-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-title b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-title .pill { height: 22px; padding: 0 8px; font-size: 11px; }
.tile-body > small { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-now { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 7px 9px; border-radius: 9px; background: var(--surface-2);
  font-size: 12.5px; font-weight: 550; min-width: 0; }
.tile-now .i { width: 14px; height: 14px; color: var(--accent); }
.tile-now span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.tile-actions .btn { flex: 1; }
.err.small { font-size: 11.5px; padding: 6px 8px; margin-top: 6px; }
.add-tile { align-items: center; justify-content: center; gap: 10px; min-height: 200px; border: 1.5px dashed var(--border-strong); background: none;
  color: var(--muted); font-weight: 600; font-size: 13px; box-shadow: none; }
.add-tile .i { width: 22px; height: 22px; }
.add-tile:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); transform: none; box-shadow: none; }
#detail-body { padding-top: 20px; padding-bottom: 20px; }
#detail-body .device { border: 0; box-shadow: none; padding: 0; grid-template-columns: 240px 1fr; }
#detail-body .device:hover { box-shadow: none; }
.screen img.still { object-fit: contain; background: #000; }
.strip .chip span { position: absolute; left: 0; right: 0; bottom: 0; background: rgb(0 0 0 / 65%); color: #fff; font-size: 9px; text-align: center; line-height: 14px; }
.strip .chip { width: 40px; }

/* ---------- cards genéricos ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card.flush { padding: 6px 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.sites-card { margin-top: 28px; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.inline-form input { flex: 1; min-width: 160px; }
.site-list { list-style: none; margin: 0; padding: 0; }
.site-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--border); }
.site-list li:first-child { border-top: 0; }
.site-list .grow small { margin-left: 6px; }

/* ---------- biblioteca ---------- */
.dropzone { display: flex; align-items: center; gap: 18px; padding: 22px 24px; margin-bottom: 20px; border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius); background: var(--surface); color: var(--text); transition: all .2s; }
.dropzone .ico-tile { background: var(--accent-soft); color: var(--accent); }
.dropzone b { display: block; font-size: 15px; }
.dropzone small { display: block; margin-top: 2px; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.005); }
.toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--muted); min-width: 240px; }
.search input { border: 0 !important; box-shadow: none !important; padding: 0 !important; height: auto !important; background: none !important; flex: 1; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 18px; }
.media { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s; }
.media:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgb(15 23 42 / 4%), 0 18px 36px -14px rgb(15 23 42 / 22%); }
.media .thumb { position: relative; aspect-ratio: 580 / 884; background: #0b0f1a; overflow: hidden; }
.media .thumb img, .media .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media .thumb video { object-fit: contain; background: #000; }
.media .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(0 0 0 / 0%) 60%, rgb(0 0 0 / 45%)); pointer-events: none; }
.kind-tag { position: absolute; left: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 7px; background: rgb(10 14 26 / 72%); color: #fff; font-size: 11.5px; font-weight: 600; backdrop-filter: blur(6px); }
.kind-tag .i { width: 13px; height: 13px; }
.thumb .play { position: absolute; z-index: 2; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  display: grid; place-items: center; background: rgb(255 255 255 / 92%); color: #0d1424; box-shadow: 0 6px 20px rgb(0 0 0 / 35%); transition: opacity .2s, transform .2s; }
.thumb .play .i { width: 18px; height: 18px; fill: currentColor; stroke: none; margin-left: 2px; }
.media .thumb.previewing .play { opacity: 0; transform: scale(.8); }
.media .thumb-actions { position: absolute; top: 8px; right: 8px; z-index: 3; opacity: 0; transition: opacity .2s; }
.media:hover .thumb-actions { opacity: 1; }
.thumb-actions .icon-btn { background: rgb(10 14 26 / 70%); color: #fff; backdrop-filter: blur(6px); }
.thumb-actions .icon-btn:hover { background: var(--bad); color: #fff; }
.media .meta { padding: 12px 14px 14px; }
.media .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; font-weight: 600; }
.media .meta small { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
.thumb .badge { position: absolute; top: 10px; left: 10px; z-index: 2; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 7px; }
.thumb .badge.live { left: auto; right: 10px; background: var(--ok); }

.media .thumb { cursor: pointer; }
.modal.viewer { width: min(560px, calc(100vw - 32px)); }
.viewer-stage { display: grid; place-items: center; background: #000; border-radius: 0 0 22px 22px; overflow: hidden; }
.viewer-stage video, .viewer-stage img { display: block; max-width: 100%; max-height: calc(100vh - 160px); }
.upload-inline small { font-weight: 500; }

/* ---------- atividade ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 34px 1fr auto; gap: 14px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; }
.timeline .ev-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.timeline .ev-ico .i { width: 16px; height: 16px; }
.timeline .warn .ev-ico { background: var(--warn-bg); color: var(--warn); }
.timeline .error .ev-ico { background: var(--bad-bg); color: var(--bad); }
.timeline .ev-msg { min-width: 0; overflow-wrap: anywhere; }
.timeline .ev-msg small { display: block; }
.timeline time { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline .empty { display: block; text-align: center; color: var(--muted); padding: 32px; }

/* ---------- modais ---------- */
.modal { border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--text); width: min(620px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg); }
.modal.wide { width: min(1040px, calc(100vw - 32px)); }
.modal.xwide { width: min(1180px, calc(100vw - 32px)); }
.modal[open] { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal::backdrop { background: rgb(8 12 24 / 55%); backdrop-filter: blur(4px); }
.modal-body { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.modal-head, .modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 24px; }
.modal-head { border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; }
.modal-foot { border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 22px 22px; }
.modal-foot > div { display: flex; gap: 10px; }
.modal-scroll { overflow: auto; padding: 4px 24px 18px; }
.modal-scroll > h4 { margin: 20px 0 8px; }
.foot-info { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.small-note { font-size: 12.5px; }

.editor-cols { display: grid; grid-template-columns: 1.1fr 1fr; overflow: auto; }
.pane { padding: 20px 24px; min-width: 0; }
.pane + .pane { border-left: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.pane-head { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; }
.pane-head h4 { margin: 0; color: var(--text); font-size: 13px; letter-spacing: .03em; }
.pane-head > :last-child:not(h4):not(.step) { margin-left: auto; }
.pane + .pane .pane-head:not(:first-child) { margin-top: 22px; }
.step { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--grad); color: #fff; font-size: 12px; font-weight: 700; flex: none; }
.count-pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.lib-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 12px; flex-wrap: wrap; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; max-height: 50vh; overflow: auto; padding: 3px; }
.pick { position: relative; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 0; cursor: pointer; overflow: hidden;
  text-align: left; color: var(--text); transition: border-color .15s, box-shadow .15s, transform .15s; }
.pick:hover { border-color: var(--accent); transform: translateY(-1px); }
.pick:disabled { opacity: .35; cursor: not-allowed; }
.pick .thumb { position: relative; aspect-ratio: 580 / 884; display: grid; place-items: center; overflow: hidden; background: #0b0f1a; }
.pick .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pick .thumb .play { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
.pick .thumb .play .i { width: 12px; height: 12px; }
.pick .thumb .badge { top: auto; bottom: 6px; left: 6px; font-size: 10.5px; padding: 2px 6px; background: rgb(10 14 26 / 72%); }
.pick span { display: block; font-size: 12px; font-weight: 550; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick.selected { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.pick.selected::after { content: ""; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; z-index: 3;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 13px no-repeat;
  box-shadow: 0 2px 6px rgb(0 0 0 / 30%); }
.upload-inline { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; padding: 12px; border: 1.5px dashed var(--border-strong);
  border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; transition: all .15s; }
.upload-inline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.playlist-edit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: item; max-height: 34vh; overflow: auto; }
.playlist-edit li { display: grid; grid-template-columns: 16px 24px 38px 1fr auto auto; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); counter-increment: item; box-shadow: var(--shadow-sm); }
.playlist-edit li[draggable="true"] { cursor: grab; }
.playlist-edit li::before { content: counter(item); order: 1; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px;
  background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 700; }
.playlist-edit .grip { order: 0; color: var(--muted); display: grid; }
.playlist-edit .grip .i { width: 16px; height: 16px; }
.playlist-edit .mini { order: 2; width: 38px; aspect-ratio: 580 / 884; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.playlist-edit .mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.playlist-edit .name { order: 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.playlist-edit .dur { order: 4; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.playlist-edit .dur .i { width: 14px; height: 14px; }
.playlist-edit .dur input { width: 68px; height: 32px; padding: 0 8px; }
.mode-hint { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft);
  color: var(--text-2); font-size: 12.5px; }
.mode-hint:empty { display: none; }
.mode-hint .i { width: 16px; height: 16px; color: var(--accent); margin-top: 1px; }
.tgroup { display: flex; flex-direction: column; gap: 6px; }
.tgroup + .tgroup { margin-top: 10px; }
.tgroup-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px; cursor: pointer; font-size: 13px; }
.tgroup-head .i { width: 15px; height: 15px; color: var(--muted); }
.tgroup-head small { margin-left: auto; }
.tgroup .target { margin-left: 22px; }
.playlist-edit .ops { order: 5; display: flex; }
.playlist-edit .ops .icon-btn { width: 28px; height: 28px; }
.playlist-edit li.playlist-empty { grid-template-columns: 1fr; justify-items: center; gap: 8px; padding: 28px 16px; border: 1.5px dashed var(--border-strong);
  background: none; box-shadow: none; text-align: center; color: var(--muted); font-size: 13px; }
.playlist-edit li.playlist-empty::before { content: none; }
.playlist-edit li.playlist-empty .i { width: 24px; height: 24px; color: var(--accent); }
.options { margin: 16px 0 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { display: none; }
.switch span { width: 42px; height: 24px; border-radius: 12px; background: var(--border-strong); position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 25%); transition: left .2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { left: 21px; }
.target-list { display: flex; flex-direction: column; gap: 8px; }
.target { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.target:hover { border-color: var(--border-strong); }
.target:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent); }
.target:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.target .grow b { display: block; font-size: 13.5px; }
.target .grow small { display: block; font-size: 12px; }
.progress { position: relative; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; max-width: 420px; }
.progress span { position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 2px; background: var(--grad); animation: indet 1.3s infinite var(--ease); }
@keyframes indet { from { left: -35%; } to { left: 100%; } }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.pad { padding: 20px 24px 6px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.form-grid .full { grid-column: 1 / -1; }
.step-block { padding: 18px 0 4px; }
.step-block + .step-block { border-top: 1px solid var(--border); margin-top: 14px; }
.discover { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.discover li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 13px; background: var(--surface-2); }
.discover li.muted { background: none; border-style: dashed; justify-content: center; }
.test-row { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; }
.test-result { flex: 1; font-size: 13px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); min-height: 38px; }
.test-result.ok { background: var(--ok-bg); color: var(--ok); }
.test-result.bad { background: var(--bad-bg); color: var(--bad); }
label.check { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 8px; color: var(--text) !important; cursor: pointer; font-weight: 500 !important; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast { display: flex; align-items: flex-start; gap: 10px; background: #0e1424; color: #e9edf6; padding: 12px 16px; border-radius: 12px; max-width: 400px;
  box-shadow: 0 12px 32px -8px rgb(0 0 0 / 40%); font-size: 13.5px; animation: slide .3s var(--ease); border: 1px solid rgb(255 255 255 / 8%); }
.toast .i { width: 17px; height: 17px; margin-top: 1px; color: #34d399; }
.toast.error .i { color: #f87171; }
@keyframes slide { from { opacity: 0; transform: translateX(16px); } }

/* ---------- fase comercial (painel, campanhas, anunciantes) ---------- */
.two-cols { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.list li { display: flex; align-items: center; gap: 10px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex: none; }
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alerts li { padding: 10px 12px; border-radius: 10px; font-size: 13px; background: var(--surface-2); }
.alerts li.bad { background: var(--bad-bg); color: var(--bad); }
.alerts li.warn { background: var(--warn-bg); color: var(--warn); }
.alerts li.ok { background: var(--ok-bg); color: var(--ok); }
.occ-row { display: grid; grid-template-columns: 180px 1fr 48px; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.occ-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { display: flex; height: 12px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar .seg { height: 100%; border-right: 1px solid var(--surface); padding: 0; border-radius: 0; background: none; }
.occ-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.grid tr:last-child td { border-bottom: 0; }
.grid th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); }
.grid td.actions { white-space: nowrap; text-align: right; }
.grid td.actions .btn { margin-left: 4px; }
.thumbs { display: inline-flex; gap: 3px; align-items: center; }
.thumbs img { width: 22px; aspect-ratio: 580 / 884; object-fit: cover; border-radius: 4px; }
.pill.c-running { color: var(--ok); background: var(--ok-bg); }
.pill.c-scheduled { color: var(--accent); background: var(--accent-soft); }
.pill.c-draft, .pill.c-ended { color: var(--muted); background: var(--surface-3); }
.pill.c-paused { color: var(--warn); background: var(--warn-bg); }
fieldset.weekdays { border: 1px solid var(--border); border-radius: 10px; display: flex; flex-wrap: wrap; gap: 14px; padding: 10px 14px; }
fieldset.weekdays legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.modal-scroll .form-grid { padding-top: 18px; }
.targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.targets > .check { grid-column: 1 / -1; }
.check-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-height: 150px; overflow: auto; }
.availability { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.availability p { margin: 0 0 6px; }
.avail-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
.avail-list li { display: flex; justify-content: space-between; gap: 8px; }
.avail-list li.bad { color: var(--bad); font-weight: 600; }
.notes { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; font-size: 13px; color: var(--muted); }
.media-actions { margin-top: 6px; }
.report-head { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; flex-wrap: wrap; }
.report-head h2 { margin: 2px 0; font-size: 22px; }
.report-head p { margin: 2px 0; }
.report-head .right { text-align: right; }
.method { font-size: 12px; color: var(--muted); margin-top: 14px; line-height: 1.5; }

@media print {
  body > *:not(#report-dialog) { display: none !important; }
  #report-dialog { position: static; box-shadow: none; width: 100%; max-height: none; }
  #report-dialog .modal-head .row-gap { display: none; }
  .modal-body { max-height: none; }
}

/* ---------- responsivo ---------- */
@media (max-width: 1280px) { .device-grid { grid-template-columns: 1fr; } }
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; height: auto; flex-direction: row; align-items: center; gap: 14px; padding: 10px 16px; overflow-x: auto; }
  .brand small, .nav-label, .side-foot { display: none; }
  .nav { flex-direction: row; }
  .tab { padding: 8px 12px; white-space: nowrap; }
  .content { padding: 22px 16px 60px; }
  .editor-cols { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 1px solid var(--border); }
  .two-cols { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .device, #detail-body .device { grid-template-columns: 1fr; }
  .site-now { border-left: 0; padding: 0; max-width: none; }
  .site-actions { margin-left: 0; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); padding: 14px; }
  .terminal { max-width: 230px; margin: 0 auto; }
  .facts, .form-grid { grid-template-columns: 1fr; }
  .device-grid { grid-template-columns: 1fr; }
  .search { min-width: 0; flex: 1; }
  .timeline li { grid-template-columns: 34px 1fr; }
  .timeline time { grid-column: 2; }
}

/* Portal na nuvem: login e gateways */
.login-page { min-height: 100vh; background: var(--bg); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; margin: 0; }
.login-card .brand { padding: 0 0 6px; }
.login-card .brand strong { color: var(--text); }
.login-card .brand small { color: var(--muted); }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 550; color: var(--text-2); }
.gw-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.gw-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.gw-list li .gw-main { flex: 1 1 220px; min-width: 0; }
.gw-list li .gw-main small { display: block; color: var(--muted); }
.gw-code { font: 600 20px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .06em; padding: 12px; border-radius: var(--radius-sm); background: var(--accent-soft); text-align: center; user-select: all; overflow-wrap: anywhere; }
