/* =========================================================================
   Sistema de Gestão de Corte — design system no estilo Duralux/Nextland
   (referência: D:\Projetos\acordos\public_html — SCSS/tema real inspecionado
   em assets/scss/themes/_bs-custom-variables.scss e theme.min.css).
   Paleta, radius e componentes (avatar-text com ícone, progress bar por
   card, badges pill) copiados fielmente dos valores compilados de lá.
   ========================================================================= */

:root {
  /* --- Paleta Duralux (fonte: _bs-custom-variables.scss) --- */
  --blue: #3454d1;
  --indigo: #6610f2;
  --purple: #6f42c1;
  --pink: #e83e8c;
  --red: #ea4d4d;
  --orange: #fd7e14;
  --yellow: #ffa21d;
  --green: #17c666;
  --teal: #41b2c4;
  --cyan: #3dc7be;

  --gray-100: #eff0f6;
  --gray-200: #e9ecef;
  --gray-300: #e5e7eb;
  --gray-400: #ced4da;
  --gray-500: #91a1b6;
  --gray-600: #64748b;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;

  --primary: var(--blue);
  --secondary: var(--gray-600);
  --success: var(--green);
  --info: var(--cyan);
  --warning: var(--yellow);
  --danger: var(--red);

  /* --- Aliases semânticos usados no resto do CSS --- */
  --bg: #f0f2f8;
  --surface: #ffffff;
  --surface-hover: var(--gray-100);
  --border: var(--gray-300);
  --border-strong: var(--gray-400);
  --text: #283c50;
  --text-muted: #64748b;
  --text-faint: var(--gray-500);

  --accent: var(--primary);
  --accent-fg: #ffffff;
  --accent-soft: #eaefff;

  --danger-soft: #fdecec;
  --success-soft: #e9f9ef;
  --warning-soft: #fff5e6;

  /* Radius (fonte: $radius-* do _variables.scss) */
  --radius-sm: 5px;
  --radius: 10px;
  --radius-lg: 15px;
  --radius-pill: 30px;
  --radius-circle: 50px;

  --shadow-xs: 0 1px 2px rgba(40, 60, 80, 0.06);
  --shadow-sm: 0 2px 6px rgba(40, 60, 80, 0.08);
  --shadow-lg: 0 12px 28px rgba(40, 60, 80, 0.14);

  --sidebar-w: 264px;
  --topbar-h: 70px;
  --bottomnav-h: 62px;
  --content-max: 1240px;

  /* Sequência de cores dos stat-tiles (icone + barra), ciclando por card
     na ordem em que aparecem — mesmo efeito visual do dashboard Duralux
     (cada card com uma progress-bar de cor diferente: primary/warning/
     success/danger...). */
  --tile-1: var(--primary);
  --tile-2: var(--warning);
  --tile-3: var(--success);
  --tile-4: var(--danger);
  --tile-5: var(--teal);
  --tile-6: var(--purple);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }

img, svg { display: block; max-width: 100%; }

/* --- Layout autenticado --- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  color: var(--gray-700);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 24px 18px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
}

.sidebar__brand-dot {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), #5c78e6);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(52, 84, 209, 0.35);
}

/* Logo da empresa (Configurações) no lugar do "SC". */
a.sidebar__brand { text-decoration: none; }
a.sidebar__brand:hover { text-decoration: none; }
.sidebar__brand-logo {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: var(--radius);
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

/* Logo no topo — só no mobile, onde a sidebar some. */
.topbar__brand { display: none; }
.topbar__brand img {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  display: block;
}

/* Pré-visualização da logo em Configurações. */
.logo-preview {
  width: 132px;
  height: 132px;
  margin: 4px auto 14px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 12.5px;
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }

.sidebar__section-label {
  padding: 0 24px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 10px 0 10px;
}

.sidebar__nav { display: flex; flex-direction: column; gap: 3px; padding: 0 16px; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--gray-700);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar__link:hover { background: var(--gray-100); text-decoration: none; color: var(--gray-800); }
.sidebar__link--active { background: var(--accent-soft); color: var(--primary); font-weight: 600; }
.sidebar__link--active .icon { color: var(--primary); }
.sidebar__link .icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--gray-500); }
.sidebar__link:hover .icon { color: var(--gray-700); }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 9px 16px;
  width: 280px;
  color: var(--text-faint);
  font-size: 13px;
}
.topbar__search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13.5px;
  color: var(--text);
  width: 100%;
  font-family: inherit;
}
.topbar__search .icon { width: 16px; height: 16px; flex-shrink: 0; }

.topbar__user { font-size: 13.5px; color: var(--text-muted); display: flex; align-items: center; gap: 14px; }
.topbar__user strong { color: var(--text); font-weight: 600; }
.topbar__avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #fff; color: var(--primary);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.topbar__icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-600); border: 1px solid var(--border);
  background: #fff; flex-shrink: 0; position: relative;
}
.topbar__icon-btn .icon { width: 17px; height: 17px; }
.topbar__icon-badge {
  position: absolute; top: -3px; right: -3px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--surface);
}

.content {
  padding: 28px;
  flex: 1;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* --- Bottom nav (mobile) --- */
.bottom-nav,
.bottom-nav__sheet,
.bottom-nav__overlay {
  display: none;
}

/* --- Componentes genéricos --- */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 5px; color: var(--gray-900); }
.page-header p { color: var(--text-muted); font-size: 13.5px; }

/* =========================================================================
   Dashboard — hero de boas-vindas, KPIs hierarquizados e mini-gráficos
   (barras + rosca) desenhados com dados reais, sem libs externas.
   ========================================================================= */

.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, var(--primary) 0%, #4a63d6 100%);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 22px;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.dash-hero__eyebrow { font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.75); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.dash-hero h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 6px; max-width: 480px; }
.dash-hero p { color: rgba(255, 255, 255, 0.72); font-size: 13px; }

