:root,
[data-theme="dark"] {
  color-scheme: dark;
  --page: #07090F;
  --card: #0F1523;
  --soft: #141D30;
  --sky: #162138;
  --sky-top: #10182B;
  --ink: #F8FAFC;
  --muted: #94A3B8;
  --primary: #F5B840;
  --primary-hover: #FFD978;
  --on-primary: #07090F;
  --teal: #25F4EE;
  --teal-soft: rgba(37, 244, 238, 0.14);
  --pink: #FE2C55;
  --pink-soft: rgba(254, 44, 85, 0.16);
  --border: #1E2B45;
  --field-border: #2E4166;
  --success: #34D399;
  --success-soft: rgba(52, 211, 153, 0.15);
  --amber: #F5B840;
  --amber-soft: rgba(245, 184, 64, 0.16);
  --danger: #FE2C55;
  --danger-soft: rgba(254, 44, 85, 0.16);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.58);
  --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.78);
  --radius: 16px;
  --radius-lg: 22px;
}

[data-theme="light"] {
  color-scheme: light;
  --page: #F6F8FC;
  --card: #FFFFFF;
  --soft: #EFF3FA;
  --sky: #E8EEF9;
  --sky-top: #DCE6F7;
  --ink: #0B101D;
  --muted: #4B5B76;
  --primary: #0B101D;
  --primary-hover: #1B253B;
  --on-primary: #FFD978;
  --teal: #0891B2;
  --teal-soft: rgba(8, 145, 178, 0.12);
  --pink: #E11D48;
  --pink-soft: rgba(225, 29, 72, 0.12);
  --border: #D5DFEE;
  --field-border: #B3C3DC;
  --success: #059669;
  --success-soft: #E6F7F0;
  --amber: #B45309;
  --amber-soft: #FEF3C7;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --shadow-sm: 0 2px 8px rgba(11, 16, 29, 0.06);
  --shadow-md: 0 14px 36px rgba(11, 16, 29, 0.11);
  --shadow-lg: 0 24px 64px rgba(11, 16, 29, 0.16);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 15px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink);
  background: var(--page);
  min-height: 100vh;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #FFD978 0%, #F5B840 55%, #D9961E 100%);
  border-color: rgba(255, 226, 138, 0.5);
  color: #07090F;
  box-shadow: 0 8px 22px -8px rgba(245, 184, 64, 0.5);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.btn-teal {
  background: rgba(37, 244, 238, 0.16);
  border-color: #25F4EE;
  color: #25F4EE;
}
[data-theme="light"] .btn-teal {
  background: #0891B2;
  border-color: #0891B2;
  color: #FFFFFF;
}
.btn-teal:hover:not(:disabled) {
  background: #25F4EE;
  color: #07090F;
}
.btn-outline {
  background: var(--card);
  border-color: var(--border);
  color: var(--ink);
}
.btn-outline:hover:not(:disabled) {
  background: var(--soft);
  border-color: var(--teal);
}
.btn-danger {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid var(--field-border);
  background: var(--soft);
  color: var(--ink);
  font-size: 14px;
}
.textarea { min-height: 92px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}

