/* ============================================================
   Capaxero Cloud — Sistema visual "Apple"
   Tipografia do sistema, superfícies limpas, materiais translúcidos
   e cores semânticas com tema claro e escuro.
   Carregado depois de style.css: redefine tokens e componentes.
   ============================================================ */

/* ---------- Tokens ---------- */
:root,
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f5f7;
  --bg-rgb: 245, 245, 247;
  --surface: #ffffff;
  --surface-rgb: 255, 255, 255;
  --surface-2: #f5f5f7;
  --surface-3: #ebebf0;
  --elevated: #ffffff;
  --sidebar-bg: rgba(250, 250, 252, 0.82);
  --bar-bg: rgba(245, 245, 247, 0.78);
  --tabbar-bg: rgba(250, 250, 252, 0.86);

  --text: #1d1d1f;
  --text-soft: #424245;
  --text-muted: #6e6e73;
  --text-dim: #86868b;
  --ink-rgb: 0, 0, 0;

  --separator: rgba(0, 0, 0, 0.08);
  --separator-strong: rgba(0, 0, 0, 0.14);
  --fill: rgba(118, 118, 128, 0.12);
  --fill-2: rgba(118, 118, 128, 0.08);
  --fill-3: rgba(118, 118, 128, 0.18);

  --accent: #fdcb24;
  --accent-rgb: 253, 203, 36;
  --accent-text: #8f6400;
  --on-accent: #1d1d1f;

  --green: #248a3d;   --green-rgb: 36, 138, 61;
  --blue: #0071e3;    --blue-rgb: 0, 113, 227;
  --orange: #c45c00;  --orange-rgb: 196, 92, 0;
  --red: #d70015;     --red-rgb: 215, 0, 21;
  --teal: #0a7e8c;    --teal-rgb: 10, 126, 140;
  --indigo: #3634a3;  --indigo-rgb: 54, 52, 163;
  --purple: #8944ab;  --purple-rgb: 137, 68, 171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.10), 0 30px 80px rgba(0, 0, 0, 0.12);
  --overlay: rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --surface: #1c1c1e;
  --surface-rgb: 28, 28, 30;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --elevated: #1c1c1e;
  --sidebar-bg: rgba(22, 22, 24, 0.86);
  --bar-bg: rgba(0, 0, 0, 0.72);
  --tabbar-bg: rgba(22, 22, 24, 0.86);

  --text: #f5f5f7;
  --text-soft: #d1d1d6;
  --text-muted: #98989d;
  --text-dim: #6e6e73;
  --ink-rgb: 255, 255, 255;

  --separator: rgba(255, 255, 255, 0.09);
  --separator-strong: rgba(255, 255, 255, 0.16);
  --fill: rgba(118, 118, 128, 0.24);
  --fill-2: rgba(118, 118, 128, 0.16);
  --fill-3: rgba(118, 118, 128, 0.32);

  --accent: #ffd60a;
  --accent-rgb: 255, 214, 10;
  --accent-text: #ffd60a;
  --on-accent: #1d1d1f;

  --green: #30d158;   --green-rgb: 48, 209, 88;
  --blue: #2997ff;    --blue-rgb: 41, 151, 255;
  --orange: #ff9f0a;  --orange-rgb: 255, 159, 10;
  --red: #ff453a;     --red-rgb: 255, 69, 58;
  --teal: #64d2ff;    --teal-rgb: 100, 210, 255;
  --indigo: #7d7aff;  --indigo-rgb: 125, 122, 255;
  --purple: #bf5af2;  --purple-rgb: 191, 90, 242;

  --shadow-sm: none;
  --shadow-md: 0 0 0 0.5px rgba(255, 255, 255, 0.04);
  --shadow-lg: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
  --overlay: rgba(0, 0, 0, 0.56);
}

:root {
  /* Aliases usados pelo CSS e JS legados */
  --brand-yellow: var(--accent);
  --brand-gold: var(--accent);
  --brand-green: var(--green);
  --brand-blue: var(--blue);
  --brand-navy: var(--indigo);
  --status-green: var(--green);
  --status-blue: var(--blue);
  --status-orange: var(--orange);
  --status-red: var(--red);
  --status-gray: var(--text-dim);
  --bg-card: var(--surface);
  --bg-card-strong: var(--surface);
  --bg-elevated: var(--elevated);
  --border: var(--separator);
  --border-strong: var(--separator-strong);
  --border-soft: var(--separator);
  --text-primary: var(--text);
  --shadow-card: var(--shadow-sm);
  --shadow-float: var(--shadow-lg);

  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --font-num: var(--font-display);

  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-apple: cubic-bezier(0.32, 0.72, 0, 1);

  --sidebar-w: 248px;
  --topbar-h: 64px;
  --page-gutter: clamp(20px, 3.2vw, 48px);
}

/* ---------- Base ---------- */
html { background: var(--bg); -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  padding-bottom: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.47;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
}
body::after { content: none !important; display: none !important; }

.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }

::selection { color: var(--text); background: rgba(var(--blue-rgb), 0.24); }
a { color: var(--blue); text-underline-offset: 3px; }
button, input, select, textarea { font-family: inherit; caret-color: var(--blue); }

* { scrollbar-width: thin; scrollbar-color: var(--fill-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--fill-3); border: 3px solid transparent; border-radius: 10px; background-clip: padding-box; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(var(--blue-rgb), 0.32) !important;
}