.dash-hero__highlights { display: flex; align-items: center; gap: 22px; flex-shrink: 0; }
.dash-hero__highlight { text-align: right; }
.dash-hero__highlight-value { display: block; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.dash-hero__highlight-label { display: block; font-size: 11.5px; color: rgba(255, 255, 255, 0.7); margin-top: 2px; }
.dash-hero__highlight-sep { width: 1px; height: 34px; background: rgba(255, 255, 255, 0.25); }

.dash-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.dash-kpi-row--finance { grid-template-columns: repeat(5, 1fr); }

/* --- Grid dos dois gráficos (barras + rosca) --- */
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-bottom: 24px; align-items: stretch; }
.dash-chart-card, .dash-donut-card { margin-bottom: 0; display: flex; flex-direction: column; }
.dash-chart-total { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }

.dash-bars {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 160px;
  padding: 6px 4px 0;
}
.dash-bar {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
  position: relative;
}
.dash-bar__fill {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--primary), #6c85ea);
  transition: height 0.3s ease;
  min-height: 3px;
}
.dash-bar__value { font-size: 11px; font-weight: 700; color: var(--gray-700); order: -1; margin-bottom: auto; }
.dash-bar__label { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

.dash-donut { position: relative; display: flex; align-items: center; justify-content: center; margin: 8px 0 18px; }
.dash-donut__svg { width: 168px; height: 168px; }
.dash-donut__svg circle { transition: stroke-dasharray 0.3s ease; }
.dash-donut__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.dash-donut__total { font-size: 26px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.01em; }
.dash-donut__label { font-size: 11.5px; color: var(--text-muted); }

.dash-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.dash-legend li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text); }
.dash-legend__dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dash-legend__label { flex: 1; color: var(--text-muted); }
.dash-legend__value { font-weight: 600; color: var(--gray-900); }

/* --- Listas de "próximos cortes" / "cobranças pendentes" --- */
.dash-list-card__link { font-size: 12.5px; font-weight: 600; color: var(--primary); flex-shrink: 0; }
.dash-rows { list-style: none; margin: 0; padding: 4px 0; }
.dash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.dash-row:last-child { border-bottom: none; }
.dash-row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-row__title { font-size: 13.5px; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-row__meta { font-size: 12px; color: var(--text-muted); }
.dash-row__value { font-size: 13.5px; font-weight: 600; color: var(--gray-900); flex-shrink: 0; }
.dash-row__whatsapp {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--success-soft);
  color: #0f9d55;
}
.dash-row__whatsapp svg { width: 15px; height: 15px; }
.dash-row__whatsapp:hover { background: #d7f5e3; text-decoration: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 22px;
  margin-bottom: 18px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: -22px -22px 18px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 14px; font-weight: 600; color: var(--gray-900); display: flex; align-items: center; gap: 8px; }
.card-header .icon { width: 16px; height: 16px; color: var(--text-muted); }
.card--flush { padding: 0; }
.card--flush .card-header { margin: 0; padding: 16px 20px; }

/* --- Breadcrumb (padrão Duralux) --- */
.breadcrumb-nav { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; flex-wrap: wrap; }
.breadcrumb-nav a { color: var(--text-muted); }
.breadcrumb-nav a:hover { color: var(--primary); }
.breadcrumb-nav .sep { color: var(--border-strong); }
.breadcrumb-nav .current { color: var(--text); font-weight: 500; }

/* --- Detail header: título + código + badge à direita + ações --- */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.detail-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Hero card: bloco de resumo no topo da tela de detalhe --- */
.hero-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); padding: 22px; margin-bottom: 18px; }
.hero-card__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.hero-card__title { font-size: 18px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.hero-card__subtitle { font-size: 13px; color: var(--text-muted); }
.hero-card__subtitle .sep { margin: 0 6px; color: var(--border-strong); }
.hero-card__status { text-align: right; }

/* --- Grid de info-label/info-value (dados em modo leitura) --- */
.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 16px; }
.info-grid--3 { grid-template-columns: repeat(3, 1fr); }
.info-grid--2 { grid-template-columns: repeat(2, 1fr); }
.info-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; font-weight: 500; }
.info-value { font-weight: 600; color: var(--gray-900); font-size: 14px; word-break: break-word; }
.info-value--muted { font-weight: 400; color: var(--text-muted); }
.info-value--lg { font-size: 18px; }

