/* ============================================
   DESIGN SYSTEM — tokens + componentes base
   Prefixo: ds-* (não colide com o Bootstrap, que continua sendo a base).
   Identidade Vi3DApp (paleta Vi3DLab): Azul Profundo #0B1A3C, Azul Elétrico #00B4FF,
   Ciano #00E0D1, Laranja #FF8A00, Amarelo #FFD23F, Rosa #FF3D8E, Roxo #8A3DFF; fonte Nunito.
   Para mexer na identidade, mude só os tokens de "Marca" abaixo (light e dark).
   Nenhuma tela usa hex solto.
   ============================================ */

:root {
  /* Superfícies — escada de elevação */
  --surface-base: #F3F6FB;   /* fundo da página */
  --surface-1:    #FFFFFF;   /* card */
  --surface-2:    #EBF0F8;   /* card dentro de card, hover de linha */
  --surface-3:    #FFFFFF;   /* popover, dropdown, modal */
  --surface-1-hover: #F7F9FD;
  --surface-2-hover: #E1E8F4;

  --border-subtle:  #E1E7F1; /* borda de card — sempre esta */
  --border-default: #C8D2E3; /* inputs, botão secundário */
  --border-strong:  #8593B2; /* focus */

  --text-primary:   #0B1A3C; /* Azul Profundo */
  --text-secondary: #45547A;
  --text-tertiary:  #65739A;

  /* Marca ≠ semântica. O Azul Elétrico puro (#00B4FF) não dá contraste com texto branco,
     então o azul de botão/link é um tom mais fundo dele; o puro fica para destaques e gradiente. */
  --brand:  #0A6CFF;  --brand-ink: #FFFFFF;  --brand-strong: #0052CC;
  --accent: #FF8A00;  --accent-ink: #0B1A3C; /* CTA primário (Laranja) — um por região */
  --accent-texto: #B35300; /* laranja legível como texto sobre fundo claro */
  --success: #047857; --danger: #DC2626; --warning: #B45309; --info: #0284C7;

  /* Cores da marca para ilustração, gráfico e destaque (não para texto) */
  --marca-azul: #00B4FF; --marca-ciano: #00E0D1; --marca-laranja: #FF8A00; --marca-amarelo: #FFD23F;
  --marca-rosa: #FF3D8E; --marca-roxo: #8A3DFF; --marca-profundo: #0B1A3C;
  --marca-gradiente: linear-gradient(120deg, #00B4FF 0%, #8A3DFF 55%, #FF3D8E 100%);

  /* Menu lateral: sempre Azul Profundo, como no app */
  --nav-bg: #0B1A3C; --nav-texto: rgba(255, 255, 255, .74); --nav-texto-fraco: rgba(255, 255, 255, .48);
  --nav-hover: rgba(255, 255, 255, .07); --nav-borda: rgba(255, 255, 255, .09);
  --nav-ativo: linear-gradient(90deg, #0A6CFF, #00A3F5);

  /* Tints 8–12% — fundo de ícone, badge e banner */
  --tint-brand:   rgba(10, 108, 255, .10);
  --tint-accent:  rgba(255, 138, 0, .13);
  --tint-success: rgba(4, 120, 87, .10);
  --tint-danger:  rgba(220, 38, 38, .10);
  --tint-warning: rgba(180, 83, 9, .11);
  --tint-info:    rgba(2, 132, 199, .10);
  --tint-neutral: rgba(74, 80, 112, .08);

  --hatch-line: rgba(101, 115, 154, .35);

  /* Forma, sombra, fonte */
  --ds-radius-sm: 6px;
  --ds-radius: 10px;
  --ds-radius-lg: 14px;
  --ds-radius-pill: 999px;
  --ds-shadow: 0 1px 2px rgba(11, 26, 60, .06), 0 2px 8px rgba(11, 26, 60, .05);
  --ds-shadow-hover: 0 4px 18px rgba(11, 26, 60, .12);
  --ds-shadow-pop: 0 12px 32px rgba(11, 26, 60, .18);
  --ds-transition: all .18s ease;
  --font-sans: Nunito, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;

  /* Bootstrap lendo os tokens */
  --bs-body-bg: var(--surface-base);
  --bs-body-color: var(--text-primary);
  --bs-body-font-family: var(--font-sans);
  --bs-border-color: var(--border-subtle);
  --bs-secondary-color: var(--text-secondary);
  --bs-tertiary-color: var(--text-tertiary);
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-strong);
  --bs-link-color-rgb: 10, 108, 255;
  --bs-link-hover-color-rgb: 0, 82, 204;
  --bs-primary: var(--brand);
  --bs-primary-rgb: 10, 108, 255;
  --bs-emphasis-color: var(--text-primary);
  --bs-secondary-bg: var(--surface-2);
  --bs-tertiary-bg: var(--surface-2);
}

:root[data-theme="dark"] {
  --surface-base: #070F24;
  --surface-1:    #0D1A38;
  --surface-2:    #132447;
  --surface-3:    #182C55;
  --surface-1-hover: #112041;
  --surface-2-hover: #182C55;

  --border-subtle:  #1C2D52;
  --border-default: #2A3F6B;
  --border-strong:  #46608F;

  --text-primary:   #E8EEFA;
  --text-secondary: #A6B3D1;
  --text-tertiary:  #7D8BAE;

  --brand:  #00B4FF;  --brand-ink: #071026;  --brand-strong: #4CCBFF;
  --accent: #FF8A00;  --accent-ink: #071026;  --accent-texto: #FFA53D;
  --success: #34D399; --danger: #F87171; --warning: #FBBF24; --info: #38BDF8;

  --nav-bg: #050C1E; --nav-borda: rgba(255, 255, 255, .07);
  --nav-ativo: linear-gradient(90deg, #0A6CFF, #00B4FF);

  --tint-brand:   rgba(0, 180, 255, .14);
  --tint-accent:  rgba(255, 138, 0, .15);
  --tint-success: rgba(52, 211, 153, .13);
  --tint-danger:  rgba(248, 113, 113, .13);
  --tint-warning: rgba(251, 191, 36, .13);
  --tint-info:    rgba(56, 189, 248, .13);
  --tint-neutral: rgba(167, 172, 201, .10);

  --hatch-line: rgba(167, 172, 201, .22);

  --ds-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .3);
  --ds-shadow-hover: 0 6px 22px rgba(0, 0, 0, .5);
  --ds-shadow-pop: 0 14px 36px rgba(0, 0, 0, .6);

  color-scheme: dark;

  --bs-link-color-rgb: 0, 180, 255;
  --bs-link-hover-color-rgb: 76, 203, 255;
  --bs-primary-rgb: 0, 180, 255;
}

/* ── Base ─────────────────────────────────────────────────────────── */
html, body { background: var(--surface-base); }
body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
}
a { color: var(--brand); }
a:hover { color: var(--brand-strong); }
hr { border-color: var(--border-subtle); opacity: 1; }
.text-secondary, .text-muted { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-brand { color: var(--brand) !important; }
.text-accent { color: var(--accent-texto) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.tabular { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
.cursor-pointer { cursor: pointer; }
[hidden] { display: none !important; }

/* ── Bootstrap no tema ───────────────────────────────────────────── */
.form-control, .form-select {
  background-color: var(--surface-1);
  border-color: var(--border-default);
  color: var(--text-primary);
  border-radius: var(--ds-radius-sm);
  font-size: 14px;
  min-height: 38px;
}
.form-control::placeholder { color: var(--text-tertiary); }
.form-control:focus, .form-select:focus, .form-check-input:focus {
  background-color: var(--surface-1);
  color: var(--text-primary);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--tint-brand);
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--surface-2); opacity: 1; }
.form-select { --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238B93AD' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); }
.form-label { font-weight: 500; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.form-text { color: var(--text-tertiary); font-size: 12px; }
.form-check-input { background-color: var(--surface-1); border-color: var(--border-default); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%238B93AD'/%3e%3c/svg%3e"); }
.input-group-text { background: var(--surface-2); border-color: var(--border-default); color: var(--text-secondary); font-size: 13px; }
.is-invalid { border-color: var(--danger) !important; }
.invalid-feedback { color: var(--danger); }

.modal-content {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-pop);
  color: var(--text-primary);
}
.modal-header, .modal-footer { border-color: var(--border-subtle); }
.modal-header { padding: 16px 20px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; gap: 8px; }
.modal-footer > * { margin: 0; }
.modal-backdrop.show { opacity: .45; }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

.dropdown-menu {
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow-pop);
  padding: 6px;
  font-size: 14px;
  --bs-dropdown-link-color: var(--text-primary);
}
.dropdown-item { border-radius: var(--ds-radius-sm); padding: 7px 10px; color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.dropdown-item i { width: 16px; text-align: center; color: var(--text-tertiary); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text-primary); }
.dropdown-item.active, .dropdown-item:active { background: var(--tint-brand); color: var(--brand); }
.dropdown-item.text-danger i { color: var(--danger); }
.dropdown-divider { border-color: var(--border-subtle); margin: 4px 0; }
.dropdown-header { color: var(--text-tertiary); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--text-primary); --bs-table-border-color: var(--border-subtle); --bs-table-hover-bg: var(--surface-1-hover); --bs-table-hover-color: var(--text-primary); margin: 0; }
.table > thead th { font-size: 12px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: .04em; border-bottom-width: 1px; white-space: nowrap; padding: 10px 12px; }
.table > tbody td { padding: 11px 12px; vertical-align: middle; }
.table-clickable tbody tr { cursor: pointer; }

.nav-tabs { border-color: var(--border-subtle); gap: 4px; }
.nav-tabs .nav-link { color: var(--text-secondary); border: none; border-bottom: 2px solid transparent; font-weight: 500; padding: 8px 12px; }
.nav-tabs .nav-link:hover { color: var(--text-primary); border-color: transparent; }
.nav-tabs .nav-link.active { color: var(--brand); background: transparent; border-bottom-color: var(--brand); }

.offcanvas { background: var(--surface-3); color: var(--text-primary); border-color: var(--border-subtle) !important; }
.popover { --bs-popover-bg: var(--surface-3); --bs-popover-border-color: var(--border-subtle); --bs-popover-body-color: var(--text-primary); --bs-popover-header-bg: var(--surface-2); --bs-popover-header-color: var(--text-primary); box-shadow: var(--ds-shadow-pop); font-family: var(--font-sans); }
.tooltip { --bs-tooltip-bg: #11142B; font-family: var(--font-sans); }
.progress { background: var(--surface-2); }
.list-group { --bs-list-group-bg: var(--surface-1); --bs-list-group-color: var(--text-primary); --bs-list-group-border-color: var(--border-subtle); --bs-list-group-action-hover-bg: var(--surface-1-hover); --bs-list-group-action-hover-color: var(--text-primary); --bs-list-group-action-active-bg: var(--surface-2); }

/* ── Botões ──────────────────────────────────────────────────────────
   .ds-btn é a base (forma); a cor vem do modificador. */
.ds-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px;
  border-radius: var(--ds-radius-sm);
  border: 1px solid transparent;
  font: 600 14px/1 var(--font-sans);
  white-space: nowrap; cursor: pointer; user-select: none;
  transition: var(--ds-transition);
  text-decoration: none;
  background: transparent; color: var(--text-primary);
}
.ds-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tint-brand); }
.ds-btn:disabled, .ds-btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.ds-btn i { font-size: 13px; }
.ds-btn-primary { background: var(--accent); color: var(--accent-ink); }
.ds-btn-primary:hover { filter: brightness(1.07); color: var(--accent-ink); }
.ds-btn-brand { background: var(--brand); color: var(--brand-ink); }
.ds-btn-brand:hover { background: var(--brand-strong); color: var(--brand-ink); }
.ds-btn-outline { background: var(--surface-1); border-color: var(--border-default); color: var(--text-primary); }
.ds-btn-outline:hover { background: var(--surface-2); color: var(--text-primary); }
.ds-btn-ghost { color: var(--text-secondary); }
.ds-btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.ds-btn-soft { background: var(--tint-brand); color: var(--brand); }
.ds-btn-soft:hover { background: var(--brand); color: var(--brand-ink); }
.ds-btn-success { background: var(--success); color: #fff; }
.ds-btn-success:hover { filter: brightness(1.08); color: #fff; }
.ds-btn-danger { background: var(--surface-1); border-color: var(--border-default); color: var(--danger); }
.ds-btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.ds-btn-danger-solid { background: var(--danger); color: #fff; }
.ds-btn-danger-solid:hover { filter: brightness(1.08); color: #fff; }
.ds-btn-whatsapp { background: #25D366; color: #08361B; }
.ds-btn-whatsapp:hover { filter: brightness(1.05); color: #08361B; }
.ds-btn-sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.ds-btn-lg { height: 48px; padding: 0 20px; font-size: 15px; border-radius: var(--ds-radius); }
.ds-btn-icon { width: 38px; padding: 0; }
.ds-btn-icon.ds-btn-sm { width: 30px; }
.ds-btn-block { width: 100%; }

/* ── Card ───────────────────────────────────────────────────────────── */
.ds-card {
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow);
}
.ds-card-body { padding: 18px; }
.ds-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border-subtle);
}
.ds-card-title { font-size: 15px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.ds-card-title .ds-count { font-weight: 500; color: var(--text-tertiary); font-size: 13px; }
.ds-card-foot { padding: 12px 18px; border-top: 1px solid var(--border-subtle); display: flex; justify-content: flex-end; gap: 8px; }
.ds-card-link { cursor: pointer; transition: var(--ds-transition); }
.ds-card-link:hover { box-shadow: var(--ds-shadow-hover); border-color: var(--border-default); }
.ds-card-flat { box-shadow: none; }

/* ── Cabeçalho da página ───────────────────────────────────────────── */
.ds-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 20px; }
.ds-page-title { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin: 0; display: flex; align-items: center; gap: 10px; }
.ds-page-sub { color: var(--text-secondary); margin: 4px 0 0; font-size: 14px; }
.ds-page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ds-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-tertiary); text-decoration: none; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.ds-back:hover { color: var(--text-primary); }

.ds-section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-tertiary); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }

