/* Vision Market — Identidade Visual Oficial (Roxo #793098 + Laranja #F79C39 + Escudo #A94AD7) */

:root {
  --bg: #f8f5fb;
  --surface: #ffffff;
  --surface-2: #f2ebf7;
  --border: #e5d8ee;
  --border-hover: #c9addb;
  --text: #1e1128;
  --text-muted: #645373;
  --brand: #793098;
  --brand-hover: #62227e;
  --brand-bright: #a94ad7;
  --brand-soft: #f5ecfa;
  --brand-border: #d9b8eb;
  --accent: #f79c39;
  --accent-hover: #df8420;
  --accent-soft: #fff4e6;
  --navy: #1e1128;
  --cyan: #793098;
  --cyan-bg: #f5ecfa;
  --amber: #c26a0a;
  --amber-bg: #fff3e0;
  --rose: #be123c;
  --rose-bg: #ffe4e6;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --shadow: 0 2px 6px rgba(121, 48, 152, 0.06), 0 1px 2px rgba(30, 17, 40, 0.04);
  --shadow-lg: 0 22px 48px rgba(30, 17, 40, 0.24);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #0d0814;
  --surface: #171022;
  --surface-2: #211731;
  --border: #322349;
  --border-hover: #4e3672;
  --text: #f5effa;
  --text-muted: #b09ec4;
  --brand: #a94ad7;
  --brand-hover: #9338c2;
  --brand-bright: #c06cf0;
  --brand-soft: rgba(169, 74, 215, 0.16);
  --brand-border: rgba(169, 74, 215, 0.44);
  --accent: #f79c39;
  --accent-hover: #ffae52;
  --accent-soft: rgba(247, 156, 57, 0.16);
  --navy: #ffffff;
  --cyan: #c084fc;
  --cyan-bg: rgba(169, 74, 215, 0.2);
  --amber: #f79c39;
  --amber-bg: rgba(247, 156, 57, 0.18);
  --rose: #fb7185;
  --rose-bg: rgba(244, 63, 94, 0.18);
  --ok: #4ade80;
  --ok-bg: rgba(34, 197, 94, 0.16);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 24px 55px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.48;
  transition: background 0.18s, color 0.18s;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 38px;
  width: auto;
  display: block;
  object-fit: contain;
}

.brand-logo-login {
  height: 58px;
  width: auto;
  display: block;
  margin: 0 auto 8px;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
}

.brand-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.nav-tab {
  background: transparent;
  border: none;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow);
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.badge.emerald { background: var(--brand-soft); color: var(--brand); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.rose { background: var(--rose-bg); color: var(--rose); }
.badge.cyan { background: var(--cyan-bg); color: var(--cyan); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-input, .text-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.select-input:focus, .text-input:focus {
  border-color: var(--brand);
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
}

.dot.online {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.dot.offline {
  background: var(--rose);
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.tab-section {
  display: none;
}

.tab-section.active {
  display: block;
}

/* KPI Strip */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.kpi-card.highlight {
  background: linear-gradient(135deg, var(--brand-soft), var(--accent-soft));
  border-color: var(--brand-border);
}

.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kpi-card.highlight .kpi-label {
  color: var(--brand);
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--navy);
  margin: 6px 0 4px;
  letter-spacing: -0.03em;
}

.kpi-card.highlight .kpi-value {
  color: var(--brand);
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-btn:hover {
  border-color: var(--brand-border);
  color: var(--text);
}

.pill-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.btn {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-bright));
  border-color: var(--brand);
  color: #ffffff;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-hover), var(--brand));
  border-color: var(--brand-hover);
  color: #ffffff;
}

.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #1e1128;
  font-weight: 700;
}

.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #1e1128;
}

.btn-whatsapp {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.btn-whatsapp:hover {
  background: #15803d;
  border-color: #15803d;
  color: #ffffff;
}

.btn-danger {
  background: var(--rose-bg);
  border-color: rgba(190, 18, 60, 0.35);
  color: var(--rose);
}

.btn-danger:hover {
  border-color: var(--rose);
  color: var(--rose);
}

.btn-amber {
  background: var(--amber-bg);
  border-color: rgba(180, 83, 9, 0.35);
  color: var(--amber);
}

.btn-amber:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px 10px;
  font-size: 14px;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
  gap: 16px;
}

.visit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.visit-card:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
  box-shadow: 0 10px 26px rgba(121, 48, 152, 0.16);
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b1320;
  overflow: hidden;
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-top-left {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 6px;
}

.thumb-top-right {
  position: absolute;
  top: 10px;
  right: 10px;
}

.thumb-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 10px 8px;
  background: linear-gradient(transparent, rgba(8, 15, 25, 0.88));
  color: #f8fafc;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
}

.overlay-chip {
  background: rgba(15, 29, 46, 0.84);
  color: #f8fafc;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.overlay-chip.synced {
  background: var(--brand);
  color: #ffffff;
  border: none;
}

.visit-body {
  padding: 14px 16px;
}