/* --- Tabs (JS puro: troca de painel por data-tab / hash) --- */
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: -22px -22px 20px; padding: 0 10px; }
.tabs__link {
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  background: none;
  border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.tabs__link:hover { color: var(--gray-800); text-decoration: none; }
.tabs__link.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs__link .icon { width: 15px; height: 15px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  background: var(--primary);
  color: var(--accent-fg);
  transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.05s ease;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { background: #2941a8; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--outline { background: var(--surface); color: var(--gray-700); border-color: var(--border-strong); }
.btn--outline:hover { background: var(--gray-100); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #d33d3d; }
.btn--sm { padding: 7px 12px; font-size: 12.5px; }
.btn:disabled, .btn[style*="pointer-events:none"] { opacity: 0.45; cursor: not-allowed; }

/* --- Tabela: vira lista de cards em telas estreitas --- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Tabela com menu "⋮" nas linhas: overflow visível para o painel não ser cortado. */
.table-wrap--menu { overflow: visible; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th, .data-table td { text-align: left; padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; background: var(--gray-100); }
.data-table tbody tr:hover td { background: var(--surface-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .font-medium { font-weight: 600; color: var(--gray-900); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--default { background: var(--success-soft); color: #0f9d55; }
.badge--secondary { background: var(--gray-100); color: var(--gray-600); }
.badge--outline { background: transparent; color: var(--text-muted); border-color: var(--border-strong); }
.badge--destructive { background: var(--danger-soft); color: #c53030; }
.badge--warning { background: var(--warning-soft); color: #c07100; }

.form-field { margin-bottom: 16px; }
.form-field label { display: block; margin-bottom: 7px; font-weight: 500; font-size: 13px; color: var(--gray-700); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 84, 209, 0.15);
}
.form-field .error { color: var(--danger); font-size: 12px; margin-top: 5px; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid transparent; }
.alert--error { background: var(--danger-soft); color: #c53030; border-color: #f7c9c9; }
.alert--aviso { background: #fff8e6; color: #8a5a00; border-color: #f3dfa8; }
.lembrete-lista { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.lembrete-lista li { margin-bottom: 4px; }
.lembrete-lista a { font-weight: 600; margin-left: 4px; }
.alert--success { background: var(--success-soft); color: #0f9d55; border-color: #b9ecce; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state p:first-child { color: var(--text); font-weight: 600; margin-bottom: 4px; }

/* --- Stat tile estilo Duralux: ícone circular (avatar-text) + número
   grande + label + barra de progresso colorida por card. --- */
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 20px;
}
.stat-tile__top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.stat-tile__icon {
  width: 46px; height: 46px; min-width: 46px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-700);
}
.stat-tile__icon .icon { width: 20px; height: 20px; }
.stat-tile__label { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; font-weight: 500; }
.stat-tile__value { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; color: var(--gray-900); }
.stat-tile__bar { height: 4px; border-radius: var(--radius-pill); background: var(--gray-100); overflow: hidden; margin-top: 14px; }
.stat-tile__bar-fill { height: 100%; border-radius: var(--radius-pill); background: var(--tile-1); }
.stat-tile:nth-of-type(6n+1) .stat-tile__bar-fill, .stat-tile:nth-of-type(6n+1) .stat-tile__icon { color: var(--tile-1); }
.stat-tile:nth-of-type(6n+2) .stat-tile__bar-fill { background: var(--tile-2); }
.stat-tile:nth-of-type(6n+2) .stat-tile__icon { color: var(--tile-2); }
.stat-tile:nth-of-type(6n+3) .stat-tile__bar-fill { background: var(--tile-3); }
.stat-tile:nth-of-type(6n+3) .stat-tile__icon { color: var(--tile-3); }
.stat-tile:nth-of-type(6n+4) .stat-tile__bar-fill { background: var(--tile-4); }
.stat-tile:nth-of-type(6n+4) .stat-tile__icon { color: var(--tile-4); }
.stat-tile:nth-of-type(6n+5) .stat-tile__bar-fill { background: var(--tile-5); }
.stat-tile:nth-of-type(6n+5) .stat-tile__icon { color: var(--tile-5); }
.stat-tile:nth-of-type(6n+6) .stat-tile__bar-fill { background: var(--tile-6); }
.stat-tile:nth-of-type(6n+6) .stat-tile__icon { color: var(--tile-6); }

/* --- Utilitários de grid (substituem style="display:grid" inline;
   colapsam para 1 coluna no mobile via media query abaixo) --- */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 0 16px; }
/* Filhos de grid não encolhem abaixo do conteúdo por padrão (min-width:
   auto): uma tabela larga (ex.: matriz cor × tamanho) alargaria a página
   inteira em vez de rolar dentro do .table-wrap. */
.grid-2 > *, .grid-2-even > *, .grid-3 > *, .grid-2-1 > *, .grid-1-2 > *,
.form-layout > *, .dash-grid > * { min-width: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.filter-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; margin-bottom: 8px; }

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-right-desktop { text-align: right; }
.font-semibold { font-weight: 600; }

/* =========================================================================
   Login — tela cheia, imersiva: fundo escuro em gradiente com canvas de
   partículas conectadas por linhas tracejadas (metáfora de pontos de
   costura se ligando), card com glassmorphism ao centro, parallax de
   mouse, relógio ao vivo e toggle de senha. Só nesta página — o resto
   do app mantém a paleta clara padrão.
   ========================================================================= */

.login-body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 90% at 15% 0%, #2941a8 0%, #16204f 45%, #0b1130 100%);
  overflow-x: hidden;
  position: relative;
}

.login-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

.login-vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse 80% 60% at 50% 45%, rgba(11, 17, 48, 0) 0%, rgba(11, 17, 48, 0.55) 100%);
}

.login-stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 28px;
}

/* --- Topbar: marca + relógio ao vivo --- */
.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.92);
}
.login-topbar__brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.login-topbar__mark {
  width: 34px; height: 34px; min-width: 34px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: center;
  color: var(--warning);
}
.login-topbar__mark svg { width: 17px; height: 17px; }
.login-topbar__clock {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.login-topbar__clock span:first-child { display: block; font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.login-topbar__date { display: block; font-size: 11px; color: rgba(255, 255, 255, 0.55); text-transform: capitalize; margin-top: 1px; }

/* --- Centro: card de vidro --- */
.login-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 0;
}

.login-glass {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 38px 34px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 60px rgba(5, 8, 26, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform-style: preserve-3d;
  transition: transform 0.15s ease-out;
  will-change: transform;
  overflow: hidden;
}

.login-glass__glow {
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 162, 29, 0.28) 0%, rgba(255, 255, 255, 0) 70%);
  top: -90px; right: -70px;
  pointer-events: none;
}

.login-glass__head { position: relative; margin-bottom: 22px; }
.login-glass__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: rgba(255, 162, 29, 0.16);
  border: 1px solid rgba(255, 162, 29, 0.3);
  color: var(--warning);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.login-glass h1 { font-size: 23px; font-weight: 700; color: #fff; letter-spacing: -0.01em; margin-bottom: 6px; }
.login-glass__head p { font-size: 13.5px; color: rgba(255, 255, 255, 0.62); }

.login-glass__alert {
  position: relative;
  background: rgba(234, 77, 77, 0.16);
  border-color: rgba(234, 77, 77, 0.35);
  color: #ffd3d3;
}

/* --- Campos --- */
.login-form { position: relative; display: flex; flex-direction: column; gap: 16px; }
.login-field { display: block; }
.login-field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}
.login-field__control {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.login-field__control:focus-within {
  border-color: rgba(255, 162, 29, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 162, 29, 0.14);
  background: rgba(255, 255, 255, 0.1);
}
.login-field__icon { width: 16px; height: 16px; margin-left: 13px; color: rgba(255, 255, 255, 0.4); flex-shrink: 0; }
.login-field__control input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  padding: 12px 12px;
  font-size: 14px;
  font-family: inherit;
  color: #fff;
}
.login-field__control input::placeholder { color: rgba(255, 255, 255, 0.32); }
/* O autofill do navegador (Chrome/Edge) força um fundo claro sólido via
   UA stylesheet, quebrando o vidro; anula isso com um "flash" de fundo
   transparente aplicado por dentro via box-shadow inset + texto claro. */
.login-field__control input:-webkit-autofill,
.login-field__control input:-webkit-autofill:hover,
.login-field__control input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  caret-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px rgba(30, 38, 74, 0.95) inset;
  box-shadow: 0 0 0 1000px rgba(30, 38, 74, 0.95) inset;
  transition: background-color 9999s ease-in-out 0s;
}
.login-field__toggle {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.4);
  padding: 0 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.login-field__toggle svg { width: 16px; height: 16px; }
.login-field__toggle:hover, .login-field__toggle.is-active { color: var(--warning); }

.login-remember { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; font-size: 12.5px; color: rgba(255, 255, 255, 0.65); cursor: pointer; }
.login-remember input { accent-color: var(--warning); width: 15px; height: 15px; margin: 0; }

/* --- Botão --- */
.login-submit {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: #1a1f38;
  background: linear-gradient(135deg, #ffc35c, var(--warning));
  box-shadow: 0 10px 24px rgba(255, 162, 29, 0.28);
  transition: transform 0.08s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
.login-submit svg { width: 16px; height: 16px; transition: transform 0.15s ease; }
.login-submit:hover svg { transform: translateX(3px); }
.login-submit:active { transform: translateY(1px); }
.login-submit.is-loading { opacity: 0.7; cursor: default; }
.login-submit.is-loading span::after { content: "…"; }
.login-submit.is-loading svg { animation: login-spin 0.8s linear infinite; }
@keyframes login-spin { to { transform: rotate(360deg); } }

.login-glass__footer { position: relative; margin-top: 22px; text-align: center; font-size: 12px; color: rgba(255, 255, 255, 0.45); }

/* --- Rodapé --- */
.login-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  padding-top: 6px;
}
.login-foot__sep { color: rgba(255, 255, 255, 0.25); }
.login-foot__status { display: inline-flex; align-items: center; gap: 6px; }
.login-foot__status i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
  display: inline-block;
}

/* --- Modal simples (sem JS framework): overlay fixo, centraliza a
   .modal-box em qualquer tamanho de tela. Alternância via JS inline
   (display:flex/none), ver financeiro/ver.php e romaneios/ver.php. --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 60, 80, 0.45);
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-box { width: 100%; max-width: 420px; margin: 0; max-height: 88vh; overflow-y: auto; }
.modal-box--lg { max-width: 620px; }

/* --- Resumo de romaneio embutido em modal (ver clientes/ver.php e
   src/templates/partials/romaneio-resumo.php) --- */
.romaneio-resumo__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.romaneio-resumo__title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.romaneio-resumo__subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.romaneio-resumo__items { display: flex; flex-direction: column; gap: 14px; max-height: 46vh; overflow-y: auto; }
.romaneio-resumo__item { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.romaneio-resumo__item-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.romaneio-resumo__item-head span { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.romaneio-resumo__total { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.romaneio-resumo__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* --- Linha de extrato clicável (abre o modal do romaneio de origem) --- */
.extrato-row { cursor: pointer; }
.extrato-row:hover td { background: var(--accent-soft); }
.extrato-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.extrato-row__hint { width: 13px; height: 13px; color: var(--primary); vertical-align: -2px; margin-left: 4px; }

/* =========================================================================
   Módulos — modelo padrão para listagem / detalhe / formulário. Pensado
   para substituir gradualmente table.data-table cru nas telas de CRUD,
   sem quebrar as que ainda não migraram (aditivo, nenhuma classe antiga
   foi removida). Piloto: clientes/*.php.
   ========================================================================= */

/* --- Toolbar da listagem: busca + filtros + ação principal --- */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.list-toolbar__search {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
}
.list-toolbar__search .icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}
.list-toolbar__search input {
  width: 100%;
  padding: 10px 13px 10px 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}
.list-toolbar__search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(52, 84, 209, 0.15);
}
.list-toolbar__count { font-size: 12.5px; color: var(--text-muted); white-space: nowrap; }
.list-toolbar__spacer { flex: 1; }

/* --- Linhas de entidade: substitui <tr> por um cartão de linha com
   avatar, título/subtítulo e ações — mesma ideia em list e sub-listas. --- */
.entity-list { display: flex; flex-direction: column; }
.entity-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}
.entity-row:last-child { border-bottom: none; }
.entity-row:hover { background: var(--surface-hover); text-decoration: none; }
a.entity-row { color: inherit; }

.avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.avatar--lg { width: 56px; height: 56px; font-size: 19px; }
.avatar--muted { background: var(--gray-100); color: var(--gray-500); }

.entity-row__body { flex: 1; min-width: 0; }
.entity-row__title { font-size: 14px; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entity-row__subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.entity-row__meta {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 90px;
  text-align: right;
}
.entity-row__meta strong { color: var(--gray-900); font-weight: 600; font-size: 13px; }

.entity-row__status { flex-shrink: 0; }

.entity-row__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Menu de ações "..." — some no desktop até o hover/click via JS
   (data-menu), sempre visível como botões simples no mobile. */
.row-menu { position: relative; }
.row-menu__trigger {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.row-menu__trigger:hover { background: var(--gray-100); color: var(--gray-700); }
.row-menu__trigger svg { width: 17px; height: 17px; }
.row-menu__panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 15;
  padding: 6px;
}
.row-menu.open .row-menu__panel { display: block; }
.row-menu__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.row-menu__item:hover { background: var(--gray-100); text-decoration: none; }
.row-menu__item svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.row-menu__item--danger { color: var(--danger); }
.row-menu__item--danger svg { color: var(--danger); }
.row-menu__item--danger:hover { background: var(--danger-soft); }

/* --- Estado vazio de listagem (versão card, com ícone) --- */
.list-empty { text-align: center; padding: 64px 20px; }
.list-empty__icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.list-empty__icon svg { width: 24px; height: 24px; }
.list-empty p:first-of-type { font-weight: 600; color: var(--gray-900); margin-bottom: 4px; }
.list-empty p:last-of-type { color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }

/* --- Detalhe: hero com avatar grande + ações + tabs modernizadas --- */
.detail-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 24px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.detail-hero__info { flex: 1; min-width: 200px; }
.detail-hero__title { font-size: 19px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.01em; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-hero__subtitle { font-size: 13px; color: var(--text-muted); }
.detail-hero__actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.detail-tabs {
  display: flex;
  gap: 4px;
  background: var(--gray-100);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 18px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.detail-tabs__link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.detail-tabs__link svg { width: 15px; height: 15px; }
.detail-tabs__link.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }
.detail-tabs__link:hover:not(.active) { color: var(--gray-800); text-decoration: none; }

/* --- Segmented control: alterna entre duas visões do mesmo dado dentro
   de uma aba (ex.: histórico de cortes "por ordem" / "por molde" em
   clientes/ver.php) — visualmente mais leve que outro nível de tabs. --- */
.segmented {
  display: inline-flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.segmented__link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}
.segmented__link svg { width: 14px; height: 14px; }
.segmented__link:hover { text-decoration: none; color: var(--gray-800); }
.segmented__link.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-xs); }

/* --- Timeline: histórico cronológico (ex.: cortes por molde ao longo do
   tempo em clientes/ver.php) — uma linha vertical com um ponto por
   evento, mais recente no topo. --- */
.timeline { list-style: none; margin: 0; padding: 16px 20px; }
.timeline__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 0 0 20px 22px;
  border-left: 2px solid var(--border);
}
.timeline__item:last-child { padding-bottom: 0; border-left-color: transparent; }
.timeline__dot {
  position: absolute;
  left: -7px;
  top: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline__body { flex: 1; min-width: 0; }
.timeline__head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.timeline__head strong { font-size: 13.5px; color: var(--gray-900); }
.timeline__date { font-size: 12px; color: var(--text-muted); }
.timeline__meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.timeline__value { text-align: right; flex-shrink: 0; }
.timeline__value strong { display: block; font-size: 13px; color: var(--gray-900); }
.timeline__value span { display: block; font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

/* --- Grade de tamanhos (peças por folha) — uma caixa por tamanho, input
   centralizado. Ver ordens/item-form.php. --- */
.grade-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 10px;
}
.grade-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px 12px;
  text-align: center;
  background: var(--surface);
}
.grade-cell.form-field { margin-bottom: 0; }
.grade-cell.form-field label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
}
.grade-cell.form-field input { text-align: center; padding: 8px 6px; font-weight: 600; }
.grade-cell.is-filled { border-color: var(--primary); background: var(--accent-soft); }

/* --- Lista de cor + folhas (enfesto) — colunas alinhadas com cabeçalho. --- */
.cor-list__head,
.cor-list .cor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 40px;
  gap: 8px;
  align-items: center;
}
.cor-list__head {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cor-list .cor-row.form-field { margin-bottom: 8px; }
.cor-list .cor-row input[type="number"] { text-align: center; }
.cor-row__remove {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.cor-row__remove:hover { color: var(--danger); border-color: var(--danger); }
.cor-row__remove svg { width: 15px; height: 15px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin: -6px 0 12px; }
.form-field .form-hint { display: block; margin: 5px 0 0; }

/* --- Opções em cartão (radio) — ex.: destino da ordem ao excluir romaneio. --- */
.choice-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.choice input { margin-top: 3px; accent-color: var(--primary); flex-shrink: 0; }
.choice strong { display: block; font-size: 13px; color: var(--gray-900); }
.choice span span { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--accent-soft); }

/* --- Chips compactos para listar valores curtos dentro de uma célula
   (grade "P 3", cores "Branco 20"). .chip--action = chip clicável que
   leva a preencher o dado que falta. --- */
.chip-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 12px;
  white-space: nowrap;
}
.chip strong { color: var(--gray-900); font-weight: 700; }
.chip--action {
  background: var(--warning-soft);
  color: #c07100;
  border: 1px dashed #f0b24a;
  font-weight: 600;
}
.chip--action:hover { text-decoration: none; background: #ffeccc; }

.data-table tr.is-clickable { cursor: pointer; }
.data-table tr.is-clickable:hover td { background: var(--surface-hover); }

/* --- Faixa de números-resumo logo abaixo do hero (romaneios/ver.php).
   4 colunas no desktop, 2 no celular. --- */
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.summary-strip__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.summary-strip__label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.summary-strip__value { font-size: 20px; font-weight: 700; color: var(--gray-900); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.summary-strip__item--accent { background: var(--accent-soft); border-color: transparent; }
.summary-strip__item--accent .summary-strip__value { color: var(--primary); }
@media (max-width: 640px) {
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .summary-strip__value { font-size: 17px; }
}

/* --- Matriz cor × tamanho (somente leitura): números à direita, linha de
   total destacada. Rola na horizontal no celular, nunca empilha. --- */
.matriz-table th:not(:first-child),
.matriz-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.matriz-table th, .matriz-table td { white-space: nowrap; }
.matriz-table__total td { font-weight: 700; background: var(--gray-100); border-bottom: 0; }
.matriz-table__folhas { color: var(--text-muted); }
/* Aproveitamento ("+10") ao lado da quantidade da matriz. */
.qtd-extra { color: var(--success); font-weight: 700; margin-left: 1px; }
/* Matriz editável do item-form: cada célula = quantidade da matriz + campo
   "+" de aproveitamento. Rola na horizontal no celular. */
.matriz-table--edit td { padding: 8px 10px; vertical-align: middle; }
.aprov-cell { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.aprov-cell__base { min-width: 28px; text-align: right; font-weight: 600; }
.aprov-cell__extra {
  display: inline-flex;
  align-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 0 0 6px;
  background: var(--surface);
  color: var(--text-faint);
  font-weight: 700;
  cursor: text;
}
.aprov-cell__extra input.aprov-input {
  width: 46px;
  border: 0;
  background: transparent;
  padding: 5px 6px 5px 2px;
  font: inherit;
  font-size: 13px;
  text-align: center;
  color: var(--success);
  -moz-appearance: textfield;
}
.aprov-cell__extra input.aprov-input::-webkit-outer-spin-button,
.aprov-cell__extra input.aprov-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.aprov-cell__extra input.aprov-input:focus { outline: none; }
.aprov-cell__extra:focus-within { border-color: var(--primary); border-style: solid; box-shadow: 0 0 0 3px rgba(52, 84, 209, 0.15); }
.aprov-cell.has-extra .aprov-cell__extra { border-style: solid; border-color: var(--success); background: var(--success-soft); color: var(--success); }
.aprov-resumo { text-align: right; font-size: 13px; color: var(--text-muted); margin: 10px 0 0; }
.aprov-resumo strong { color: var(--gray-900); }

/* --- Item do romaneio: rodapé com peças × valor e total do item. --- */
.romaneio-item__footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
  .romaneio-item__footer { padding: 12px 16px; }
}

/* --- Barra de progresso (percentual recebido de uma cobrança). --- */
.progress { height: 8px; border-radius: var(--radius-pill); background: var(--gray-100); overflow: hidden; }
.progress__fill { display: block; height: 100%; border-radius: inherit; background: var(--success); }

/* --- Lista compacta de pagamentos (data · forma ........ valor). --- */
.pagamento-list { list-style: none; margin: 0 0 16px; padding: 0; }
.pagamento-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
  color: var(--text-muted);
}
.pagamento-list li:last-child { border-bottom: 0; }
.pagamento-list strong { color: var(--gray-900); white-space: nowrap; }

/* --- Lista vertical de rótulo/valor (painel lateral). --- */
.info-list { display: flex; flex-direction: column; gap: 14px; }
.info-list > div { display: flex; flex-direction: column; }

/* --- Etapas de um fluxo linear (ordens/ver.php: Aberta → Em corte →
   Romaneio). .is-done = etapa concluída, .is-current = etapa atual. --- */
.flow-steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 8px;
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}
.flow-steps__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  min-width: 0;
}
.flow-steps__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--gray-100);
  font-size: 12px;
  font-weight: 700;
}
.flow-steps__text { min-width: 0; }
.flow-steps__text strong { display: block; font-size: 13px; color: var(--gray-800); }
.flow-steps__text span { display: block; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-steps__item.is-current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.flow-steps__item.is-current .flow-steps__num { background: var(--primary); color: var(--accent-fg); }
.flow-steps__item.is-done .flow-steps__num { background: var(--success-soft); color: var(--success); }
@media (max-width: 640px) {
  .flow-steps { grid-auto-flow: row; }
}

/* --- Formulário: seções com título, mais respiro entre grupos ---
   .form-shell sozinho (sem .form-layout ao redor) segue como antes —
   card único centralizado, largura de leitura confortável, usado em
   formulários curtos de uma coluna só. */
.form-shell { max-width: 720px; }
.form-section { margin-bottom: 26px; }
.form-section:last-child { margin-bottom: 0; }
.form-section__title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* --- Formulário com painel lateral: usa a largura da página em telas
   grandes (form ~2/3 + aside 1/3 fixo), em vez do card estreito e alto
   de .form-shell sozinho. O aside acompanha o scroll do form (sticky). --- */
.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  align-items: start;
}
.form-layout .form-shell { max-width: none; }