/* ── Badge ──────────────────────────────────────────────────────────── */
.ds-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: var(--ds-radius-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1;
  background: var(--tint-neutral); color: var(--text-secondary);
}
.ds-badge i { font-size: 10px; }
.ds-badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ds-badge-brand   { background: var(--tint-brand);   color: var(--brand); }
.ds-badge-accent  { background: var(--tint-accent);  color: var(--accent-texto); }
.ds-badge-success { background: var(--tint-success); color: var(--success); }
.ds-badge-danger  { background: var(--tint-danger);  color: var(--danger); }
.ds-badge-warning { background: var(--tint-warning); color: var(--warning); }
.ds-badge-info    { background: var(--tint-info);    color: var(--info); }
.ds-badge-outline { background: transparent; border: 1px solid var(--border-default); color: var(--text-secondary); }
.ds-badge-lg { height: 26px; padding: 0 10px; font-size: 13px; }

/* ── Chips de filtro / seleção ─────────────────────────────────────── */
.ds-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ds-chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--ds-radius-pill);
  border: 1px solid var(--border-default); background: var(--surface-1);
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: var(--ds-transition); white-space: nowrap; user-select: none;
}
.ds-chip:hover { border-color: var(--border-strong); color: var(--text-primary); }
.ds-chip.active, .ds-chip[aria-pressed="true"] { background: var(--tint-brand); border-color: var(--brand); color: var(--brand); }
.ds-chip .ds-chip-count { font-size: 11px; font-weight: 600; background: var(--surface-2); color: var(--text-secondary); border-radius: 10px; padding: 1px 6px; }
.ds-chip.active .ds-chip-count { background: var(--brand); color: var(--brand-ink); }
.ds-chip-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ds-chip-scroll::-webkit-scrollbar { display: none; }