.mono, .val.mono, .kpi-value, .rev, table.data-table td { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
[style*="--font-num"] { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
/* Monoespaçada só para códigos; números e selos usam a fonte do sistema com algarismos tabulares */
.map-hint, .cpx-depot-pin .pin-tag, .admin-badge, .gauge-ring .inner, .plan-total strong,
.chart-y-axis, .chart-x-axis span, .rank-idx, .coupon-discount-badge, .coupon-scope-badge.specific,
.coupon-usage-text, .coupon-cpf-limit-badge, .coupon-cpf-count strong, .cpf-summary-box .val,
.coupon-edit-tab .tab-count, .stock-updated-at, .station-cycle-chart-head strong, .cycle-chart-axis-label,
.info-box .val.mono, .plan-fields input.form-control {
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--text); letter-spacing: -0.015em; }

/* ============================================================
   Barra lateral (macOS) e barra de abas (iOS)
   ============================================================ */
.navbar {
  position: fixed !important;
  z-index: 1000;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  height: 100vh;
  min-height: 100vh;
  padding: 18px 12px 16px;
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 0;
  border: 0;
  border-right: 1px solid var(--separator);
  background: transparent;
  /* Sem backdrop-filter aqui: ele criaria um bloco de contenção para os filhos fixos (busca e perfil) */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none;
  overflow: visible;
}
.navbar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--sidebar-bg);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
}
/* Barra superior translúcida: fica abaixo do cabeçalho (busca/perfil) e do filtro de vínculo */
.navbar::after { content: none !important; }
body::before {
  content: '';
  display: block !important;
  position: fixed;
  z-index: 990;
  inset: auto;
  opacity: 1;
  mask-image: none;
  background-image: none;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  width: auto;
  background: var(--bar-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
  pointer-events: none;
}
body:has(.auth-backdrop:not(.hidden))::before { display: none !important; }

.navbar .brand {
  order: 0 !important;
  min-height: 0;
  margin: 0 0 18px;
  padding: 4px 8px;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start;
  gap: 10px;
  border: 0;
  width: 100%;
}
.navbar .brand img {
  width: 34px !important;
  height: 34px !important;
  object-fit: cover;
  border: 0;
  border-radius: 9px !important;
  box-shadow: 0 0 0 0.5px var(--separator-strong), var(--shadow-sm);
}
.brand-lockup { display: grid; gap: 0; margin: 0; text-align: left; line-height: 1.15; }
.brand-lockup b { color: var(--text); font-family: var(--font-display); font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-lockup small { color: var(--text-muted); font-family: var(--font-body); font-size: 11.5px; font-weight: 500; letter-spacing: 0; }

.nav-tabs {
  order: 1 !important;
  width: 100% !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  gap: 2px !important;
  border: 0 !important;
  overflow: visible !important;
}
.nav-tabs::before {
  content: 'Painel';
  display: block;
  padding: 0 10px 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.nav-tab-btn {
  position: relative !important;
  width: 100% !important;
  min-height: 34px !important;
  height: auto !important;
  margin: 0 !important;
  padding: 7px 10px !important;
  display: flex;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  color: var(--text-soft) !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  letter-spacing: -0.005em !important;
  line-height: 1.2 !important;
  text-align: left !important;
  white-space: nowrap !important;
  transform: none !important;
  transition: background-color 150ms ease, color 150ms ease !important;
}
.nav-tab-btn::after { content: none !important; }
.nav-tab-btn .i { width: 18px !important; height: 18px !important; stroke-width: 1.8; color: var(--text-muted); transition: color 150ms ease; }
.nav-tab-btn > span { display: block; overflow: hidden; text-overflow: ellipsis; }
@media (hover: hover) {
  .nav-tab-btn:hover { background: var(--fill-2) !important; color: var(--text) !important; }
}
.nav-tab-btn:active { background: var(--fill) !important; }
.nav-tab-btn.active {
  color: var(--text) !important;
  font-weight: 600 !important;
  background: var(--fill) !important;
}
.nav-tab-btn.active .i { color: var(--accent-text); }

/* ---------- Ações da barra superior ---------- */
.topbar-actions {
  position: fixed;
  z-index: 1003;
  top: 0;
  right: var(--page-gutter);
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
}

.navbar-search {
  position: relative;
  inset: auto;
  order: 0;
  width: clamp(200px, 26vw, 340px);
  height: 36px;
  margin: 0;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 10px;
  background: var(--fill);
  box-shadow: none;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.navbar-search:focus-within { background: var(--surface); box-shadow: 0 0 0 4px rgba(var(--blue-rgb), 0.28), 0 0 0 1px rgba(var(--blue-rgb), 0.6) inset; }
.navbar-search > .i { width: 16px; height: 16px; color: var(--text-muted); stroke: currentColor; }
.navbar-search input { color: var(--text); font-size: 13.5px; -webkit-appearance: none; appearance: none; }
.navbar-search input::placeholder { color: var(--text-muted); }
.navbar-search input::-webkit-search-cancel-button { display: none; }
.navbar-search input:focus-visible { box-shadow: none !important; }
#global-search-clear {
  width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%;
  background: var(--text-dim); color: var(--surface); cursor: pointer;
  flex: 0 0 auto; line-height: 0;
}
#global-search-clear .i { width: 11px; height: 11px; stroke-width: 3; }

.theme-toggle {
  position: relative;
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--text-soft);
  background: var(--fill);
  cursor: pointer;
  transition: background-color 150ms ease, transform 150ms var(--ease-out);
}
.theme-toggle:hover { background: var(--fill-3); color: var(--text); }
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle .i { position: absolute; width: 18px; height: 18px; transition: opacity 250ms ease, transform 400ms var(--ease-apple); }
.theme-icon-moon { opacity: 0; transform: rotate(-60deg) scale(0.6); }
:root[data-theme="dark"] .theme-icon-sun { opacity: 0; transform: rotate(60deg) scale(0.6); }
:root[data-theme="dark"] .theme-icon-moon { opacity: 1; transform: none; }

.profile-wrap { position: relative; inset: auto; z-index: 1; margin: 0; }
.profile-btn {
  height: 36px;
  padding: 0 8px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: var(--fill);
  box-shadow: none;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.profile-btn:hover { background: var(--fill-3); }
.profile-dot { width: 7px; height: 7px; box-shadow: 0 0 0 3px rgba(var(--green-rgb), 0.18); }
.profile-name { color: var(--text); font-size: 13px; font-weight: 500; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.profile-role {
  padding: 2px 7px;
  color: var(--text-soft);
  background: var(--fill);
  border: 0;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
}
.profile-caret { width: 14px !important; height: 14px !important; color: var(--text-muted); }

.profile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  background: rgba(var(--surface-rgb), 0.94);
  backdrop-filter: saturate(180%) blur(30px);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  box-shadow: var(--shadow-lg), 0 0 0 0.5px var(--separator-strong);
  transform-origin: top right;
}
.profile-menu.open { animation: cpxMenuIn 220ms var(--ease-apple) both; }
.pm-head { display: flex; align-items: center; gap: 12px; padding: 4px 4px 14px; }
.pm-avatar {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--on-accent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent));
  font-family: var(--font-display); font-size: 15px; font-weight: 650; letter-spacing: 0.02em;
}
.pm-id { min-width: 0; }
.pm-name { color: var(--text); font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-email { color: var(--text-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.pm-stat { padding: 10px 12px; border-radius: 10px; background: var(--fill-2); }
.pm-stat-lbl { color: var(--text-muted); font-size: 11.5px; font-weight: 500; }
.pm-stat-val { margin-top: 2px; font-family: var(--font-display); font-size: 22px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pm-rows { padding: 2px 4px; }
.pm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 34px; color: var(--text-muted); font-size: 13px; border-bottom: 1px solid var(--separator); }
.pm-row:last-child { border-bottom: 0; }
.pm-row .pm-num { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pm-role { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 600; }
.pm-role .i { color: var(--accent-text); }
.pm-appearance { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 10px; padding: 10px 4px 0; border-top: 1px solid var(--separator); color: var(--text-muted); font-size: 13px; }
.pm-theme-seg { margin: 0 !important; }
.pm-actions { display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--separator); }
.profile-menu .pm-link {
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.profile-menu .pm-link .i { width: 17px; height: 17px; color: var(--text-muted); }
.profile-menu .pm-link:hover { color: var(--text); background: var(--fill); }
.profile-menu .pm-logout, .profile-menu .pm-logout .i { color: var(--red); }

/* ---------- Filtro de vínculo (admin) ---------- */
.ownership-bar {
  position: fixed !important;
  z-index: 995;
  top: 0 !important;
  left: calc(var(--sidebar-w) + var(--page-gutter)) !important;
  right: auto !important;
  height: var(--topbar-h) !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
}
.ownership-bar-label { color: var(--text-muted); font-size: 12.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }

/* Segmented control (UISegmentedControl) */
.segmented {
  position: relative;
  margin: 0;
  padding: 2px;
  display: inline-flex;
  gap: 0;
  border: 0;
  border-radius: 9px;
  background: var(--fill);
}
.segmented button {
  position: relative;
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: nowrap;
  transition: background-color 200ms ease, box-shadow 200ms ease;
}
.segmented button + button::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 1px;
  background: var(--separator-strong);
  transition: opacity 150ms ease;
}
.segmented button.active + button::before, .segmented button.active::before { opacity: 0; }
.segmented button.active {
  color: var(--text);
  font-weight: 600;
  background: var(--surface);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}
:root[data-theme="dark"] .segmented button.active { background: #636366; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3); }

/* Intervalo de datas do dashboard ("de … até …") */
.date-range {
  align-items: center;
  gap: 4px;
  padding: 2px;
  border-radius: 10px;
  background: var(--fill);
}
.date-range-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 4px 0 10px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 0 0 0.5px var(--separator-strong);
  cursor: pointer;
}
:root[data-theme="dark"] .date-range-field { background: var(--surface-2); }
.date-range-field:focus-within { box-shadow: 0 0 0 4px rgba(var(--blue-rgb), 0.28), 0 0 0 1px var(--blue); }
.date-range-field > span { color: var(--text-muted); font-size: 12px; font-weight: 500; }
.date-range-field input {
  height: 30px;
  padding: 0 4px;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color-scheme: inherit;
}
.date-range-field input:focus-visible { box-shadow: none !important; }
.date-range-field input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.55; }
.date-range-sep { color: var(--text-dim); font-size: 13px; }

/* Perfis sem acesso de administrador */
body:not(.is-admin) .admin-only,
body:not(.is-admin) #tab-cadastros,
body:not(.is-admin) #tab-manutencao,
body:not(.is-admin) #ownership-bar,
body:not(.is-admin) .ownership-bar,
body:not(.is-admin) #page-cadastros,
body:not(.is-admin) #page-manutencao,
.nav-tab-btn[style*="display: none"],
.nav-tab-btn[style*="display:none"],
.ownership-bar[style*="display: none"],
.ownership-bar[style*="display:none"] { display: none !important; }

/* ============================================================
   Página e títulos
   ============================================================ */
.page,
body:not(.is-admin) .page {
  width: auto;
  max-width: none;
  margin: 0 0 0 var(--sidebar-w);
  padding: calc(var(--topbar-h) + 36px) var(--page-gutter) 64px !important;
}
.page > div { width: min(100%, 1480px); margin: 0 auto; }
.page.active > div { animation: cpxPageIn 420ms var(--ease-apple) both; }

.page-head {
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
  padding: 0;
  border: 0;
}
.page-head h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(28px, 2.6vw, 34px);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.12;
  text-wrap: balance;
}
.page-head h1 .i { display: none; }
.page-head p { max-width: 70ch; margin: 6px 0 0; color: var(--text-muted); font-size: 15px; line-height: 1.45; }

h2, h3,
.table-card-head h2, .panel-card h2, .chart-card h2, .chart-head h2, .station-group-head h2 {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.012em;
  text-transform: none;
}
.section-title { margin: 0 0 4px; font-size: 20px; font-weight: 650; }

/* ============================================================
   Cartões e superfícies
   ============================================================ */
.kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 28px; }
.kpi-card {
  min-height: 0;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--separator);
  backdrop-filter: none;
  transition: transform 300ms var(--ease-apple), box-shadow 300ms ease;
}
.kpi-card::before, .kpi-card::after { content: none !important; }
.kpi-card:hover { transform: none; box-shadow: var(--shadow-md), 0 0 0 0.5px var(--separator); }
.kpi-card.orange { border: 0; }
.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.003em;
  text-transform: none;
}
.kpi-label::before {
  content: '';
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent, var(--green));
}
.kpi-value {
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: clamp(26px, 2.3vw, 34px);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-card:first-child .kpi-value { font-size: clamp(26px, 2.3vw, 34px); }
.kpi-sub { margin-top: 6px; padding: 0; color: var(--text-muted); font-size: 12.5px; }

.table-card, .panel-card, .chart-card, .map-panel, .dashboard-card, .summary-card, .simulator-card {
  border: 0 !important;
  border-radius: var(--radius-lg) !important;
  background: var(--surface) !important;
  box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--separator) !important;
  backdrop-filter: none !important;
}
.table-card { overflow: hidden; }
.table-card-head {
  min-height: 56px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--separator);
  background: transparent;
}
.table-card-head h2, .panel-card h2, .chart-card h2, .chart-head h2 { font-size: 17px; letter-spacing: -0.01em; }
.table-card-head .count {
  padding: 2px 8px;
  color: var(--text-muted);
  background: var(--fill);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
}
.panel-card, .chart-card { padding: 20px 22px; }
.panel-card p, .panel-card > p { color: var(--text-muted); line-height: 1.5; }
.chart-head { padding-bottom: 14px; border-bottom: 1px solid var(--separator); }
.chart-head .total, .rank-val { color: var(--green); font-family: var(--font-display); font-weight: 650; }
.chart-y-axis, .chart-x-axis span { color: var(--text-dim); font-family: var(--font-body); }
.rank-bar-bg { background: var(--fill); }
.rank-bar-fill { background: var(--accent); }
.rank-idx { border-radius: 7px; }

