/* ============================================================================
 * PLURIBUS TRACKING — OBSIDIAN FINTECH DESIGN SYSTEM
 * Fundo preto absoluto (#070709), cartões grafite (#111114), bordas 1px
 * ============================================================================ */

:root {
  color-scheme: dark;
  --bg: #070709;
  --bg-elev: #0c0c0f;
  --card: #111114;
  --card-hover: #16161b;
  --border: #1e1e24;
  --border-strong: #2b2b34;
  --ink: #fafafa;
  --ink-soft: #d4d4dc;
  --mut: #8e8e98;
  --mut-2: #64646f;
  --blue: #3b82f6;
  --blue-hover: #2563eb;
  --blue-soft: rgba(59, 130, 246, 0.14);
  --green: #22c55e;
  --green-soft: rgba(34, 197, 94, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.14);
  --tfoot-bg: #111927;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 64px;
}

html.light {
  color-scheme: light;
  --bg: #f6f7f9;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --card-hover: #f9fafb;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ink: #111827;
  --ink-soft: #374151;
  --mut: #6b7280;
  --mut-2: #9ca3af;
  --tfoot-bg: #eff6ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* Shell Layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Narrow Icon Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  z-index: 40;
}

.sidebar-brand {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.04em;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--border-strong);
  margin-bottom: 22px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.sidebar-nav a,
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--mut);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-nav a svg,
.icon-btn svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav a:hover,
.icon-btn:hover {
  color: var(--ink);
  background: var(--card);
}

.sidebar-nav a[aria-current="page"] {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: rgba(59, 130, 246, 0.25);
}

.sidebar-divider {
  display: block;
  width: 24px;
  height: 1px;
  background: var(--border);
  margin: 4px auto;
}

.sidebar-nav a.sidebar-external-link {
  color: var(--mut);
  opacity: 0.85;
}

.sidebar-nav a.sidebar-external-link:hover {
  color: var(--blue, #3b82f6);
  background: var(--card);
  border-color: rgba(59, 130, 246, 0.2);
  opacity: 1;
}

/* Tooltip on hover */
.sidebar-nav a::after {
  content: attr(data-tip);
  position: absolute;
  left: 52px;
  white-space: nowrap;
  background: #18181f;
  color: #fafafa;
  border: 1px solid var(--border-strong);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
  transition: opacity 0.12s, transform 0.12s;
  z-index: 60;
}

.sidebar-nav a:hover::after {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* Workspace */
.workspace {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.welcome-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

.welcome-title span {
  color: var(--ink);
  font-weight: 700;
}

.welcome-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--mut);
  margin-top: 2px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  display: inline-block;
}

.sep { opacity: 0.45; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Pills & Controls */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 12px;
}

.goal-pill {
  padding: 0 12px;
}

.goal-pill #goalVal {
  color: var(--blue);
  font-weight: 700;
}

.goal-track {
  width: 76px;
  height: 5px;
  border-radius: 99px;
  background: var(--border-strong);
  overflow: hidden;
}

.goal-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 99px;
  transition: width 0.35s ease;
}

.currency-pills {
  padding: 3px;
  gap: 2px;
}

.curr-pill {
  border: 0;
  background: transparent;
  color: var(--mut);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.curr-pill.active {
  background: var(--blue);
  color: #fff;
}

.sr-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.select-pill {
  cursor: pointer;
}

.select-pill select {
  background: transparent;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  padding-right: 2px;
}

.select-pill select option {
  background: var(--card);
  color: var(--ink);
}

.action-pill {
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.action-pill:hover,
.action-pill[aria-pressed="true"] {
  border-color: var(--border-strong);
  color: var(--ink);
}

.sync-pill {
  padding-right: 4px;
}

.sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.sync-btn:hover { background: var(--card-hover); border-color: var(--blue); }
.sync-btn:disabled { opacity: 0.5; cursor: default; }

.mini-ico {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Main Content */
.content {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 22px 28px 56px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.sub-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--mut);
}

.muted-xs {
  font-size: 12px;
  color: var(--mut);
}

.footnote {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--mut-2);
}

/* Cards & Grids */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
  min-width: 0;
}

.card.no-pad {
  padding: 0;
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-grid.kpi-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi-grid.kpi-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
  transition: border-color 0.15s;
}

.kpi-card:hover {
  border-color: var(--border-strong);
}

.kpi-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--mut);
}