.form-aside {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-aside__card { text-align: center; }
.form-aside__avatar { margin: 4px auto 14px; }
.form-aside__name { font-size: 15px; font-weight: 700; color: var(--gray-900); margin-bottom: 3px; word-break: break-word; }
.form-aside__hint { font-size: 12.5px; color: var(--text-muted); }
.form-aside__status { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-aside__tip {
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.form-aside__tip svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-faint); margin-top: 1px; }

/* --- Tamanhos do molde: chips (moldes/ver.php, aba "Tamanhos") --- */
.tamanhos-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.tamanho-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
}

/* --- Upload de fotos do molde (moldes/ver.php, aba "Fotos") --- */
.foto-upload-form__drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 32px 20px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.foto-upload-form__drop:hover,
.foto-upload-form__drop.is-dragover { border-color: var(--primary); background: var(--accent-soft); }
.foto-upload-form__drop svg { width: 26px; height: 26px; color: var(--text-faint); margin-bottom: 4px; }
.foto-upload-form__drop strong { color: var(--text); }
.foto-upload-form__hint { font-size: 12px; color: var(--text-faint); }
.foto-upload-form__selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.foto-upload-form__selected:empty { display: none; }
.foto-upload-form__chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: var(--gray-100);
  color: var(--text);
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foto-galeria {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.foto-galeria__item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--gray-100);
  border: 1px solid var(--border);
}
.foto-galeria__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-galeria__remove { position: absolute; top: 6px; right: 6px; margin: 0; }
.foto-galeria__remove-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 25, 35, 0.55);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(2px);
}
.foto-galeria__remove-btn:hover { background: var(--danger); }
.foto-galeria__remove-btn svg { width: 14px; height: 14px; }