/* Tabelas */
.data-table, table.data-table { background: transparent; }
.data-table thead th, table.data-table th, .coupons-data-table th {
  padding: 10px 16px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--separator);
  background: rgba(var(--surface-rgb), 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.data-table tbody td, table.data-table td {
  padding: 13px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--separator);
  font-size: 13.5px;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { color: var(--text); background: var(--fill-2); }
.data-table .mono, table.data-table .mono { color: var(--text-soft); }
table.data-table .muted { color: var(--text-muted); }
table.data-table .accent { color: var(--accent-text); }

/* Estações */
.station-group { margin-top: 32px; margin-bottom: 0; }
.station-group-head { margin-bottom: 12px; padding: 0 2px; border: 0; align-items: baseline; }
.station-group-head h2 { color: var(--text); font-size: 20px; font-weight: 650; letter-spacing: -0.015em; }
.station-group-head .sub { color: var(--text-muted); font-size: 13px; }
.station-group-head .rule { background: var(--separator); }
.station-group-head .rev { color: var(--green); font-family: var(--font-display); font-weight: 600; }
.totem-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.totem-card {
  position: relative;
  padding: 16px;
  overflow: hidden;
  border: 0 !important;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--separator) !important;
  backdrop-filter: none;
  transition: transform 300ms var(--ease-apple), box-shadow 300ms ease;
}
.totem-card::after { content: none; }
@media (hover: hover) {
  .totem-card:hover { transform: translateY(-2px); background: var(--surface); box-shadow: var(--shadow-md), 0 0 0 0.5px var(--separator-strong) !important; }
}
.totem-card:active { transform: scale(0.985); }
.totem-card.status-cleaning { box-shadow: var(--shadow-sm), 0 0 0 1.5px rgba(var(--blue-rgb), 0.55) !important; }
.totem-card.status-error { box-shadow: var(--shadow-sm), 0 0 0 1.5px rgba(var(--red-rgb), 0.5) !important; }
.totem-card-top .name { color: var(--text); font-family: var(--font-display); font-size: 16px; font-weight: 650; letter-spacing: -0.015em; }
.totem-card-loc, .totem-location { color: var(--text-muted); font-size: 13px; }
.status-pill { padding: 3px 9px; font-size: 12px; font-weight: 600; }
.status-pill i { width: 6px; height: 6px; }
.cycle-box { border: 0; border-radius: 12px; background: var(--fill-2); }
.cycle-box.is-active { border: 0; background: rgba(var(--blue-rgb), 0.1); }
.cycle-box-info .title { font-size: 13px; }
.cycle-box-info .sub { font-size: 12px; }
.cycle-box-pct { font-family: var(--font-display); font-weight: 650; }
.cycle-bar-bg, .progress-track { height: 5px; background: var(--fill); }
.cycle-bar-fill { background: var(--fill-color, var(--blue)); animation: none; }
.totem-card-foot { color: var(--text-muted); font-family: var(--font-body); font-size: 13px; font-variant-numeric: tabular-nums; }
.totem-card-foot .rev { color: var(--green); font-weight: 600; }