.kpi-value {
  display: block;
  margin: 8px 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value.accent-blue { color: var(--blue); }
.kpi-value.accent-green { color: var(--green); }
.kpi-value.accent-red { color: var(--red); }
.kpi-value.accent-amber { color: var(--amber); }

.kpi-sub {
  display: block;
  font-size: 11px;
  color: var(--mut-2);
}

.grid-2-1 {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sub-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0;
}

/* Legends & Dots */
.legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--mut);
  margin-top: 4px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 4px;
}

.dot.blue { background: var(--blue); }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.amber { background: var(--amber); }

/* Key-Value Lines */
.kv-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.kv-line:last-child { border-bottom: 0; }
.kv-line span { color: var(--mut); }
.kv-line strong { color: var(--ink); font-weight: 600; }

/* Product Progress List */
.prod-row {
  margin-bottom: 11px;
}

.prod-row:last-child { margin-bottom: 0; }

.prod-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 5px;
}

.prod-name {
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.prod-stat {
  color: var(--mut);
  white-space: nowrap;
}

.prod-bar {
  height: 5px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}

.prod-bar i {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 99px;
}

/* Subtabs & Filters */
.subtabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.seg-group {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  gap: 2px;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--mut);
  padding: 6px 13px;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}

.seg-btn.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.seg-btn .cnt {
  font-size: 11px;
  opacity: 0.75;
}

.filter-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  height: 36px;
  min-width: 240px;
  color: var(--mut);
}

.search-wrap input {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
  width: 100%;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 8px 11px;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--blue);
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:disabled { opacity: 0.45; cursor: default; }
.btn-primary.full { width: 100%; padding: 11px; }

.btn-secondary {
  background: var(--card);
  color: var(--ink-soft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-secondary:hover { border-color: var(--blue); color: var(--ink); }
.btn-secondary:disabled { opacity: 0.4; cursor: default; }

/* Tables */
.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th, td {
  padding: 11px 14px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

th:first-child, td:first-child {
  text-align: left;
}

thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mut);
  background: var(--bg-elev);
}

tbody tr {
  transition: background 0.12s;
}

tbody tr:hover {
  background: var(--card-hover);
}

tbody tr.clickable {
  cursor: pointer;
}

tfoot td {
  background: var(--tfoot-bg);
  font-weight: 700;
  color: var(--ink);
  border-top: 1px solid var(--border-strong);
  border-bottom: 0;
}

.tree-btn {
  background: transparent;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.tree-btn:hover { color: var(--blue); }

/* Badges & Value Colors */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.muted { background: var(--border); color: var(--mut); }

.txt-green { color: var(--green); font-weight: 600; }
.txt-red { color: var(--red); font-weight: 600; }
.txt-blue { color: var(--blue); font-weight: 600; }
.txt-mut { color: var(--mut); }

/* Charts (Zero-Dependency Crisp SVG) */
.chart-box {
  width: 100%;
  overflow: hidden;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
}

.batch-bars {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-height: 150px;
  padding: 12px 4px 4px;
  overflow-x: auto;
}

.batch-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 56px;
}

.batch-col i {
  display: block;
  width: 28px;
  min-height: 4px;
  background: var(--blue);
  border-radius: 6px 6px 2px 2px;
}

.batch-col i.testing {
  background: repeating-linear-gradient(45deg, var(--blue) 0 4px, var(--border-strong) 4px 8px);
}

/* Forms */
.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.rules-grid label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--mut);
}

.reattr-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: center;
}

.code-field {
  margin-bottom: 12px;
}

.code-field:last-child { margin-bottom: 0; }

.mono-box {
  display: block;
  margin: 6px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--ink-soft);
  word-break: break-all;
}

.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--mut);
  font-size: 13px;
}

.pager {
  display: flex;
  gap: 6px;
}

/* Privacy Blur Mode */
body.privacy-on .val-sensitive {
  filter: blur(7px);
  user-select: none;
}

/* Slide-over Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  z-index: 80;
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: min(460px, 100%);
  height: 100%;
  background: var(--card);
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
}

.drawer-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-body {
  padding: 18px 22px;
  overflow-y: auto;
  flex: 1;
}

/* Login Modal */
.login-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 8, 0.92);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: 28px;
}

.login-badge {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--blue-soft);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 16px;
}

.login-card h2 {
  font-size: 19px;
  margin-bottom: 6px;
}

.login-card p {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--mut);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-soft);
}

.login-form input {
  background: var(--bg-elev);
  padding: 10px 12px;
}

.login-error {
  margin: 0 !important;
  font-size: 12px !important;
  color: var(--red) !important;
}

