:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-soft: #f5f1eb;
  --surface-hover: #f9f6f1;
  --border: #e8e1d7;
  --border-strong: #d7cdc0;

  --text: #1f1b16;
  --text-secondary: #5c5349;
  --text-muted: #847a6f;

  --primary: #c84b31;
  --primary-hover: #ae3d26;
  --primary-soft: #fdf0ec;
  --primary-border: #f3c4b7;

  --green: #1e7a4c;
  --green-soft: #eaf7f0;
  --green-border: #bce5ce;

  --amber: #b45309;
  --amber-soft: #fef6e7;
  --amber-border: #f4d399;

  --red: #b91c1c;
  --red-soft: #fef2f2;
  --red-border: #fecaca;

  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --blue-border: #bfdbfe;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(31, 27, 22, 0.05);
  --shadow-md: 0 8px 24px rgba(31, 27, 22, 0.08);
  --shadow-lg: 0 20px 50px rgba(31, 27, 22, 0.18);

  --sidebar-width: 248px;
  --topbar-height: 68px;
  --bottom-nav-height: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.num {
  font-variant-numeric: tabular-nums;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-muted);
}

.text-green {
  color: var(--green);
}

.text-blue {
  color: var(--blue);
}

.text-amber {
  color: var(--amber);
}

.text-red {
  color: var(--red);
}

/* ===========================
   APP SHELL & SIDEBAR
   =========================== */

.app-shell {
  display: flex;
  min-height: 100dvh;
  background: var(--bg);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
}

.sidebar-backdrop {
  display: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 18px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(200, 75, 49, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 12px;
  color: var(--text-muted);
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 18px 10px 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-module {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-module-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-module-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-module.active {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
  font-weight: 600;
}

.nav-module.disabled {
  opacity: 0.64;
  cursor: not-allowed;
}

.badge-soon {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-summary {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.summary-row strong {
  color: var(--text);
  font-weight: 600;
}

/* ===========================
   MAIN AREA & TOPBAR
   =========================== */

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.topbar-title-group {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.topbar-title-group h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.desktop-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-soft);
  padding: 4px;
  border-radius: 11px;
  border: 1px solid var(--border);
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-count {
  font-size: 11.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-muted);
}

.tab-btn.active .tab-count {
  background: var(--primary-soft);
  color: var(--primary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ===========================
   BUTTONS & CONTROLS
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-soft);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-soft);
  color: var(--text);
}

.btn-danger-outline {
  background: var(--surface);
  border-color: var(--red-border);
  color: var(--red);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--red-soft);
}

.btn-green-outline {
  background: var(--surface);
  border-color: var(--green-border);
  color: var(--green);
}

.btn-green-outline:hover:not(:disabled) {
  background: var(--green-soft);
}

.btn-sm {
  padding: 7px 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-full {
  width: 100%;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}

/* ===========================
   GLOBAL ALERTS
   =========================== */

.global-alert-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 24px;
}

.global-alert-area:empty {
  display: none;
}

.alert-banner {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--amber-border);
  background: var(--amber-soft);
  color: #7c3a09;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}

.alert-banner.error {
  border-color: var(--red-border);
  background: var(--red-soft);
  color: var(--red);
}

.alert-banner-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.alert-banner-content strong {
  font-weight: 700;
}

.alert-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ===========================
   CONTENT & VIEWS
   =========================== */

.content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
}

.view.active {
  display: flex;
  flex-direction: column;
}

/* ===========================
   SEARCH, CHIPS & SWITCH
   =========================== */

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 36px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 75, 49, 0.12);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
}

.search-clear:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 12px;
  min-height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.chip.active {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
  font-weight: 600;
}

.chip-warn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #fff;
}

.list-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.list-count {
  font-weight: 500;
}

.muted-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
  font-weight: 500;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.switch-input:checked + .switch-track {
  background: var(--primary);
}

.switch-input:checked + .switch-track::after {
  transform: translateX(14px);
}

.switch-input:focus-visible + .switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ===========================
   BADGES
   =========================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-neutral {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.badge-size {
  background: #efeae2;
  color: var(--text);
  font-weight: 700;
  min-width: 24px;
  justify-content: center;
}

.badge-green {
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green);
}

.badge-amber {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
}

.badge-red {
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  color: var(--red);
}

.badge-primary {
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary);
}

/* ===========================
   ABA 1: PRODUTOS (MASTER-DETAIL)
   =========================== */