/* Caixas de informação, medidores e painéis */
.info-box, .gauge-card, .cpf-summary-box, .stock-card {
  border: 0 !important;
  border-radius: 12px;
  background: var(--fill-2) !important;
  box-shadow: none;
}
.info-box .lbl, .cpf-summary-box .lbl { color: var(--text-muted); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.info-box .val, .cpf-summary-box .val { color: var(--text); font-size: 15px; font-weight: 600; }
.gauge-title { color: var(--text); }
.gauge-sub, .stock-updated-at { color: var(--text-muted); }
.gauge-ring { box-shadow: none; }
.gauge-ring .inner { background: var(--surface); }
.admin-panel {
  border: 0 !important;
  border-radius: 14px;
  background: var(--fill-2) !important;
}
.admin-panel-yellow-border { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.45) !important; }
.admin-badge { border-radius: 6px; background: rgba(var(--accent-rgb), 0.2); color: var(--accent-text); border: 0; }
.admin-panel-note { color: var(--text-muted); }
.plan-block { border: 0; border-radius: 12px; background: var(--fill-2); }
.plan-block-head .plan-name { color: var(--text); font-family: var(--font-display); font-weight: 600; }
.plan-block-head .plan-desc { color: var(--text-muted); }

.station-cycle-chart { border: 0; border-radius: 14px; background: var(--fill-2); }
.cycle-chart-grid { stroke: var(--separator); }
.cycle-chart-axis-label { fill: var(--text-dim); }
.cycle-chart-line { stroke: var(--green); }
.cycle-chart-point { fill: var(--surface); stroke: var(--green); }
.chart-gridline { border-color: var(--separator); }

.history-notice { border-radius: 12px; border: 0; }
.history-notice.neutral { color: var(--text-soft); background: var(--fill-2); }
.history-notice.green { color: var(--green); background: rgba(var(--green-rgb), 0.1); }
.history-notice.amber { color: var(--orange); background: rgba(var(--orange-rgb), 0.1); }
.history-notice.red { color: var(--red); background: rgba(var(--red-rgb), 0.1); }

.empty-state { color: var(--text-muted); }
.empty-state h3 { color: var(--text); font-weight: 600; }

/* ============================================================
   Controles
   ============================================================ */