/* Responsive */
@media (max-width: 1180px) {
  .kpi-grid, .kpi-grid.kpi-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2-1, .grid-2 { grid-template-columns: 1fr; }
  .reattr-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .sidebar {
    inset: auto 0 0 0;
    width: 100%;
    height: 58px;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 6px;
    border-right: 0;
    border-top: 1px solid var(--border);
    overflow: hidden;
  }
  .sidebar-brand, .sidebar-footer, .sidebar-nav a::after, .sidebar-divider { display: none; }
  .sidebar-nav {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .sidebar-nav a { flex-shrink: 0; width: 36px; height: 36px; }
  .workspace { margin-left: 0; padding-bottom: 66px; }
  .topbar, .content { padding-left: 14px; padding-right: 14px; }
  .goal-pill { display: none; }
  .reattr-grid { grid-template-columns: 1fr; }
}

/* ========================================================================== */
/* FASE 1: MELHORIAS FINTECH PREMIUM & RESPONSIVIDADE                         */
/* ========================================================================== */

/* Skeleton Loading Shimmer */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--card) 25%, var(--soft) 50%, var(--card) 75%) !important;
  background-size: 200% 100% !important;
  animation: shimmer 1.5s infinite !important;
  border-radius: 4px;
  color: transparent !important;
}

.skeleton-card {
  border-color: var(--line) !important;
}

/* Toasts de Feedback */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.success {
  border-color: rgba(56, 189, 248, 0.4);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.toast-icon {
  font-weight: 700;
  font-size: 14px;
}

/* Período Personalizado */
.custom-dates-pill {
  display: flex;
  align-items: center;
  gap: 6px;
}

.custom-dates-pill input[type="date"] {
  background: transparent;
  border: none;
  color: inherit;
  font-size: 12px;
  padding: 2px;
  color-scheme: dark;
}

/* Cabeçalhos de Tabela Ordenáveis */
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}

th.sortable:hover {
  color: var(--ink);
}

.sort-arrow {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: var(--blue);
}

/* Compatibilidade de classes legadas */
.metric {
  box-sizing: border-box;
}

/* Mobile First Sticky First Column */
@media (max-width: 720px) {
  .table-wrap th:first-child,
  .table-wrap td:first-child {
    position: sticky;
    left: 0;
    background: var(--card);
    z-index: 2;
  }
}

/* Breakdown Grid & Donut Chart */
.breakdown-grid {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 140px;
  padding: 8px 0;
}

@media (max-width: 600px) {
  .breakdown-grid {
    flex-direction: column;
    align-items: stretch;
  }
}

.donut-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.donut-center .val {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: block;
}

.donut-center .sub {
  font-size: 10px;
  color: var(--mut);
  text-transform: uppercase;
}

.breakdown-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.breakdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  gap: 8px;
}

.breakdown-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breakdown-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.breakdown-stat {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

/* ============================================================================
 * INTERACTIVE WORLD MAP & COUNTRIES STACK
 * ============================================================================ */
:root {
  --map-bg: rgba(12, 12, 15, 0.7);
  --map-land: #18181f;
  --map-land-stroke: #2b2b34;
}

html.light {
  --map-bg: #f8fafc;
  --map-land: #e2e8f0;
  --map-land-stroke: #cbd5e1;
}

.countries-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.world-map-wrap {
  width: 100%;
  position: relative;
  background: var(--map-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;
}

.world-map-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 250px;
  border-radius: 4px;
}

.world-map-grid line {
  stroke: var(--border);
  stroke-width: 0.5;
  stroke-dasharray: 2 4;
  opacity: 0.5;
}

.world-map-land,
.world-map-country {
  fill: var(--map-land, #171820);
  stroke: var(--map-land-stroke, #2c2e3a);
  stroke-width: 0.7;
  stroke-linejoin: round;
  transition: fill 0.2s ease, stroke 0.2s ease, filter 0.2s ease;
  cursor: pointer;
}

.world-map-country.has-sales {
  fill: rgba(59, 130, 246, 0.22);
  stroke: rgba(59, 130, 246, 0.65);
  stroke-width: 0.9;
}

.world-map-country:hover,
.world-map-country.is-hovered {
  fill: rgba(59, 130, 246, 0.45);
  stroke: #3b82f6;
  stroke-width: 1.4;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.5));
}

html.light .world-map-country {
  fill: #e2e8f0;
  stroke: #cbd5e1;
}

html.light .world-map-country.has-sales {
  fill: rgba(59, 130, 246, 0.18);
  stroke: #3b82f6;
}

html.light .world-map-country:hover,
html.light .world-map-country.is-hovered {
  fill: rgba(59, 130, 246, 0.35);
  stroke: #2563eb;
}

.world-map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 11px;
  color: #f1f5f9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 50;
  display: none;
  transform: translate(-50%, -120%);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.world-map-tooltip.is-active {
  display: flex;
  align-items: center;
  gap: 8px;
}

html.light .world-map-tooltip {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(59, 130, 246, 0.35);
  color: #0f172a;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.map-tooltip-flag {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.map-tooltip-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.map-tooltip-title {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-tooltip-stats {
  font-size: 11px;
  color: #cbd5e1;
}

html.light .map-tooltip-stats {
  color: #475569;
}

.map-pin {
  cursor: pointer;
}

.map-pin-inner {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-pin:hover .map-pin-inner,
.map-pin.is-hovered .map-pin-inner {
  transform: scale(1.35);
}

.map-pin-halo {
  fill: var(--blue);
  opacity: 0.35;
  transform-box: fill-box;
  transform-origin: center;
  animation: mapPinPulse 2.4s infinite ease-out;
}

.map-pin:hover .map-pin-halo,
.map-pin.is-hovered .map-pin-halo {
  opacity: 0.75;
  animation: mapPinPulseFast 1.2s infinite ease-out;
}

.map-pin-core {
  fill: #60a5fa;
  stroke: #ffffff;
  stroke-width: 1.5;
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.8));
  transition: fill 0.2s, stroke-width 0.2s;
}