.visit-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.visit-store {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.visit-time {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.visit-meta {
  font-size: 12px;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 5px;
}

.visit-reason {
  font-size: 12px;
  color: var(--text-muted);
}

.info-banner {
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 18px;
}

.empty-state {
  text-align: center;
  padding: 56px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  color: var(--text-muted);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 29, 46, 0.72);
  backdrop-filter: blur(5px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 1180px;
  max-height: 94vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal.modal-md { max-width: 740px; }
.modal.modal-sm { max-width: 500px; }

.modal-header {
  padding: 15px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
}

.modal-close {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

.modal-close:hover {
  color: var(--text);
  border-color: var(--brand);
}

.modal-body {
  padding: 20px 22px;
}

/* Dual Video Player */
.video-stage {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.video-stage.dual { grid-template-columns: 1fr 1fr; }
.video-stage.single { grid-template-columns: 1fr; }

@media (max-width: 860px) {
  .video-stage.dual { grid-template-columns: 1fr; }
}

.video-pane {
  background: #02050a;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

.video-pane-label {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(15, 29, 46, 0.85);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.video-pane video {
  width: 100%;
  max-height: 460px;
  display: block;
  background: #000;
}

.transport-bar {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.scrubber-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.scrubber-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.scrubber-wrap input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
  cursor: pointer;
}

.entry-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 20px;
  background: var(--brand);
  border-radius: 2px;
  pointer-events: none;
}

.transport-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.speed-group {
  display: flex;
  gap: 4px;
}

.speed-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text-muted);
}

.speed-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.review-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.review-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pdv-placeholder {
  background: var(--brand-soft);
  border: 1px dashed var(--brand-border);
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* Cameras Grid */
.cameras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 16px;
}

.cam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cam-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #0b1320;
}

.cam-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cam-body {
  padding: 14px 16px;
}

.rtmp-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0;
  word-break: break-all;
}

/* Self-Service Wizard */
.wizard-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.wiz-step {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wiz-step.active {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.wiz-step.done {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.profile-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.profile-card {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
}

.profile-card.selected {
  background: var(--brand-soft);
  border-color: var(--brand);
}

.profile-card strong {
  display: block;
  font-size: 13px;
  color: var(--navy);
  margin-bottom: 3px;
}

.profile-card span {
  font-size: 12px;
  color: var(--text-muted);
}

.mibo-guide {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  font-size: 13px;
}

.mibo-guide ol {
  padding-left: 18px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--text-muted);
}

.mibo-guide strong {
  color: var(--navy);
}

.live-wait-box {
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.live-wait-box.connected {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

/* ROI Canvas Editor */
.roi-canvas-wrap {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-hover);
  margin-bottom: 14px;
}

.roi-canvas-wrap canvas {
  width: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.settings-input-wide {
  width: 290px;
  max-width: 100%;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field input, .field select {
  width: 100%;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 760px;
  box-shadow: var(--shadow);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: none;
}

/* Login Screen */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-screen.open {
  display: flex;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  padding: 28px;
}

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--navy);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  padding: 11px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 400;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s;
}

[data-theme="dark"] .toast {
  background: var(--brand);
  color: #031710;
}

/* Date Filter & Day Grouping */
.date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.date-inputs input[type="date"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 12px;
  color: var(--text);
}

.date-group {
  margin-bottom: 24px;
}

.date-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

.date-group-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
}

/* Report & Export Strip inside Review Modal */
.report-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.report-box label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 6px;
}

.report-box textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13px;
  outline: none;
  margin-bottom: 10px;
}

.report-box textarea:focus {
  border-color: var(--brand);
}

.export-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Users Table */
.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: 18px;
  align-items: start;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   Responsividade Completa (Tablet <= 1024px | Mobile <= 768px | Small <= 480px)
   ========================================================================== */

@media (max-width: 1024px) {
  .topbar {
    padding: 10px 16px;
    gap: 10px;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .container {
    padding: 18px 16px 56px;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 10px 12px;
  }

  .brand-logo {
    height: 30px;
  }

  .brand-divider, .brand-sub {
    display: none;
  }

  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .topbar-right .select-input {
    flex: 1;
    min-width: 0;
  }

  #sys-status-pill {
    display: none;
  }

  .container {
    padding: 14px 12px 48px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
  }

  .kpi-card {
    padding: 12px 13px;
  }

  .kpi-label {
    font-size: 10px;
    flex-wrap: wrap;
    gap: 4px;
  }

  .kpi-value {
    font-size: 22px;
    margin: 4px 0 2px;
  }

  .kpi-sub {
    font-size: 11px;
  }

  .toolbar {
    gap: 10px;
  }

  .filter-pills {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .filter-pills::-webkit-scrollbar {
    display: none;
  }

  .pill-btn {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Modais adaptados para celular */
  .modal-backdrop {
    padding: 8px;
    align-items: flex-end;
  }

  .modal {
    max-height: 95dvh;
    border-radius: 14px 14px 10px 10px;
  }

  .modal-header {
    padding: 12px 14px;
  }

  .modal-header h2 {
    font-size: 15px;
  }

  .modal-body {
    padding: 14px;
  }

  .video-pane video {
    max-height: 38vh;
  }

  .transport-bar {
    padding: 10px;
  }

  .transport-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .transport-controls > div {
    justify-content: space-between;
  }

  .speed-group {
    justify-content: space-between;
  }

  .speed-btn {
    flex: 1;
    padding: 7px 6px;
  }

  .pdv-placeholder {
    flex-direction: column;
    align-items: flex-start;
  }

  .review-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .review-bar .text-input {
    width: 100%;
    min-width: 0 !important;
  }

  .review-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .review-actions .btn {
    justify-content: center;
    min-height: 42px;
  }

  /* Wizard e ROI no mobile */
  .wizard-steps {
    flex-direction: column;
    gap: 6px;
  }

  .profile-cards {
    grid-template-columns: 1fr;
  }

  .rtmp-box {
    flex-direction: column;
    align-items: stretch;
  }

  .rtmp-box > div {
    justify-content: flex-end;
  }

  .live-wait-box {
    flex-direction: column;
    align-items: stretch;
  }

  .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .settings-input-wide {
    width: 100%;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 14px;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar-right .btn-primary {
    font-size: 12px;
    padding: 6px 10px;
  }
}