.btn {
  min-height: 36px;
  padding: 0 16px;
  justify-content: center;
  gap: 6px;
  border: 0 !important;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600 !important;
  letter-spacing: -0.005em;
  box-shadow: none;
  transition: transform 150ms var(--ease-out), background-color 150ms ease, filter 150ms ease, opacity 150ms ease;
}
.btn:hover { transform: none !important; }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover { filter: brightness(0.96); transform: none; }
  :root[data-theme="dark"] .btn:not(:disabled):hover { filter: brightness(1.12); }
}
.btn:active:not(:disabled) { transform: scale(0.97) !important; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary,
.btn[style*="background:var(--accent)"],
.btn[style*="background:var(--brand-yellow)"] {
  color: var(--on-accent) !important;
  background: var(--accent) !important;
  box-shadow: none !important;
}
.btn-outline { color: var(--text) !important; background: var(--fill) !important; }
.btn-outline:hover { color: var(--text) !important; background: var(--fill-3) !important; }
.btn-blue { color: var(--blue) !important; background: rgba(var(--blue-rgb), 0.12) !important; }
.btn-yellow-outline { color: var(--accent-text) !important; background: rgba(var(--accent-rgb), 0.18) !important; }
.btn-orange { color: var(--orange) !important; background: rgba(var(--orange-rgb), 0.12) !important; }
.btn-danger { color: var(--red) !important; background: rgba(var(--red-rgb), 0.1) !important; }
.btn[style*="background:var(--blue)"], .btn[style*="background: var(--blue)"] { color: #fff !important; }
.btn[style*="background:var(--orange)"] { color: #fff !important; }

.form-control, .map-search-box, .coupon-search-wrap {
  min-height: 38px;
  padding: 8px 12px;
  color: var(--text);
  border: 1px solid var(--separator-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  box-shadow: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .map-search-box,
:root[data-theme="dark"] .coupon-search-wrap { background: var(--fill-2); border-color: var(--separator); }
.form-control::placeholder { color: var(--text-dim); }
.form-control:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(var(--blue-rgb), 0.22); }
textarea.form-control { min-height: 84px; line-height: 1.45; }
select.form-control {
  padding-right: 34px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 9l5-5 5 5M7 15l5 5 5-5'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 34px !important;
  color-scheme: inherit;
}
select.form-control option, select.form-control optgroup { color: var(--text); background: var(--surface); }
label.field-label, .field-label, .form-group label {
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
input[type='checkbox'], input[type='radio'] { accent-color: var(--blue); }
.checkbox-row { color: var(--text); }

.status-badge, .status-chip, .admin-badge, .badge, .perm-badge, .coupon-status-chip, .coupon-scope-badge, .coupon-mode-badge, .cpf-pill { border-radius: 999px; }

/* ============================================================
   Modais (folhas)
   ============================================================ */
.modal-overlay {
  z-index: 1100;
  padding: 24px;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.modal-box {
  position: relative;
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 0;
  border-radius: var(--radius-xl);
  background: var(--elevated);
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(0.98);
  transition: transform 380ms var(--ease-apple), opacity 220ms ease;
}
.modal-box.compact { padding: 24px 26px; }
.modal-box .modal-sticky-head, .modal-sticky-head {
  padding: 20px 24px 14px;
  background: rgba(var(--surface-rgb), 0.86);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
}
.modal-box .modal-body, .modal-body { padding: 20px 24px 26px; }
.modal-box h2, .detail-title h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.modal-box .detail-loc, .detail-loc { margin-top: 4px; color: var(--text-muted); font-size: 13.5px; }
.modal-close {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--text-muted);
  background: var(--fill);
  font-size: 13px;
  font-weight: 700;
}
.modal-close:hover { color: var(--text); background: var(--fill-3); }
.modal-box .cycle-box.is-active { background: rgba(var(--blue-rgb), 0.1); box-shadow: none; }
.modal-box #modal-cycle-pct { color: var(--blue) !important; }
.modal-box #modal-cycle-bar { background: var(--blue) !important; animation: none !important; }

.modal-tabs, .coupon-edit-tabs {
  gap: 2px;
  padding: 2px;
  display: inline-flex;
  max-width: 100%;
  overflow-x: auto;
  border: 0;
  border-radius: 9px;
  background: var(--fill);
  scrollbar-width: none;
}
.modal-tab, .coupon-edit-tab {
  min-height: 30px;
  padding: 0 14px;
  margin: 0;
  color: var(--text);
  border: 0 !important;
  border-radius: 7px;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}
.modal-tab.active, .coupon-edit-tab.active {
  color: var(--text);
  font-weight: 600;
  background: var(--surface);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}
:root[data-theme="dark"] .modal-tab.active, :root[data-theme="dark"] .coupon-edit-tab.active { background: #636366; }

/* ============================================================
   Ordens de manutenção — relatório de atendimento
   ============================================================ */
.om-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
  background: var(--fill);
}
.om-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.om-chip[data-tone="green"] { color: var(--green); background: rgba(var(--green-rgb), 0.12); }
.om-chip[data-tone="orange"] { color: var(--orange); background: rgba(var(--orange-rgb), 0.12); }
.om-chip[data-tone="blue"] { color: var(--blue); background: rgba(var(--blue-rgb), 0.12); }

.modal-box.om-report-box { width: min(760px, 100%); }
.om-report-box .modal-sticky-head { align-items: flex-start; }
.om-report-eyebrow { color: var(--text-muted); font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.om-report-form { display: grid; gap: 14px; }
.om-report-issue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--fill-2);
}
.om-report-issue p { flex-basis: 100%; margin: 4px 0 0; color: var(--text-soft); font-size: 13.5px; }

.om-section {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--separator);
}
:root[data-theme="dark"] .om-section { background: var(--fill-2); box-shadow: none; }
.om-section legend {
  float: left;
  width: 100%;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.om-section legend + * { clear: both; }
.om-grid { display: grid; gap: 12px; }
.om-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.om-grid-4 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.5fr); }
.om-time-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.om-section .form-control { min-width: 0; width: 100%; }
.om-duration { margin-top: 8px; color: var(--text-muted); font-size: 12.5px; min-height: 0; }
.om-duration:empty { display: none; }
.om-duration.is-error { color: var(--red); }

.om-check-count { color: var(--text-muted); font-family: var(--font-body); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.om-checklist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.om-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text);
  background: var(--fill-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.om-check:hover { background: var(--fill); }
.om-check input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--green); }
.om-check:has(input:checked) { background: rgba(var(--green-rgb), 0.1); }

.om-parts-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.om-btn-sm { min-height: 28px !important; padding: 0 10px !important; font-size: 12.5px !important; }
.om-parts { display: grid; gap: 6px; }
.om-parts:empty::before { content: 'Nenhuma peça adicionada.'; color: var(--text-dim); font-size: 13px; }
.om-part-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px 32px; gap: 6px; align-items: center; }
.om-part-remove {
  width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%;
  color: var(--text-muted); background: transparent; cursor: pointer;
}
.om-part-remove:hover { color: var(--red); background: rgba(var(--red-rgb), 0.1); }

.om-outcomes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.om-outcome {
  position: relative;
  display: flex;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--fill-2);
  box-shadow: inset 0 0 0 1.5px transparent;
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
.om-outcome input { margin: 2px 0 0; accent-color: var(--tone, var(--blue)); }
.om-outcome[data-tone="green"] { --tone: var(--green); --tone-rgb: var(--green-rgb); }
.om-outcome[data-tone="orange"] { --tone: var(--orange); --tone-rgb: var(--orange-rgb); }
.om-outcome[data-tone="blue"] { --tone: var(--blue); --tone-rgb: var(--blue-rgb); }
.om-outcome:has(input:checked) { background: rgba(var(--tone-rgb), 0.1); box-shadow: inset 0 0 0 1.5px var(--tone); }
.om-outcome b { display: block; color: var(--text); font-size: 13.5px; font-weight: 600; }
.om-outcome small { display: block; color: var(--text-muted); font-size: 12px; }

.om-close-toggle {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(var(--green-rgb), 0.08);
  cursor: pointer;
}
.om-close-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--green); }
.om-close-toggle b { display: block; color: var(--text); font-size: 13.5px; font-weight: 600; }
.om-close-toggle small { display: block; color: var(--text-muted); font-size: 12px; }

.auth-error-msg.om-report-error { display: none; margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(var(--red-rgb), 0.08); text-align: left; }
.om-report-meta { color: var(--text-dim); font-size: 12px; }
.om-report-meta:empty { display: none; }
.om-report-actions { display: flex; align-items: center; gap: 8px; padding-top: 4px; }

@media (max-width: 820px) {
  .om-grid-4 { grid-template-columns: 1fr; }
  .om-checklist, .om-outcomes, .om-grid-2 { grid-template-columns: 1fr; }
  .modal-box .om-time-pair { grid-template-columns: 1fr 1fr !important; }
  .om-report-actions #omr-cancel { display: none; }
}

.history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; color: var(--text); font-size: 15px; font-weight: 600; }
.history-toolbar .i { width: 15px; height: 15px; }
.om-link-box { display: flex; gap: 8px; }
.om-link-box .form-control { flex: 1; min-width: 0; font-size: 13px; color: var(--text-soft); }
.om-link-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.om-link-actions a.btn { text-decoration: none; }

/* ============================================================
   Página do técnico (link da OM, sem login)
   ============================================================ */