.map-pin:hover .map-pin-core,
.map-pin.is-hovered .map-pin-core {
  fill: #93c5fd;
  stroke-width: 2;
  filter: drop-shadow(0 0 8px #3b82f6);
}

@keyframes mapPinPulse {
  0% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.5); opacity: 0.25; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes mapPinPulseFast {
  0% { transform: scale(0.9); opacity: 0.85; }
  100% { transform: scale(2.4); opacity: 0; }
}

.country-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.country-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

html.light .country-row {
  background: rgba(0, 0, 0, 0.02);
}

.country-row:hover,
.country-row.is-hovered {
  background: var(--blue-soft);
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateX(2px);
}

.country-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}

.country-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.country-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.country-flag-svg {
  width: 22px;
  height: 15px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  vertical-align: middle;
  flex-shrink: 0;
  display: inline-block;
  overflow: hidden;
}

html.light .country-flag-svg {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.country-name {
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.country-code-pill {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(147, 197, 253, 0.12);
  color: #93c5fd;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.country-metrics {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.country-count {
  font-weight: 600;
  color: var(--ink);
}

.country-pct {
  color: var(--mut);
  font-size: 11px;
}

.country-revenue {
  color: #34d399;
  font-weight: 600;
  font-size: 12px;
}

.country-bar-bg {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

html.light .country-bar-bg {
  background: rgba(0, 0, 0, 0.06);
}

.country-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  transition: width 0.4s ease;
}

/* =============================================================================
   Aba Clientes (Customers Directory)
   ============================================================================= */

.cust-kpi-grid {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .cust-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .cust-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.cust-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
}

.cust-filters-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.cust-filters-right select {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--ink);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  outline: none;
}

.cust-filters-right select:focus {
  border-color: var(--blue);
}

.cust-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.cust-table th {
  padding: 12px 16px;
  color: var(--mut);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--bg-elev);
}

.cust-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  vertical-align: middle;
}

.cust-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.cust-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

html.light .cust-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.035);
}

.badge-purchased {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-not-purchased {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.order-tag {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: #93c5fd;
  white-space: nowrap;
}

.order-tag-extra {
  font-size: 10px;
  color: var(--mut);
  margin-left: 4px;
}

.cust-pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}

.cust-page-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Gaveta Lateral de Detalhes do Cliente */
.cust-drawer-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.cust-drawer-section:last-child {
  border-bottom: none;
}

.cust-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mut);
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cust-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.cust-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cust-detail-label {
  font-size: 11px;
  color: var(--mut);
}

.cust-detail-val {
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
  word-break: break-word;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 211, 102, 0.15);
  color: #25d366;
  border: 1px solid rgba(37, 211, 102, 0.35);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 6px;
}

.btn-whatsapp:hover {
  background: rgba(37, 211, 102, 0.25);
  border-color: #25d366;
  color: #fff;
}

.cust-orders-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.cust-order-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cust-order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cust-order-tx {
  font-family: var(--font-mono, monospace);
  font-weight: 600;
  font-size: 12px;
  color: #60a5fa;
}

.cust-order-prod {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
}

.cust-order-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--mut);
}