/* ── Segmented ──────────────────────────────────────────────────────── */
.ds-segmented { display: inline-flex; background: var(--surface-2); border-radius: var(--ds-radius-sm); padding: 3px; gap: 2px; }
.ds-segmented button {
  border: none; background: transparent; color: var(--text-secondary);
  height: 30px; padding: 0 12px; border-radius: 5px; font: 500 13px var(--font-sans); cursor: pointer;
}
.ds-segmented button.active { background: var(--surface-1); color: var(--text-primary); box-shadow: var(--ds-shadow); }

/* ── KPI ────────────────────────────────────────────────────────────── */
.ds-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.ds-kpi {
  background: var(--surface-1); border: 1px solid var(--border-subtle); border-radius: var(--ds-radius-lg);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--ds-shadow);
  text-decoration: none; color: inherit; transition: var(--ds-transition);
}
a.ds-kpi:hover, button.ds-kpi:hover { box-shadow: var(--ds-shadow-hover); color: inherit; }
button.ds-kpi { text-align: left; width: 100%; }
button.ds-kpi[aria-pressed="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.ds-kpi-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 15px; }
.ds-kpi-value { font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ds-kpi-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.tone-brand   { background: var(--tint-brand);   color: var(--brand); }
.tone-accent  { background: var(--tint-accent);  color: var(--accent-texto); }
.tone-success { background: var(--tint-success); color: var(--success); }
.tone-danger  { background: var(--tint-danger);  color: var(--danger); }
.tone-warning { background: var(--tint-warning); color: var(--warning); }
.tone-info    { background: var(--tint-info);    color: var(--info); }
.tone-neutral { background: var(--tint-neutral); color: var(--text-secondary); }

/* ── Banner / alerta ───────────────────────────────────────────────── */
.ds-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: var(--ds-radius); border: 1px solid var(--border-subtle);
  background: var(--surface-1); font-size: 14px;
}
.ds-banner > i { font-size: 16px; flex-shrink: 0; }
.ds-banner-body { flex: 1; min-width: 0; }
.ds-banner-title { font-weight: 600; }
.ds-banner-sub { color: var(--text-secondary); font-size: 13px; }
.ds-banner-info    { background: var(--tint-info);    border-color: transparent; } .ds-banner-info > i { color: var(--info); }
.ds-banner-warning { background: var(--tint-warning); border-color: transparent; } .ds-banner-warning > i { color: var(--warning); }
.ds-banner-danger  { background: var(--tint-danger);  border-color: transparent; } .ds-banner-danger > i { color: var(--danger); }
.ds-banner-success { background: var(--tint-success); border-color: transparent; } .ds-banner-success > i { color: var(--success); }
.ds-banner-brand   { background: var(--tint-brand);   border-color: transparent; } .ds-banner-brand > i { color: var(--brand); }

/* ── Estado vazio ──────────────────────────────────────────────────── */
.ds-empty { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.ds-empty-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; background: var(--tint-brand); color: var(--brand); }
.ds-empty-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.ds-empty-desc { font-size: 14px; max-width: 420px; margin: 0 auto 16px; }
.ds-empty-sm { padding: 20px 12px; }
.ds-empty-sm .ds-empty-icon { width: 40px; height: 40px; font-size: 16px; border-radius: 12px; margin-bottom: 8px; }
.ds-empty-sm .ds-empty-title { font-size: 14px; }
.ds-empty-sm .ds-empty-desc { font-size: 13px; margin-bottom: 8px; }

/* ── Lista de linhas ───────────────────────────────────────────────── */
.ds-list { display: flex; flex-direction: column; }
.ds-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle); color: inherit; text-decoration: none;
  transition: background .12s ease;
}
.ds-row:last-child { border-bottom: none; }
a.ds-row:hover, .ds-row.clickable:hover { background: var(--surface-1-hover); color: inherit; cursor: pointer; }
.ds-row-main { flex: 1; min-width: 0; }
.ds-row-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-row-sub { color: var(--text-secondary); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-row-side { text-align: right; flex-shrink: 0; }

/* ── Dados (definições) ────────────────────────────────────────────── */
.ds-dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px 20px; margin: 0; }
.ds-dl dt { font-size: 12px; color: var(--text-tertiary); font-weight: 500; margin-bottom: 2px; }
.ds-dl dd { margin: 0; font-weight: 600; font-size: 14px; }