body.tech-page::before { display: none !important; }
.tech-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: var(--bar-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--separator);
}
.tech-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; box-shadow: 0 0 0 0.5px var(--separator-strong); }
.tech-bar-title { flex: 1; display: grid; line-height: 1.15; }
.tech-bar-title b { color: var(--text); font-size: 15px; font-weight: 650; }
.tech-bar-title span { color: var(--text-muted); font-size: 12px; }
.tech-wrap { width: min(720px, 100%); margin: 0 auto; padding: 20px 16px calc(40px + env(safe-area-inset-bottom)); display: grid; gap: 14px; }
.tech-om { padding: 18px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--separator); }
.tech-om h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.tech-local { margin: 4px 0 12px; color: var(--text-muted); font-size: 14px; }
.tech-local:empty { display: none; }
.tech-closed { margin-top: 12px; padding: 10px 12px; border-radius: 10px; color: var(--green); background: rgba(var(--green-rgb), 0.1); font-size: 13.5px; font-weight: 500; }
#tech-content { display: grid; gap: 14px; }
#tech-content[hidden], .tech-state[hidden], #tech-form[hidden], .tech-actions[hidden], .tech-closed[hidden] { display: none !important; }
.tech-actions { position: sticky; bottom: 0; padding: 10px 0 max(10px, env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 35%); }
.tech-actions .auth-submit-btn { margin: 0; }
.tech-state { padding: 48px 20px; display: grid; justify-items: center; gap: 8px; color: var(--text-muted); text-align: center; }
.tech-state .i { width: 44px; height: 44px; color: var(--text-dim); }
.tech-state h1 { margin: 0; color: var(--text); font-size: 22px; }
.tech-state p { margin: 0 0 8px; max-width: 36ch; }
.tech-error .i { color: var(--red); }
.tech-done .i { color: var(--green); }
.tech-page .om-section .form-control { font-size: 16px; }

/* ============================================================
   Insumos por máquina
   ============================================================ */
body.is-employee .sup-owner-only { display: none !important; }
.sup-section-head { margin: 4px 0 12px; }
.sup-machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; gap: 14px; }
.sup-machine {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm), 0 0 0 0.5px var(--separator);
}
.sup-machine-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sup-machine-name { color: var(--text); font-family: var(--font-display); font-size: 16px; font-weight: 650; letter-spacing: -0.015em; }
.sup-machine-local { color: var(--text-muted); font-size: 12.5px; }
.sup-empty { padding: 14px; border-radius: 12px; color: var(--text-muted); background: var(--fill-2); font-size: 13px; text-align: center; }
.sup-empty-cell { padding: 22px !important; color: var(--text-muted) !important; text-align: center; }
.sup-hint { margin: 6px 0 0; color: var(--text-muted); font-size: 12.5px; line-height: 1.4; }

.sup-install { --tone: var(--text-dim); padding: 12px; border-radius: 12px; background: var(--fill-2); }
.sup-install[data-tone="green"] { --tone: var(--green); }
.sup-install[data-tone="orange"] { --tone: var(--orange); }
.sup-install[data-tone="red"] { --tone: var(--red); }
.sup-install-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sup-install-name { color: var(--text); font-size: 14px; font-weight: 600; }
.sup-install-meta { color: var(--text-muted); font-size: 12px; }
.sup-install-count { display: grid; justify-items: end; line-height: 1.05; }
.sup-install-count b { color: var(--text); font-family: var(--font-display); font-size: 26px; font-weight: 650; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.sup-install-count span { color: var(--text-muted); font-size: 11.5px; }
.sup-bar { height: 6px; margin: 10px 0 6px; overflow: hidden; border-radius: 999px; background: var(--fill); }
.sup-bar span { display: block; height: 100%; border-radius: inherit; background: var(--tone); transition: width 400ms var(--ease-apple); }
.sup-install-foot { display: flex; justify-content: space-between; gap: 10px; color: var(--text-muted); font-size: 12px; }
.sup-install-foot > span:last-child:not(:first-child) { white-space: nowrap; }
.sup-install[data-tone="red"] .sup-install-foot > span:first-child { color: var(--red); font-weight: 600; }
.sup-install-modes { margin-top: 4px; color: var(--text-dim); font-size: 11.5px; }
.sup-install-actions { display: flex; gap: 6px; margin-top: 10px; }
.sup-replace-note {
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  background: rgba(var(--orange-rgb), 0.1);
  font-size: 13px;
  line-height: 1.45;
}
.sup-replace-note[hidden] { display: none; }

/* ============================================================
   Custos operacionais e relatórios
   ============================================================ */
.cost-adjust { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }
.cost-adjust .form-control { min-height: 30px; padding: 4px 10px; text-align: right; }
.cost-summary { padding: 14px 20px; border-top: 1px solid var(--separator); color: var(--text-muted); font-size: 13.5px; }
.cost-summary b { color: var(--text); font-variant-numeric: tabular-nums; }
.cost-summary:empty { display: none; }

#report-modal [hidden] { display: none !important; }
.report-machines { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; margin-bottom: 10px; padding: 2px; }
.report-machine { align-items: center; }
.report-machine-name { flex: 1; min-width: 0; font-weight: 600; }
.report-machine-name small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-machine-stats { color: var(--text-muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.report-preview { color: var(--text-muted); font-size: 13px; }
.report-preview:empty { display: none; }

/* ============================================================
   Toast, mapa e utilidades
   ============================================================ */
.toast-msg {
  color: var(--text);
  border: 0;
  border-radius: 14px;
  background: rgba(var(--surface-rgb), 0.86);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
}

.map-panel.leaflet-host { overflow: hidden; }
:root[data-theme="light"] .cpx-dark-tiles { filter: saturate(0.85); }
:root[data-theme="dark"] .cpx-dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(0.88) contrast(0.9) saturate(0.6); }
.leaflet-container { background: var(--surface-2); font-family: var(--font-body); }
.map-panel.leaflet-host .leaflet-control-zoom a {
  color: var(--text);
  background: rgba(var(--surface-rgb), 0.9);
  border-color: var(--separator);
}
.map-panel.leaflet-host .leaflet-control-attribution { color: var(--text-dim); background: rgba(var(--surface-rgb), 0.8); }
.map-hint, .map-search-results { color: var(--text-soft); background: rgba(var(--surface-rgb), 0.9); border-color: var(--separator); backdrop-filter: blur(16px); box-shadow: var(--shadow-md); }
.map-search-box { background: rgba(var(--surface-rgb), 0.92); backdrop-filter: blur(16px); }
.cpx-depot-pin .pin-tag { color: var(--text); background: rgba(var(--surface-rgb), 0.94); border-color: var(--separator-strong); box-shadow: var(--shadow-md); }
.cpx-leaflet-popup .leaflet-popup-content-wrapper, .cpx-leaflet-popup .leaflet-popup-tip { color: var(--text); background: var(--elevated); box-shadow: var(--shadow-lg); }

.coupon-code-pill { border-radius: 8px; font-family: var(--font-mono); }
.coupon-owner { margin-top: 3px; color: var(--text-muted); font-size: 12px; }
.coupon-progress-track { background: var(--fill); }

/* ============================================================
   Login
   ============================================================ */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  overflow-y: auto;
  background: var(--bg);
}
.auth-backdrop::before { content: none; }
.auth-ambient { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.auth-ambient span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: cpxDrift 22s ease-in-out infinite alternate;
}
.auth-ambient span:nth-child(1) { width: 520px; height: 520px; left: calc(50% - 520px); top: 8%; background: rgba(var(--accent-rgb), 0.55); }
.auth-ambient span:nth-child(2) { width: 460px; height: 460px; left: calc(50% + 20px); top: 30%; background: rgba(var(--green-rgb), 0.32); animation-delay: -7s; }
.auth-ambient span:nth-child(3) { width: 380px; height: 380px; left: calc(50% - 160px); bottom: -8%; background: rgba(var(--blue-rgb), 0.22); animation-delay: -14s; }
:root[data-theme="dark"] .auth-ambient span { opacity: 0.32; }

.auth-theme-toggle { position: absolute; top: 20px; right: 20px; z-index: 2; background: rgba(var(--surface-rgb), 0.7); backdrop-filter: blur(20px); box-shadow: 0 0 0 0.5px var(--separator-strong); }

.auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  min-height: 0;
  padding: 40px 36px 28px;
  display: block;
  overflow: visible;
  border: 0;
  border-radius: 28px;
  background: rgba(var(--surface-rgb), 0.78);
  backdrop-filter: saturate(180%) blur(40px);
  -webkit-backdrop-filter: saturate(180%) blur(40px);
  box-shadow: 0 0 0 0.5px var(--separator-strong), 0 30px 80px -20px rgba(0, 0, 0, 0.18);
  animation: cpxAuthIn 700ms var(--ease-apple) both;
}
:root[data-theme="dark"] .auth-card { background: rgba(28, 28, 30, 0.72); box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.12), 0 30px 90px -20px rgba(0, 0, 0, 0.8); }
.auth-card::before { content: none; }