/* =========================================================================
   Responsivo
   ========================================================================= */

@media (max-width: 860px) {
  .sidebar { display: none; }

  .content { padding: 16px 14px calc(var(--bottomnav-h) + 20px); }
  .topbar { padding: 0 14px; height: 56px; }
  .topbar__user span { display: none; }
  .topbar__search { display: none; }
  .topbar__brand { display: block; }

  .page-header h1 { font-size: 19px; }
  .page-header { margin-bottom: 18px; }

  .card { padding: 16px; border-radius: var(--radius); }
  /* O padding mobile acima não pode vencer o .card--flush (listas encostadas na borda). */
  .card.card--flush { padding: 0; }

  .grid-2, .grid-1-2, .grid-2-1, .grid-2-even { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .text-right-desktop { text-align: left; }

  .info-grid, .info-grid--3, .info-grid--2 { grid-template-columns: 1fr 1fr; gap: 14px; }
  .hero-card__top { flex-direction: column; }
  .hero-card__status { text-align: left; }

  .dash-hero { padding: 20px; flex-direction: column; align-items: flex-start; }
  .dash-hero h1 { font-size: 18px; }
  .dash-hero__highlights { width: 100%; justify-content: space-between; }
  .dash-kpi-row, .dash-kpi-row--finance { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-bars { height: 130px; }
  .dash-row { padding: 12px 16px; flex-wrap: wrap; }
  .tabs { margin: -16px -16px 16px; overflow-x: auto; flex-wrap: nowrap; }
  .tabs__link { white-space: nowrap; }
  .card-header { margin: -16px -16px 16px; padding: 12px 16px; flex-wrap: wrap; }

  .filter-row { flex-direction: column; align-items: stretch; }
  .filter-row .form-field { min-width: 0 !important; }

  .list-toolbar__search { max-width: none; min-width: 0; flex: 1 1 100%; }
  .list-toolbar__spacer { display: none; }
  .list-toolbar__count { margin-left: auto; }

  .entity-row { padding: 12px 14px; gap: 10px; }
  .entity-row__meta { display: none; }
  .avatar { width: 36px; height: 36px; font-size: 13px; }

  .detail-hero { padding: 18px; gap: 14px; }
  .detail-hero__actions { width: 100%; }
  .detail-hero__actions .btn { flex: 1; }
  .detail-hero__title { font-size: 17px; }

  .form-shell { max-width: none; }
  .form-actions { position: sticky; bottom: 0; background: var(--surface); margin: 24px -16px 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  .form-actions .btn { flex: 1; justify-content: center; }

  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .form-aside { position: static; order: 2; }

  /* iOS dá zoom na página ao focar campo com fonte < 16px (ex.: folhas e
     "+" do aproveitamento) — a tela "expande" ao digitar. */
  .form-field input, .form-field select, .form-field textarea,
  .aprov-cell__extra input.aprov-input { font-size: 16px; }
  .form-layout .form-shell { order: 1; }

  .segmented { width: 100%; }
  .segmented__link { flex: 1; justify-content: center; }
  .timeline { padding: 14px; }
  .timeline__item { flex-direction: column; gap: 6px; }
  .timeline__value { text-align: left; }

  .foto-galeria { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .foto-upload-form__drop { padding: 22px 14px; }

  /* Tabela -> lista de cards empilhados (mantém <table> semântico, some
     apenas o cabeçalho e reflui cada linha em bloco). */
  .data-table.stack-mobile,
  .data-table.stack-mobile tbody,
  .data-table.stack-mobile tr,
  .data-table.stack-mobile td {
    display: block;
    width: 100%;
  }
  .data-table.stack-mobile thead { display: none; }
  .data-table.stack-mobile tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 4px 0;
    background: var(--surface);
  }
  .data-table.stack-mobile td {
    border-bottom: none;
    padding: 6px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    text-align: right;
  }
  .data-table.stack-mobile td:empty { display: none; }
  .data-table.stack-mobile td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: left;
  }
  .data-table.stack-mobile td[data-label=""]::before,
  .data-table.stack-mobile td:not([data-label])::before { content: none; }

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: var(--bottomnav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(40, 60, 80, 0.08);
    z-index: 30;
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav__link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-faint);
    font-size: 10.5px;
    font-weight: 600;
    padding: 6px 2px;
    border-radius: var(--radius-sm);
    min-width: 0;
    white-space: nowrap;
  }
  .bottom-nav__link:hover { text-decoration: none; }
  /* flex-shrink:0: sem isso, um rótulo comprido esmaga o ícone (vira um ponto). */
  .bottom-nav__link .icon { width: 20px; height: 20px; flex-shrink: 0; }
  .bottom-nav__link--active { color: var(--primary); }
  .bottom-nav__more { position: relative; }

  .bottom-nav__sheet {
    display: none;
    position: fixed;
    left: 10px; right: 10px;
    bottom: calc(var(--bottomnav-h) + 8px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    z-index: 31;
  }
  .bottom-nav__sheet.open { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .bottom-nav__sheet a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 6px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
  }
  .bottom-nav__sheet a:hover { background: var(--gray-100); text-decoration: none; }
  .bottom-nav__sheet .icon { width: 20px; height: 20px; color: var(--text-muted); }

  .bottom-nav__overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 25, 35, 0.35);
    z-index: 29;
  }
  .bottom-nav__overlay.open { display: block; }

  .login-stage { padding: 16px 16px 20px; }
  .login-topbar__clock span:first-child { font-size: 13px; }
  .login-topbar__date { font-size: 10px; }
  .login-center { padding: 18px 0; }
  .login-glass { padding: 30px 22px; max-width: 100%; }
  .login-glass h1 { font-size: 20px; }
  .login-foot { flex-wrap: wrap; text-align: center; }
}