/* ── Avatar / swatch ───────────────────────────────────────────────── */
.ds-avatar { width: 32px; height: 32px; border-radius: 9px; background: var(--tint-brand); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.ds-avatar-sm { width: 26px; height: 26px; font-size: 11px; border-radius: 7px; }
.ds-swatch { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex-shrink: 0; border: 1px solid rgba(0,0,0,.15); vertical-align: -1px; }
[data-theme="dark"] .ds-swatch { border-color: rgba(255,255,255,.2); }
.ds-material { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

/* ── Progresso (mesas impressas) ───────────────────────────────────── */
.ds-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; display: flex; }
.ds-progress > span { display: block; height: 100%; background: var(--success); transition: width .4s ease; }
.ds-progress > span.imprimindo { background: var(--info); }
.ds-progress-label { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ── Skeleton ──────────────────────────────────────────────────────── */
.skel { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 6px; }
.skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: skel 1.3s infinite; }
[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
@keyframes skel { 100% { transform: translateX(100%); } }
.skel-line { height: 12px; margin: 8px 0; }
.skel-title { height: 18px; width: 40%; margin-bottom: 12px; }
.skel-card { height: 96px; border-radius: var(--ds-radius-lg); }

/* ── Timeline (UC21) ───────────────────────────────────────────────── */
.ds-timeline { position: relative; padding-left: 28px; }
.ds-timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: var(--border-subtle); }
.ds-tl-item { position: relative; padding-bottom: 16px; }
.ds-tl-item:last-child { padding-bottom: 0; }
.ds-tl-dot { position: absolute; left: -28px; top: 0; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; border: 2px solid var(--surface-1); }
.ds-tl-head { font-size: 13px; color: var(--text-secondary); display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.ds-tl-head strong { color: var(--text-primary); font-weight: 600; }
.ds-tl-when { color: var(--text-tertiary); font-size: 12px; }
.ds-tl-body { margin-top: 4px; font-size: 14px; }
.ds-tl-note { background: var(--surface-2); border-radius: var(--ds-radius); padding: 10px 12px; margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.ds-tl-change { font-size: 13px; }
.ds-tl-change del { color: var(--text-tertiary); }
.ds-tl-files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ds-file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--ds-radius-sm); border: 1px solid var(--border-default); background: var(--surface-1); font-size: 12.5px; color: var(--text-primary); cursor: pointer; max-width: 240px; }
.ds-file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-file-chip:hover { border-color: var(--brand); color: var(--brand); }
.ds-composer { border: 1px solid var(--border-default); border-radius: var(--ds-radius); background: var(--surface-1); }
.ds-composer textarea { border: none; resize: none; box-shadow: none !important; min-height: 64px; background: transparent; }
.ds-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border-top: 1px solid var(--border-subtle); }