.master-detail {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.master-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.pane-controls {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.produtos-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.produto-card {
  width: 100%;
  text-align: left;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.produto-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.produto-card.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.produto-card.inactive {
  opacity: 0.68;
}

.produto-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.produto-card-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.produto-card-tags {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.produto-card-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.metric-pair {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text-muted);
}

.metric-inline strong {
  color: var(--text);
  font-weight: 600;
}

.produto-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.code-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.code-indicator.empty {
  color: var(--text-muted);
}

/* Detail pane */
.detail-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 36px;
}

.detail-container {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty-detail,
.loading-box,
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* Cards inside detail */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Detail Header */
.detail-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.detail-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.detail-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Segmented toggle: Inteira | 1/2 Pizza */
.segmented-control {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.segmented-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented-btn.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Compact Codes Block */
.codes-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.code-group {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.code-group-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.code-group-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.code-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 26px;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.code-chip-remove {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
}

.code-chip-remove:hover {
  background: var(--red-soft);
  color: var(--red);
}

.code-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13.5px;
}

.code-input:focus {
  outline: none;
  border-color: var(--primary);
}

/* 4 Summary KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-card.highlight-green {
  border-color: var(--green-border);
  background: linear-gradient(180deg, #ffffff 0%, #f7fcf9 100%);
}

.kpi-card.highlight-amber {
  border-color: var(--amber-border);
  background: linear-gradient(180deg, #ffffff 0%, #fffbf2 100%);
}

.kpi-card.highlight-red {
  border-color: var(--red-border);
  background: linear-gradient(180deg, #ffffff 0%, #fff7f7 100%);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.25;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.meia-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
}

/* Recipe Tables */
.recipe-subsection {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recipe-subsection + .recipe-subsection {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.recipe-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.recipe-subhead h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.recipe-subtotal {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  text-align: left;
  padding: 9px 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}

.data-table th.text-right {
  text-align: right;
}

.data-table th:first-child {
  border-top-left-radius: 8px;
}

.data-table th:last-child {
  border-top-right-radius: 8px;
}

.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

.table-empty {
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 13px;
}

/* Pricing Form */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field-hint {
  font-size: 11.5px;
  color: var(--text-muted);
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input.num-input {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.textarea {
  height: auto;
  min-height: 70px;
  padding: 9px 11px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 75, 49, 0.12);
}

.pricing-footer {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pricing-preview {
  font-size: 13px;
  color: var(--text-secondary);
}

/* Collapsible Version History */
.history-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.history-summary {
  padding: 15px 20px;
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  user-select: none;
}

.history-summary::-webkit-details-marker {
  display: none;
}

.history-chevron {
  transition: transform 0.18s ease;
  color: var(--text-muted);
}

.history-details[open] .history-chevron {
  transform: rotate(180deg);
}

.history-list {
  border-top: 1px solid var(--border);
  padding: 12px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.history-item-meta {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.history-item-reason {
  font-size: 13px;
  color: var(--text);
}

.history-item-summary {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   ABA 2: INSUMOS
   =========================== */

.section-toolbar {
  padding: 16px 24px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-search {
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.insumos-container {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 36px;
}

.insumos-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.insumo-name-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-weight: 600;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* ===========================
   ABA 3: COMPOSTOS
   =========================== */

.compostos-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.compostos-grid {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 36px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  align-content: start;
  gap: 16px;
}

.composto-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.composto-card.incomplete {
  border-color: var(--amber-border);
  background: linear-gradient(180deg, #fffdf9 0%, #ffffff 30%);
}

.composto-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.composto-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 700;
}

.composto-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.composto-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.composto-kpi span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.composto-kpi strong {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}

.composto-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.composto-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}

.composto-item-row:last-child {
  border-bottom: none;
}

.composto-item-name {
  font-weight: 500;
  color: var(--text);
}

.composto-item-vals {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.composto-warning-note {
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: #7c3a09;
  font-size: 12.5px;
}

/* ===========================
   MODAL & FORM EDITOR
   =========================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 20, 16, 0.48);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-sheet {
  width: 100%;
  max-width: 720px;
  max-height: 90dvh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-sheet.modal-sm {
  max-width: 520px;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.modal-subtitle {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Dynamic editor rows */
.editor-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.editor-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editor-section-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.editor-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 115px 90px 36px;
  gap: 8px;
  align-items: center;
}

.editor-row-cost {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
}

.live-preview-box {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.live-preview-box strong {
  font-size: 15.5px;
  color: var(--primary);
}

.live-preview-breakdown {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.form-error-inline {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  color: var(--red);
  font-size: 13px;
  font-weight: 500;
}

/* Purchase History list inside modal */
.purchase-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.purchase-history-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.purchase-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.purchase-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  font-size: 12.5px;
}

.purchase-history-grid span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

/* ===========================
   MODAL DE CONFIGURAÇÕES
   =========================== */

.btn-settings {
  padding: 8px 13px;
}

.config-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.config-section {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.config-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.config-section-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.config-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.config-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
}

.config-item-info {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}

.config-item-name {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  word-break: break-word;
}

.config-item-id {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}

.config-item-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.config-confirm-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--red);
  margin-right: 2px;
}

.config-add-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.config-add-form .input {
  flex: 1;
  min-width: 0;
  height: 36px;
  font-size: 13.5px;
}

/* ===========================
   TOASTS
   =========================== */

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
  width: calc(100vw - 32px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #241f1a;
  color: #fff;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
  animation: toastIn 0.18s ease-out;
}

.toast.success {
  background: #175c39;
}

.toast.warning {
  background: #92400e;
}

.toast.error {
  background: #991b1b;
}

.toast-close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   BOTTOM NAV (MOBILE ONLY)
   =========================== */

.bottom-nav {
  display: none;
}

.mobile-only {
  display: none;
}

/* ===========================
   RESPONSIVE BREAKPOINTS
   =========================== */

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pricing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .master-detail {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 959px) {
  .mobile-only {
    display: inline-flex;
  }

  .desktop-tabs {
    display: none;
  }

  /* Sidebar becomes slide-over drawer */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100dvh;
    width: min(290px, 84vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
    z-index: 90;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(24, 20, 16, 0.42);
    z-index: 85;
  }

  .main-area {
    height: 100dvh;
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    height: 60px;
    padding: 0 14px;
  }

  .topbar-title-group h1 {
    font-size: 17px;
  }

  .topbar-subtitle {
    display: none;
  }

  .btn-settings {
    width: auto;
    height: auto;
    min-height: 40px;
    padding: 8px 10px;
  }

  .btn-settings-label {
    display: inline;
    font-size: 13px;
  }

  .global-alert-area {
    padding: 0 12px;
  }

  /* Single-pane master-detail switch on mobile */
  .master-detail {
    display: flex;
    flex-direction: column;
  }

  .master-pane {
    flex: 1;
    border-right: none;
  }

  .detail-pane {
    display: none;
    flex: 1;
  }

  .master-detail.detail-open .master-pane {
    display: none;
  }

  .master-detail.detail-open .detail-pane {
    display: flex;
  }

  .mobile-detail-bar {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px 7px 6px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 600;
    font-size: 13.5px;
  }

  .pane-controls {
    padding: 12px 14px 10px;
  }

  /* Large touch-friendly horizontal scroll chips */
  .chips-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .chips-row::-webkit-scrollbar {
    display: none;
  }

  .chip {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 13.5px;
    flex-shrink: 0;
  }

  .produtos-list {
    padding: 10px 12px 20px;
    gap: 8px;
  }

  .produto-card {
    padding: 14px;
  }

  .detail-scroll {
    padding: 14px 12px 28px;
  }

  .card {
    padding: 15px 14px;
  }

  .detail-title {
    font-size: 19px;
  }

  .kpi-value {
    font-size: 18px;
  }

  .section-toolbar {
    padding: 12px 14px 10px;
  }

  .toolbar-search {
    max-width: none;
    min-width: 0;
    width: 100%;
  }

  .insumos-container {
    padding: 12px 12px 24px;
  }

  .compostos-grid {
    padding: 12px 12px 24px;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Fixed Bottom Navigation Bar */
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    z-index: 60;
    box-shadow: 0 -4px 16px rgba(31, 27, 22, 0.06);
  }

  .bottom-nav-item {
    border: none;
    background: transparent;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 2px;
  }

  .bottom-nav-item.active {
    color: var(--primary);
    background: var(--primary-soft);
  }

  .toast-container {
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
    top: 8px;
    bottom: auto;
  }

  /* Comfortable bottom-sheet modal on mobile */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-sheet {
    max-width: none;
    max-height: 92dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
  }

  .modal-body {
    padding: 16px 14px;
  }

  .modal-footer {
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .input,
  .select,
  .textarea,
  .search-input,
  .code-input {
    font-size: 16px;
    min-height: 44px;
  }

  .btn {
    min-height: 42px;
  }

  .btn-sm {
    min-height: 38px;
  }
}

/* Responsive card transformation for tables on small screens (no horizontal scroll!) */
@media (max-width: 720px) {
  .form-grid-2,
  .form-grid-3,
  .pricing-grid,
  .config-sections {
    grid-template-columns: 1fr;
  }

  .config-add-form {
    flex-direction: column;
    align-items: stretch;
  }

  .config-add-form .input {
    height: 44px;
    font-size: 16px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .kpi-card {
    padding: 12px;
  }

  .composto-kpis {
    grid-template-columns: 1fr;
  }

  .editor-row {
    grid-template-columns: 1fr 1fr;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
  }

  .editor-row .editor-select {
    grid-column: 1 / -1;
  }

  .editor-row .editor-qty {
    grid-column: 1 / 2;
  }

  .editor-row .editor-row-cost {
    grid-column: 2 / 3;
    align-self: center;
  }

  .editor-row .editor-remove {
    grid-column: 1 / -1;
    width: 100%;
    height: 34px;
    border: 1px solid var(--red-border);
    color: var(--red);
    background: var(--red-soft);
    font-size: 13px;
  }

  .insumos-table-card {
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .responsive-table tbody tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 13px;
    box-shadow: var(--shadow-sm);
  }

  .responsive-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border-bottom: 1px dashed var(--border);
    text-align: right;
  }

  .responsive-table td:last-child {
    border-bottom: none;
    padding-top: 8px;
  }

  .responsive-table td::before {
    content: attr(data-label);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    flex-shrink: 0;
  }

  .responsive-table td.cell-primary {
    display: block;
    text-align: left;
    padding-top: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }

  .responsive-table td.cell-primary::before {
    display: none;
  }

  .responsive-table td.cell-actions {
    display: block;
  }

  .responsive-table td.cell-actions::before {
    display: none;
  }

  .responsive-table td.cell-actions .row-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .purchase-history-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ===========================
   SUB-ABAS MOBILE (MÓDULO ATIVO)
   =========================== */

.mobile-subtabs {
  display: none;
}

/* ===========================
   ABAS INTERNAS DO MODAL (CONFIGURAÇÕES)
   =========================== */

.modal-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  margin-bottom: 14px;
  min-width: 0;
}

.modal-tab {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.modal-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 720px) {
  .modal-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
  }

  .modal-tab {
    padding: 7px 6px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* ===========================
   INTEGRAÇÕES (CONFIGURAÇÕES)
   =========================== */

.integ-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.integ-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.integ-card.primary-integ {
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.integ-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.integ-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.integ-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.integ-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
}

.integ-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.integ-key-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 12.5px;
}

.integ-key-mask {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text);
}

.integ-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.integ-actions-left,
.integ-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.integ-feedback {
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
}

.integ-feedback.ok {
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green);
}

.integ-feedback.err {
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  color: var(--red);
}

.integ-soon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.integ-soon-card {
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.integ-soon-card strong {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.integ-soon-card span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   MÓDULO 2: CARDÁPIOWEB — PEDIDOS
   =========================== */

.cw-top-summary-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.cw-filters-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cw-filter-dates,
.cw-filter-selects,
.cw-filter-switches {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cw-filter-switches {
  justify-content: space-between;
}

.cw-switches-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cw-date-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cw-date-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.input-sm,
.select-sm {
  height: 36px;
  font-size: 13.5px;
}

.cw-filter-selects .select-sm {
  width: auto;
  min-width: 165px;
}

.cw-ped-search {
  flex: 1;
  min-width: 200px;
  max-width: 340px;
}

.cw-kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.cw-mini-kpi {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cw-mini-kpi.warn {
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

.cw-mini-kpi.good {
  background: var(--green-soft);
  border-color: var(--green-border);
}

.cw-mini-kpi.cw-cai {
  background: var(--blue-soft);
  border-color: var(--blue-border);
}

.cw-mini-kpi.cw-cai .cw-mini-kpi-val {
  font-size: 20px;
  color: var(--blue);
}

.cw-mini-kpi.cw-sobra {
  background: var(--green-soft);
  border-color: var(--green-border);
}

.cw-mini-kpi.cw-sobra .cw-mini-kpi-val {
  font-size: 20px;
  color: var(--green);
}

.cw-mini-kpi.cw-sobra.neg {
  background: var(--red-soft);
  border-color: var(--red-border);
}

.cw-mini-kpi.cw-sobra.neg .cw-mini-kpi-val {
  color: var(--red);
}

.cw-mini-kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cw-mini-kpi-val {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.cw-mini-kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cw-team-note {
  font-size: 12px;
  color: var(--text-muted);
}

.cw-master-detail {
  grid-template-columns: 390px minmax(0, 1fr);
}

.cw-list-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  font-size: 12.5px;
}

.cw-day-header {
  position: sticky;
  top: -10px;
  z-index: 2;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.cw-order-card {
  gap: 6px;
}

.cw-order-card.equipe {
  border-style: dashed;
  background: #faf9fc;
}

.cw-order-card.canceled {
  opacity: 0.68;
}

.badge-channel {
  background: #eef2f8;
  border: 1px solid #d2dcf0;
  color: #29487d;
}

.badge-channel.ifood {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.badge-channel.food99 {
  background: #fef8e7;
  border-color: #f6d57a;
  color: #9a5b00;
}

.badge-channel.catalog {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
}

.badge-channel.whatsapp_extension {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--green);
}

/* Detalhe do Pedido — Árvore de Itens & Opções */
.order-finance-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.order-fin-cell {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.order-fin-cell span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.order-fin-cell strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.order-tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-item-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.order-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.order-item-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.order-item-title strong {
  font-size: 14.5px;
  color: var(--text);
}

.order-item-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.order-options-tree {
  margin-left: 10px;
  padding-left: 14px;
  border-left: 2px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-option-node {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.order-option-group {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.order-desm-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.order-desm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.order-desm-row strong {
  color: var(--green);
}

/* ===========================
   MÓDULO 2: ESPELHO DO CARDÁPIO
   =========================== */

.cw-catalogo-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
}

.cw-catalogo-alert.warn {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: #7c3a09;
}

.cw-catalogo-alert.ok {
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green);
}

.toolbar-row-between {
  justify-content: space-between;
}

.vinculo-fichas-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.role-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.role-card {
  position: relative;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.role-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.role-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.role-card strong {
  font-size: 13.5px;
  color: var(--text);
}

.role-card span {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.vinculo-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 36px;
  gap: 8px;
  align-items: center;
}

/* ===========================
   MÓDULO 2: RAIO-X POR PRODUTO
   =========================== */

.cw-raiox-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.cw-raiox-select-field {
  flex: 1;
  min-width: 260px;
  max-width: 460px;
}

.cw-raiox-controls .cw-date-field {
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.raiox-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px 36px;
}

.raiox-container {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.raiox-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.raiox-note {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.raiox-choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.choice-group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-group-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.choice-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.choice-name {
  font-weight: 600;
  color: var(--text);
  min-width: 0;
  word-break: break-word;
}

.choice-stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
}

.choice-bar-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.choice-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.2s ease;
}

/* ===========================
   RESPONSIVIDADE MÓDULO 2 + SUB-ABAS MOBILE
   =========================== */

@media (max-width: 1180px) {
  .cw-kpi-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .order-finance-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cw-master-detail {
    grid-template-columns: 330px minmax(0, 1fr);
  }
}

@media (max-width: 959px) {
  .mobile-subtabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }

  .mobile-subtab {
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface-soft);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-subtab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
  }

  .cw-top-summary-bar {
    padding: 10px 12px;
    max-height: 44dvh;
    overflow-y: auto;
  }

  .cw-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .cw-master-detail {
    display: flex;
    flex-direction: column;
  }

  .cw-master-detail.detail-open .master-pane {
    display: none;
  }

  .cw-master-detail.detail-open .detail-pane {
    display: flex;
  }

  .raiox-scroll {
    padding: 12px 12px 24px;
  }

  .raiox-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .raiox-choices-grid {
    grid-template-columns: 1fr;
  }

  .integ-soon-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .cw-filter-dates,
  .cw-filter-selects {
    flex-direction: column;
    align-items: stretch;
  }

  .cw-filter-selects .select-sm,
  .cw-ped-search,
  .cw-raiox-select-field {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .cw-date-field {
    width: 100%;
  }

  .cw-date-field .input {
    flex: 1;
    min-width: 0;
  }

  .cw-raiox-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .cw-raiox-controls .cw-date-field {
    width: 100%;
  }

  .cw-raiox-controls .cw-date-field .input {
    width: 100%;
  }

  .order-finance-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-cards {
    grid-template-columns: 1fr;
  }

  .vinculo-row {
    grid-template-columns: 1fr 44px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
  }

  .vinculo-row .editor-picker-wrap {
    grid-column: 1 / -1;
  }

  .integ-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .integ-actions-left,
  .integ-actions-right {
    width: 100%;
  }

  .integ-actions .btn {
    flex: 1;
  }
}

/* ===========================
   POLIMENTO MOBILE (V2) — ROLAGEM ÚNICA E FILTROS RECOLHÍVEIS
   =========================== */

.filter-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.filter-bar-search {
  flex: 1;
  min-width: 0;
}

.mobile-filter-toggle {
  display: none;
}

.mobile-filter-drawer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cw-dates-pair {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cw-day-header {
  top: 0;
}

.cw-kpi-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cw-raiox-top-row {
  max-width: 520px;
}

.cw-raiox-controls {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.cw-raiox-controls .cw-date-field {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.mobile-detail-bar {
  position: sticky;
  top: 96px;
  z-index: 20;
}

@media (max-width: 959px) {
  .desktop-only-btn {
    display: none !important;
  }

  /* Uma única rolagem natural da página no celular (zero rolagem dupla) */
  .app-shell {
    display: block;
    min-height: 100dvh;
    height: auto;
  }

  .main-area {
    display: block;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 18px);
  }

  .content {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .view.active {
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .master-detail,
  .cw-master-detail {
    display: block;
    height: auto;
    overflow: visible;
  }

  .master-pane,
  .detail-pane {
    height: auto;
    overflow: visible;
    border-right: none;
  }

  .master-detail:not(.detail-open) .detail-pane,
  .cw-master-detail:not(.detail-open) .detail-pane {
    display: none;
  }

  .master-detail.detail-open .master-pane,
  .cw-master-detail.detail-open .master-pane {
    display: none;
  }

  .master-detail.detail-open .detail-pane,
  .cw-master-detail.detail-open .detail-pane {
    display: block;
  }

  #view-cw-pedidos.cw-detail-mode #cwPedidosTopBar {
    display: none;
  }

  .produtos-list,
  .detail-scroll,
  .insumos-container,
  .compostos-grid,
  .raiox-scroll,
  .cw-top-summary-bar {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  /* Cabeçalho compacto sem corte de título */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 50px;
    padding: 0 12px;
    gap: 10px;
  }

  .topbar-left {
    flex: 1;
    min-width: 0;
    gap: 0;
  }

  .topbar-title-group {
    min-width: 0;
  }

  .topbar-title-group h1 {
    font-size: 16.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-primary-btn {
    height: 36px;
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 9px;
  }

  /* Faixa de sub-abas mobile fixa logo abaixo do cabeçalho */
  .mobile-subtabs {
    position: sticky;
    top: 50px;
    z-index: 35;
    padding: 6px 12px;
    gap: 6px;
  }

  .mobile-subtab {
    min-height: 34px;
    padding: 4px 6px;
    font-size: 13px;
  }

  .mobile-detail-bar {
    top: 96px;
    padding: 8px 12px;
  }

  /* Filtros recolhidos por padrão no mobile */
  .mobile-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 38px;
    min-height: 38px;
    padding: 0 11px;
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 13px;
    border-radius: 9px;
  }

  .mobile-filter-toggle.has-active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
  }

  .mobile-filter-drawer {
    display: none;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    flex-direction: column;
    gap: 8px;
  }

  .mobile-filter-drawer.open {
    display: flex;
  }

  .pane-controls,
  .section-toolbar {
    padding: 8px 12px;
    gap: 8px;
  }

  .filter-bar-search .search-input,
  .filter-bar-search.select {
    height: 38px;
    min-height: 38px;
    font-size: 16px;
  }

  /* Datas lado a lado (2 colunas) e selects compactos ao expandir Filtros */
  .cw-dates-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .cw-date-field {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    width: 100%;
  }

  .cw-date-field .input,
  .cw-raiox-controls .cw-date-field .input {
    height: 38px;
    min-height: 38px;
    font-size: 14px;
    padding: 0 8px;
    width: 100%;
  }

  .cw-filter-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .cw-filter-selects .select-sm {
    width: 100%;
    min-width: 0;
    height: 38px;
    min-height: 38px;
    font-size: 14px;
  }

  .cw-filter-switches {
    padding-top: 2px;
  }

  .cw-raiox-top-row {
    max-width: none;
  }

  .cw-raiox-controls {
    flex-direction: column;
    align-items: stretch;
    margin-top: 8px;
  }

  .cw-raiox-controls .cw-date-field {
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
  }

  /* Cabeçalho de dia sem sticky no mobile: nunca corta o 1º pedido */
  .cw-day-header {
    position: static;
    top: auto;
    margin: 2px 0;
    padding: 5px 10px;
  }

  /* Resumo KPI enxuto 2x2 rolando junto com a página */
  .cw-top-summary-bar {
    padding: 8px 12px 8px;
    gap: 8px;
  }

  .cw-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .cw-mini-kpi {
    padding: 7px 9px;
    gap: 1px;
    border-radius: 10px;
  }

  .cw-mini-kpi-label {
    font-size: 10px;
  }

  .cw-mini-kpi-val {
    font-size: 14.5px;
  }

  .cw-mini-kpi-sub {
    font-size: 10.5px;
  }

  .cw-team-note {
    font-size: 11px;
    line-height: 1.3;
  }

  .cw-list-header {
    padding: 6px 12px;
    font-size: 12px;
  }

  .produtos-list {
    padding: 8px 12px 14px;
    gap: 8px;
  }

  .cw-order-card {
    padding: 10px 12px;
    gap: 4px;
  }

  .produto-card {
    padding: 11px 12px;
    gap: 5px;
  }

  .cw-catalogo-alert {
    padding: 8px 10px;
    font-size: 12.5px;
  }

  .detail-scroll {
    padding: 12px 12px 24px;
  }
}

/* ===========================
   SELETOR PESQUISÁVEL CLARO & RAIO-X MESTRE-DETALHE
   =========================== */

.cw-filter-chip-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cw-chip-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cw-chip-group-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 42px;
}

.cw-chip-group .chips-row {
  flex: 1;
  min-width: 0;
}

/* Botão disparador do seletor pesquisável (tema claro) */
.picker-trigger {
  width: 100%;
  min-height: 40px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.picker-trigger:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.picker-trigger.placeholder {
  color: var(--text-muted);
}

.picker-trigger-text {
  flex: 1;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
  line-height: 1.32;
  font-weight: 500;
}

.role-cards.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.picker-trigger-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
}

/* Grupo de opções em pílulas (Tipo / Unidade / Tipo de compra) */
.pill-radio-group {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.pill-radio-btn {
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.pill-radio-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.pill-radio-btn.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

/* Overlay do seletor pesquisável (tema claro, acima dos modais) */
.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(24, 20, 16, 0.42);
  backdrop-filter: blur(2px);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.picker-sheet {
  width: 100%;
  max-width: 540px;
  max-height: 82dvh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.picker-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.picker-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.picker-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
}

.picker-search-wrap {
  padding: 10px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg);
}

.picker-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 6px 2px;
}

.picker-group-label:first-child {
  padding-top: 2px;
}

.picker-option {
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.picker-option:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.picker-option.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.picker-option-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.picker-option-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
  line-height: 1.3;
}

.picker-option-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}

.picker-option-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.picker-option-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.picker-option-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}

/* Raio-X mestre-detalhe */
.cw-raiox-master-detail {
  grid-template-columns: 370px minmax(0, 1fr);
}

.raiox-prod-card {
  gap: 6px;
}

@media (max-width: 1180px) {
  .cw-raiox-master-detail {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 959px) {
  .cw-raiox-master-detail {
    display: block;
    height: auto;
    overflow: visible;
  }

  .cw-raiox-master-detail:not(.detail-open) .detail-pane {
    display: none;
  }

  .cw-raiox-master-detail.detail-open .master-pane {
    display: none;
  }

  .cw-raiox-master-detail.detail-open .detail-pane {
    display: block;
  }

  .cw-chip-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .picker-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .picker-sheet {
    max-width: none;
    max-height: 86dvh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
  }

  .picker-list {
    padding: 10px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .picker-trigger {
    min-height: 44px;
    font-size: 15px;
  }

  .pill-radio-btn {
    min-height: 42px;
    font-size: 14px;
  }

  .editor-row .editor-picker-wrap {
    grid-column: 1 / -1;
  }
}

/* =========================================================
   ITENS SEM CÓDIGO (CARDÁPIOWEB / 99FOOD / IFOOD)
   ========================================================= */
.badge-sem-codigo {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
}

.badge-sem-codigo-subtle {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #5b21b6;
  font-weight: 600;
}

.cw-badge-pair {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.cw-order-badges {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cw-order-card.sem-codigo-pend {
  border-left: 3px solid #6366f1;
}

.cw-code-meta {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
}

.chip-sem-codigo {
  border-color: #c7d2fe;
  color: #4338ca;
  background: #f5f7ff;
}

.chip-sem-codigo:hover {
  background: #eef2ff;
  border-color: #a5b4fc;
}

.chip-sem-codigo.active {
  background: #4338ca;
  border-color: #4338ca;
  color: #ffffff;
}

.cw-catalogo-alert-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.vinculo-codigo-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vinculo-codigo-box label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.modal-footer {
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .modal-footer {
    justify-content: stretch;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}

.cw-import-row {
  display: flex;
  min-width: 0;
  max-width: 100%;
}

.cw-import-btn {
  white-space: normal;
  line-height: 1.25;
  text-align: left;
  max-width: 100%;
  cursor: pointer;
}

.cw-conc-line,
.cw-conc-chips,
.cw-conc-note {
  min-width: 0;
  max-width: 100%;
}

.cw-conc-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 6px;
  font-size: 12px;
}

.cw-conc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.cw-conc-note {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.cw-conc-warn {
  margin-top: 10px;
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  font-size: 12.5px;
  line-height: 1.38;
}

.cw-conc-grid,
.integ-planilha-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 12px;
  min-width: 0;
}

.cw-conc-cell {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}

.cw-conc-cell span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.cw-conc-cell strong {
  font-size: 14px;
  word-break: break-word;
}

.integ-planilha {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin-bottom: 12px;
}

.integ-hist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 0;
}

.integ-hist span {
  word-break: break-word;
}

.raiox-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.fin-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-width: 0;
}

.cw-conc-cell > .fin-label,
.order-fin-cell > .fin-label,
.cw-mini-kpi-label,
.kpi-label,
th .fin-label {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

th .fin-label {
  justify-content: flex-end;
}

.cw-cai-inline {
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  color: var(--blue);
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 700;
}

.cw-cai-inline strong {
  font-size: 14px;
  color: var(--blue);
}

.cw-sobra-inline {
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green);
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 700;
}

.cw-sobra-inline strong {
  font-size: 14px;
  color: var(--green);
}

.cw-sobra-inline.neg {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red);
}

.cw-sobra-inline.neg strong {
  color: var(--red);
}

.cw-conc-hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
  min-width: 0;
}

.cw-conc-cell.cw-cai {
  background: var(--blue-soft);
  border-color: var(--blue-border);
  padding: 12px 14px;
}

.cw-conc-cell.cw-cai strong {
  font-size: 24px;
  line-height: 1.15;
  color: var(--blue);
}

.cw-conc-cell.cw-sobra {
  background: var(--green-soft);
  border-color: var(--green-border);
  padding: 12px 14px;
}

.cw-conc-cell.cw-sobra strong {
  font-size: 24px;
  line-height: 1.15;
  color: var(--green);
}

.cw-conc-cell.cw-sobra.neg {
  background: var(--red-soft);
  border-color: var(--red-border);
}

.cw-conc-cell.cw-sobra.neg strong {
  color: var(--red);
}

.cw-conc-sub,
.cw-conc-cell .cw-conc-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 3px;
  margin-bottom: 0;
  line-height: 1.3;
}

.help-dot {
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.help-dot:hover,
.help-dot:focus-visible {
  border-color: var(--green-border);
  color: var(--green);
  outline: none;
}

.help-pop {
  position: fixed;
  z-index: 260;
  max-width: min(280px, calc(100vw - 16px));
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 10px 28px 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.help-pop p {
  margin: 0;
}

.help-pop-x {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.raiox-mobile-label {
  display: none;
}

@media (max-width: 720px) {
  .responsive-table td.raiox-money::before {
    content: none;
  }

  .raiox-mobile-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
  }

  .cw-conc-cell.cw-cai strong,
  .cw-conc-cell.cw-sobra strong {
    font-size: 20px;
  }
}

@media (max-width: 440px) {
  .cw-conc-hero {
    grid-template-columns: 1fr;
  }
}

/* Pedidos: barra compacta. As outras gavetas (ficha, insumos, espelho) ficam como estão. */
#cwPedidosTopBar {
  padding: 8px 16px;
  gap: 8px;
}

#cwPedidosTopBar .cw-ped-main-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

#cwPedidosTopBar .cw-ped-search {
  flex: 0 1 180px;
  min-width: 130px;
  max-width: 210px;
}

#cwPedidosTopBar .cw-filter-dates {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

#cwPedidosTopBar .cw-date-field .input-sm {
  height: 34px;
  padding: 0 5px;
  font-size: 12px;
  width: 124px;
}

#cwPedidosTopBar .cw-ped-search .search-input {
  height: 34px;
  font-size: 13px;
}

#cwPedidosTopBar .cw-quick-days .chip {
  min-height: 30px;
  padding: 4px 7px;
  font-size: 11.5px;
}

#cwPedidosTopBar .mobile-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

#cwPedidosTopBar .mobile-filter-toggle.has-active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

#cwPedidosTopBar .cw-ped-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

#cwPedidosTopBar .cw-period-btn,
#cwPedidosTopBar .cw-import-btn {
  height: 34px;
  min-height: 34px;
  padding: 0 11px;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#cwPedidosTopBar .cw-period-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  font-size: 12.5px;
  color: var(--text);
  flex-wrap: wrap;
}

#cwPedidosTopBar .cw-period-progress.hidden {
  display: none;
}

#cwPedidosTopBar .cw-period-progress.done {
  background: var(--green-soft);
  border-color: var(--green-border);
}

#cwPedidosTopBar .cw-period-progress.err {
  background: var(--red-soft);
  border-color: var(--red-border);
}

#cwPedidosTopBar .cw-period-progress.warn {
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

#cwPedidosTopBar .cw-period-prog-info {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#cwPedidosTopBar .cw-period-prog-text {
  font-weight: 600;
  color: var(--text);
}

#cwPedidosTopBar .cw-period-prog-eta {
  color: var(--text-secondary);
  font-size: 12px;
}

#cwPedidosTopBar .cw-period-prog-track {
  flex: 0 1 180px;
  min-width: 110px;
  height: 7px;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.14);
  overflow: hidden;
}

#cwPedidosTopBar .cw-period-prog-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
  transition: width 0.25s ease;
}

#cwPedidosTopBar .cw-period-progress.done .cw-period-prog-fill {
  background: var(--green);
}

#cwPedidosTopBar .cw-period-progress.err .cw-period-prog-fill {
  background: var(--red);
}

#cwPedidosTopBar .cw-period-prog-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Modal de importação de período */
.cw-period-modal-section {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cw-period-modal-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.cw-period-cov-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cw-period-cov-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text);
}

.cw-period-pending-box {
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cw-period-pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.cw-period-mode-tabs {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
  gap: 4px;
  align-self: flex-start;
}

.cw-period-mode-btn {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.cw-period-mode-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.cw-period-note {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.cw-period-option {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}

.cw-period-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#cwPedidosTopBar .cw-ped-bar-wrap {
  position: relative;
}

#cwPedidosTopBar .mobile-filter-drawer {
  display: none;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
}

#cwPedidosTopBar .mobile-filter-drawer.open {
  display: flex;
}

.cw-filter-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.cw-filter-pop-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.cw-filter-pop-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-link-clear {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
}

.btn-link-clear:hover {
  background: var(--primary-soft);
}

.cw-filter-pop-close {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.cw-filter-pop-close:hover {
  background: var(--surface-soft);
  color: var(--text);
}

#drawerCwPedidos .cw-filter-chip-groups {
  gap: 7px;
}

#drawerCwPedidos .cw-chip-group {
  gap: 8px;
}

