/* ==========================================================================
   HYDRABROKER — PAINEL ADMINISTRATIVO HQ
   Design System: Quadcode Dark Slate & Lime Signature · Glassmorphism · Bento Grid
   ========================================================================== */

:root {
  /* Surfaces */
  --bg: #111214;
  --panel: #131822;
  --panel-elevated: #1a202c;
  --card: #1a202c;
  --card-elevated: #202838;
  --card-hover: #263042;
  
  /* Borders & Lines */
  --line: rgba(255, 255, 255, 0.06);
  --line-hover: rgba(255, 255, 255, 0.12);
  --line-purple: rgba(201, 244, 91, 0.22);
  --line-purple-bright: rgba(201, 244, 91, 0.55);
  
  /* Brand Violet / Purple */
  --purple: #C9F45B;
  --purple-hover: #C9F45B;
  --purple-dark: #C9F45B;
  --purple-light: #DDF98F;
  --purple-glow: 0 0 26px -2px rgba(201, 244, 91, 0.45);
  --purple-subtle: rgba(201, 244, 91, 0.08);

  /* Status Accents */
  --ok: #10b981;
  --ok-glow: rgba(16, 185, 129, 0.25);
  --bad: #f43f5e;
  --bad-glow: rgba(244, 63, 94, 0.25);
  --warn: #f59e0b;
  --warn-glow: rgba(245, 158, 11, 0.25);
  --gold: #eab308;

  /* Typography */
  --text: #f5f4fb;
  --text-secondary: #c4c0db;
  --muted: #7f7a9f;
  --font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Radii */
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
}

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

html, body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.admin-app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  background: radial-gradient(1000px circle at 85% 0%, rgba(201, 244, 91, 0.06), transparent 50%),
              radial-gradient(800px circle at 15% 100%, rgba(224, 72, 0, 0.05), transparent 45%),
              var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 244, 91, 0.4);
}

/* Form Elements */
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(201, 244, 91, 0.6);
  box-shadow: 0 0 0 3px rgba(201, 244, 91, 0.18), var(--purple-glow);
}
input::placeholder, textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
input[type=checkbox] {
  width: 16px;
  height: 16px;
  accent-color: var(--purple);
  cursor: pointer;
}
textarea {
  min-height: 85px;
  resize: vertical;
}

/* ==========================================================================
   SIDEBAR DOCK
   ========================================================================== */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 12px 6px 10px 6px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: fit-content;
  min-height: 100vh;
  z-index: 20;
  backdrop-filter: blur(20px);
  overflow-y: auto;
}

.sidebar-top {
  padding: 0 2px 8px 2px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.brand img, .brand svg {
  height: 24px;
  width: auto;
  display: block;
  margin-left: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.4));
}

/* Nav Items - mobile first */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  margin: 0 2px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
}
.sidebar-nav a .nav-ico {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  margin: 0;
  margin-right: 6px;
  color: var(--muted);
  flex: 0 0 20px;
  transition: color 0.15s ease, transform 0.15s ease;
}
.sidebar-nav a span:not(.nav-ico) {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.sidebar-nav a:hover {
  background: var(--purple-subtle);
  color: var(--purple);
}
.sidebar-nav a:hover .nav-ico {
  color: var(--purple);
}
.sidebar-nav a.active {
  background: rgba(201, 244, 91, 0.15);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 16px rgba(201, 244, 91, 0.1);
}
.sidebar-nav a.active .nav-ico {
  color: var(--purple);
  filter: drop-shadow(0 0 8px rgba(201, 244, 91, 0.6));
}

.pill {
  background: var(--warn);
  color: #0b0914;
  font-size: 10px;
  border-radius: var(--radius-pill);
  padding: 1px 6px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}
.pill:empty {
  display: none;
}

/* Sidebar Footer */
.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-profile-compact {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
}
.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 0 12px rgba(201, 244, 91, 0.35);
  flex-shrink: 0;
}
.profile-info {
  min-width: 0;
  flex: 1;
}
.profile-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-email {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-links {
  display: flex;
  gap: 8px;
}
.foot-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  transition: all 0.15s ease;
}
.foot-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.15);
}
.foot-btn.logout:hover {
  background: rgba(244, 63, 94, 0.1);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.3);
}

/* ==========================================================================
   TOPBAR COMMAND HEADER
   ========================================================================== */
.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(7, 6, 11, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 15;
}

.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.topbar-left h1 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}
.topbar-crumb {
  font-size: 11.5px;
  color: var(--muted);
}

.topbar-center {
  flex: 1;
  max-width: 440px;
  margin: 0 16px;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.search-box .search-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  display: grid;
  place-items: center;
  pointer-events: none;
}
.search-box input {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  padding: 8px 36px 8px 38px;
  font-size: 12.5px;
  color: var(--text);
  width: 100%;
  backdrop-filter: blur(10px);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.search-box input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(201, 244, 91, 0.55);
  box-shadow: 0 0 20px -2px rgba(201, 244, 91, 0.35);
}
.clear-search-btn {
  position: absolute;
  right: 12px;
  color: var(--muted);
  font-size: 12px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease;
}
.clear-search-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

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