/* ── Dropzone ──────────────────────────────────────────────────────── */
.ds-dropzone {
  border: 2px dashed var(--border-default); border-radius: var(--ds-radius-lg);
  padding: 22px; text-align: center; color: var(--text-secondary); cursor: pointer;
  transition: var(--ds-transition); background: var(--surface-1);
}
.ds-dropzone:hover, .ds-dropzone.over { border-color: var(--brand); background: var(--tint-brand); color: var(--brand); }
.ds-dropzone i { font-size: 22px; margin-bottom: 6px; display: block; }
.ds-upload-item { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 8px 0; }
.ds-upload-item .ds-progress { flex: 1; }

/* ── Toasts ────────────────────────────────────────────────────────── */
.ds-toasts { position: fixed; z-index: 2000; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.ds-toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface-3); color: var(--text-primary);
  border: 1px solid var(--border-subtle); border-left: 4px solid var(--info);
  border-radius: var(--ds-radius); box-shadow: var(--ds-shadow-pop);
  padding: 12px 14px; font-size: 14px; animation: toast-in .2s ease;
}
.ds-toast.saindo { animation: toast-out .2s ease forwards; }
.ds-toast > i { margin-top: 2px; }
.ds-toast-body { flex: 1; min-width: 0; }
.ds-toast-title { font-weight: 600; }
.ds-toast-actions { display: flex; gap: 6px; margin-top: 8px; }
.ds-toast-close { border: none; background: none; color: var(--text-tertiary); padding: 0 2px; cursor: pointer; }
.ds-toast-success { border-left-color: var(--success); } .ds-toast-success > i { color: var(--success); }
.ds-toast-error   { border-left-color: var(--danger); }  .ds-toast-error > i { color: var(--danger); }
.ds-toast-warning { border-left-color: var(--warning); } .ds-toast-warning > i { color: var(--warning); }
.ds-toast-info > i { color: var(--info); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ── Picker (busca com resultados: cliente, produto) ───────────────── */
.ds-picker { position: relative; }
.ds-picker-menu {
  position: absolute; z-index: 1060; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface-3); border: 1px solid var(--border-subtle); border-radius: var(--ds-radius);
  box-shadow: var(--ds-shadow-pop); max-height: 300px; overflow-y: auto; padding: 4px;
}
.ds-picker-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--ds-radius-sm); cursor: pointer; font-size: 14px; }
.ds-picker-opt:hover, .ds-picker-opt.active { background: var(--surface-2); }
.ds-picker-opt small { color: var(--text-tertiary); }
.ds-picker-selected { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-default); border-radius: var(--ds-radius-sm); padding: 6px 8px 6px 10px; background: var(--surface-1); min-height: 38px; }