.auth-header {
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 0;
  background: none;
}
.auth-logo {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 0 0 0.5px var(--separator-strong), 0 12px 28px -10px rgba(0, 0, 0, 0.35);
}
.auth-title {
  margin: 20px 0 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.024em;
  line-height: 1.15;
  text-transform: none;
}
.auth-tagline { max-width: 32ch; margin: 8px 0 0; color: var(--text-muted); font-size: 15px; line-height: 1.45; }

.auth-form { display: block; margin-top: 28px; padding: 0; }
.auth-form::before { content: none; }
.auth-fields {
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--separator-strong);
  transition: box-shadow 150ms ease;
}
:root[data-theme="dark"] .auth-fields { background: rgba(118, 118, 128, 0.18); box-shadow: 0 0 0 1px var(--separator); }
.float-field { position: relative; }
.float-field + .float-field { border-top: 1px solid var(--separator-strong); }
.float-field input {
  width: 100%;
  height: 58px;
  padding: 22px 16px 6px;
  border: 0;
  border-radius: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.float-field.has-action input { padding-right: 52px; }
.float-field label {
  position: absolute;
  left: 16px;
  top: 19px;
  color: var(--text-muted);
  font-size: 17px;
  pointer-events: none;
  transform-origin: left top;
  transition: transform 200ms var(--ease-apple), color 200ms ease;
}
.float-field input:focus + label,
.float-field input:not(:placeholder-shown) + label { transform: translateY(-11px) scale(0.72); }
.float-field input:focus + label { color: var(--blue); }
.float-field input:focus-visible { box-shadow: none !important; }
.float-field:focus-within { box-shadow: inset 0 0 0 2px var(--blue); }
.float-field:first-child:focus-within { border-radius: 14px 14px 0 0; }
.float-field:last-child:focus-within { border-radius: 0 0 14px 14px; }
.float-field input:-webkit-autofill { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 40px var(--surface) inset; transition: background-color 9999s; }
.field-action {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}
.field-action:hover { color: var(--text); background: var(--fill); }
.field-action .i { width: 19px; height: 19px; }
.field-action .eye-closed, .field-action[aria-pressed="true"] .eye-open { display: none; }
.field-action[aria-pressed="true"] .eye-closed { display: block; }

.auth-error-msg {
  margin: 12px 2px 0;
  padding: 0;
  color: var(--red);
  border: 0;
  background: none;
  font-size: 13.5px;
  text-align: center;
}

.auth-submit-btn {
  position: relative;
  width: 100%;
  min-height: 50px;
  margin-top: 18px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600 !important;
  letter-spacing: -0.01em;
}
.auth-submit-btn .auth-submit-arrow { width: 18px; height: 18px; transition: transform 250ms var(--ease-apple); }
@media (hover: hover) { .auth-submit-btn:hover .auth-submit-arrow { transform: translateX(3px); } }
.auth-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: cpxSpin 700ms linear infinite;
}
.auth-submit-btn.is-loading { opacity: 1 !important; cursor: progress; }
.auth-submit-btn.is-loading .auth-submit-label, .auth-submit-btn.is-loading .auth-submit-arrow { display: none; }
.auth-submit-btn.is-loading .auth-spinner { display: block; }

.auth-features {
  margin: 26px 0 0;
  padding: 20px 0 0;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  list-style: none;
  border-top: 1px solid var(--separator);
}
.auth-features li { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12.5px; font-weight: 500; }
.auth-features .i { width: 15px; height: 15px; color: var(--accent-text); }

.auth-legal {
  position: relative;
  z-index: 1;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12.5px;
}
.auth-legal .i { width: 13px; height: 13px; }

/* ============================================================
   Animações
   ============================================================ */
@keyframes cpxPageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cpxMenuIn { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes cpxAuthIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes cpxDrift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(40px, -30px, 0) scale(1.08); }
  100% { transform: translate3d(-30px, 20px, 0) scale(0.96); }
}
@keyframes cpxSpin { to { transform: rotate(360deg); } }

/* ============================================================
   Responsivo
   ============================================================ */