/* Quick Ranges Segmented Control */
.quick-ranges {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.range-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  transition: all 0.16s ease;
}
.range-pill:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.range-pill.active {
  background: var(--purple);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(201, 244, 91, 0.45);
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  color: var(--text-secondary);
  transition: all 0.18s ease;
}
.topbar-icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border-color: rgba(201, 244, 91, 0.35);
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Main View Container */
.view {
  padding: 24px 32px 64px;
  animation: viewEnter 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   GLASSMORPHISM BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 14px rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(201, 244, 91, 0.35);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 6px 20px rgba(201, 244, 91, 0.18);
  color: #fff;
}
.btn:active {
  transform: translateY(0.5px) scale(0.985);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.btn.primary {
  background: linear-gradient(135deg, #C9F45B 0%, #C9F45B 100%);
  border-color: rgba(201, 244, 91, 0.5);
  color: #fff;
  box-shadow: 0 4px 22px rgba(124, 58, 237, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn.primary:hover {
  background: linear-gradient(135deg, #C9F45B 0%, #C9F45B 100%);
  box-shadow: 0 6px 30px rgba(201, 244, 91, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transform: translateY(-1.5px);
}

.btn.ok {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
  box-shadow: inset 0 1px 0 rgba(16, 185, 129, 0.2), 0 4px 14px rgba(0, 0, 0, 0.3);
}
.btn.ok:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.btn.bad {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
  box-shadow: inset 0 1px 0 rgba(244, 63, 94, 0.2), 0 4px 14px rgba(0, 0, 0, 0.3);
}
.btn.bad:hover {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.5);
  box-shadow: 0 0 20px rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

.btn.gold {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.35);
  color: #fde047;
  box-shadow: inset 0 1px 0 rgba(234, 179, 8, 0.2), 0 4px 14px rgba(0, 0, 0, 0.3);
}
.btn.gold:hover {
  background: rgba(234, 179, 8, 0.22);
  border-color: rgba(234, 179, 8, 0.6);
  box-shadow: 0 0 20px rgba(234, 179, 8, 0.3);
}

.btn.sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 6px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  transition: all 0.15s ease;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  border-color: var(--line-hover);
}

/* ==========================================================================
   BENTO GRID ARCHITECTURE (DASHBOARD)
   ========================================================================== */
.bento-hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 20px;
}

.bento-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.bento-card:hover {
  border-color: var(--line-purple);
  box-shadow: 0 12px 36px -4px rgba(0, 0, 0, 0.6), 0 0 22px -4px rgba(201, 244, 91, 0.18);
  transform: translateY(-2px);
}
.bento-card.highlight {
  border-color: rgba(201, 244, 91, 0.35);
  background: radial-gradient(400px circle at 100% 0%, rgba(201, 244, 91, 0.09), transparent 60%),
              var(--card);
}

/* Card Header */
.bento-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.bento-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.bento-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid var(--line);
}
.bento-tag.purple {
  background: rgba(201, 244, 91, 0.12);
  border-color: rgba(201, 244, 91, 0.3);
  color: var(--purple-light);
}

/* Big Balance Overview */
.bento-big-num {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.bento-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
}
.stat-pill.pos {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.stat-pill.neg {
  background: rgba(244, 63, 94, 0.14);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.25);
}

/* Glowing Curve Area Chart */
.chart-box {
  width: 100%;
  position: relative;
  margin-top: 8px;
}
.chart-svg {
  width: 100%;
  height: 180px;
  display: block;
  overflow: visible;
}
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(18, 15, 32, 0.94);
  border: 1px solid rgba(201, 244, 91, 0.4);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(201, 244, 91, 0.3);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  transform: translate(-50%, -115%);
  white-space: nowrap;
  z-index: 30;
  transition: opacity 0.15s ease, transform 0.1s ease;
  opacity: 0;
}
.chart-tooltip.visible {
  opacity: 1;
}

/* KPI Cards Grid */
.bento-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-purple);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 16px rgba(201, 244, 91, 0.14);
}
.kpi-card .kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kpi-card .kpi-ico {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  color: var(--muted);
}
.kpi-card.ok .kpi-ico {
  color: #34d399;
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.2);
}
.kpi-card.bad .kpi-ico {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.2);
}
.kpi-card.purple .kpi-ico {
  color: var(--purple);
  background: rgba(201, 244, 91, 0.1);
  border-color: rgba(201, 244, 91, 0.25);
}
.kpi-card.warn .kpi-ico {
  color: #fde047;
  background: rgba(234, 179, 8, 0.08);
  border-color: rgba(234, 179, 8, 0.25);
}

.kpi-card .kpi-val {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  margin-bottom: 4px;
}
.kpi-card.ok .kpi-val { color: #34d399; }
.kpi-card.bad .kpi-val { color: #fb7185; }
.kpi-card.gold .kpi-val { color: #fde047; }

.kpi-card .kpi-footer {
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.kpi-badge-alert {
  background: rgba(245, 158, 11, 0.15);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 700;
}

/* Secondary Filter Bar (Dashboard Specific) */
.dash-filters-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  margin-bottom: 20px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.filter-date-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.filter-date-item input[type="date"] {
  width: auto;
  min-width: 130px;
  padding: 6px 10px;
  font-size: 12px;
}
.filter-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* ==========================================================================
   CARDS & TABLES
   ========================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.card h3 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card h3 small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.grid-2 > *, .grid-3 > * { min-width: 0; }
.grid-2.grid-2-wide { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
@media (max-width: 1360px) { .grid-2.grid-2-wide { grid-template-columns: minmax(0, 1fr); } }

/* Data Table */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 11px 14px;
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  white-space: nowrap;
}
th.num, td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}
/* Células longas quebram em vez de empurrar a tabela para fora do card; números, tags e botões não quebram. */
td { overflow-wrap: anywhere; }
td.num, td .tag, td .btn, td .badge { white-space: nowrap; }
td pre { overflow-wrap: anywhere; white-space: pre-wrap; max-width: 100% !important; }
tr {
  transition: background 0.15s ease;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.row-link {
  color: #fff;
  font-weight: 500;
  transition: color 0.15s;
}
.row-link:hover {
  color: var(--purple-light);
  text-decoration: underline;
}
.muted {
  color: var(--muted);
  font-size: 11.5px;
}

/* Status Tags (No Emojis) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
  border: 1px solid transparent;
}
.tag.active, .tag.approved, .tag.paid, .tag.won, .tag.finished {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}
.tag.blocked, .tag.rejected, .tag.lost, .tag.cancelled, .tag.bad {
  background: rgba(244, 63, 94, 0.12);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.25);
}
.tag.pending, .tag.open, .tag.scheduled {
  background: rgba(245, 158, 11, 0.12);
  color: #fde047;
  border-color: rgba(245, 158, 11, 0.25);
}
.tag.vip {
  background: rgba(201, 244, 91, 0.15);
  color: var(--purple-light);
  border-color: rgba(201, 244, 91, 0.35);
  box-shadow: 0 0 10px rgba(201, 244, 91, 0.2);
}
.tag.marketing {
  background: rgba(236, 72, 153, 0.15);
  color: #f472b6;
  border-color: rgba(236, 72, 153, 0.3);
}
.tag.admin {
  background: linear-gradient(135deg, rgba(201, 244, 91, 0.25), rgba(224, 72, 0, 0.2));
  color: #DDF98F;
  border-color: rgba(201, 244, 91, 0.4);
}

/* User Avatar Pill in Table */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-cell-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--purple-light);
  flex-shrink: 0;
}

/* Empty State */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ==========================================================================
   DRAWER (SLIDE-OVER PANEL)
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 50;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(780px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.7);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 60;
  display: flex;
  flex-direction: column;
}
body.drawer-open .drawer {
  transform: translateX(0);
}
body.drawer-open .drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}
.drawer header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}
.drawer header h2 {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}
.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Forms inside Drawer / Views */
.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}
.form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.form label.full {
  grid-column: 1 / -1;
}
.form label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.form .hint {
  font-size: 11.5px;
  color: var(--muted);
  grid-column: 1 / -1;
  margin-top: -4px;
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--purple-light);
  margin: 22px 0 10px;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin: 18px 0 16px;
  overflow-x: auto;
}
.tabs button {
  padding: 9px 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-weight: 500;
  transition: all 0.15s ease;
}
.tabs button:hover {
  color: var(--text);
}
.tabs button.active {
  color: #fff;
  border-color: var(--purple);
}

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.mini-kpis div {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.mini-kpis small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.mini-kpis strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: #fff;
}