/* ── Kbd / misc ────────────────────────────────────────────────────── */
.ds-btn-primary kbd, .ds-btn-brand kbd { background: rgba(255,255,255,.18); color: inherit; border-color: rgba(255,255,255,.35); }
kbd { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border-default); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; font-size: 11px; font-family: var(--font-sans); }
.ds-divider-text { display: flex; align-items: center; gap: 10px; color: var(--text-tertiary); font-size: 12px; margin: 14px 0; }
.ds-divider-text::before, .ds-divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border-subtle); }
.ds-money { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ds-hatch { background-image: repeating-linear-gradient(135deg, var(--hatch-line) 0 2px, transparent 2px 8px); }
.ds-pin { color: var(--brand); }
.ds-sticky { position: sticky; top: 76px; }
.ds-spin { animation: ds-spin 1s linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }
.ds-fade-in { animation: toast-in .25s ease; }

/* Tela de carregamento inicial (antes da sessão ser conferida) */
#app-loading { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: var(--surface-base); transition: opacity .2s ease; }
#app-loading.saindo { opacity: 0; pointer-events: none; }
.app-loading-mark { width: 64px; height: 64px; object-fit: contain; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .75; } }

/* Marca (logo provisório) */
/* Logo: -b em tema claro, -w em tema escuro */
.brand-icone { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
.logo-tema-escuro { display: none; }
:root[data-theme="dark"] .logo-tema-claro { display: none; }
:root[data-theme="dark"] .logo-tema-escuro { display: inline-block; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); font-size: 15px; flex-shrink: 0; }
.brand-name { font-weight: 700; letter-spacing: -.01em; font-size: 16px; color: var(--text-primary); }