@media (max-width: 420px) {
  .login-topbar__date { display: none; }
  .tiles { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .dash-kpi-row, .dash-kpi-row--finance { grid-template-columns: 1fr; }
  .dash-hero__highlights { flex-direction: column; align-items: flex-start; gap: 12px; }
  .dash-hero__highlight { text-align: left; }
  .dash-hero__highlight-sep { display: none; }
}

@media print {
  .bottom-nav, .sidebar, .topbar, .no-print { display: none !important; }
}

/* --- Ajuda / manual (src/lib/ajuda.php, public/ajuda.php) --- */
.topbar__help {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: #fff;
  color: var(--primary); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
}
.topbar__help:hover { background: var(--accent-soft); border-color: transparent; }
.topbar__help .icon { width: 17px; height: 17px; }
@media (max-width: 860px) {
  .topbar__help { width: 38px; padding: 0; justify-content: center; }
}

.ajuda-dialog { max-width: 680px; }
.ajuda-dialog__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.ajuda-dialog__head h2 { margin: 2px 0 0; font-size: 18px; color: var(--gray-900); }
.ajuda-dialog__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); }
.ajuda-dialog__close { border: 0; background: var(--gray-100); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--gray-600); flex-shrink: 0; }
.ajuda-dialog__close:hover { background: var(--gray-200); }
.ajuda-dialog__foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }

.ajuda-topico__titulo { margin: 0 0 6px; font-size: 18px; color: var(--gray-900); scroll-margin-top: calc(var(--topbar-h) + 16px); }
.ajuda-topico__resumo { margin: 6px 0 14px; color: var(--text-muted); font-size: 13.5px; line-height: 1.55; }
.ajuda-topico__secao { margin: 16px 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-700); }
.ajuda-topico__lista { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.ajuda-topico__lista li::marker { color: var(--primary); }
.ajuda-topico__dica { display: flex; gap: 10px; margin-top: 16px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); font-size: 13px; color: var(--gray-700); }
.ajuda-topico__dica svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--primary); margin-top: 1px; }
.ajuda-topico__dica p { margin: 0; }

.ajuda-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.ajuda-indice { position: sticky; top: calc(var(--topbar-h) + 16px); padding: 16px 18px; }
.ajuda-indice__titulo { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.ajuda-indice ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
@media (max-width: 860px) {
  .ajuda-layout { grid-template-columns: 1fr; }
  .ajuda-indice { position: static; }
}
@media print {
  .ajuda-indice, .topbar, .sidebar, .bottom-nav, .breadcrumb-nav, .page-header .btn { display: none !important; }
  .ajuda-layout { display: block; }
  .ajuda-secao { break-inside: avoid; box-shadow: none; }
}

/* =========================================================================
   Gráficos dos relatórios (src/templates/partials/charts.php).
   Cores validadas para daltonismo (validate_palette): primária/recebido/
   atraso passam todas as checagens; "contexto" é o cinza de apoio da
   forma "destaque" (uma série em cor, a outra em cinza).
   ========================================================================= */
.chart-c--primaria { background: #3454d1; }
.chart-c--recebido { background: #0f9d55; }
.chart-c--atraso { background: #e03e3e; }
.chart-c--contexto { background: #91a1b6; }

.chart-card__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.chart-card__head h3 { margin: 0; font-size: 14px; }
.chart-card__head p { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.chart-card__total { font-size: 13px; color: var(--text-muted); }
.chart-card__total strong { color: var(--gray-900); font-size: 15px; }
.chart-vazio { color: var(--text-muted); font-size: 13px; text-align: center; padding: 28px 0; margin: 0; }

/* Legenda: amostra + rótulo em cor de texto (nunca o texto colorido). */
.chart-legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; padding: 0; list-style: none; font-size: 12px; color: var(--text-muted); }
.chart-legenda span, .chart-legenda li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.chart-legenda--valores { flex-direction: column; gap: 8px; margin: 14px 0 0; }
.chart-legenda--valores li { display: grid; grid-template-columns: 10px 1fr auto 40px; gap: 8px; align-items: center; font-size: 13px; }
.chart-legenda--valores strong { color: var(--gray-900); font-variant-numeric: tabular-nums; }
.chart-legenda--valores small { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Colunas no tempo */
.chart-colunas { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.chart-colunas__eixo { position: relative; height: 180px; min-width: 44px; font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.chart-colunas__eixo span { position: absolute; right: 0; transform: translateY(50%); white-space: nowrap; }
.chart-colunas__scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-top: 18px; margin-top: -18px; }
.chart-colunas__plot {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--n), minmax(16px, 1fr));
  height: 180px;
  min-width: calc(var(--n) * 16px);
  border-bottom: 1px solid var(--gray-300);
}
.chart-grade { position: absolute; left: 0; right: 0; border-top: 1px solid var(--gray-200); pointer-events: none; }
.chart-col { position: relative; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; outline: none; cursor: default; }
.chart-col:hover, .chart-col:focus-visible { background: rgba(52, 84, 209, 0.06); border-radius: 6px 6px 0 0; }
.chart-col__barras { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.chart-col__barra { position: relative; width: 100%; max-width: 24px; min-height: 0; border-radius: 4px 4px 0 0; }
.chart-col__barras:has(> :nth-child(2)) .chart-col__barra { max-width: 14px; }
.chart-col__valor { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 3px; font-style: normal; font-size: 11px; font-weight: 700; color: var(--gray-800); white-space: nowrap; }
.chart-col__rotulo { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 6px; font-size: 10.5px; color: var(--text-muted); white-space: nowrap; }
.chart-colunas__scroll { padding-bottom: 26px; }

/* Ranking em barras horizontais */
.chart-barras { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.chart-barra { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); gap: 10px; align-items: center; outline: none; border-radius: 6px; }
.chart-barra:hover, .chart-barra:focus-visible { background: rgba(52, 84, 209, 0.06); }
.chart-barra__rotulo { font-size: 12.5px; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-barra__trilho { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chart-barra__fill { height: 14px; min-width: 3px; border-radius: 0 4px 4px 0; flex-shrink: 0; max-width: calc(100% - 78px); }
.chart-barra__valor { font-size: 12px; font-weight: 600; color: var(--gray-800); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Parte-do-todo */
.chart-empilhada { display: flex; gap: 2px; height: 18px; border-radius: 5px; overflow: hidden; }
.chart-empilhada__seg { flex-basis: 0; min-width: 4px; outline: none; }
.chart-empilhada__seg:hover, .chart-empilhada__seg:focus-visible { filter: brightness(1.12); }

/* Dica */
.chart-tip {
  position: fixed; z-index: 1000; pointer-events: none;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-lg); padding: 8px 10px; font-size: 12px; min-width: 120px;
  opacity: 0; transition: opacity 0.08s ease;
}
.chart-tip.is-visible { opacity: 1; }
.chart-tip__titulo { color: var(--text-muted); margin-bottom: 4px; }
.chart-tip__linha { display: flex; align-items: center; gap: 6px; }
.chart-tip__linha i { width: 10px; height: 2px; border-radius: 1px; display: inline-block; }
.chart-tip__linha strong { color: var(--gray-900); font-size: 13px; }
.chart-tip__linha span { color: var(--text-muted); }

/* Abas dos relatórios + tabela com números alinhados */
.report-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.report-tabs a { padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.report-tabs a.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tfoot td { font-weight: 700; background: var(--gray-100); }
.report-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.report-grid > .card { margin-bottom: 0; }
.report-section-title { font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 22px 0 10px; }

@media (max-width: 860px) {
  .report-grid { grid-template-columns: minmax(0, 1fr); }
  .chart-barra { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .data-table.stack-mobile td.num { text-align: left; }
  .data-table.stack-mobile tfoot { display: block; }
}
.chart-barra__pilha { display: flex; gap: 2px; height: 14px; min-width: 3px; max-width: calc(100% - 78px); flex-shrink: 0; border-radius: 0 4px 4px 0; overflow: hidden; }
.chart-barra__pilha > span { flex-basis: 0; min-width: 2px; }
.chart-tabela { margin-top: 6px; font-size: 12.5px; }
.chart-tabela summary { cursor: pointer; color: var(--primary); font-weight: 500; width: max-content; }
.chart-tabela .table-wrap { margin-top: 8px; max-height: 260px; overflow: auto; }