.note {
  font-size: 12.5px;
  color: var(--text-secondary);
  background: rgba(201, 244, 91, 0.06);
  border: 1px solid rgba(201, 244, 91, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
}

/* ==========================================================================
   SUPPORT CHAT VIEW
   ========================================================================== */
.support {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  height: calc(100vh - 150px);
  min-height: 460px;
  min-width: 0;
}
.support-list {
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
}
.support-thread {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  transition: background 0.15s ease;
}
.support-thread:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: -2px;
}
.support-thread:hover {
  background: rgba(255, 255, 255, 0.03);
}
.support-thread.active {
  background: rgba(201, 244, 91, 0.12);
  border-left: 3px solid var(--purple);
}
.support-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.support-when {
  font-size: 11px;
  color: var(--muted);
}
.support-chat {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  min-width: 0;
  overflow: hidden;
}
.support-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}
.support-head .btn {
  margin-left: auto;
}
.support-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.support-msg {
  max-width: 72%;
  background: var(--panel-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13.5px;
  align-self: flex-start;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.support-msg.admin {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(201, 244, 91, 0.22), rgba(224, 72, 0, 0.28));
  border-color: rgba(201, 244, 91, 0.35);
}
.support-msg small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}
.support-reply {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  align-items: flex-end;
}
.support-reply textarea {
  min-height: 60px;
}
.support-status {
  padding: 8px 14px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
}
.support-status[data-error="true"] { color: #fda4af; }

/* SVG Icon Helper Style */
.svg-ico {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* ==========================================================================
   RESPONSIVE LAYOUT
   ========================================================================== */
/* KPIs do dashboard (5 cards): 3 em cima + 2 embaixo, sem card sozinho na linha. */
.bento-kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bento-kpi-grid > .kpi-card { grid-column: span 2; min-width: 0; }
.bento-kpi-grid > .kpi-card:nth-child(n+4) { grid-column: span 3; }
@media (max-width: 1100px) {
  .bento-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bento-kpi-grid > .kpi-card, .bento-kpi-grid > .kpi-card:nth-child(n+4) { grid-column: span 1; }
  .bento-kpi-grid > .kpi-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .bento-kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .bento-kpi-grid > .kpi-card:last-child:nth-child(odd) { grid-column: auto; }
}

@media (max-width: 1200px) {
  .bento-hero {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body.admin-app {
    grid-template-columns: 1fr;
    position: relative;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.6);
    background: #0d121f;
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 14px 4px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-close-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e1;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .sidebar-close-btn:active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
  }
  .sidebar-nav {
    flex-direction: column;
    flex-wrap: nowrap;
    overflow-y: auto;
    gap: 4px;
  }
  .sidebar-nav a {
    padding: 10px 12px;
    font-size: 13.5px;
  }
  .mobile-menu-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.14);
  }
  .topbar {
    padding: 12px 16px;
    gap: 12px;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .topbar-titles h1 {
    font-size: 18px;
  }
  .topbar-titles .topbar-crumb {
    font-size: 11px;
  }
  .topbar-center {
    width: 100%;
    max-width: 100%;
    margin: 4px 0 0 0;
    order: 3;
  }
  .topbar-right {
    margin-left: auto;
  }
  .view {
    padding: 14px 14px calc(24px + env(safe-area-inset-bottom, 24px));
  }
  .form {
    grid-template-columns: 1fr;
  }
  .support {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    gap: 12px;
  }
  .support-list {
    max-height: 34vh;
    min-height: 120px;
  }
  .support-chat {
    min-height: 52vh;
  }
  .support-msgs {
    min-height: 180px;
  }
  .support-reply textarea {
    min-height: 76px;
  }
}

/* Celular: a barra de cima quebra linha (o "Trancar" da Personalização cabia fora da tela) e os cartões de
   imagem da Personalização empilham a prévia em cima do texto. */
@media (max-width: 600px) {
  .topbar-right { flex-wrap: wrap; }
  .brand-img { flex-direction: column; align-items: stretch !important; }
  .brand-img > div:first-child { width: 100% !important; height: 90px !important; }
  .brand-img input[type=file] { width: 100%; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop, .btn, .bento-card, .kpi-card {
    transition: none !important;
    animation: none !important;
  }
}

/* Login próprio do painel */
.admin-login { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: #0b0f19; }
.admin-login[hidden] { display: none; }
.admin-login-card { width: min(360px, 92vw); display: grid; gap: 14px; padding: 28px; border-radius: 16px; background: #111827; border: 1px solid #1f2937; color: #e5e7eb; }
.admin-login-logo { height: 28px; justify-self: start; }
.admin-login-card h1 { margin: 0; font-size: 18px; }
.admin-login-card label { display: grid; gap: 6px; font-size: 12px; color: #9ca3af; }
.admin-login-card input { padding: 10px 12px; border-radius: 8px; border: 1px solid #374151; background: #0b0f19; color: #fff; font-size: 14px; }
.admin-login-err { min-height: 16px; margin: 0; font-size: 12px; color: #fca5a5; }
body.admin-locked > :not(#adminLogin) { display: none !important; }

/* Tela Segurança */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { display: grid; gap: 4px; padding: 14px 16px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); }
.kpi b { font-size: 22px; color: #fff; }
.kpi span { font-size: 12px; color: var(--muted, #9ca3af); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input { padding: 8px 10px; border-radius: 8px; border: 1px solid #374151; background: #0b0f19; color: #fff; font-size: 13px; }
.btn.danger { background: rgba(239,68,68,.15); color: #fca5a5; border: 1px solid rgba(239,68,68,.4); }
.btn.danger:hover { background: rgba(239,68,68,.28); }
.admin-login-card label[hidden] { display: none; }
.inline-form input { width: auto; flex: 1 1 180px; }

/* MBWIN - Direcionador de Velas */
.mw-banner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 20px; }
.mw-banner { display: flex; align-items: flex-start; gap: 14px; padding: 16px; border-radius: 12px; background: rgba(30, 41, 59, 0.4); border: 1px solid rgba(255, 255, 255, 0.08); }
.mw-banner-purple { border-color: rgba(147, 51, 234, 0.3); background: linear-gradient(135deg, rgba(88, 28, 135, 0.25), rgba(17, 24, 39, 0.6)); }
.mw-banner-amber { border-color: rgba(245, 158, 11, 0.3); background: linear-gradient(135deg, rgba(120, 53, 15, 0.25), rgba(17, 24, 39, 0.6)); }
.mw-banner-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.mw-banner-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.mw-banner-text { font-size: 11px; color: #94a3b8; line-height: 1.5; }

.vbtn { border: 1px solid rgba(255, 255, 255, 0.12); padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s; background: rgba(30, 41, 59, 0.6); color: #cbd5e1; }
.vbtn:hover { background: rgba(51, 65, 85, 0.8); color: #fff; }
.vbtn-active { border-color: #C9F45B !important; background: #C9F45B !important; color: #071B2B !important; box-shadow: 0 0 10px rgba(124, 58, 237, 0.4); }
.vbtn-up.vbtn-active { border-color: #10b981 !important; background: #10b981 !important; box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
.vbtn-down.vbtn-active { border-color: #ef4444 !important; background: #ef4444 !important; box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
.vbtn-mkt.vbtn-active { border-color: #64748b !important; background: #64748b !important; }

/* Switch Toggle */
.mw-switch { position: relative; display: inline-block; width: 38px; height: 22px; vertical-align: middle; }
.mw-switch input { opacity: 0; width: 0; height: 0; }
.mw-slider { position: absolute; cursor: pointer; inset: 0; background-color: #334155; transition: .2s; border-radius: 22px; }
.mw-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%; }
.mw-switch input:checked + .mw-slider { background-color: #C9F45B; }
.mw-switch input:checked + .mw-slider:before { transform: translateX(16px); }
.mw-switch input:disabled + .mw-slider { opacity: 0.5; cursor: not-allowed; }

.mw-badge-up { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.mw-badge-down { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }
.mw-badge-mkt { background: rgba(100, 116, 139, 0.2); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.4); }
.mw-badge-locked { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }

/* Helper styles for Mobile & Desktop layout */
.mobile-menu-btn { display: none; }
.sidebar-close-btn { display: none; }
.sidebar-backdrop { display: none; }
.mw-type-pill-mobile { display: none; }
.mw-type-pill-desktop { display: inline-flex; }
.mw-switch-label { display: none; }
.mw-action-wrap { display: flex; align-items: center; gap: 12px; }
.mw-switch-row { display: flex; align-items: center; }
.mw-ctl-btns { display: flex; gap: 6px; align-items: center; }
.mw-lock-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #fbbf24; }

/* MBWIN Mobile Optimizations */
@media (max-width: 768px) {
  /* No MBWIN, oculta a barra de busca do topo pois há campo de busca dedicado nos cards */
  body[data-view="mbwin"] .topbar-center {
    display: none !important;
  }
  .mw-topbar-speed {
    display: none !important;
  }

  /* Toolbar MBWIN no mobile */
  .mbwin-toolbar {
    padding: 12px 14px !important;
  }
  .mbwin-sync-indicator {
    display: none !important;
  }
  .mw-filter-pills {
    width: 100%;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .mw-filter-pills::-webkit-scrollbar {
    display: none;
  }
  .mw-speed-bar {
    padding: 12px 14px !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .mw-speed-bar > div:last-child {
    max-width: 100% !important;
  }

  .mbwin-table-wrap {
    overflow-x: visible !important;
    padding: 0 12px 14px !important;
    background: transparent !important;
  }

  /* MBWIN Table -> Modern Native Mobile Cards */
  #mbwinTable,
  #mbwinTable tbody {
    display: block;
    width: 100%;
  }
  #mbwinTable thead {
    display: none;
  }
  #mbwinTable tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 10px 12px;
    align-items: center;
    padding: 16px 14px;
    margin-bottom: 12px;
    background: #111827;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
    width: 100%;
  }
  #mbwinTable tbody tr:last-child {
    margin-bottom: 0;
  }
  .mw-col-id {
    display: none !important;
  }
  .mw-col-type {
    display: none !important;
  }
  .mw-type-pill-mobile {
    display: inline-flex !important;
  }
  .mw-col-ticker {
    grid-column: 1;
    grid-row: 1;
    padding: 0 !important;
    border: none !important;
  }
  .mw-col-price {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
    font-size: 16px !important;
    font-weight: 800;
    color: #10b981;
    padding: 0 !important;
    border: none !important;
    justify-self: end;
    font-variant-numeric: tabular-nums;
  }
  .mw-col-status {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 10px 0 !important;
    border: none !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
  }
  .mw-col-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    padding: 8px 0 0 0 !important;
    border: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    width: 100%;
  }
  .mw-action-wrap {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  .mw-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .mw-switch-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
  }
  /* Large touch switch for mobile thumbs */
  .mw-switch {
    width: 52px;
    height: 30px;
  }
  .mw-slider {
    border-radius: 30px;
  }
  .mw-slider:before {
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    border-radius: 50%;
  }
  .mw-switch input:checked + .mw-slider:before {
    transform: translateX(22px);
  }
  .mw-ctl-btns {
    display: flex;
    width: 100%;
    gap: 8px;
  }
  .vbtn {
    flex: 1 1 0;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    border-radius: 10px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
  }
  .vbtn:active {
    transform: scale(0.96);
  }
  .mw-lock-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
  }

  /* Evita auto-zoom do Safari no iOS ao focar em inputs */
  input[type="text"],
  input[type="search"],
  input[type="password"],
  input[type="email"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* KPIs 2 colunas no mobile */
  .kpis {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .kpis .kpi:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
  }
}

/* ---------------- Afiliados ---------------- */
body[data-view="affiliates"] .bento-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
body[data-view="affiliates"] .bento-kpi-grid > .kpi-card {
  grid-column: auto;
}
body[data-view="affiliates"] .table-wrap table {
  min-width: 1080px;
}
body[data-view="affiliates"] .table-wrap th:first-child,
body[data-view="affiliates"] .table-wrap td:first-child {
  min-width: 230px;
}
body[data-view="affiliates"] .table-wrap td:first-child .user-cell {
  white-space: nowrap;
}
body[data-view="affiliates"] .table-wrap td:nth-child(2) {
  white-space: nowrap;
}
body[data-view="affiliates"] .table-wrap td:last-child {
  white-space: nowrap;
}
@media (max-width: 1100px) {
  body[data-view="affiliates"] .bento-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  body[data-view="affiliates"] .bento-kpi-grid {
    grid-template-columns: 1fr;
  }
}
body[data-view="affiliates"] .table-wrap th,
body[data-view="affiliates"] .table-wrap td {
  padding: 11px 10px;
  font-size: 12px;
}
body[data-view="affiliates"] .table-wrap th:first-child,
body[data-view="affiliates"] .table-wrap td:first-child {
  min-width: 210px;
}
body[data-view="affiliates"] .table-wrap table {
  min-width: 1000px;
}

/* ==========================================================================
   MOBILE · PAINEL UTILIZÁVEL (<= 900px)
   Correção do cabeçalho, das tabelas e dos formulários no telefone. As regras
   ficam no fim do arquivo para vencer as larguras fixas das telas específicas.
   ========================================================================== */
@media (max-width: 900px) {
  body.admin-app {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .main { min-height: 100vh; min-height: 100dvh; }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 14px;
  }
  .topbar-left {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }
  .topbar-titles { flex: 1 1 auto; min-width: 0; }
  .topbar-titles h1 {
    font-size: 18px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-titles .topbar-crumb {
    font-size: 10.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .topbar-center {
    order: 5;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .topbar-right {
    order: 4;
    width: 100%;
    margin: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
  }
  .quick-ranges {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .quick-ranges::-webkit-scrollbar { display: none; }
  .range-pill { padding: 6px 11px; font-size: 11.5px; white-space: nowrap; }
  .topbar-icon-btn { width: 38px; height: 38px; flex: none; }
  .actions { width: auto; flex: 1 1 220px; flex-wrap: wrap; gap: 8px; }
  .actions > * { max-width: 100%; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
  .view { padding: 12px 12px calc(28px + env(safe-area-inset-bottom, 0px)); }
  .card { padding: 16px 14px; border-radius: 14px; margin-bottom: 14px; }
  .card h3 { flex-wrap: wrap; gap: 6px; font-size: 14px; }
  .grid-2, .grid-3 { gap: 12px; margin-bottom: 14px; }
  .drawer-body { padding: 16px 14px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .drawer header { padding: 14px 16px; }
  .drawer header h2 { font-size: 15px; }
  .form { grid-template-columns: 1fr; gap: 12px; }
  .form-actions {
    margin: 14px 0 0;
    padding: 0;
    background: none;
  }
  .form-actions .btn { flex: 1 1 auto; justify-content: center; }
  .dash-filters-bar { padding: 12px; gap: 10px; }
  .filter-group { width: 100%; gap: 8px; }
  .filter-date-item { flex: 1 1 100%; justify-content: space-between; }
  .filter-date-item input[type="date"] { flex: 1 1 auto; min-width: 0; width: 100%; }
  .admin-login-card { padding: 22px 18px; }
  /* 16 px evita o zoom automático do iOS ao focar um campo. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  select, textarea { font-size: 16px !important; }
  .btn { min-height: 38px; }
  .btn.sm { min-height: 34px; }
}

/* Tabelas viram cartões no telefone. `decorateTables()` (admin.js) copia o
   título de cada coluna para data-label; o CSS usa esse rótulo em cada linha. */
@media (max-width: 900px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
  .table-wrap table:not(.mobile-cards) { min-width: 680px; }

  table.mobile-cards {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
  }
  table.mobile-cards thead { display: none; }
  table.mobile-cards tbody { display: block; width: 100%; }
  table.mobile-cards tbody tr {
    display: block;
    width: 100%;
    margin: 0 0 10px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  }
  table.mobile-cards tbody tr:last-child { margin-bottom: 0; }
  table.mobile-cards tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
  table.mobile-cards td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 0;
    border: 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
    text-align: right;
    font-size: 12.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  table.mobile-cards td:last-child { border-bottom: 0; }
  table.mobile-cards td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    max-width: 38%;
    text-align: left;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.6;
    text-transform: uppercase;
  }
  table.mobile-cards td[data-label=""]::before,
  table.mobile-cards td[data-label="\a0"]::before { content: none; }
  table.mobile-cards td > * { min-width: 0; max-width: 100%; }
  table.mobile-cards td .user-cell { justify-content: flex-end; text-align: left; }
  table.mobile-cards td .user-cell > div { min-width: 0; }
  table.mobile-cards td .btn { flex: none; }
  table.mobile-cards td[colspan] { justify-content: center; text-align: center; }

  /* Afiliados: a tabela larga (min-width 1000/1080 px) passa a usar os cartões. */
  body[data-view="affiliates"] .table-wrap table.mobile-cards { min-width: 0 !important; }
  body[data-view="affiliates"] .table-wrap table.mobile-cards th,
  body[data-view="affiliates"] .table-wrap table.mobile-cards td,
  body[data-view="affiliates"] .table-wrap table.mobile-cards td:first-child {
    min-width: 0 !important;
    white-space: normal !important;
  }
  body[data-view="affiliates"] .table-wrap table.mobile-cards td:first-child .user-cell {
    white-space: normal !important;
  }
}

@media (max-width: 900px) {
  /* O backdrop do menu lateral era sobrescrito pelo `display:none` das regras
     utilitárias no meio do arquivo: no telefone o menu abria sem fundo clicável. */
  .sidebar-backdrop { display: block; }
  .mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .mini-kpis > div { min-width: 0; padding: 10px; }
  .mini-kpis strong { font-size: 15px; overflow-wrap: anywhere; }
  .drawer-info-grid { grid-template-columns: 1fr !important; }
  .drawer-balance-form { grid-template-columns: 1fr !important; }
  .drawer-balance-form .btn { width: 100%; }
  .kyc-doc-row { flex-wrap: wrap; }
  .kyc-doc-actions { flex-wrap: wrap; width: 100%; }
  .kyc-doc-actions .btn { flex: 1 1 30%; justify-content: center; }
}

@media (max-width: 900px) {
  .table-wrap table:not(.mobile-cards) { min-width: 680px; }
  .chart-box > div:first-child { flex-wrap: wrap !important; gap: 8px !important; }
  .chart-box > div:first-child .quick-ranges { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .chart-box > div:first-child .quick-ranges::-webkit-scrollbar { display: none; }
  .support-head { flex-wrap: wrap; padding: 12px 14px; gap: 8px; }
  .support-head > div:nth-child(2) { flex: 1 1 160px; min-width: 0; }
  .support-head .btn { margin-left: 0; width: 100%; justify-content: center; }
  .support-msgs { padding: 12px; }
}

@media (max-width: 900px) {
  .chart-box > div:first-child .quick-ranges {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .chart-box > div:first-child .quick-ranges .range-pill {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .chart-box > div:first-child .quick-ranges {
    flex-wrap: wrap;
    overflow: visible;
  }
}

@media (max-width: 900px) {
  table.mobile-cards td > b:first-child { white-space: nowrap; }
  table.mobile-cards td > .tag,
  table.mobile-cards td > .pill { white-space: nowrap; }
  .support-reply { flex-direction: column; align-items: stretch; }
  .support-reply .btn { width: 100%; justify-content: center; }
}

@media (max-width: 900px) {
  /* A tabela do MBWIN já tem cartões próprios: não pode receber o min-width das
     tabelas comuns nem deixar o conteúdo vazar para fora do cartão. */
  .table-wrap table:not(.mobile-cards):not(#mbwinTable) { min-width: 680px; }
  #mbwinTable { min-width: 0 !important; }
  .mbwin-table-wrap { overflow-x: hidden !important; }
  #mbwinTable tbody tr { overflow: hidden; }
  .mw-col-ticker, .mw-col-price { min-width: 0; }
  .mw-col-ticker { overflow-wrap: anywhere; }
  .mbwin-toolbar { overflow: hidden; }
  .mbwin-toolbar > div:first-child {
    flex-direction: column;
    align-items: stretch !important;
  }
  .mbwin-toolbar > div:first-child > div:first-child {
    flex: 0 0 auto !important;
    min-width: 0 !important;
  }
}

@media (max-width: 900px) {
  .mbwin-toolbar > div:first-child { min-width: 0 !important; }
  .mbwin-toolbar .mw-filter-pills { min-width: 0 !important; max-width: 100%; }
}

@media (max-width: 768px) {
  .mw-speed-bar { gap: 10px !important; }
  .mw-speed-bar > div { flex: 0 0 auto !important; height: auto !important; max-width: 100% !important; }
}

.coupon-code-cell {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  max-width: 100%;
}

/* ==========================================================================
   MOTORES DO GRÁFICO · ENTRADAS AO VIVO · VIÉS CONTRA A MAIORIA
   ========================================================================== */
.liveops-card { padding-bottom: 16px; }
.live-status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 12px 14px;
  margin: 14px 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(201, 244, 91, 0.08), rgba(201, 244, 91, 0.02));
}
.live-status-item {
  font-size: 12px;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
}
.live-status-item b {
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.live-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
}
.live-control {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  min-width: 0;
}
.live-control > label:first-child {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.live-control select {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-hover);
  background: var(--card-elevated);
  color: var(--text);
  font-size: 12px;
}
.live-control small {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
}
.live-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.live-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.live-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 23px;
  border-radius: var(--radius-pill);
  background: #3b4155;
  border: 1px solid var(--line-hover);
  transition: background 0.18s ease;
}
.live-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}
.live-switch input:checked + .live-switch-track {
  background: var(--ok);
  border-color: var(--ok);
}
.live-switch input:checked + .live-switch-track::after { transform: translateX(19px); }
.live-switch input:focus-visible + .live-switch-track { outline: 2px solid var(--purple); outline-offset: 2px; }
.live-cross-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 14px;
}
.live-cross-links a {
  font-size: 12px;
  color: var(--purple-light);
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 194, 166, 0.4);
}
.live-cross-links a:hover { color: #fff; }
.live-bias-global {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(201, 244, 91, 0.25);
  border-radius: var(--radius-md);
  background: var(--purple-subtle);
}
.live-bias-scope {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--purple-light);
}
.live-bias-global small.muted { font-size: 11px; }
.live-bias-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid var(--line-hover);
  color: var(--text-secondary);
}
.live-bias-chip.call { background: rgba(16, 185, 129, 0.14); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.live-bias-chip.put { background: rgba(244, 63, 94, 0.14); color: #fb7185; border-color: rgba(244, 63, 94, 0.3); }
.live-bias-detail {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
  white-space: normal;
}
.live-bias-id {
  display: block;
  font-size: 10px;
  color: var(--muted);
}

@media (max-width: 768px) {
  .live-status-bar { gap: 8px 12px; }
  .live-control-grid { grid-template-columns: 1fr; }
}
.coupon-code-cell > b { white-space: nowrap; }

/* Financeiro e confirmação por PIN */
.finance-title { margin: 22px 0 10px; font-size: 14px; color: #fff; }
.finance-title small, .finance-note { color: var(--muted); font-weight: 400; font-size: 12px; }
.finance-note { margin: 8px 0 12px; }
.finance-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.finance-pages { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.pin-modal { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .7); }
.pin-modal-card { width: min(360px, 100%); padding: 22px; border-radius: 14px; background: #17181c; border: 1px solid rgba(255, 255, 255, .12); }
.pin-modal-card h3 { margin: 0 0 6px; color: #fff; }
.pin-modal-card p { margin: 0 0 14px; font-size: 13px; color: #b6bac6; }
.pin-modal-card input { width: 100%; box-sizing: border-box; padding: 11px 12px; font-size: 18px; letter-spacing: 6px; text-align: center; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); background: #0f1013; color: #fff; }
.pin-modal-card .pin-modal-err { min-height: 18px; margin: 8px 0; color: #fb7185; font-size: 12px; }
.pin-modal-card div { display: flex; justify-content: flex-end; gap: 8px; }

/* ==========================================================================
   VER OPERAÇÕES E USUÁRIOS · ajustes de preço (MBWIN integrado)
   ========================================================================== */
.mu-panel > summary.mu-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  font-weight: 800;
  font-size: 14px;
  color: var(--text);
  list-style: none;
}
.mu-panel > summary.mu-summary-head::-webkit-details-marker { display: none; }
.mu-panel > summary.mu-summary-head::after { content: '▾'; color: var(--muted); font-size: 13px; }
.mu-panel:not([open]) > summary.mu-summary-head::after { content: '▸'; }
.mu-panel > summary.mu-summary-head small { font-size: 11px; color: var(--muted); font-weight: 600; }
.mu-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.mu-filters button {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-hover);
  background: rgba(255, 255, 255, .03);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.mu-filters button:hover { background: rgba(255, 255, 255, .07); }
.mu-filters button.active {
  background: rgba(201, 244, 91, .16);
  border-color: rgba(201, 244, 91, .5);
  color: #C9F45B;
}
.mu-subtitle {
  margin: 22px 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.mu-subtitle small { font-size: 11px; color: var(--muted); font-weight: 600; }
.mu-divider { height: 1px; background: var(--line); margin: 24px 0 0; }
.mu-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.mu-choices button {
  flex: 1 1 auto;
  min-width: 84px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-hover);
  background: rgba(255, 255, 255, .03);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.mu-choices button:hover { background: rgba(255, 255, 255, .07); }
.mu-choices button.active {
  background: rgba(16, 185, 129, .16);
  border-color: rgba(16, 185, 129, .55);
  color: #34d399;
}
.mu-choices-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
.mu-choices-grid button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.mu-choices-grid button b { font-size: 12px; }
.mu-choices-grid button small { font-size: 10px; color: var(--muted); font-weight: 500; }
.mu-unlock-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  border: 1px solid rgba(245, 158, 11, .4);
  border-radius: var(--radius-md);
  background: rgba(245, 158, 11, .08);
}
.mu-unlock-box label { font-size: 12px; font-weight: 700; color: #fde047; }
.mu-unlock-box input {
  flex: 1 1 220px;
  min-width: 160px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-hover);
  background: var(--card-elevated);
  color: var(--text);
  font-size: 12px;
}
.mu-unlock-box small { flex: 1 1 100%; font-size: 11px; color: var(--muted); }
.mu-adjust-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.mu-adjust-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.mu-adjust-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, .02);
  font-size: 12px;
}
.mu-adjust-item > div:first-child { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mu-adjust-item .muted { font-size: 11px; }
.mu-adjust-item .btn { align-self: flex-start; }
.mu-market { margin-bottom: 14px; }
.mu-step { font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.mu-asset-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.mu-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-hover);
  background: rgba(255, 255, 255, .03); color: var(--text-secondary); cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.mu-chip b { font-size: 11.5px; }
.mu-chip small { font-size: 10px; color: var(--muted); }
.mu-chip:hover { background: rgba(255, 255, 255, .08); }
.mu-chip.active { background: rgba(16, 185, 129, .16); border-color: rgba(16, 185, 129, .6); color: #34d399; }
.mu-chip.active small { color: #6ee7b7; }
.mu-market-grid { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 12px; }
.mu-chart-card { border: 1px solid var(--line); border-radius: var(--radius-md); background: #0b0e14; padding: 10px 12px 8px; }
.mu-chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.mu-chart-head b { font-size: 13px; color: #fff; }
.mu-chart-head small { display: block; font-size: 10.5px; color: var(--muted); }
.mu-chart-live { font-size: 10.5px; color: #34d399; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.mu-chart-live i { width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 8px #34d399; }
.mu-chart { width: 100%; display: block; border-radius: 6px; }
.mu-chart-foot { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; color: var(--muted); margin-top: 4px; }
.mu-summary { border: 1px solid var(--line); border-radius: var(--radius-md); background: rgba(255, 255, 255, .02); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.mu-summary-head { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.mu-summary-head span { color: #f97316; }
.mu-summary-total small { font-size: 10.5px; color: var(--muted); }
.mu-summary-total b { display: block; font-size: 26px; color: #fff; font-variant-numeric: tabular-nums; }
.mu-summary-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mu-summary-sides span { display: flex; justify-content: space-between; padding: 7px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 600; }
.mu-summary-sides .up { background: rgba(16, 185, 129, .14); color: #34d399; }
.mu-summary-sides .down { background: rgba(251, 113, 133, .14); color: #fb7185; }
.mu-summary-next { background: #1b2130; border: 1px solid #2b3445; border-radius: 6px; padding: 9px 10px; }
.mu-summary-next small { font-size: 10px; color: var(--muted); }
.mu-summary-next b { display: block; font-size: 24px; color: #fff; font-variant-numeric: tabular-nums; }
.mu-summary .btn { margin-top: auto; }
.mu-ops-table td { vertical-align: middle; }
.mu-ops-table th:nth-child(1), .mu-ops-table td:nth-child(1) { min-width: 78px; white-space: nowrap; }
.mu-ops-table th:nth-child(2), .mu-ops-table td:nth-child(2),
.mu-ops-table th:nth-child(3), .mu-ops-table td:nth-child(3),
.mu-ops-table th:nth-child(8), .mu-ops-table td:nth-child(8) { white-space: nowrap; }
.mu-ops-table th:nth-child(9), .mu-ops-table td:nth-child(9) { min-width: 200px; white-space: nowrap; }
.mu-flip {
  margin-top: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line-hover);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .03);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}
.mu-flip:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.mu-rate { display: flex; flex-direction: column; gap: 1px; font-size: 11px; line-height: 1.25; white-space: nowrap; }
.mu-rate span { color: var(--muted); }
.mu-rate b { color: #fff; font-variant-numeric: tabular-nums; }
.mu-rate small { font-weight: 700; }
.mu-up { color: #34d399; }
.mu-down { color: #fb7185; }
.mu-spark { display: block; border: 1px solid var(--line); border-radius: 6px; background: #0e1118; }
.mu-row-ctl { display: flex; gap: 4px; }
.mu-row-dir {
  flex: 1 1 0;
  padding: 7px 4px;
  border: 1px solid var(--line-hover);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .03);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.mu-row-dir:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.mu-row-dir.active[onclick*="'up'"] { background: rgba(16, 185, 129, .18); border-color: rgba(16, 185, 129, .6); color: #34d399; }
.mu-row-dir.active[onclick*="'down'"] { background: rgba(251, 113, 133, .18); border-color: rgba(251, 113, 133, .6); color: #fb7185; }
.mu-row-dir.active[onclick*="'market'"] { background: rgba(148, 163, 184, .2); border-color: rgba(148, 163, 184, .6); color: #cbd5e1; }
.mu-row-dir:disabled { opacity: .45; cursor: not-allowed; }
.mu-lock { display: block; margin-top: 4px; font-size: 10px; color: #fbbf24; }
@media (max-width: 900px) {
  .mu-market-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .mu-panel > summary.mu-summary-head { font-size: 13px; }
  .mu-choices button { min-width: 72px; padding: 8px 10px; }
}
/* ---------- Dashboard · Visão geral (2026-12-02) ---------- */
.ov-wrap { margin-bottom: 22px; }
.ov-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.ov-head h2 { font-size: 18px; font-weight: 700; color: #fff; margin: 0 0 2px; letter-spacing: -.01em; }
.ov-head small { color: var(--muted); font-size: 12px; }
.ov-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.ov-card { background: var(--card, #161a22); border: 1px solid var(--line); border-radius: var(--radius-sm, 10px); padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ov-card.accent { border-color: rgba(201, 244, 91, .45); background: linear-gradient(180deg, rgba(201, 244, 91, .10), transparent 70%), var(--card, #161a22); }
.ov-card.neg { border-color: rgba(251, 113, 133, .45); }
.ov-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ov-value { font-size: 22px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11.5px; }
.ov-sub { color: var(--muted); }
.ov-delta { font-weight: 700; font-size: 11.5px; padding: 2px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.ov-delta.pos { color: #34d399; background: rgba(52, 211, 153, .12); }
.ov-delta.neg { color: #fb7185; background: rgba(251, 113, 133, .12); }
.ov-delta.warn { color: #fbbf24; background: rgba(251, 191, 36, .12); }
.ov-delta.flat { color: var(--muted); background: rgba(255, 255, 255, .05); font-weight: 600; }
.ov-chart-card { margin-bottom: 14px; }
.ov-svg { width: 100%; height: auto; display: block; }
.ov-legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.ov-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
@media (max-width: 1100px) { .ov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .ov-grid { grid-template-columns: 1fr; } .ov-value { font-size: 20px; } }

/* ---------- Mobile: alvos de toque, quebras e ações compactas (2026-12-05) ---------- */
@media (max-width: 900px) {
  .topbar { padding: 10px 12px; gap: 10px; flex-wrap: wrap; }
  .topbar-left { min-width: 0; }
  .topbar-titles { min-width: 0; }
  .topbar-left h1 { font-size: 18px; line-height: 1.2; }
  .topbar-crumb { font-size: 11px; line-height: 1.3; }
  .topbar-right { width: 100%; gap: 8px; align-items: center; }
  .quick-ranges { flex: 1 1 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .quick-ranges::-webkit-scrollbar { display: none; }
  .range-pill { flex: 0 0 auto; min-height: 34px; padding: 7px 12px; }
  .topbar-center { order: 3; flex: 1 1 100%; }
  .search-box { width: 100%; }
  #viewActions { display: flex; gap: 8px; flex: 0 1 auto; flex-wrap: wrap; }
  #viewActions .btn { width: auto; min-height: 36px; padding: 8px 12px; font-size: 12px; }
  .topbar-icon-btn { min-width: 36px; min-height: 36px; }
  .view { padding: 14px 12px 28px; }
  .card { padding: 14px; }
  .ov-card { padding: 13px; }
  .ov-grid { gap: 10px; }
  .table-wrap td, .table-wrap th { overflow-wrap: anywhere; word-break: break-word; }
  .user-cell { min-width: 0; }
  .user-cell .muted { overflow-wrap: anywhere; }
  .form input, .form select, .form textarea { width: 100%; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 auto; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; padding: 8px 10px; }
  .bento-big-num { font-size: 26px; overflow-wrap: anywhere; }
}

@media (max-width: 420px) {
  .topbar { padding: 9px 10px; }
  .topbar-left h1 { font-size: 16px; }
  .range-pill { padding: 6px 10px; min-height: 32px; }
  .card { padding: 12px; border-radius: 12px; }
  .ov-card { padding: 12px; }
  .ov-value { font-size: 19px; }
}

@media (max-width: 900px) {
  .topbar-right { justify-content: flex-end; }
  #viewActions { flex: 0 1 auto; margin-left: auto; }
  #viewActions .btn { width: auto !important; flex: 0 1 auto !important; white-space: nowrap; max-width: 210px; }
  .user-cell, .user-cell * { min-width: 0; overflow-wrap: anywhere; word-break: break-word; }
  .table-wrap td { overflow-wrap: anywhere; word-break: break-word; }
  .table-wrap td .muted { overflow-wrap: anywhere; }
}

@media (max-width: 900px) {
  .user-cell .muted { font-size: 11px; line-height: 1.35; }
  .user-cell { gap: 8px; }
}

@media (max-width: 600px) {
  .mw-filter-pills { flex-wrap: wrap !important; overflow: visible !important; }
  .mw-filter-pills .mw-type-filter-btn { flex: 1 1 auto; text-align: center; }
}