/* Gráfico de barras agrupadas (faturamento.js): eixo fixo à esquerda, colunas com rolagem quando são muitas */
.ds-bars-legenda { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 12px; }
.ds-bars-legenda strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.ds-bars-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ds-bars { display: flex; gap: 8px; height: 240px; }
.ds-bars-eixo { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; font-size: 11px; color: var(--text-tertiary); text-align: right; min-width: 22px; font-variant-numeric: tabular-nums; }
.ds-bars-eixo span { line-height: 0; }
.ds-bars-rolagem { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.ds-bars-area {
  height: 100%; display: grid; grid-template-columns: repeat(var(--colunas), minmax(0, 1fr)); gap: 2px;
  background: repeating-linear-gradient(to bottom, var(--border-subtle) 0 1px, transparent 1px 25%) 0 0 / 100% calc(100% - 22px) no-repeat;
}
.ds-bars-largo { min-width: calc(var(--colunas) * 18px); }
.ds-bars-col {
  display: flex; flex-direction: column; min-width: 0; padding: 0; border: 0; background: transparent; cursor: pointer;
  border-radius: var(--ds-radius-sm); color: inherit;
}
.ds-bars-col:hover, .ds-bars-col.ativo { background: var(--tint-neutral); }
.ds-bars-grupo { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 1px; padding: 0 2px; border-bottom: 1px solid var(--border-default); }
.ds-bar { flex: 1; max-width: 14px; min-height: 2px; border-radius: 3px 3px 0 0; transition: height .3s ease; }
.ds-bars-rotulo { height: 22px; line-height: 22px; font-size: 10.5px; color: var(--text-tertiary); text-align: center; white-space: nowrap; overflow: visible; }
.ds-bars-detalhe { min-height: 20px; margin-top: 10px; }
.ds-meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ds-meter > span { display: block; height: 100%; border-radius: 3px; background: var(--brand); }