#drawerCwPedidos .cw-chip-group-label {
  min-width: 56px;
  font-size: 11px;
}

#drawerCwPedidos .chips-row {
  gap: 5px;
}

#drawerCwPedidos .chip {
  min-height: 27px;
  padding: 3px 10px;
  font-size: 12px;
}

.cw-filter-pop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  flex-wrap: wrap;
  padding-top: 7px;
  border-top: 1px solid var(--border);
}

.cw-filter-pop-foot .cw-switches-group {
  gap: 12px;
  font-size: 12.5px;
}

.cw-filter-pop-foot .cw-team-note {
  font-size: 11.5px;
  color: var(--text-muted);
}

@media (min-width: 960px) {
  #cwPedidosTopBar {
    padding: 7px 16px;
    gap: 7px;
  }

  /* No computador, Filtros abre como painel flutuante sem empurrar KPIs nem a lista */
  #cwPedidosTopBar .cw-filter-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 45;
    width: min(620px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 11px 14px;
  }

  /* Cabeçalho de dia colado no topo da lista sem fresta nem cartão vazando por cima */
  #cwPedidosList {
    padding-top: 0;
  }

  #cwPedidosList .cw-day-header {
    position: sticky;
    top: 0;
    z-index: 3;
    margin: 0 -10px 2px;
    padding: 6px 12px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    background: var(--surface-soft);
    box-shadow: 0 1px 3px rgba(31, 27, 22, 0.05);
  }
}

@media (max-width: 959px) {
  #cwPedidosTopBar .cw-filter-popover {
    margin-top: 6px;
    padding: 9px 10px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
  }

  #drawerCwPedidos .cw-chip-group {
    gap: 4px;
  }

  #drawerCwPedidos .chip {
    min-height: 29px;
    padding: 3px 9px;
    font-size: 12px;
  }
}

#cwPedidosKpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 960px) {
  #cwPedidosKpis .cw-mini-kpi {
    padding: 6px 10px;
    gap: 1px;
  }

  #cwPedidosKpis .cw-mini-kpi-label {
    font-size: 10.5px;
  }

  #cwPedidosKpis .cw-mini-kpi-val {
    font-size: 15.5px;
  }

  #cwPedidosKpis .cw-mini-kpi.cw-cai .cw-mini-kpi-val,
  #cwPedidosKpis .cw-mini-kpi.cw-sobra .cw-mini-kpi-val {
    font-size: 17.5px;
  }

  #cwPedidosKpis .cw-mini-kpi-sub {
    font-size: 10.5px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #view-cw-pedidos .detail-scroll {
    padding: 14px 18px 24px;
  }

  #view-cw-pedidos .detail-container {
    max-width: 1120px;
  }

  #cwPedidosList .produto-card {
    padding: 9px 11px;
  }
}

@media (min-width: 1200px) {
  #cwPedidosKpis {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}

@media (min-width: 1280px) {
  #view-cw-pedidos .cw-master-detail {
    grid-template-columns: 400px minmax(0, 1fr);
  }

  #cwPedidosList .cw-conc-line {
    gap: 4px 6px;
  }

  #cwPedidosList .cw-cai-inline,
  #cwPedidosList .cw-sobra-inline {
    padding: 2px 6px;
  }
}

.order-fin-cell {
  padding: 7px 9px;
  min-width: 0;
}

.order-fin-cell > .fin-label {
  flex-wrap: nowrap;
  white-space: nowrap;
  font-size: 10.5px;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 959px) {
  #cwPedidosKpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #cwPedidosTopBar .cw-ped-actions {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  #cwPedidosTopBar .cw-period-btn,
  #cwPedidosTopBar .cw-import-btn {
    margin-left: 0;
    width: 100%;
    justify-content: center;
    padding: 0 8px;
    font-size: 12.5px;
  }

  #cwPedidosTopBar .cw-ped-search {
    flex: 1 1 160px;
    max-width: none;
  }

  #cwPedidosTopBar .cw-filter-dates,
  #cwPedidosTopBar .cw-dates-pair {
    width: 100%;
  }

  #cwPedidosTopBar .cw-date-field .input-sm {
    width: 100%;
  }
}


/* ===========================
   CONFIGURAÇÕES: MAQUININHAS E TAXAS
   =========================== */

.cfg-maq-note {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.45;
}

.cfg-maq-form {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cfg-maq-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.cfg-maq-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-top: 2px;
}

.cfg-maq-rates-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}

.cfg-maq-rates-grid > .field > label,
.cfg-maq-rates-grid .field-pix-head {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}

.cfg-maq-rates-grid > .field > label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.field-pix-head {
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.field-pix-head > label {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  line-height: 1;
  white-space: nowrap;
}

.cfg-maq-brand-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cfg-maq-brand-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cfg-maq-brand-head > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.cfg-maq-brand-head strong {
  font-size: 13px;
}

.cfg-maq-brand-head span {
  font-size: 12px;
  color: var(--text-muted);
}

.cfg-maq-brand-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cfg-maq-brand-rows:empty {
  display: none;
}

.cfg-maq-brand-row {
  display: grid;
  grid-template-columns: minmax(0, 156px) minmax(0, 1fr) minmax(150px, 210px) 32px;
  gap: 6px;
  align-items: center;
}

.cfg-maq-brand-row .select,
.cfg-maq-brand-row .cfg-brand-name,
.cfg-maq-brand-row .cfg-brand-rate-wrap {
  min-width: 0;
  max-width: 100%;
}

.cfg-brand-rate-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cfg-brand-rate-wrap > .input {
  flex: 1 1 0;
  width: auto;
  min-width: 72px;
}

.taxa-modo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  line-height: 1;
}

.taxa-modo-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.taxa-modo-btn.is-on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(31, 27, 22, 0.08);
}

.cfg-maq-brand-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.cfg-maq-brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  color: var(--text-secondary);
}

.fin-maq-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fin-maq-cell .fin-maq-select {
  flex: 1 1 170px;
  min-width: 150px;
}

.fin-maq-cell .fin-bandeira-select {
  flex: 1 1 140px;
  min-width: 130px;
}

.fin-bandeira-select.is-pending-bandeira {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.cfg-maq-defaults {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 6px 0 2px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.cfg-maq-form-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cfg-maq-form-bottom .input {
  flex: 1;
}

.cfg-maq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cfg-maq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cfg-maq-card.is-inactive {
  opacity: 0.68;
  background: var(--surface-soft);
}

.cfg-maq-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cfg-maq-card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14.5px;
}

.cfg-maq-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cfg-maq-card-rates {
  font-size: 13px;
  color: var(--text-secondary);
}

.cfg-maq-card-obs {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   MÓDULO 3: FINANCEIRO — FECHAMENTO DE CAIXA
   =========================== */

.fin-caixa-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px 32px;
}

.fin-caixa-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fin-header-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fin-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.fin-date-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fin-date-controls .input-sm {
  width: auto;
  min-width: 145px;
}

.fin-window-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-left: 4px;
}

.fin-header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fin-recent-days {
  padding-top: 2px;
}

.fin-day-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

.fin-day-dot.ok {
  background: var(--green);
}

.fin-day-dot.pend {
  background: var(--amber);
}

.fin-empty-maq-banner {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13.5px;
}

.fin-empty-maq-banner > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.fin-section-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fin-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.fin-lote-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 10px;
}

.fin-lote-bar .select-sm {
  width: auto;
  min-width: 160px;
}

.fin-lote-check {
  padding: 0 4px;
  white-space: nowrap;
}

.fin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.fin-order-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fin-order-time {
  font-size: 12px;
  color: var(--text-muted);
}

.fin-order-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fin-orig-note {
  font-size: 11.5px;
  color: var(--amber);
  font-weight: 600;
}

.fin-row.is-conferido {
  background: rgba(22, 163, 74, 0.03);
}

.btn-conferido-ok {
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green);
  font-weight: 700;
}

.btn-conferido-pend {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  font-weight: 700;
}

.fin-maq-summary {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fin-maq-summary-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.fin-maq-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.fin-maq-summary-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fin-maq-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.fin-maq-summary-metrics {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
}

.fin-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.fin-cash-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fin-cash-expected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
}

.fin-cash-expected strong {
  font-size: 18px;
}

.fin-cash-diff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
}

.fin-cash-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.fin-sublist-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 4px;
}

.fin-simple-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fin-simple-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  font-size: 13px;
}

.fin-simple-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fin-simple-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fin-mod-select-compact {
  width: auto;
  min-width: 135px;
}

.fin-apps-box {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fin-apps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fin-app-mini {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fin-app-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.5px;
}

.fin-app-mini-vals {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

.fin-excl-note {
  font-size: 12px;
  color: var(--text-muted);
}

@media (max-width: 1100px) {
  .fin-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fin-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .fin-caixa-scroll {
    padding: 12px 12px 28px;
  }

  .cfg-maq-rates-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cfg-maq-brand-row {
    grid-template-columns: minmax(0, 1fr) 32px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  .cfg-maq-brand-row .cfg-brand-mod {
    grid-column: 1;
    grid-row: 1;
  }

  .cfg-maq-brand-row .cfg-brand-remove {
    grid-column: 2;
    grid-row: 1;
  }

  .cfg-maq-brand-row .cfg-brand-name,
  .cfg-maq-brand-row .cfg-brand-rate-wrap {
    grid-column: 1 / -1;
  }

  .cfg-maq-form-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .fin-lote-bar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .fin-lote-bar .select-sm {
    width: 100%;
  }

  .fin-apps-grid {
    grid-template-columns: 1fr;
  }
}

/* Página Inicial. Tudo fica em #view-inicio para não alterar Ficha, Pedidos nem Caixa. */
#btnBrandHome {
  cursor: pointer;
}

#btnBrandHome:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 10px;
}

#view-inicio {
  min-width: 0;
  background:
    radial-gradient(900px 280px at 10% -10%, rgba(200, 75, 49, 0.08), transparent 60%),
    transparent;
}

#view-inicio .home-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: auto;
  padding: 16px 18px 32px;
}

#view-inicio .home-loading,
#view-inicio .home-empty {
  margin: 28px auto;
  max-width: 420px;
  text-align: center;
  color: var(--text-secondary);
}

#view-inicio .home-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

#view-inicio .home-rise {
  animation: home-rise 0.35s ease both;
}

#view-inicio .home-scroll {
  padding: 14px 20px 28px;
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Cabeçalho leve e claro (v1.6 — compacto no padrão Ranking) */
#view-inicio .home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 11px 16px;
  box-shadow: var(--shadow-sm);
}

#view-inicio .home-header-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

#view-inicio .home-header-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#view-inicio .home-header-title {
  margin: 0;
  font-size: 18.5px;
  line-height: 1.2;
  font-weight: 760;
  color: var(--text);
  letter-spacing: -0.015em;
}

#view-inicio .home-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 640;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

#view-inicio .home-status-pill.is-aberta {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--green);
}

#view-inicio .home-status-pill.is-preparacao {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}