/* Badges / Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--muted);
}
.badge-live { background: var(--pink-soft); color: var(--pink); border-color: rgba(254, 44, 85, 0.45); }
.badge-ok { background: var(--success-soft); color: var(--success); border-color: rgba(52, 211, 153, 0.3); }
.badge-warn { background: var(--amber-soft); color: var(--amber); border-color: rgba(245, 184, 64, 0.35); }
.badge-teal { background: var(--teal-soft); color: var(--teal); border-color: rgba(37, 244, 238, 0.35); }

/* Studio Layout */
.studio-shell {
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.brand-row img {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  box-shadow: 0 0 0 1px rgba(245, 184, 64, 0.45);
}
.brand-row b { font-size: 17px; display: block; line-height: 1.2; letter-spacing: -0.02em; }
.brand-row b span { color: #F5B840; }
.brand-row small { color: var(--teal); font-size: 11.5px; font-weight: 600; }

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  transition: all 0.14s ease;
}
.nav-item:hover { background: var(--soft); color: var(--ink); }
.nav-item.active {
  background: var(--teal-soft);
  border-color: rgba(37, 244, 238, 0.35);
  color: var(--teal);
  font-weight: 700;
}
.nav-item.cta-buy {
  background: linear-gradient(135deg, #FFD978 0%, #F5B840 55%, #D9961E 100%);
  color: #07090F;
  font-weight: 800;
  margin-bottom: 6px;
  box-shadow: 0 8px 20px -8px rgba(245, 184, 64, 0.45);
}
.nav-item.cta-buy:hover { filter: brightness(1.06); color: #07090F; }

.studio-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.content-wrap {
  padding: 22px 24px 90px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Cards & Grids */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-pill {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-pill strong { font-size: 22px; font-weight: 800; }

/* Cloud Phone Cards */
.phones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 16px;
}
.phone-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.phone-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--field-border); }
.phone-card.selected { border: 2px solid var(--teal); box-shadow: 0 0 0 3px rgba(37, 244, 238, 0.16); }
.phone-card.sync-pulse { animation: syncFlash 0.55s ease; }
@keyframes syncFlash {
  0% { box-shadow: 0 0 0 0 rgba(37, 244, 238, 0.75); }
  100% { box-shadow: 0 0 0 14px rgba(37, 244, 238, 0); }
}

.phone-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.phone-viewport-mini {
  position: relative;
  aspect-ratio: 9 / 15.5;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  color: #fff;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(155deg, #0D5860 0%, #09263A 55%, #071320 100%);
  user-select: none;
}
.phone-viewport-mini.wp-sunset {
  background: linear-gradient(155deg, #BE244E 0%, #701A5C 52%, #241446 100%);
}
.phone-viewport-mini.wp-ocean {
  background: linear-gradient(155deg, #1E40AF 0%, #111F4D 60%, #090D1A 100%);
}
.phone-viewport-mini.offline {
  background: #171E2E;
  filter: grayscale(0.8);
}
.pv-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  opacity: 0.92;
}
.pv-cc {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(7, 9, 15, 0.68);
  color: #25F4EE;
  font-weight: 700;
  font-size: 11.5px;
}
.pv-clock {
  font-size: 30px;
  font-weight: 300;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-top: 8px;
}
.pv-dock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.pv-app-dot {
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

/* Device Modal / 3-Tab Drawer (Tela | Proteções da live | Vídeo na câmera) */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  justify-content: flex-end;
}
.drawer-panel {
  width: min(560px, 100vw);
  height: 100vh;
  background: var(--page);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.seg-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--soft);
  border: 1px solid var(--border);
  padding: 5px;
  border-radius: 14px;
  margin: 14px 20px 0;
}
.seg-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 8px;
  border-radius: 10px;
}
.seg-tab.active {
  background: var(--card);
  border-color: var(--teal);
  color: var(--teal);
  box-shadow: var(--shadow-sm);
}

/* Full Interactive Android Screen inside Drawer */
.android-device-frame {
  width: min(334px, 100%);
  aspect-ratio: 9 / 17.5;
  margin: 0 auto;
  border-radius: 30px;
  border: 6px solid #161F33;
  background: linear-gradient(160deg, #0D4B4E 0%, #0F172A 65%, #020617 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(37, 244, 238, 0.2);
}
.android-statusbar {
  display: flex;
  justify-content: space-between;
  padding: 8px 16px 4px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.32);
}
.android-body {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
}
.android-apps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
  margin-top: 14px;
}
.android-icon-btn {
  border: 0;
  background: transparent;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  text-align: center;
  padding: 2px;
  position: relative;
}
.android-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}
.new-icon-pill {
  position: absolute;
  top: -5px;
  right: 2px;
  background: #F5B840;
  color: #07090F;
  font-size: 8.5px;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 99px;
}
.android-navbar {
  display: flex;
  justify-content: space-around;
  padding: 8px 0 10px;
  background: rgba(0, 0, 0, 0.48);
}
.android-navbar button {
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 15px;
  padding: 4px 16px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 120;
  display: grid;
  gap: 8px;
  max-width: 390px;
}
.toast {
  background: #0F1523;
  color: #F8FAFC;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid #263656;
  box-shadow: var(--shadow-md);
  font-size: 13.5px;
  border-left: 4px solid #25F4EE;
  animation: slideIn 0.2s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 50;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 4px;
}
.mobile-bottom-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 2px;
  border-radius: 10px;
}
.mobile-bottom-nav button.active {
  background: var(--teal-soft);
  color: var(--teal);
}

@media (max-width: 960px) {
  .studio-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-bottom-nav { display: grid; }
  .topbar { padding: 12px 16px; }
  .content-wrap { padding: 16px 14px 96px; }
}