@media (max-width: 1180px) {
  :root { --sidebar-w: 76px; }
  .navbar { padding-inline: 10px !important; }
  .navbar .brand { justify-content: center; padding: 4px 0; }
  .brand-lockup, .nav-tabs::before { display: none; }
  .nav-tab-btn { justify-content: center !important; min-height: 44px !important; padding: 0 !important; }
  .nav-tab-btn > span { display: none; }
  .nav-tab-btn .i { width: 20px !important; height: 20px !important; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .navbar-search { width: clamp(180px, 24vw, 280px); }
  .ownership-bar-label { display: none; }
}

@media (max-width: 960px) {
  .profile-name { display: none; }
}

@media (max-width: 820px) {
  :root { --sidebar-w: 0px; --topbar-h: 56px; --page-gutter: 16px; }

  /* Barra de abas inferior */
  .navbar {
    inset: auto 0 0 0 !important;
    width: 100% !important;
    height: calc(56px + env(safe-area-inset-bottom)) !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 4px 6px env(safe-area-inset-bottom) !important;
    flex-direction: row !important;
    align-items: stretch !important;
    border: 0 !important;
    border-top: 1px solid var(--separator) !important;
  }
  .navbar::before { background: var(--tabbar-bg); }
  body::before { left: 0; }

  /* Marca no topo, à esquerda */
  .navbar .brand {
    position: fixed;
    top: 0;
    left: 16px;
    height: var(--topbar-h);
    width: auto;
    margin: 0;
    padding: 0;
  }
  .navbar .brand img { width: 30px !important; height: 30px !important; border-radius: 8px !important; }
  .brand-lockup { display: grid; }
  .brand-lockup small { display: none; }

  .nav-tabs {
    flex-direction: row !important;
    gap: 0 !important;
    overflow-x: auto !important;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab-btn {
    flex: 1 0 64px !important;
    min-height: 48px !important;
    padding: 4px 2px !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 3px !important;
    border-radius: 10px !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
    font-weight: 500 !important;
    background: transparent !important;
  }
  .nav-tab-btn > span { display: block; max-width: 100%; text-overflow: ellipsis; }
  .nav-tab-btn .i { width: 22px !important; height: 22px !important; color: currentColor; }
  .nav-tab-btn:hover, .nav-tab-btn:active { background: transparent !important; }
  .nav-tab-btn.active { color: var(--accent-text) !important; background: transparent !important; font-weight: 600 !important; }
  .nav-tab-btn.active .i { color: currentColor; }

  .topbar-actions { right: 12px; gap: 8px; }
  .navbar-search { display: none !important; }
  .theme-toggle, .profile-btn { height: 34px; }
  .theme-toggle { width: 34px; }
  .profile-role { display: none; }
  .profile-menu { position: fixed; top: calc(var(--topbar-h) + 6px); left: 12px; right: 12px; width: auto; }

  /* Filtro de vínculo vira uma segunda barra rolável */
  .ownership-bar {
    top: var(--topbar-h) !important;
    left: 0 !important;
    right: 0 !important;
    height: 48px !important;
    padding: 0 16px !important;
    overflow-x: auto;
    background: var(--bar-bg) !important;
    backdrop-filter: saturate(180%) blur(20px) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px) !important;
    border-bottom: 1px solid var(--separator) !important;
  }
  body.is-admin .page { padding-top: calc(var(--topbar-h) + 48px + 20px) !important; }

  .page, body:not(.is-admin) .page {
    margin-left: 0 !important;
    padding: calc(var(--topbar-h) + 20px) 16px calc(88px + env(safe-area-inset-bottom)) !important;
  }
  .page-head { align-items: flex-start; gap: 14px; margin-bottom: 20px; }
  .page-head h1 { font-size: 30px; }
  .page-head p { font-size: 14px; }
  .kpi-card { padding: 16px; }

  .modal-overlay { align-items: flex-end; padding: 0; overscroll-behavior: contain; }
  .modal-box { width: 100% !important; max-height: 92dvh; border-radius: 16px 16px 0 0; transform: translateY(40px); -webkit-overflow-scrolling: touch; }
  .modal-box .modal-sticky-head, .modal-box .modal-body, .modal-sticky-head, .modal-body { padding-inline: 18px !important; }
  .modal-box .modal-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important; }
  .modal-box .plans-config-grid, .modal-box .two-col { grid-template-columns: minmax(0, 1fr) !important; }
  .modal-box .plan-fields { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .modal-box form > div[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .modal-box input, .modal-box select, .modal-box textarea { max-width: 100%; min-width: 0; font-size: 16px; }
  .modal-box .modal-actions-sticky {
    position: sticky;
    bottom: calc(-24px - env(safe-area-inset-bottom));
    z-index: 3;
    margin: 18px -18px calc(-24px - env(safe-area-inset-bottom)) !important;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    background: rgba(var(--surface-rgb), 0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--separator);
  }
  .modal-box .modal-actions-sticky .btn { flex: 1; justify-content: center; }

  .auth-card { padding: 32px 22px 22px; border-radius: 24px; }
  .auth-title { font-size: 26px; }
  .auth-theme-toggle { top: max(14px, env(safe-area-inset-top)); right: 14px; }
}

@media (max-width: 540px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value, .kpi-card:first-child .kpi-value { font-size: 24px; }
  .kpi-label { font-size: 12px; }
  .page-head > div:last-child { width: 100%; }
  .page-head .btn { width: 100%; }
  .table-card, .panel-card, .chart-card, .map-panel { border-radius: 14px !important; }
  .info-grid-4, .info-grid-3, .info-grid-2 { grid-template-columns: 1fr 1fr; }
  .auth-backdrop { justify-content: flex-start; padding-top: 72px; }
  .auth-features { gap: 12px; }
}

@media (max-width: 420px) {
  .modal-box .plan-fields { grid-template-columns: minmax(0, 1fr) !important; }
  .kpi-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .auth-ambient span { animation: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .navbar::before, .navbar::after, .profile-menu, .toast-msg, .auth-card, .modal-sticky-head { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
  .navbar::before { background: var(--surface); }
  .navbar::after { background: var(--bg); }
  .profile-menu, .toast-msg, .auth-card { background: var(--elevated) !important; }
}

/* ============================================================
   Indicações — pagamento por indicador (dashboard e aba Indicações)
   ============================================================ */
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.ref-sub { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); max-width: 640px; }
.ref-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.ref-kpis > div { padding: 12px 14px; border-radius: 12px; background: rgba(var(--ink-rgb), .04); border: 1px solid var(--separator); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ref-kpis span { font-size: 11.5px; color: var(--text-muted); }
.ref-kpis strong { font-family: var(--font-num); font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.ref-pay-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-top: 16px; }
.ref-field { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--text-muted); }
.ref-field .form-control { width: auto; min-width: 170px; padding: 7px 12px; font-size: 12.5px; }
.ref-pay-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.ref-ranking { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; margin-top: 18px; }
.ref-rank-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 5px; }
.ref-rank-row .top span:first-child { color: var(--text-soft); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-rank-row .top span:last-child { font-family: var(--font-num); font-weight: 700; color: var(--accent-text); white-space: nowrap; }
.ref-rank-row .bar { height: 7px; border-radius: 999px; background: rgba(var(--ink-rgb), .07); overflow: hidden; }
.ref-rank-row .bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--blue) 55%, transparent), var(--blue)); }
.ref-rank-row .meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.ref-partner-chip { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: rgba(var(--blue-rgb, 0, 113, 227), .12); color: var(--blue); }
.ref-status-paid { color: var(--green); font-weight: 700; }
.ref-status-pending { color: var(--orange); font-weight: 700; }
.ref-empty { color: var(--text-muted); font-size: 12.5px; padding: 12px; text-align: center; grid-column: 1 / -1; }
@media (max-width: 720px) {
  .ref-kpis { grid-template-columns: 1fr; }
  .ref-ranking { grid-template-columns: 1fr; }
}
.ref-partner-chip { white-space: nowrap; }
.ref-pay-card .data-table { min-width: 480px; }