#view-inicio .home-status-pill.is-pos {
  background: var(--blue-soft);
  border-color: var(--blue-border);
  color: var(--blue);
}

#view-inicio .home-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: none;
}

#view-inicio .home-status-pill.is-aberta .home-dot {
  background: #22c55e;
  animation: home-pulse 1.8s ease-out infinite;
}

#view-inicio .home-status-pill.is-preparacao .home-dot {
  background: #f59e0b;
}

#view-inicio .home-status-pill.is-pos .home-dot {
  background: #3b82f6;
}

#view-inicio .home-header-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#view-inicio .home-header-meta-sep {
  color: var(--border-strong);
}

#view-inicio .home-header-sync {
  color: var(--text-muted);
  font-size: 12px;
}

#view-inicio .home-period-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 0;
}

#view-inicio .home-period-pills {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

#view-inicio .home-period-pill {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.2px;
  font-weight: 620;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

#view-inicio .home-period-pill:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
}

#view-inicio .home-period-pill.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(200, 75, 49, 0.24);
}

/* Linha de 4 KPIs com Sparkline SVG */
#view-inicio .home-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

#view-inicio .home-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px 16px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#view-inicio .home-kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

#view-inicio .home-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#view-inicio .home-kpi-label {
  font-size: 12.5px;
  font-weight: 640;
  color: var(--text-secondary);
}

#view-inicio .home-kpi-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

#view-inicio .home-kpi-badge.tone-green {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}

#view-inicio .home-kpi-badge.tone-red {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red-border);
}

#view-inicio .home-kpi-badge.tone-blue {
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}

#view-inicio .home-kpi-badge.tone-primary {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

#view-inicio .home-kpi-body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

#view-inicio .home-kpi-val {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 780;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

#view-inicio .home-kpi-card.is-blue .home-kpi-val { color: var(--blue); }
#view-inicio .home-kpi-card.is-green .home-kpi-val { color: var(--green); }
#view-inicio .home-kpi-card.is-red .home-kpi-val { color: var(--red); }

#view-inicio .home-kpi-spark {
  width: 92px;
  height: 36px;
  flex-shrink: 0;
  overflow: visible;
}

#view-inicio .home-kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

/* Painéis genéricos limpos */
#view-inicio .home-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

#view-inicio .home-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

#view-inicio .home-panel h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 740;
  color: var(--text);
}

#view-inicio .home-panel-note {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Grades de 2 colunas */
#view-inicio .home-row-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

#view-inicio .home-row-leaks {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: stretch;
}

/* Legenda e gráfico de colunas SVG (Ritmo diário) */
#view-inicio .home-chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 620;
  color: var(--text-secondary);
}

#view-inicio .home-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#view-inicio .leg-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  display: inline-block;
}

#view-inicio .leg-bruto { background: #c84b31; }
#view-inicio .leg-mc { background: #1e7a4c; }

#view-inicio .home-bar-svg-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

#view-inicio .home-bar-svg {
  width: 100%;
  min-width: 320px;
  height: 230px;
  display: block;
}

#view-inicio .home-bar-hit {
  cursor: pointer;
}

#view-inicio .home-bar-hit:hover .home-bar-rect-fat {
  opacity: 0.85;
}

#view-inicio .home-bar-hit:hover .home-bar-rect-mc {
  opacity: 0.85;
}

/* Gráfico de Rosca (Donut) por Canal */
#view-inicio .home-donut-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  justify-content: space-between;
}

#view-inicio .home-donut-top {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 0;
}

#view-inicio .home-donut-svg {
  width: 176px;
  height: 176px;
  display: block;
}

#view-inicio .home-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#view-inicio .home-donut-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#view-inicio .home-donut-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

#view-inicio .home-donut-item-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

#view-inicio .home-donut-swatch {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  flex: none;
}

#view-inicio .home-donut-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: block;
}

#view-inicio .home-donut-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  display: block;
  font-variant-numeric: tabular-nums;
}

#view-inicio .home-donut-item-right {
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

#view-inicio .home-donut-val {
  font-size: 13.5px;
  font-weight: 740;
  color: var(--text);
  display: block;
}

#view-inicio .home-donut-sobra {
  font-size: 11.5px;
  font-weight: 640;
  color: var(--green);
  display: block;
}

/* Raio-X do Dinheiro por Canal */
#view-inicio .home-raiox-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#view-inicio .home-raiox-card {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 13px 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

#view-inicio .home-raiox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

#view-inicio .home-raiox-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 740;
  color: var(--text);
}

#view-inicio .home-raiox-base {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

#view-inicio .home-raiox-sobra-pill {
  font-size: 12.5px;
  font-weight: 740;
  padding: 3px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}

#view-inicio .home-raiox-sobra-pill.is-warn {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: var(--amber-border);
}

#view-inicio .home-raiox-sobra-pill.is-bad {
  background: var(--red-soft);
  color: var(--red);
  border-color: var(--red-border);
}

#view-inicio .home-raiox-steps {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#view-inicio .home-raiox-step {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 74px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

#view-inicio .home-raiox-step-lbl {
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-inicio .home-raiox-track {
  height: 8px;
  border-radius: 999px;
  background: #ede6dc;
  overflow: hidden;
}

#view-inicio .home-raiox-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

#view-inicio .home-raiox-fill.step-cheio { background: #b7aa9b; }
#view-inicio .home-raiox-fill.step-pago { background: #d97706; }
#view-inicio .home-raiox-fill.step-repasse { background: #2563eb; }
#view-inicio .home-raiox-fill.step-cmv { background: #c84b31; }
#view-inicio .home-raiox-fill.step-entrega { background: #9333ea; }
#view-inicio .home-raiox-fill.step-sobra { background: #1e7a4c; }
#view-inicio .home-raiox-fill.step-sobra.is-neg { background: #b91c1c; }

#view-inicio .home-raiox-step-val {
  text-align: right;
  font-weight: 680;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

#view-inicio .home-raiox-step.is-final .home-raiox-step-lbl,
#view-inicio .home-raiox-step.is-final .home-raiox-step-val {
  font-weight: 760;
  color: var(--green);
}

#view-inicio .home-raiox-step.is-final.is-neg .home-raiox-step-lbl,
#view-inicio .home-raiox-step.is-final.is-neg .home-raiox-step-val {
  color: var(--red);
}

/* Vazamentos de Margem + Pendências */
#view-inicio .home-leak-counters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#view-inicio .home-leak-stat {
  border-radius: 11px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#view-inicio .home-leak-stat.is-red {
  background: var(--red-soft);
  border-color: var(--red-border);
}

#view-inicio .home-leak-stat.is-amber {
  background: var(--amber-soft);
  border-color: var(--amber-border);
}

#view-inicio .home-leak-stat strong {
  font-size: 18px;
  line-height: 1.1;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

#view-inicio .home-leak-stat.is-red strong { color: var(--red); }
#view-inicio .home-leak-stat.is-amber strong { color: var(--amber); }

#view-inicio .home-leak-stat span {
  font-size: 11.5px;
  color: var(--text-secondary);
}

#view-inicio .home-leak-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 2px;
}

#view-inicio .home-leak-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#view-inicio .home-leak-row:hover {
  border-color: var(--primary-border);
  background: var(--surface-hover);
}

#view-inicio .home-leak-row.sev-prejuizo {
  border-left: 3px solid var(--red);
}

#view-inicio .home-leak-row.sev-critico {
  border-left: 3px solid var(--amber);
}

#view-inicio .home-leak-row.sev-atencao {
  border-left: 3px solid #eab308;
}

#view-inicio .home-leak-row-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

#view-inicio .home-leak-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}

#view-inicio .home-leak-row-top strong {
  color: var(--text);
}

#view-inicio .home-leak-date {
  font-size: 11.5px;
  color: var(--text-muted);
}

#view-inicio .home-leak-flow {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#view-inicio .home-leak-row-right {
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

#view-inicio .home-leak-sobra {
  display: block;
  font-size: 14px;
  font-weight: 780;
  color: var(--amber);
}

#view-inicio .home-leak-sobra.is-neg {
  color: var(--red);
}

#view-inicio .home-leak-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

#view-inicio .home-radar-divider {
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

#view-inicio .home-radar-subtitle {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#view-inicio .home-radar {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

#view-inicio .home-radar-item {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  text-align: left;
  cursor: pointer;
}

#view-inicio .home-radar-item strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

#view-inicio .home-radar-item span {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
}

#view-inicio .home-radar-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex: none;
  background: var(--amber);
}

#view-inicio .home-radar-item.is-amber { background: var(--amber-soft); border-color: var(--amber-border); }
#view-inicio .home-radar-item.is-blue { background: var(--blue-soft); border-color: var(--blue-border); }
#view-inicio .home-radar-item.is-blue .home-radar-mark { background: var(--blue); }
#view-inicio .home-radar-item.is-primary { background: var(--primary-soft); border-color: var(--primary-border); }
#view-inicio .home-radar-item.is-primary .home-radar-mark { background: var(--primary); }

#view-inicio .home-ok {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green);
  font-size: 12.5px;
  font-weight: 600;
}

/* Top 5 Maior vs Menor Margem */
#view-inicio .home-seg-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#view-inicio .home-seg-group {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  gap: 2px;
}

#view-inicio .home-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 640;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

#view-inicio .home-seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(31, 27, 22, 0.1);
}

#view-inicio .home-top5-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

#view-inicio .home-top5-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

#view-inicio .home-top5-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

#view-inicio .home-top5-col-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 740;
  color: var(--text);
}

#view-inicio .home-top5-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#view-inicio .home-top5-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--bg);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

#view-inicio .home-top5-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-soft);
}

#view-inicio .home-top5-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

#view-inicio .home-top5-name {
  font-size: 13px;
  font-weight: 680;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#view-inicio .home-top5-val {
  font-size: 13.5px;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}

#view-inicio .home-top5-val.is-high { color: var(--green); }
#view-inicio .home-top5-val.is-low { color: var(--amber); }
#view-inicio .home-top5-val.is-neg { color: var(--red); }

#view-inicio .home-top5-track {
  height: 7px;
  border-radius: 999px;
  background: #eae2d7;
  overflow: hidden;
}

#view-inicio .home-top5-fill {
  height: 100%;
  border-radius: 999px;
}

#view-inicio .home-top5-fill.is-high { background: linear-gradient(90deg, #1e7a4c, #2f9e66); }
#view-inicio .home-top5-fill.is-low { background: linear-gradient(90deg, #d97706, #f59e0b); }
#view-inicio .home-top5-fill.is-neg { background: #b91c1c; }

#view-inicio .home-top5-meta {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

/* Matriz Kasavana & Smith */
#view-inicio .home-kas-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 18px;
  align-items: start;
}

#view-inicio .home-kas-chart-box {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px;
  background: var(--bg);
}

#view-inicio .home-kas-svg {
  width: 100%;
  height: 290px;
  display: block;
}

#view-inicio .home-kas-dot {
  cursor: pointer;
  transition: transform 0.15s ease;
}

#view-inicio .home-kas-quads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#view-inicio .home-kas-card {
  border-radius: 13px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

#view-inicio .home-kas-card.q-estrela {
  background: #f2fbf6;
  border-color: #bfe6d0;
}

#view-inicio .home-kas-card.q-quebra_cabeca {
  background: #f2f7ff;
  border-color: #c3dbfe;
}

#view-inicio .home-kas-card.q-burro_de_carga {
  background: #fffaf0;
  border-color: #f4d8a1;
}

#view-inicio .home-kas-card.q-abacaxi {
  background: #fef5f4;
  border-color: #f5c9c2;
}

#view-inicio .home-kas-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

#view-inicio .home-kas-card-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 760;
  color: var(--text);
}

#view-inicio .home-kas-card-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-secondary);
}

#view-inicio .home-kas-count {
  font-size: 11.5px;
  font-weight: 740;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(31, 27, 22, 0.1);
  color: var(--text);
  white-space: nowrap;
}

#view-inicio .home-kas-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#view-inicio .home-kas-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 8px;
  border: 1px solid rgba(31, 27, 22, 0.06);
  background: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

#view-inicio .home-kas-item-btn:hover {
  background: #ffffff;
  border-color: var(--border-strong);
}

#view-inicio .home-kas-item-name {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

#view-inicio .home-kas-item-nums {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11.5px;
}

#view-inicio .home-kas-action {
  margin: 2px 0 0;
  padding-top: 7px;
  border-top: 1px dashed rgba(31, 27, 22, 0.12);
  font-size: 11.8px;
  line-height: 1.4;
  color: var(--text-secondary);
}

#view-inicio .home-kas-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

/* Cartões compactos de acesso rápido aos módulos (sem botões redundantes no topo) */
#view-inicio .home-modules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#view-inicio .home-mod {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

#view-inicio .home-mod:hover {
  border-color: var(--border-strong);
}

#view-inicio .home-mod-main {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

#view-inicio .home-mod-top {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

#view-inicio .home-mod-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
}

#view-inicio .home-mod-icon.tone-cw { background: #fdf0ec; color: #c84b31; }
#view-inicio .home-mod-icon.tone-fin { background: #eff6ff; color: #1d4ed8; }
#view-inicio .home-mod-icon.tone-ficha { background: #eaf7f0; color: #1e7a4c; }
#view-inicio .home-mod-icon.tone-soon { background: var(--surface-soft); color: var(--text-muted); }

#view-inicio .home-mod h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 740;
  color: var(--text);
}

#view-inicio .home-mod p {
  margin: 2px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
}

#view-inicio .home-mod-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 11px;
  color: var(--text);
  font-size: 12.5px;
}

#view-inicio .home-mod-stats b {
  font-variant-numeric: tabular-nums;
}

#view-inicio .home-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#view-inicio .home-pill {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11.8px;
  font-weight: 650;
  cursor: pointer;
}

#view-inicio .home-pill:hover {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

@keyframes home-rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes home-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@media (max-width: 1180px) {
  #view-inicio .home-kpis,
  #view-inicio .home-modules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #view-inicio .home-row-charts,
  #view-inicio .home-row-leaks,
  #view-inicio .home-kas-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  #view-inicio .home-top5-grid,
  #view-inicio .home-kas-quads {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #view-inicio .home-scroll {
    padding: 12px 12px 28px;
    gap: 12px;
  }
  #view-inicio .home-header {
    padding: 13px 14px;
  }
  #view-inicio .home-header-title {
    font-size: 19px;
  }
  #view-inicio .home-period-pills {
    width: 100%;
    justify-content: flex-start;
  }
  #view-inicio .home-period-pill {
    padding: 5px 9px;
    font-size: 12px;
  }
  #view-inicio .home-kpis,
  #view-inicio .home-modules {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  #view-inicio .home-kpi-val {
    font-size: 21px;
  }
  #view-inicio .home-panel {
    padding: 14px;
  }
  #view-inicio .home-raiox-step {
    grid-template-columns: 92px minmax(0, 1fr) 64px;
    font-size: 11.5px;
  }
  #view-inicio .home-leak-counters {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  #view-inicio .home-rise,
  #view-inicio .home-status-pill.is-aberta .home-dot {
    animation: none;
  }
}

.cw-aliases-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-secondary);
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.cw-unificar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cw-unificar-titulo {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.cw-unificar-texto {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-secondary);
}

.cw-unificar-escolha {
  font-size: 13px;
  font-weight: 600;
}

.cw-unificar-acoes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* =========================================================
   BOTÕES E CONFIRMAÇÕES DE EXCLUSÃO SEGURA (2 PASSOS)
   ========================================================= */
.btn-ghost-danger {
  background: transparent;
  color: var(--red, #b91c1c);
  border: 1px solid rgba(185, 28, 28, 0.25);
}

.btn-ghost-danger:hover:not(:disabled) {
  background: var(--red-soft, #fef2f2);
  border-color: rgba(185, 28, 28, 0.45);
}

.btn-danger {
  background: var(--red, #b91c1c);
  color: #fff;
  border: 1px solid var(--red, #b91c1c);
}

.btn-danger:hover:not(:disabled) {
  background: #991b1b;
  border-color: #991b1b;
}

.delete-confirm-bar {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--red-soft, #fef2f2);
  border: 1px solid var(--red-border, #fecaca);
  color: var(--red, #991b1b);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
}

.delete-confirm-bar.is-error {
  background: var(--amber-soft, #fffbeb);
  border-color: var(--amber-border, #fde68a);
  color: var(--amber, #92400e);
}

.delete-confirm-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.inline-delete-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--red, #b91c1c);
}

.modal-footer-split {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-footer-left,
.modal-footer-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cw-cat-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}


/* ============================================================
   MÓDULO 4 — ENTREGADORES (Ranking, Folha & Pagamentos, Equipe & Regras)
   ============================================================ */
.ent-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px 32px;
}

.ent-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.ent-container > * {
  min-width: 0;
}

.ent-bar {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ent-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ent-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.ent-scroll .btn {
  min-height: 40px;
}

.ent-scroll .btn.btn-sm {
  min-height: 34px;
  padding: 6px 12px;
}

.ent-bar .segmented-btn {
  height: 32px;
  padding: 0 16px;
}

.ent-date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ent-scroll .btn.ent-nav-btn {
  width: 40px;
  padding: 0;
  font-size: 11px;
  color: var(--text-secondary);
}

.ent-scroll .btn.ent-date-trigger {
  min-width: 176px;
  justify-content: space-between;
}

.ent-date-label {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

.ent-status {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.ent-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ent-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
}

.ent-dot.is-ok { background: var(--green); }
.ent-dot.is-warn { background: #d99b06; }
.ent-dot.is-err { background: var(--red); }
.ent-dot.is-off { background: var(--border-strong); }

.ent-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ent-kpis .kpi-card {
  min-width: 0;
  overflow: hidden;
}

.ent-ellipsis {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ent-resumo-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.ent-resumo-list span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ent-resumo-list b {
  color: var(--text);
  font-weight: 600;
}

.ent-pix-note {
  margin: -4px 2px 0;
}

.ent-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ent-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ent-block-head .card-title,
.ent-block-head .card-subtitle {
  margin: 0;
}

.ent-block-head .card-subtitle {
  margin-top: 3px;
}

.ent-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.ent-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.ent-table-wrap .data-table td,
.ent-table-wrap .data-table th {
  padding: 11px 10px;
}

.ent-row {
  cursor: pointer;
}

.ent-row:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.ent-row.is-winner td {
  background: #fffaf0;
}

.ent-col-pos {
  width: 52px;
}

.ent-col-pay {
  width: 104px;
}

.ent-col-name {
  min-width: 150px;
}

.ent-name {
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

.ent-muted {
  color: var(--text-muted);
  font-size: 12.5px;
}

.ent-motivo {
  display: block;
  max-width: 230px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--text-muted);
}

.ent-nogps {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.ent-pos {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.ent-pos.win {
  background: #fdecc8;
  border-color: #e9c46a;
  color: var(--amber);
}

.badge.ent-badge-win {
  background: #fdecc8;
  border: 1px solid #e9c46a;
  color: var(--amber);
}

.ent-rank-cards,
.ent-pay-cards,
.ent-team-cards {
  display: none;
}

.ent-rank-card {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.ent-rank-card.is-winner {
  background: #fffaf0;
  border-color: #ecd49b;
}

.ent-rank-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ent-rank-card-top .ent-name {
  flex: 1;
  min-width: 0;
}

.ent-rank-pts {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.ent-rank-pts small {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-left: 3px;
}

.ent-rank-card-stats,
.ent-pay-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ent-pay-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.ent-rank-card-stats span,
.ent-pay-card-grid span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.ent-rank-card-stats small,
.ent-pay-card-grid small {
  font-size: 11px;
  color: var(--text-muted);
}

.ent-rank-card-stats b,
.ent-pay-card-grid b {
  font-size: 13.5px;
  font-weight: 600;
}

.ent-rank-card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ent-rank-card-foot .ent-motivo {
  display: inline;
  margin: 0;
  max-width: 100%;
  white-space: normal;
}

.ent-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
}

.ent-item-main {
  flex: 1;
  min-width: 0;
}

.ent-item-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ent-item-text {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.ent-valor {
  font-weight: 700;
}

.ent-note-card,
.ent-error {
  color: var(--text-secondary);
  font-size: 13.5px;
}

.ent-error {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.ent-error p {
  margin: 0;
}

/* Detalhes do entregador */
.ent-detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.ent-detail-pts {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.ent-detail-pts small {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.ent-detail-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ent-notice {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
  font-size: 13px;
}

.ent-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.ent-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  min-width: 0;
}

.ent-metric-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.ent-metric-value {
  font-size: 17px;
  font-weight: 700;
}

.ent-metric-hint {
  font-size: 11px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}

.ent-trechos {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ent-sub-title {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.ent-gps-box {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.ent-trip-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ent-trip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
}

.ent-trip-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.ent-trip-main b {
  white-space: nowrap;
}

.ent-trip-main span {
  color: var(--text-secondary);
}

.ent-trip-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--text-secondary);
  text-align: right;
}

/* Card WhatsApp */
.ent-card-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.ent-card-loading {
  color: var(--text-muted);
  font-size: 13.5px;
  text-align: center;
  padding: 24px 8px;
}

.ent-card-img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: 62vh;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.ent-card-img.is-loading {
  display: none;
}

.modal-footer a.btn {
  text-decoration: none;
}

/* Folha */
.ent-bar-row-folha {
  align-items: flex-end;
}

.ent-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ent-scroll .ent-quick .chip {
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
}

.ent-range {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-left: auto;
}

.ent-range .field {
  width: 156px;
}

.ent-bar-actions-folha {
  margin-left: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.ent-pay {
  min-height: 30px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ent-pay.is-due {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber);
}

.ent-pay.is-paid {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--green);
}

.ent-pay:hover {
  filter: brightness(0.97);
}

.ent-pay-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.ent-pay-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ent-pay-card-top > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ent-pay-card-top b {
  font-size: 16px;
  white-space: nowrap;
}

.ent-pay-card-foot {
  display: flex;
  justify-content: flex-end;
}

/* Equipe e regras */
.ent-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 260px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.ent-team-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.ent-team-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.ent-team-top > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ent-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
}

.ent-form-grid-adv {
  margin-top: 14px;
}

.ent-span-full {
  grid-column: 1 / -1;
}

.ent-switch-row {
  min-height: 40px;
  display: flex;
  align-items: center;
}

.ent-details {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 14px;
  background: var(--surface-hover);
}

.ent-details > summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

.ent-details[open] {
  padding-bottom: 16px;
}

.ent-form-actions {
  display: flex;
  justify-content: flex-end;
}

.ent-readonly {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 8px 11px;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  background: var(--surface-soft);
  font-size: 13.5px;
  color: var(--text-secondary);
}

.ent-textarea {
  height: auto;
  min-height: 84px;
  padding: 10px 11px;
  resize: vertical;
  font-family: inherit;
}

.ent-confirm-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.input.ent-input {
  height: 40px;
}

.ent-file {
  height: auto;
  padding: 8px 11px;
}

@media (max-width: 1100px) {
  .ent-two-col {
    grid-template-columns: 1fr;
  }

  .ent-kpis-folha {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ent-kpis-folha .ent-resumo {
    grid-column: 1 / -1;
  }

  .ent-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ent-pay-table-hide,
  .ent-pay-table {
    display: none;
  }

  .ent-pay-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .ent-table-wrap:has(.ent-pay-table) {
    display: none;
  }
}

@media (max-width: 959px) {
  .ent-range {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .ent-scroll {
    padding: 12px 12px 24px;
  }

  .ent-container {
    gap: 12px;
  }

  .ent-scroll .btn {
    min-height: 44px;
  }

  .ent-scroll .btn.btn-sm {
    min-height: 40px;
  }

  .ent-bar {
    padding: 12px;
  }

  .ent-bar-row {
    gap: 10px;
  }

  .ent-bar .segmented-control {
    width: 100%;
  }

  .ent-bar .segmented-control .segmented-btn {
    flex: 1;
    height: 36px;
  }

  .ent-date-nav {
    width: 100%;
  }

  .ent-scroll .btn.ent-nav-btn {
    width: 44px;
    flex: 0 0 44px;
  }

  .ent-scroll .btn.ent-date-trigger {
    flex: 1;
    min-width: 0;
  }

  .ent-bar-actions {
    width: 100%;
    margin-left: 0;
  }

  .ent-bar-actions .btn {
    flex: 1 1 0;
  }

  .ent-bar-actions-folha .btn {
    flex: 1 1 100%;
  }

  .ent-status {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .ent-chip {
    white-space: normal;
  }

  .ent-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .ent-kpis .kpi-card {
    padding: 12px;
  }

  .ent-kpis .kpi-value {
    font-size: 18px;
  }

  .ent-table-wrap {
    display: none;
  }

  .ent-rank-cards,
  .ent-team-cards {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .ent-pay-cards {
    grid-template-columns: 1fr;
  }

  .ent-range {
    width: 100%;
  }

  .ent-range .field {
    flex: 1;
    width: auto;
  }

  .ent-scroll .ent-quick {
    width: 100%;
  }

  .ent-scroll .ent-quick .chip {
    flex: 1 1 calc(50% - 6px);
    min-height: 44px;
  }

  .ent-block-head > .segmented-control {
    width: 100%;
  }

  .ent-block-head > .segmented-control .segmented-btn {
    flex: 1;
    height: 36px;
  }

  .ent-form-grid {
    grid-template-columns: 1fr;
  }

  .input.ent-input {
    height: 44px;
    font-size: 16px;
  }

  .ent-textarea {
    font-size: 16px;
  }

  .ent-pay {
    min-height: 40px;
    padding: 0 18px;
  }

  .ent-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ent-detail-pts {
    font-size: 30px;
  }

  .ent-trip {
    flex-direction: column;
    align-items: flex-start;
  }

  .ent-trip-meta {
    justify-content: flex-start;
    text-align: left;
  }

  .ent-item {
    align-items: flex-start;
  }

  .ent-card-img {
    max-height: 56vh;
  }
}

/* =========================================================
   MÓDULO ENTREGAS (DESPACHO & MAPA, FILA, REGRAS & TAXAS)
   Escopado sob .dsp-* e #view-dsp-*
   ========================================================= */
.dsp-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 24px 32px;
}

.dsp-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dsp-bar {
  padding: 12px 16px;
}

.dsp-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dsp-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dsp-day-chips {
  margin-left: 4px;
}

.dsp-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dsp-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dsp-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dsp-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
  align-items: start;
}

.dsp-right-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.dsp-pane {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.dsp-pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dsp-dispatch-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dsp-dispatch-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.dsp-dispatch-select-wrap {
  flex: 1 1 220px;
  min-width: 0;
}

.dsp-dispatch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dsp-dispatch-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.dsp-ped-list,
.dsp-trip-list,
.dsp-fila-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dsp-ped-card {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 13px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dsp-ped-card.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dsp-ped-card.dsp-ped-amber {
  border-left: 4px solid var(--amber);
}

.dsp-ped-card.dsp-ped-red {
  border-left: 4px solid var(--red);
}

.dsp-ped-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.dsp-ped-check-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.dsp-ped-check {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

.dsp-ped-num {
  font-size: 14.5px;
}

.dsp-ped-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dsp-ped-time {
  font-size: 12px;
  color: var(--text-muted);
}

.dsp-ped-cli {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13.5px;
}

.dsp-ped-addr {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.dsp-ped-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
}

.dsp-ped-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--text-secondary);
}

.dsp-no-coord {
  font-size: 11.5px;
  color: var(--text-muted);
}

.dsp-canal-ifood {
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  color: var(--red);
}

.dsp-canal-99 {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  color: var(--amber);
}

.dsp-badge-blue {
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  color: var(--blue);
}

/* Mapa Leaflet */
.dsp-map-box {
  width: 100%;
  height: 310px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  overflow: hidden;
  z-index: 1;
}

.dsp-map-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-secondary);
}

.dsp-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dsp-pin-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dsp-pin-dot.is-store {
  background: #c84b31;
}

.dsp-pin-dot.is-pend {
  background: #d97706;
}

.dsp-pin-dot.is-route {
  background: #1d4ed8;
}

.dsp-pin-dot.is-done {
  background: #1e7a4c;
}

.dsp-map-fallback {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  color: var(--text-secondary);
}

/* Viagens */
.dsp-trip-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dsp-trip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dsp-trip-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dsp-trip-code {
  background: var(--text);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}

.dsp-trip-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.dsp-trip-stops {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dsp-stop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.dsp-stop-row.is-done {
  background: var(--green-soft);
  border-color: var(--green-border);
}

.dsp-stop-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.dsp-stop-ord {
  font-weight: 700;
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 2px;
}

.dsp-stop-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 13px;
}

.dsp-stop-addr {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.dsp-trip-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.dsp-trip-times {
  font-size: 12px;
  color: var(--text-muted);
}

.dsp-trip-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Fila */
.dsp-checkin-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dsp-fila-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  flex-wrap: wrap;
}

.dsp-fila-row.is-next {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dsp-fila-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.dsp-fila-pos {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}

.dsp-fila-row.is-next .dsp-fila-pos {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.dsp-fila-name-line {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.dsp-fila-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dsp-fila-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Regras & Taxas */
.dsp-faixas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dsp-faixa-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.dsp-faixa-ord {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-secondary);
  padding-bottom: 10px;
}

.dsp-cfg-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
}

.dsp-cota-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.dsp-cota-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
}

.dsp-cota-item span {
  color: var(--text-muted);
}

.dsp-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}

/* =========================================================
   ETAPA 2A — MAPA GRANDE + SIDEBAR ESTREITA + NAVEGAÇÃO KDS & COTA
   ========================================================= */
.dsp-top-tabs {
  align-items: center;
  gap: 6px;
}

.dsp-top-tabs .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dsp-kds-dropdown {
  position: relative;
  display: inline-flex;
}

.dsp-kds-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.dsp-kds-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
}

.dsp-kds-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1200;
  min-width: 245px;
  padding: 6px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(44, 36, 30, 0.16);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dsp-kds-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.dsp-kds-item:hover {
  background: var(--surface-soft);
}

.dsp-kds-item strong {
  font-size: 12.8px;
  color: var(--text);
}

.dsp-kds-item span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.dsp-quota-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.dsp-quota-pill:hover {
  border-color: var(--accent);
}

.dsp-quota-bar {
  width: 34px;
  height: 7px;
  border-radius: 999px;
  background: #e6dfd6;
  overflow: hidden;
  display: inline-block;
}

.dsp-quota-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #2f7d57;
  transition: width 0.25s ease;
}

.dsp-quota-fill.warn {
  background: #b7791f;
}

.dsp-quota-fill.danger {
  background: #b83227;
}

/* Palco 100% da altura na aba Mapa */
#view-dsp-painel.active {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--topbar-height, 64px));
  min-height: 520px;
  overflow: hidden;
}

.dsp-painel-stage {
  flex: 1;
  display: flex;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.dsp-split-stage {
  flex: 1;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.dsp-left-panel {
  width: 356px;
  min-width: 336px;
  max-width: 370px;
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: margin-left 0.2s ease, width 0.2s ease;
}

.dsp-split-stage.map-expanded .dsp-left-panel {
  margin-left: -356px;
}

.dsp-left-panel-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 12px;
  gap: 8px;
}

.dsp-side-daybar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dsp-side-daynav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dsp-day-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.dsp-day-nav-btn:hover {
  border-color: var(--accent);
}

.dsp-side-date-input {
  height: 26px;
  padding: 0 7px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.dsp-queue-mini-tag {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf7f1;
  color: #2f7d57;
  border: 1px solid rgba(47, 125, 87, 0.25);
  cursor: pointer;
}

.dsp-stopped-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: #fdf2f0;
  border: 1px solid rgba(184, 50, 39, 0.32);
  color: #98231a;
  font-size: 11.8px;
}

.dsp-btn-avulsa {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px dashed var(--border-strong, #c5b9aa);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dsp-btn-avulsa:hover {
  border-color: var(--accent);
  background: rgba(200, 85, 61, 0.06);
}

.dsp-btn-avulsa-plus {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
}

.dsp-side-dispatch-box {
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dsp-dispatch-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dsp-mode-switch {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.dsp-mode-btn {
  padding: 6px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.dsp-mode-btn.active {
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(44, 36, 30, 0.08);
}

.dsp-moto-btn {
  position: relative;
  width: 44px;
  height: 34px;
  border-radius: 8px;
  border: none;
  background: var(--accent, #c8553d);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(200, 85, 61, 0.28);
}

.dsp-moto-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.dsp-moto-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #2c241e;
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dsp-select-compact {
  height: 31px;
  font-size: 12.2px;
  padding: 2px 8px;
}

.dsp-auto-next-hint {
  font-size: 11.6px;
  color: var(--text-muted);
  padding: 0 2px;
}

.dsp-auto-next-hint.warn {
  color: #b7791f;
}

.dsp-dispatch-row-sub {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.dsp-sub-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.dsp-sub-action-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.dsp-sub-action-btn:disabled {
  opacity: 0.46;
  cursor: not-allowed;
}

.dsp-side-counter-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.8px;
}

.dsp-side-counter-main {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dsp-link-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 11.8px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.dsp-link-btn:hover {
  text-decoration: underline;
}

.dsp-selection-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(200, 85, 61, 0.1);
  border: 1px solid rgba(200, 85, 61, 0.26);
  color: var(--text);
  font-size: 12px;
}

.dsp-inner-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  gap: 2px;
}

.dsp-inner-tab {
  padding: 7px 3px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.8px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dsp-inner-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.dsp-side-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding-right: 2px;
}

.dsp-empty-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26px 14px;
  color: var(--text-muted);
  gap: 6px;
}

.dsp-empty-pane strong {
  color: var(--text);
  font-size: 13.5px;
}

.dsp-empty-pane p {
  font-size: 12px;
  margin: 0;
  line-height: 1.4;
}

.dsp-side-order-card {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.dsp-side-order-card.selected {
  border-color: var(--accent);
  background: rgba(200, 85, 61, 0.055);
}

.dsp-side-order-card.pin-editing {
  border-color: #2b6cb0;
  box-shadow: 0 0 0 2px rgba(43, 108, 176, 0.2);
}

.dsp-side-order-card.alert-orange {
  border-left: 3.5px solid #b7791f;
}

.dsp-side-order-card.alert-red {
  border-left: 3.5px solid #b83227;
}

.dsp-side-order-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dsp-side-check-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.dsp-side-order-num {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text);
}

.dsp-stop-seq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10.8px;
  font-weight: 800;
}

.dsp-side-order-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dsp-pay-tag,
.dsp-wait-tag,
.dsp-pin-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
}

.dsp-pay-tag.paid {
  background: #edf7f1;
  color: #2f7d57;
}

.dsp-pay-tag.cash {
  background: #fff6e5;
  color: #9c6311;
}

.dsp-pay-tag.pix {
  background: #e9f5fb;
  color: #1f6b96;
}

.dsp-pay-tag.card {
  background: #f3effb;
  color: #5a3e99;
}

.dsp-wait-tag {
  background: var(--surface-soft);
  color: var(--text-muted);
}

.dsp-wait-tag.alert-orange {
  background: #fff4df;
  color: #9c6311;
}

.dsp-wait-tag.alert-red {
  background: #fde8e6;
  color: #98231a;
}

.dsp-pin-tag.manual {
  background: #ebf3fc;
  color: #2b6cb0;
}

.dsp-pin-tag.missing {
  background: #fde8e6;
  color: #98231a;
}

.dsp-side-order-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.dsp-side-customer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.6px;
}

.dsp-side-bairro {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-soft);
  padding: 1px 6px;
  border-radius: 6px;
}

.dsp-side-address {
  font-size: 11.8px;
  color: var(--text-muted);
  line-height: 1.3;
}

.dsp-side-items {
  font-size: 11.2px;
  color: var(--text);
  opacity: 0.85;
}

.dsp-side-order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px dashed var(--border);
}

.dsp-side-metrics {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.6px;
  color: var(--text-muted);
}

.dsp-side-fee {
  color: var(--text);
}

.dsp-side-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dsp-icon-act {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.dsp-icon-act:hover,
.dsp-icon-act.active {
  border-color: var(--accent);
  color: var(--accent);
}

.dsp-icon-act.danger:hover {
  border-color: #b83227;
  color: #b83227;
}

/* Cards de Rotas Pré-Agrupadas e Viagens na Sidebar */
.dsp-side-route-card {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dsp-side-route-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dsp-side-route-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.dsp-side-route-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.8px;
  color: var(--text-muted);
}

.dsp-route-stops-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.dsp-route-stop-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.8px;
}

.dsp-route-stop-line.done {
  opacity: 0.72;
}

.dsp-route-stop-addr {
  flex: 1;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dsp-trip-stop-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dsp-trip-stop-sub {
  font-size: 10.8px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dsp-side-route-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: wrap;
}

.dsp-side-footer {
  padding-top: 6px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.dsp-busy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11.8px;
  font-weight: 700;
  cursor: pointer;
}

.dsp-busy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9c9288;
}

.dsp-busy-chip.on {
  background: #fff6e5;
  border-color: rgba(183, 121, 31, 0.35);
  color: #8c580c;
}

.dsp-busy-chip.on .dsp-busy-dot {
  background: #d97706;
}

/* Área direita: Mapa Grande Persistente */
.dsp-map-stage {
  flex: 1;
  height: 100%;
  min-width: 0;
  position: relative;
  background: #e9e4dc;
}

.dsp-map-full-canvas {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.dsp-map-overlay-tl {
  position: absolute;
  top: 12px;
  left: 54px;
  z-index: 500;
}

.dsp-map-type-toggle {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(44, 36, 30, 0.15);
}

.dsp-map-type-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.2px;
  font-weight: 700;
  cursor: pointer;
}

.dsp-map-type-btn.active {
  background: var(--text);
  color: var(--surface);
}

.dsp-map-overlay-tc {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  max-width: min(640px, 86%);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(44, 36, 30, 0.18);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.4px;
}

.dsp-banner-pin {
  background: #ebf3fc;
  border-color: #2b6cb0;
  color: #1e4e8c;
}

.dsp-warn-inline {
  color: #b7791f;
  font-weight: 700;
}

.dsp-map-overlay-tr {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
}

.dsp-map-overlay-br {
  position: absolute;
  bottom: 24px;
  right: 12px;
  z-index: 500;
}

.dsp-map-fab {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(44, 36, 30, 0.16);
}

.dsp-map-fab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* =========================================================
   ETAPA 2B — PINOS REDONDOS 36x36px, SELO R1/R2, SPIDERFY 28px,
   ROTAS SUGERIDAS COM DRAG & DROP E MEDIDOR GOOGLE MAPS (🗺️ 0%)
   ========================================================= */
.dsp-marker-wrap {
  background: transparent !important;
  border: none !important;
}

.dsp-pin {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
  color: #ffffff;
  background: #d32f2f;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.32);
  box-sizing: border-box;
  user-select: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.dsp-pin:hover {
  transform: scale(1.08);
}

.dsp-pin.is-long {
  font-size: 10.5px;
  letter-spacing: -0.35px;
}

.dsp-pin.is-xlong {
  font-size: 9.2px;
  letter-spacing: -0.45px;
}

.dsp-pin-store {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #d32f2f;
  color: #ffffff;
  font-size: 17px;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dsp-pin-ready {
  background: #4caf50;
}

.dsp-pin-prep,
.dsp-pin-pending {
  background: #d32f2f;
}

.dsp-pin-orange {
  background: #fb8c00;
}

.dsp-pin-red {
  background: #b71c1c;
}

.dsp-pin-route {
  background: #2196f3;
}

.dsp-pin-grouped {
  background: #6b46c1;
}

.dsp-pin-selected {
  background: #ff9800 !important;
  border: 3px solid #ff5722 !important;
  z-index: 40;
}

.dsp-pin-editing {
  background: #1e4e8c !important;
  border: 3px solid #ffffff !important;
  transform: scale(1.16);
  box-shadow: 0 0 0 4px rgba(43, 108, 176, 0.38) !important;
}

.dsp-pin-route-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 16px;
  height: 12px;
  padding: 0 3px;
  border-radius: 3px;
  background: #ffffff;
  color: #212121;
  font-size: 8px;
  font-weight: 800;
  line-height: 10px;
  text-align: center;
  border: 1px solid #bdbdbd;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  box-sizing: border-box;
}

/* Medidor Google Maps (🗺️ 0%) no topo */
.dsp-quota-meter-wrap {
  position: relative;
  display: inline-flex;
  margin-left: 6px;
}

.dsp-quota-meter-btn {
  border: 1px solid #cfd8dc;
  background: #fafafa;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: #37474f;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dsp-quota-meter-btn:hover {
  border-color: #90a4ae;
  background: #f0f4f7;
}

.dsp-quota-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5000;
  width: 316px;
  max-height: 440px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #b0bec5;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  padding: 10px 12px;
  font-size: 11.8px;
  color: #2c241e;
}

.dsp-quota-pop-title {
  font-weight: 800;
  font-size: 12.6px;
  margin-bottom: 3px;
}

.dsp-quota-pop-sub {
  color: #607d8b;
  font-size: 11.2px;
  margin-bottom: 8px;
}

.dsp-quota-pop-prov {
  padding: 6px 8px;
  border-radius: 6px;
  background: #f5f7f8;
  border: 1px solid #e0e6ea;
  margin-bottom: 9px;
  font-size: 11.2px;
  line-height: 1.35;
}

.dsp-quota-api-row {
  margin-bottom: 9px;
}

.dsp-quota-api-name {
  font-weight: 700;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dsp-quota-api-line {
  font-size: 11.1px;
  color: #455a64;
  margin-bottom: 3px;
}

.dsp-quota-track {
  height: 6px;
  background: #eceff1;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.dsp-quota-track.day {
  height: 4px;
  margin-bottom: 0;
}

.dsp-quota-fill-bar {
  height: 100%;
  background: #546e7a;
  transition: width 0.2s ease;
}

.dsp-quota-fill-bar.yellow {
  background: #f9a825;
}

.dsp-quota-fill-bar.red {
  background: #c62828;
}

.dsp-quota-fill-bar.day {
  background: #90a4ae;
}

/* Bloco de Rotas Sugeridas (R1, R2...) e Drag & Drop na Sidebar */
.dsp-sug-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  background: #f7f4ef;
  border: 1px solid var(--border);
}

.dsp-sug-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--text);
}

.dsp-sug-card {
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.dsp-sug-card:hover,
.dsp-sug-card.drag-over {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(200, 85, 61, 0.14);
}

.dsp-sug-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.dsp-sug-title-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dsp-sug-selo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 5px;
  border-radius: 5px;
  background: #2c241e;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
}

.dsp-sug-reason {
  font-size: 11.2px;
  font-weight: 700;
  color: #455a64;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dsp-sug-legs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-soft);
  padding: 3px 7px;
  border-radius: 6px;
}

.dsp-sug-orders-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dsp-sug-order-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 7px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 11.6px;
  cursor: grab;
}

.dsp-sug-order-pill:active {
  cursor: grabbing;
}

.dsp-sug-order-pill.dragging {
  opacity: 0.45;
}

.dsp-sug-order-left {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.dsp-prep-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #d32f2f;
}

.dsp-prep-dot.ready {
  background: #4caf50;
}

.dsp-sug-order-addr {
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dsp-sug-dropzone-new {
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px dashed #b0bec5;
  text-align: center;
  font-size: 11px;
  color: #607d8b;
  background: rgba(255, 255, 255, 0.6);
}

.dsp-sug-dropzone-new.drag-over {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(200, 85, 61, 0.08);
}

/* Toast 8s com botão Desfazer */
.dsp-undo-toast-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dsp-undo-btn {
  background: #fff;
  color: #2c241e;
  border: none;
  font-weight: 800;
}

.dsp-addr-geocode-row {
  display: flex;
  gap: 8px;
}

.dsp-addr-geocode-row .input {
  flex: 1;
}

.dsp-search-inline {
  min-width: 240px;
}

.dsp-kds-preview-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.dsp-kds-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.dsp-mobile-drawer-fab {
  display: none;
}

@media (max-width: 1100px) {
  .dsp-main-grid {
    grid-template-columns: 1fr;
  }
  .dsp-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dsp-cfg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dsp-cota-summary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  #view-dsp-painel.active {
    height: calc(100dvh - 148px);
  }
  .dsp-left-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(340px, 88vw);
    max-width: 88vw;
    box-shadow: 8px 0 24px rgba(44, 36, 30, 0.22);
    transform: translateX(-102%);
    transition: transform 0.22s ease;
  }
  .dsp-split-stage.mobile-drawer-open .dsp-left-panel {
    transform: translateX(0);
  }
  .dsp-mobile-drawer-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    bottom: 18px;
    left: 14px;
    z-index: 520;
    padding: 9px 14px;
    border-radius: 999px;
    border: none;
    background: var(--accent, #c8553d);
    color: #fff;
    font-size: 12.8px;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(200, 85, 61, 0.36);
  }
  .dsp-scroll {
    padding: 12px 12px 24px;
  }
  .dsp-pane {
    padding: 12px;
  }
  .dsp-faixa-row {
    grid-template-columns: 1fr 1fr;
  }
  .dsp-faixa-ord {
    grid-column: 1 / -1;
    padding-bottom: 0;
  }
  .dsp-cfg-grid {
    grid-template-columns: 1fr;
  }
}

/* Etapa 2C — Botões rápidos Pronto / Voltar ao preparo no painel de Despacho */
.dsp-icon-act[data-dsp-prep-next="1"] {
  border-color: rgba(46, 125, 50, 0.45);
  background: rgba(46, 125, 50, 0.08);
  color: #1b5e20;
  font-weight: 700;
}
.dsp-icon-act[data-dsp-prep-next="1"]:hover {
  background: rgba(46, 125, 50, 0.16);
  border-color: #2e7d32;
}
.dsp-icon-act[data-dsp-prep-next="0"] {
  border-color: rgba(21, 101, 192, 0.4);
  background: rgba(21, 101, 192, 0.07);
  color: #1565c0;
  font-weight: 700;
}
.dsp-icon-act[data-dsp-prep-next="0"]:hover {
  background: rgba(21, 101, 192, 0.14);
  border-color: #1565c0;
}


/* =========================================================
   ETAPA 3 — ENTREGADORES (PIN, GPS) + POSIÇÕES AO VIVO NO MAPA
   ========================================================= */
#dspEntregadoresRoot .dsp-fila-info {
  flex: 1 1 260px;
  min-width: 0;
}

#dspEntregadoresRoot .dsp-fila-actions {
  flex-wrap: wrap;
}

.dsp-ent-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.dsp-pin-box {
  text-align: center;
}

.dsp-pin-code {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 8px;
  padding: 14px 10px 14px 18px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 2px dashed var(--border-strong);
  user-select: all;
}

.dsp-pin-aviso {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.dsp-live-pin {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
  background: #2f855a;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
  box-sizing: border-box;
  margin: 2px;
  cursor: pointer;
}

.dsp-live-pin.is-rota {
  background: #0369a1;
}

.dsp-live-pin.is-foco {
  border-color: #ff5722;
  box-shadow: 0 0 0 3px rgba(255, 87, 34, 0.35), 0 2px 8px rgba(0, 0, 0, 0.42);
}

.dsp-live-pin.is-stale {
  background: #9aa3ad;
  border: 3px dashed #d32f2f;
  opacity: 0.78;
}

.dsp-live-pin em {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 1px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
  line-height: 15px;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dsp-live-legend {
  position: absolute;
  left: 12px;
  bottom: 24px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  max-width: min(420px, calc(100% - 90px));
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(44, 36, 30, 0.16);
  font-size: 12px;
}

.dsp-live-legend.hidden {
  display: none;
}

.dsp-live-legend-stale {
  color: #b7791f;
  font-weight: 700;
}

.dsp-live-legend-trail {
  color: #0369a1;
  font-weight: 700;
}

@media (max-width: 768px) {
  .dsp-live-legend {
    bottom: 66px;
    border-radius: 12px;
    max-width: calc(100% - 28px);
  }
  .dsp-pin-code {
    font-size: 34px;
    letter-spacing: 6px;
  }
}

/* =========================================================
   ETAPA 3B — MENU LATERAL RETRÁTIL, DESPACHO NO CARD,
   TRAVA INTELIGENTE E ÁREA DE TESTE ISOLADA
   ========================================================= */
.sidebar-collapse-btn,
.sidebar-reopen-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (min-width: 900px) {
  .sidebar {
    transition: width 0.2s ease, padding 0.2s ease, border-color 0.2s ease, opacity 0.18s ease;
    overflow: hidden;
  }

  .app-shell.sidebar-collapsed .sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    border-right-color: transparent;
    opacity: 0;
    pointer-events: none;
  }

  .app-shell:not(.sidebar-collapsed) .sidebar-reopen-btn {
    display: none;
  }
}

@media (max-width: 899px) {
  .sidebar-collapse-btn,
  .sidebar-reopen-btn {
    display: none !important;
  }
  html,
  body {
    overflow-x: hidden;
  }
}

/* Despacho direto no card da rota */
.dsp-card-dispatch-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.dsp-card-courier-select {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 2px 24px 2px 8px;
  font-size: 11.8px;
  border-radius: 8px;
}

.dsp-card-dispatch-btn {
  flex-shrink: 0;
  height: 30px;
  padding: 0 10px;
  font-size: 11.8px;
  font-weight: 700;
}

/* Trava inteligente de rotas manuais */
.dsp-sug-card.is-manual {
  border-color: #c4b5fd;
  background: #faf8ff;
}

.dsp-fixed-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  background: #ede9fe;
  color: #5b21b6;
  white-space: nowrap;
}

.dsp-lock-mini {
  font-size: 10px;
  line-height: 1;
  opacity: 0.85;
}

.dsp-routes-subsection {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

/* Botão e banner da Área de Teste */
.dsp-test-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px dashed #8b5cf6;
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.dsp-test-toggle-btn:hover {
  background: #ede9fe;
}

.dsp-test-toggle-btn.active {
  background: #6d28d9;
  border-style: solid;
  border-color: #5b21b6;
  color: #ffffff;
}

.dsp-test-toggle-mob.active {
  background: #6d28d9 !important;
  color: #ffffff !important;
  border-color: #5b21b6 !important;
}

.dsp-test-banner-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 16px;
  background: #ede9fe;
  border-bottom: 2px solid #7c3aed;
  color: #4c1d95;
  flex-shrink: 0;
}

.dsp-test-banner-bar.hidden {
  display: none;
}

.dsp-test-banner-text {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 12.8px;
}

.dsp-test-banner-text strong {
  font-size: 13px;
  letter-spacing: 0.01em;
}

.dsp-test-banner-text span {
  color: #5b21b6;
}

.dsp-test-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

@media (max-width: 899px) {
  .dsp-test-banner-bar {
    padding: 8px 12px;
  }
}


/* =========================================================
   ETAPA F1 + F2 — FINANCEIRO (RESUMO & CANAIS + CONTA DO PEDIDO)
   E EVOLUÇÃO DO MENU INÍCIO (PERÍODO, GRÁFICO BRUTO × MARGEM, 3 CANAIS)
   ========================================================= */
.home-period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.home-period-label {
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(255, 249, 242, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.home-period-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.home-period-pill {
  background: rgba(255, 255, 255, 0.1);
  color: #fff9f2;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.home-period-pill:hover {
  background: rgba(255, 255, 255, 0.18);
}

.home-period-pill.active {
  background: #fff9f2;
  color: #36180f;
  border-color: #fff9f2;
  font-weight: 700;
}

.home-metrics.home-metrics-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-panel-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.home-chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.home-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.leg-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.leg-dot.leg-bruto {
  background: #c84b31;
}

.leg-dot.leg-mc {
  background: #15803d;
}

.home-bar-mc-val {
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.1;
}

.home-bar-mc-val.is-pos {
  color: #15803d;
}

.home-bar-mc-val.is-neg {
  color: #b91c1c;
}

.home-bar-col.home-bar-col-dual {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding: 0 3px;
}

.home-bar-col-dual .home-bar-fill {
  flex: 1;
  border-radius: 5px 5px 2px 2px;
}

.home-bar-col-dual .home-bar-fill-bruto {
  background: linear-gradient(180deg, #d95d39 0%, #a9381d 100%);
}

.home-bar-col-dual .home-bar-fill-mc {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
}

.home-bar-col-dual .home-bar-fill-mc.is-neg {
  background: linear-gradient(180deg, #ef4444 0%, #b91c1c 100%);
}

.home-channel-group {
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}

.home-channel-group:last-child {
  border-bottom: 0;
}

.home-channel-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-channel-row .home-channel {
  flex: 1;
  min-width: 0;
}

.home-channel-expand {
  flex-shrink: 0;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
}

.home-channel-fin-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  padding-left: 4px;
}

.home-subchannels {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  padding: 6px 8px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.home-subchannel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 0;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.home-subchannel:hover {
  background: rgba(0, 0, 0, 0.04);
}

.home-subchannel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.home-subchannel-name {
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.home-subchannel-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Financeiro -> Resumo & Canais */
.fin-resumo-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.fin-resumo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.fin-resumo-dates {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fin-pend-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.fin-pend-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.fin-pend-alert > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fin-pend-alert.is-blue {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.fin-pend-alert.is-amber {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}

.fin-dre-ladder {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
}

.fin-dre-step {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fin-dre-step.is-blue {
  background: #f0f7ff;
  border-color: #bfdbfe;
}

.fin-dre-step.is-green {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.fin-dre-step.is-red {
  background: #fef2f2;
  border-color: #fecaca;
}

.fin-dre-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.fin-dre-val {
  font-size: 19px;
  font-weight: 800;
  color: var(--text);
}

.fin-dre-val small {
  font-size: 13px;
  font-weight: 700;
}

.fin-dre-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.text-blue {
  color: #0369a1 !important;
}

.text-green {
  color: #15803d !important;
}

.text-red {
  color: #b91c1c !important;
}

.fin-canal-cell-title {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fin-expand-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fin-canal-link {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.fin-canal-link:hover {
  text-decoration: underline;
  color: var(--primary);
}

.fin-suborigem-row td {
  background: var(--surface-soft);
  font-size: 12.5px;
}

.fin-suborigem-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 18px;
}

.fin-sub-branch {
  color: var(--text-muted);
}

.fin-canais-total-row td {
  background: var(--surface-soft);
  border-top: 2px solid var(--border-strong);
}

.fin-extra-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
}

.fin-extra-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 6px;
}

.fin-extra-metrics > div {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fin-extra-metrics span {
  font-size: 12px;
  color: var(--text-secondary);
}

.fin-extra-metrics strong {
  font-size: 15.5px;
}

/* Conta deste pedido (Detalhe do pedido) */
.order-extrato-box {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  overflow: hidden;
}

.order-extrato-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.order-extrato-head > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.order-extrato-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.order-extrato-pends {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.order-extrato-rows {
  display: flex;
  flex-direction: column;
}

.order-extrato-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.order-extrato-row:last-child {
  border-bottom: 0;
}

.order-extrato-row.is-muted {
  color: var(--text-secondary);
  font-size: 12.5px;
}

.order-extrato-row.is-subtotal {
  background: rgba(0, 0, 0, 0.025);
  font-weight: 600;
}

.order-extrato-row.is-liquido {
  background: #f0f7ff;
  font-weight: 700;
}

.order-extrato-row.is-sobra.is-pos {
  background: #f0fdf4;
  font-weight: 700;
}

.order-extrato-row.is-sobra.is-neg {
  background: #fef2f2;
  font-weight: 700;
}

@media (max-width: 768px) {
  .home-metrics.home-metrics-4 {
    grid-template-columns: 1fr;
  }
  .fin-extra-metrics {
    grid-template-columns: 1fr;
  }
  .order-extrato-row {
    flex-wrap: wrap;
  }
}


/* =========================================================
   ETAPA F3: DRE GERENCIAL & CONTAS A PAGAR
   ========================================================= */
@media (max-width: 959px) {
  .mobile-subtabs.mobile-subtabs-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.fin-dre-toolbar,
.fin-contas-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fin-dre-controls,
.fin-contas-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fin-month-input {
  width: auto;
  min-width: 152px;
  max-width: 190px;
}

.fin-kpi-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.fin-dre-statement {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}

.fin-dre-row {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.fin-dre-row:last-child {
  border-bottom: 0;
}

.fin-dre-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
}

.fin-dre-row.is-subtotal {
  background: var(--surface-soft);
}

.fin-dre-row.is-subtotal-destaque {
  background: #f8fafc;
}

.fin-dre-row.is-final {
  background: #f0fdf4;
  border-top: 2px solid #bbf7d0;
}

.fin-dre-row.is-final.is-neg {
  background: #fef2f2;
  border-top: 2px solid #fecaca;
}

.fin-dre-row-left {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.fin-dre-row-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fin-dre-row-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.fin-dre-row.is-subtotal .fin-dre-row-label,
.fin-dre-row.is-subtotal-destaque .fin-dre-row-label,
.fin-dre-row.is-final .fin-dre-row-label {
  font-weight: 700;
}

.fin-dre-row-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.fin-dre-row-right {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-shrink: 0;
  text-align: right;
}

.fin-dre-row-val {
  font-size: 15px;
  font-weight: 700;
}

.fin-dre-row.is-final .fin-dre-row-val {
  font-size: 17px;
  font-weight: 800;
}

.fin-dre-row-pct {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 48px;
}

.fin-dre-children {
  background: #fafbfc;
  border-top: 1px dashed var(--border);
  padding: 6px 14px 10px 38px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fin-dre-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.8px;
  padding: 4px 0;
}

.fin-dre-group-box {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  overflow: hidden;
}

.fin-dre-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--text);
}

.fin-dre-group-head:hover {
  background: var(--surface-soft);
}

.fin-dre-cat-list {
  border-top: 1px solid var(--border);
  padding: 6px 10px 8px 26px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #fcfcfd;
}

.fin-dre-cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.fin-fora-dre-card {
  border-color: #fde68a;
  background: #fffdf5;
}

.fin-fora-dre-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.fin-fora-dre-metric {
  background: var(--surface);
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fin-fora-dre-metric span {
  font-size: 12px;
  color: var(--text-secondary);
}

.fin-fora-dre-metric strong {
  font-size: 15.5px;
}

.fin-contas-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.fin-contas-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fin-contas-search-wrap {
  min-width: 220px;
  flex: 1;
  max-width: 340px;
}

.fin-rateio-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fin-rateio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fin-rateio-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.fin-cat-mgr-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 46dvh;
  overflow-y: auto;
}

.fin-cat-mgr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
}

.fin-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .fin-kpi-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .fin-fora-dre-summary {
    grid-template-columns: 1fr;
  }
  .fin-rateio-grid {
    grid-template-columns: 1fr;
  }
  .fin-dre-children {
    padding-left: 14px;
  }
  .fin-dre-row-main {
    flex-wrap: wrap;
  }
  .fin-dre-row-right {
    width: 100%;
    justify-content: flex-end;
  }
  .fin-month-input {
    max-width: none;
    width: 100%;
  }
  .fin-contas-search-wrap {
    max-width: none;
    width: 100%;
  }
}

/* =========================================================
   ETAPA F4: EXTRATOS BANCÁRIOS (OFX/CSV), CONCILIAÇÃO & IMPRESSÃO DRE
   ========================================================= */
@media (max-width: 959px) {
  .mobile-subtabs.mobile-subtabs-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .mobile-subtabs.mobile-subtabs-5 .mobile-subtab {
    padding: 7px 4px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

.fin-ext-accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.fin-ext-account-card {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 13px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fin-ext-account-card:hover {
  border-color: var(--primary);
}

.fin-ext-account-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(200, 85, 61, 0.14);
  background: #fffaf8;
}

.fin-ext-account-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.fin-ext-account-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.fin-ext-account-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.fin-ext-account-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
}

.fin-ext-import-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 11px;
  background: var(--surface-soft);
  margin-top: 12px;
}

.fin-ext-import-result {
  margin-top: 10px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fin-ext-sug-box {
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.fin-ext-sug-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid #fde68a;
}

.fin-ext-conc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.fin-ext-mov-hint {
  font-size: 11.5px;
  color: #b45309;
  font-weight: 600;
  margin-top: 2px;
}

.fin-ext-file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

@media (max-width: 768px) {
  .fin-ext-accounts-grid {
    grid-template-columns: 1fr;
  }
  .fin-ext-import-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .fin-ext-sug-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* =========================================================
   IMPRESSÃO / PDF DA DRE GERENCIAL
   ========================================================= */
@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  body,
  .app-shell,
  .main-area,
  .content,
  .fin-caixa-scroll {
    background: #fff !important;
    color: #111 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .sidebar,
  .sidebar-backdrop,
  .topbar,
  .mobile-subtabs,
  .bottom-nav,
  .global-alert-area,
  .dsp-test-banner-bar,
  .toast-container,
  .modal-overlay,
  .picker-overlay,
  .fin-dre-controls,
  .fin-pend-stack,
  .fin-expand-btn,
  .btn,
  .chip,
  .no-print {
    display: none !important;
  }

  .view {
    display: none !important;
  }

  .view.active {
    display: block !important;
  }

  .card,
  .fin-dre-statement,
  .fin-fora-dre-card {
    box-shadow: none !important;
    border: 1px solid #d1d5db !important;
    break-inside: avoid;
    margin-bottom: 12px !important;
  }

  .fin-dre-row {
    break-inside: avoid;
  }

  .fin-kpi-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}


/* =========================================================
   ETAPA S1 (v1.3) — SEGURANÇA COMERCIAL, TELA DE LOGIN E PERFIS
   ========================================================= */
.app-shell.auth-locked {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
  overflow: hidden;
}

.auth-login-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(24, 20, 17, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-login-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-login-title {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.auth-login-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.auth-login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-auth-box {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-auth-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12.5px;
}

.sidebar-auth-user strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cfg-auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cfg-auth-switches {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 14px;
}

.cfg-auth-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.cfg-auth-reset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

@media (max-width: 640px) {
  .cfg-auth-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Etapa 3C — Topo recolhível e Cards enxutos no Despacho
   ========================================================= */
.dsp-side-topbar-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dsp-top-courier-select {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  font-size: 12.2px;
  font-weight: 600;
  padding: 0 24px 0 8px;
  border-radius: 8px;
  text-overflow: ellipsis;
}

.dsp-opts-toggle-btn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11.8px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.dsp-opts-toggle-btn:hover,
.dsp-opts-toggle-btn.open {
  border-color: var(--accent);
  color: var(--accent);
}

.dsp-top-drawer {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 7px 8px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.dsp-drawer-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-wrap: nowrap;
}

.dsp-drawer-row .dsp-side-date-input {
  width: 112px;
  min-width: 0;
  font-size: 11.4px;
  padding: 0 4px;
}

.dsp-btn-avulsa-mini {
  margin-left: auto;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px dashed var(--border-strong, #c5b9aa);
  background: var(--surface);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.dsp-btn-avulsa-mini:hover {
  border-color: var(--accent);
  background: rgba(200, 85, 61, 0.06);
}

.dsp-mode-switch-mini {
  flex: 0 0 auto;
  min-width: 108px;
}

.dsp-mode-switch-mini .dsp-mode-btn {
  padding: 4px 7px;
  font-size: 11.4px;
}

.dsp-sub-action-mini {
  flex: 1 1 0;
  min-width: 0;
  height: 27px;
  padding: 0 6px;
  font-size: 11.4px;
  white-space: nowrap;
}

.dsp-sel-microbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(200, 85, 61, 0.1);
  border: 1px solid rgba(200, 85, 61, 0.25);
  font-size: 11.6px;
}

.dsp-sel-micro-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.dsp-micro-btn {
  height: 23px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid rgba(200, 85, 61, 0.32);
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.dsp-micro-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.dsp-micro-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dsp-micro-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
}

.dsp-list-mini-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0 2px;
  margin-bottom: -2px;
}

/* Cards enxutos (2 linhas, ~54px de altura, zero estouro horizontal) */
.dsp-side-order-card.dsp-card-slim {
  padding: 7px 9px;
  gap: 4px;
  min-width: 0;
}

.dsp-card-row1,
.dsp-card-row2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}

.dsp-card-row2 {
  cursor: pointer;
}

.dsp-card-client {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.6px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dsp-card-row2-right {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 48%;
}

.dsp-card-courier {
  font-size: 11.2px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 118px;
}

.dsp-card-courier.muted {
  opacity: 0.72;
  font-weight: 500;
}

.dsp-status-pill {
  font-size: 10.4px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.dsp-status-pill.ready {
  background: #edf7f1;
  color: #2f7d57;
}

.dsp-status-pill.prep {
  background: var(--surface-soft);
  color: var(--text-muted);
}

.dsp-micro-ico {
  width: 21px;
  height: 21px;
  padding: 0;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.dsp-micro-ico:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.dsp-micro-ico.danger:hover {
  border-color: #b83227;
  color: #b83227;
}

.dsp-sug-order-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.dsp-popup-actions {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  display: flex;
  justify-content: flex-end;
}


/* =========================================================
   ENTREGAS / VIAGENS DO DIA — REFORMULAÇÃO VISUAL (v1.5)
   ========================================================= */
.dsp-entregas-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 2px 0 24px;
  min-width: 0;
}

.dsp-ent-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
}

.dsp-ent-bar-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.dsp-date-step {
  width: 34px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.dsp-ent-date-input {
  width: 148px;
  height: 36px;
  padding: 6px 10px;
  flex: 0 0 auto;
}

.dsp-ent-bar-search {
  flex: 1 1 220px;
  min-width: 180px;
}

.dsp-ent-search-input {
  width: 100%;
  height: 36px;
}

.dsp-ent-bar-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.dsp-ent-map-btn {
  height: 36px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.dsp-ent-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.dsp-ent-kpi {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.dsp-ent-kpi-label {
  font-size: 12.5px;
  font-weight: 620;
  color: var(--text-secondary);
}

.dsp-ent-kpi-val {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 780;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dsp-ent-kpi.tone-blue .dsp-ent-kpi-val { color: var(--blue); }
.dsp-ent-kpi.tone-green .dsp-ent-kpi-val { color: var(--green); }
.dsp-ent-kpi.tone-primary .dsp-ent-kpi-val { color: var(--primary); }

.dsp-ent-kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.dsp-ent-pane {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.dsp-ent-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dsp-ent-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dsp-ent-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dsp-ent-group-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 720;
  color: var(--text);
}

.dsp-viagens-list,
.dsp-ent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dsp-viagem-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dsp-viagem-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dsp-viagem-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dsp-viagem-code {
  font-size: 12px;
  font-weight: 740;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.dsp-viagem-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.dsp-viagem-paradas {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dsp-parada-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.dsp-parada-row.done {
  background: #f8fcf9;
  border-color: var(--green-border);
}

.dsp-parada-ord {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 740;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dsp-parada-main {
  flex: 1 1 auto;
  min-width: 0;
}

.dsp-parada-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}

.dsp-parada-addr {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.dsp-parada-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dsp-parada-fee {
  font-size: 13px;
  font-weight: 720;
  color: var(--text);
}

.dsp-viagem-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.dsp-viagem-times {
  font-size: 12px;
  color: var(--text-muted);
}

.dsp-viagem-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dsp-ent-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(140px, 0.9fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  min-width: 0;
}

.dsp-ent-row.is-active {
  background: #fdfbf7;
  border-color: var(--blue-border);
  border-left: 3px solid var(--blue);
}

.dsp-ent-row.is-done {
  border-left: 3px solid var(--green);
}

.dsp-ent-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dsp-ent-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}

.dsp-ent-cli {
  font-weight: 620;
  color: var(--text);
}

.dsp-ent-fonte {
  font-size: 11px;
  font-weight: 640;
  color: var(--text-muted);
  background: var(--surface-soft);
  padding: 1px 6px;
  border-radius: 999px;
}

.dsp-ent-row-addr {
  font-size: 12px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.dsp-ent-row-courier {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.dsp-ent-courier-name {
  font-size: 12.8px;
  font-weight: 660;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dsp-ent-courier-time {
  font-size: 11.5px;
  color: var(--text-muted);
}

.dsp-ent-row-fee {
  font-size: 13.5px;
  font-weight: 760;
  color: var(--text);
  white-space: nowrap;
  text-align: right;
}

.dsp-empty-box {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
  background: var(--bg);
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
}

@media (max-width: 1020px) {
  .dsp-ent-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dsp-ent-bar {
    padding: 10px 12px;
    gap: 8px;
  }
  .dsp-ent-bar-date {
    width: 100%;
  }
  .dsp-ent-date-input {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }
  .dsp-ent-bar-search {
    flex: 1 1 100%;
    min-width: 0;
  }
  .dsp-ent-bar-pills {
    flex: 1 1 auto;
  }
  .dsp-ent-map-btn {
    margin-left: 0;
  }
  .dsp-ent-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .dsp-ent-kpi {
    padding: 11px 12px;
  }
  .dsp-ent-kpi-val {
    font-size: 20px;
  }
  .dsp-ent-pane {
    padding: 12px;
  }
  .dsp-ent-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .dsp-ent-row-courier {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px;
    border-top: 1px dashed var(--border);
  }
  .dsp-parada-row {
    flex-wrap: wrap;
  }
  .dsp-parada-right {
    width: 100%;
    justify-content: space-between;
  }
}

/* =========================================================
   ETAPA v1.6 — PADRONIZAÇÃO VISUAL GERAL, CORREÇÃO DE MODAIS/FORMULÁRIOS
   E COMPACTAÇÃO NO PADRÃO RANKING (TODAS AS 20 TELAS)
   ========================================================= */

/* 1. Classes globais de formulários, tabelas e badges ausentes */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: start;
  min-width: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.form-label {
  font-size: 12.2px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.25;
}

.form-input {
  width: 100%;
  min-width: 0;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.2px;
  line-height: 1.3;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

select.form-input {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

textarea.form-input {
  height: auto;
  min-height: 72px;
  padding: 8px 11px;
  resize: vertical;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-input[readonly],
.form-input:disabled {
  background: var(--surface-soft);
  color: var(--text-secondary);
}

.form-input.input-sm {
  height: 34px;
  padding: 0 10px;
  font-size: 12.8px;
  border-radius: 8px;
}

select.form-input.input-sm {
  padding-right: 26px;
}

.form-input.num {
  font-variant-numeric: tabular-nums;
}

.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.muted {
  color: var(--text-muted);
}

.badge-blue {
  background: var(--blue-soft);
  border: 1px solid var(--blue-border);
  color: var(--blue);
}

/* 2. Modais e Rateio mais enxutos e alinhados */
.modal-header {
  padding: 14px 18px 12px;
}

.modal-body {
  padding: 14px 18px;
}

.modal-footer {
  padding: 12px 18px;
}

.fin-rateio-box {
  padding: 10px 12px;
  gap: 8px;
}

.fin-rateio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
  min-width: 0;
}

.fin-rateio-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* 3. Classes do módulo Entregas / Despacho (Fila, Entregadores, Regras e Popups) */
.dsp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.dsp-toolbar-left,
.dsp-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.dsp-toolbar-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.dsp-date-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dsp-date-input {
  width: 146px;
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dsp-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.dsp-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.dsp-kpi-val {
  font-size: 20px;
  font-weight: 760;
  line-height: 1.15;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dsp-kpi-sub {
  font-size: 11.8px;
  color: var(--text-muted);
}

.dsp-fila-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  flex-wrap: wrap;
}

.dsp-fila-pos {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.dsp-fila-info {
  flex: 1 1 220px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dsp-fila-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text);
}

.dsp-popup {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 190px;
  max-width: 260px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--text);
}

.dsp-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 13px;
}

.dsp-popup-addr {
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.dsp-popup-meta {
  color: var(--text-muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.dsp-popup-ent {
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
}

.dsp-faixa-km,
.dsp-faixa-rs {
  height: 36px;
  font-variant-numeric: tabular-nums;
}

/* 4. Compactação Geral no Padrão Ranking (Todas as 20 telas) */
.fin-caixa-scroll,
.dsp-scroll,
.ent-scroll,
.raiox-scroll {
  padding: 14px 20px 28px;
}

.fin-caixa-container,
.dsp-container,
.ent-container,
.raiox-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.card {
  padding: 14px 16px;
}

.card-header {
  margin-bottom: 10px;
  gap: 10px;
}

.card-title {
  font-size: 15.5px;
}

.card-subtitle {
  font-size: 12.2px;
  margin-top: 2px;
}

.kpi-card,
.cw-mini-kpi,
.dsp-ent-kpi {
  padding: 12px 14px;
}

.kpi-value,
.cw-mini-kpi-val,
.dsp-ent-kpi-val {
  font-size: 20px;
  line-height: 1.15;
}

.data-table th {
  padding: 8px 10px;
  font-size: 11.5px;
}

.data-table td {
  padding: 9px 10px;
  font-size: 13px;
}

/* Barra superior compacta do Financeiro (padrão .ent-bar do Ranking) */
.fin-bar-card {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fin-resumo-toolbar,
.fin-dre-toolbar,
.fin-contas-toolbar {
  margin-bottom: 0;
  gap: 10px 14px;
  align-items: center;
}

.fin-bar-card .card-title {
  font-size: 16px;
  margin: 0;
}

.fin-bar-card .card-subtitle {
  font-size: 12px;
  margin: 2px 0 0;
}

.fin-ext-import-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 8px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

.fin-ext-import-inline label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.fin-ext-import-select {
  width: auto;
  min-width: 175px;
  max-width: 240px;
  height: 30px !important;
  font-size: 12.2px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.fin-ext-empty-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
  font-size: 12.5px;
  color: var(--text-secondary);
}

.fin-ext-empty-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.fin-ext-accounts-grid {
  margin-top: 0;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.fin-ext-account-card {
  padding: 9px 11px;
  gap: 5px;
}

.fin-contas-filters {
  margin-top: 0;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

.fin-contas-search-wrap {
  min-width: 280px;
  width: 310px;
  max-width: 100%;
  flex: 0 1 310px;
}

.fin-dre-ladder {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.fin-dre-step {
  padding: 10px 12px;
  gap: 3px;
}

.fin-dre-val {
  font-size: 17.5px;
}

#view-inicio .home-kpis {
  gap: 12px;
}

#view-inicio .home-header {
  padding: 10px 15px;
  gap: 10px 12px;
}

#view-inicio .home-header-left {
  flex: 1 1 320px;
  min-width: 0;
}

#view-inicio .home-header-meta {
  font-size: 12px;
  gap: 6px;
  line-height: 1.3;
}

#view-inicio .home-period-bar {
  flex: 0 0 auto;
  margin-top: 0;
}

#view-inicio .home-period-pill {
  padding: 4px 9px;
  font-size: 12px;
}

@media (min-width: 1181px) {
  #view-inicio .home-header {
    flex-wrap: nowrap;
  }
}

#view-inicio .home-kpi-card {
  padding: 12px 14px;
  border-radius: 14px;
  gap: 6px;
}

#view-inicio .home-kpi-val {
  font-size: 21px;
}

#view-inicio .home-panel {
  padding: 14px 16px;
  border-radius: 14px;
  gap: 12px;
}

#view-inicio .home-row-charts,
#view-inicio .home-row-leaks {
  gap: 12px;
}

@media (max-width: 1020px) {
  .fin-dre-ladder {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .fin-caixa-scroll,
  .dsp-scroll,
  .ent-scroll,
  .raiox-scroll {
    padding: 10px 12px 24px;
  }

  .form-row-2,
  .fin-rateio-grid,
  .fin-rateio-grid.cols-3,
  .fin-dre-ladder {
    grid-template-columns: 1fr;
  }

  .fin-contas-search-wrap {
    min-width: 0;
    width: 100%;
    flex: 1 1 100%;
  }

  .fin-ext-import-inline {
    width: 100%;
  }

  .fin-ext-import-select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
  }

  .dsp-toolbar {
    padding: 10px 12px;
  }
}

/* =========================================================
   ETAPA v1.7 — MODAL DE DETALHES NOS VAZAMENTOS, TOPO ESCURO COMPACTO
   NO INÍCIO E TOP 5 + MATRIZ KASAVANA & SMITH EM 3 NÍVEIS
   ========================================================= */

/* 1. Modal largo para detalhes completos de pedido (.modal-lg) */
.modal-sheet.modal-lg {
  max-width: 820px;
}

.detail-container.detail-in-modal {
  gap: 12px;
}

/* 2. Topo escuro elegante no Início envolvendo cabeçalho + 4 cards KPI (.home-hero-band, v1.9) */
#view-inicio .home-hero-band {
  background: linear-gradient(135deg, #241914 0%, #3a2117 58%, #592618 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 14px 18px 16px;
  box-shadow: 0 12px 28px rgba(36, 25, 20, 0.16);
  color: #faf6f0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

#view-inicio .home-hero-band .home-header {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  color: #faf6f0;
}

#view-inicio .home-hero-band .home-kpi-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 6px 16px rgba(15, 10, 8, 0.18);
}

#view-inicio .home-hero-band .home-kpi-card:hover {
  background: #ffffff;
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 8px 20px rgba(15, 10, 8, 0.24);
}

#view-inicio .home-header-title {
  color: #faf6f0;
}

#view-inicio .home-header-meta {
  color: rgba(246, 239, 230, 0.80);
}

#view-inicio .home-header-meta strong {
  color: #ffffff;
  font-weight: 700;
}

#view-inicio .home-header-meta-sep {
  color: rgba(255, 255, 255, 0.28);
}

#view-inicio .home-header-sync {
  color: rgba(246, 239, 230, 0.68);
}

#view-inicio .home-status-pill {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
  color: #faf6f0;
}

#view-inicio .home-status-pill.is-aberta {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(74, 222, 128, 0.38);
  color: #bbf7d0;
}

#view-inicio .home-status-pill.is-preparacao {
  background: rgba(245, 158, 11, 0.20);
  border-color: rgba(251, 191, 36, 0.38);
  color: #fde68a;
}

#view-inicio .home-status-pill.is-pos {
  background: rgba(59, 130, 246, 0.20);
  border-color: rgba(96, 165, 250, 0.38);
  color: #bfdbfe;
}

#view-inicio .home-period-pills {
  background: rgba(15, 10, 8, 0.28);
  border-color: rgba(255, 255, 255, 0.14);
}

#view-inicio .home-period-pill {
  color: rgba(250, 246, 240, 0.84);
}

#view-inicio .home-period-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

#view-inicio .home-period-pill.active {
  background: #faf6f0;
  color: #241914;
  font-weight: 740;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

/* 3. Barra de subfiltros em 3 níveis (Produtos | Sabores / Receitas | Complementos) */
#view-inicio .home-subfilter-bar {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  flex-wrap: wrap;
  padding: 8px 11px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}

#view-inicio .home-subfilter-label {
  font-size: 12px;
  font-weight: 680;
  color: var(--text-secondary);
  white-space: nowrap;
}

#view-inicio .home-subfilter-pills {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}

#view-inicio .home-subfilter-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 640;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

#view-inicio .home-subfilter-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

#view-inicio .home-subfilter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

#view-inicio .home-kas-dot[data-home-action] {
  cursor: pointer;
}

/* Destaque nas 3 abas de nível (Produtos | Sabores / Receitas | Complementos) */
#view-inicio .home-level-switch-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

#view-inicio .home-level-switch-label {
  font-size: 11.5px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary);
}

#view-inicio .home-level-tabs {
  background: #f6ede6;
  border: 1.5px solid rgba(200, 85, 61, 0.34);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
  box-shadow: 0 1px 4px rgba(200, 85, 61, 0.10);
}

#view-inicio .home-level-tabs .home-seg-btn {
  font-size: 12.5px;
  font-weight: 700;
  color: #5a382b;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

#view-inicio .home-level-tabs .home-seg-btn:hover:not(.active) {
  background: rgba(200, 85, 61, 0.10);
  color: #241914;
}

#view-inicio .home-level-tabs .home-seg-btn.active {
  background: #c8553d;
  color: #ffffff;
  box-shadow: 0 2px 7px rgba(200, 85, 61, 0.32);
}

@media (max-width: 720px) {
  #view-inicio .home-hero-band {
    padding: 12px 13px 14px;
    border-radius: 15px;
    gap: 10px;
  }

  #view-inicio .home-level-switch-wrap {
    width: 100%;
  }

  #view-inicio .home-level-switch-label {
    display: none;
  }

  #view-inicio .home-level-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #view-inicio .home-level-tabs .home-seg-btn {
    padding: 6px 4px;
    font-size: 11.5px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}


