:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-soft: #f8faff;
  --line: #dde4f0;
  --text: #1c2840;
  --muted: #69768f;
  --brand: #5368d5;
  --brand-2: #7e8ff0;
  --brand-deep: #3548a5;
  --shadow: 0 20px 45px rgba(26, 40, 72, 0.10);
  --sidebar: linear-gradient(180deg, #4c60cb 0%, #3f4faa 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(126, 143, 240, 0.18), transparent 22%),
    linear-gradient(180deg, #f7f8fc 0%, var(--bg) 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 11px 16px;
}

.secondary-action {
  background: #eef1fb;
  color: var(--brand-deep);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.status-tag.live {
  background: #dff5e6;
  color: #1b7d46;
}

.status-tag.soon {
  background: #eef1fb;
  color: var(--brand-deep);
}

.hidden {
  display: none;
}

.login-shell,
.placeholder-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card,
.placeholder-panel.standalone {
  width: min(100%, 440px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h1,
.placeholder-panel h1 {
  margin: 16px 0 10px;
  font-size: 2rem;
}

.login-card p,
.placeholder-panel p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label,
.field label {
  font-size: 0.86rem;
  color: var(--muted);
}

.login-form input,
.field input,
.field select {
  width: 100%;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.error {
  min-height: 1.2rem;
  color: #b32944;
  font-size: 0.88rem;
  margin-top: 12px;
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.83rem;
}

.dashboard-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 28px;
  border-radius: 28px;
  color: #fff;
  background: linear-gradient(135deg, #4457b8 0%, #6274df 55%, #8492ec 100%);
  box-shadow: var(--shadow);
}

.dashboard-hero h1 {
  margin: 14px 0 10px;
  font-size: 2rem;
}

.dashboard-hero p {
  margin: 0;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.6;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.module-card {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.module-card.primary {
  background: linear-gradient(180deg, #ffffff 0%, #f6f8ff 100%);
}

.module-card h2 {
  margin: 18px 0 8px;
  font-size: 1.5rem;
}

.module-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  background: var(--sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transition: padding 0.25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 6px 8px;
}

/* ── Toggle button ── */
.sidebar-toggle {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  text-align: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: rgba(255,255,255,0.22);
}

/* ── Collapsed state ── */
.app-shell.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 20px 8px;
  align-items: center;
  overflow: visible;
}

.app-shell.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  gap: 0;
  padding: 0;
}

.app-shell.sidebar-collapsed .sidebar-brand-text {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  width: 40px;
  padding: 8px 0;
}

.app-shell.sidebar-collapsed .nav-entry {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.app-shell.sidebar-collapsed .nav-entry strong,
.app-shell.sidebar-collapsed .nav-entry span {
  display: none;
}

.app-shell.sidebar-collapsed .nav-entry::before {
  content: attr(data-initial);
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

/* ── Hover expand (overlay, sem mover conteudo) ── */
.app-shell.sidebar-collapsed .sidebar:hover {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  z-index: 200;
  padding: 24px 18px;
  align-items: stretch;
  overflow-y: auto;
  box-shadow: 4px 0 32px rgba(26,40,72,0.28);
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-brand {
  flex-direction: row;
  gap: 14px;
  padding: 6px 8px;
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-brand-text {
  display: block;
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-toggle {
  width: 100%;
  padding: 8px;
}

.app-shell.sidebar-collapsed .sidebar:hover .nav-entry {
  width: auto;
  height: auto;
  padding: 14px 14px 14px 16px;
  justify-content: flex-start;
}

.app-shell.sidebar-collapsed .sidebar:hover .nav-entry::before {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar:hover .nav-entry strong,
.app-shell.sidebar-collapsed .sidebar:hover .nav-entry span {
  display: block;
}

.app-shell.sidebar-collapsed .sidebar:hover .sidebar-footer {
  display: block;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}

.sidebar-brand span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.85rem;
  margin-top: 2px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-entry {
  padding: 14px 14px 14px 16px;
  text-align: left;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-entry strong,
.nav-entry span {
  display: block;
}

.nav-entry span {
  margin-top: 4px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.4;
}

.nav-entry.active {
  background: rgba(255, 255, 255, 0.18);
}

.sidebar-footer {
  margin-top: auto;
}

.sidebar-footer .secondary-action {
  width: 100%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.workspace {
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.module-switch,
.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.module-link {
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border: 1px solid transparent;
}

.module-link.active {
  background: #eef1fb;
  color: var(--brand-deep);
  border-color: #dce2fb;
}

.user-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: #f3f5fc;
  color: var(--muted);
  font-size: 0.88rem;
}

.view-section {
  margin-top: 18px;
}

.panel,
.placeholder-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  margin-top: 16px;
}

.filters-panel {
  display: grid;
  grid-template-columns: 1.4fr 1.8fr 1.1fr 0.8fr;
  gap: 12px;
}

.compact-header {
  padding: 14px 18px;
}

.section-head.compact {
  margin-bottom: 0;
}

.muted-tag {
  background: #eef1fb;
  color: var(--brand-deep);
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.legend-card {
  padding: 14px 16px;
  border: 1px solid #dce6f7;
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff 0%, #f3f8ff 100%);
}

.legend-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--brand-deep);
}

.legend-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 6px;
}

.field-action {
  align-self: end;
}

.field-action button {
  width: 100%;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}

.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-note {
  margin-top: 6px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-soft);
  color: var(--text);
}

.check-item input {
  margin-top: 2px;
}

.pagination-summary {
  color: var(--muted);
  font-size: 0.88rem;
  align-self: center;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
}

table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf1f7;
  font-size: 0.86rem;
}

th {
  position: sticky;
  top: 0;
  background: #f7f9ff;
  text-align: left;
  z-index: 3;
  box-shadow: inset 0 -1px 0 #dfe7f4;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

.sort-ind {
  margin-left: 4px;
  color: #7a88a8;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pill {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.s1 {
  background: #fee2e2;
  color: #991b1b;
}

.s2 {
  background: #ffedd5;
  color: #9a3412;
}

.s3 {
  background: #dcfce7;
  color: #166534;
}

.s4 {
  background: #e2e8f0;
  color: #334155;
}

.placeholder-panel {
  padding: 28px;
}

.abc-row-hover {
  background: #f8faff;
}

.abc-hover-card {
  position: fixed;
  z-index: 40;
  width: 360px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 50px rgba(25, 40, 72, 0.18);
  pointer-events: none;
}

.abc-hover-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.abc-hover-head strong {
  font-size: 0.92rem;
}

.abc-hover-head span,
.abc-hover-empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.abc-hover-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: 6px;
  min-height: 170px;
}

.abc-bar-wrap {
  display: grid;
  gap: 6px;
  align-items: end;
  justify-items: center;
}

.abc-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, #6d82eb 0%, #4c60cb 100%);
}

.abc-bar-value,
.abc-bar-label {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}

.ruptura-sparkline {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: 4px;
  min-width: 180px;
  height: 52px;
}

.ruptura-spark-col {
  display: grid;
  align-items: end;
  justify-items: center;
  gap: 4px;
}

.ruptura-spark-bar {
  width: 100%;
  min-height: 6px;
  border-radius: 999px;
  background: #d9dfef;
}

.ruptura-spark-bar.has-sale {
  background: linear-gradient(180deg, #86d39d 0%, #339860 100%);
}

.ruptura-spark-label {
  font-size: 0.66rem;
  color: var(--muted);
}

.pedido-group-row td {
  background: #f7f9ff;
  font-weight: 700;
}

.pedido-detail-row td {
  background: #eef5ff;
}

.minmax-detail-row td {
  background: #eef5ff;
}

.pedido-detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 46%) 1fr;
  gap: 20px;
  padding: 14px 10px;
  align-items: start;
}

.minmax-detail-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(5, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px 8px;
  align-items: start;
}

.pedido-detail-chart {
  display: grid;
  gap: 8px;
}

.minmax-detail-chart {
  display: grid;
  gap: 8px;
}

.minmax-detail-block {
  align-content: start;
}

.pedido-detail-title {
  font-size: 0.9rem;
}

.pedido-detail-metrics {
  align-content: start;
}

.pedido-toggle {
  padding: 6px 10px;
  min-width: 40px;
}

.minmax-toggle {
  padding: 6px 10px;
  min-width: 40px;
}

.metric-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

.pedido-metric-table {
  width: 100%;
  min-width: 420px;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid #d9e5fb;
  border-radius: 14px;
  overflow: hidden;
}

.pedido-metric-table th,
.pedido-metric-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #dce6f7;
  font-size: 0.84rem;
  vertical-align: top;
}

.pedido-metric-table tr:last-child th,
.pedido-metric-table tr:last-child td {
  border-bottom: 0;
}

.pedido-metric-table th {
  width: 22%;
  background: rgba(234, 241, 255, 0.7);
  color: #41506f;
  font-weight: 700;
}

.pedido-metric-table td {
  width: 28%;
  background: rgba(255, 255, 255, 0.65);
  color: var(--text);
}

.pedido-detail-row .ruptura-sparkline {
  min-width: 0;
  width: 100%;
  max-width: 340px;
  height: 42px;
  gap: 3px;
}

.pedido-detail-row .ruptura-spark-col {
  gap: 3px;
}

.pedido-detail-row .ruptura-spark-bar {
  min-height: 4px;
}

.pedido-detail-row .ruptura-spark-label {
  font-size: 0.62rem;
}

.minmax-detail-row .ruptura-sparkline {
  min-width: 0;
  width: 100%;
  max-width: 340px;
  height: 42px;
  gap: 3px;
}

.minmax-detail-row .ruptura-spark-col {
  gap: 3px;
}

.minmax-detail-row .ruptura-spark-bar {
  min-height: 4px;
}

.minmax-detail-row .ruptura-spark-label {
  font-size: 0.62rem;
}

.minmax-metric-table {
  min-width: 0;
  table-layout: fixed;
}

.minmax-metric-table th,
.minmax-metric-table td {
  padding: 9px 10px;
}

#minmaxTable {
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

#minmaxTable th,
#minmaxTable td {
  padding: 8px 6px;
  font-size: 0.79rem;
  vertical-align: top;
}

.minmax-wrap {
  overflow-x: auto;
  overflow-y: visible;
}

.minmax-head-wrap {
  position: sticky;
  top: 0;
  z-index: 12;
  overflow: hidden;
  background: #f7f9ff;
  border-bottom: 1px solid #dfe7f4;
}

#minmaxHeadTable {
  min-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}

#minmaxHeadTable th {
  padding: 8px 6px;
  font-size: 0.79rem;
  background: #f7f9ff;
  white-space: normal;
  vertical-align: top;
  position: static;
}

#minmaxHeadTable .minmax-col-toggle,
#minmaxTable .minmax-col-toggle {
  width: 48px;
  text-align: center;
}

#minmaxHeadTable .minmax-col-sel,
#minmaxTable .minmax-col-sel {
  width: 42px;
  text-align: center;
}

#minmaxHeadTable .minmax-col-fornecedor,
#minmaxTable .minmax-col-fornecedor {
  width: 15%;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

#minmaxHeadTable .minmax-col-codigo,
#minmaxTable .minmax-col-codigo {
  width: 7%;
  white-space: nowrap;
}

#minmaxHeadTable .minmax-col-produto,
#minmaxTable .minmax-col-produto {
  width: 24%;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

#minmaxHeadTable .minmax-col-num,
#minmaxTable .minmax-col-num {
  width: 5.8%;
  white-space: nowrap;
}

#minmaxHeadTable .minmax-col-regularidade,
#minmaxTable .minmax-col-regularidade {
  width: 6%;
  text-align: center;
  white-space: nowrap;
}

#minmaxHeadTable .minmax-col-status,
#minmaxTable .minmax-col-status {
  width: 6%;
  white-space: nowrap;
}

#minmaxTable .minmax-row td {
  overflow-wrap: anywhere;
}

#minmaxTable .minmax-detail-row td {
  padding: 0;
}

.minmax-compact-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  font-size: 0.64rem;
  white-space: nowrap;
}

.minmax-compact-pill .pill-icon {
  font-size: 0.82rem;
  line-height: 1;
}

.placeholder-panel ul {
  margin: 18px 0 0;
  padding-left: 18px;
  color: #47546d;
  line-height: 1.6;
}

.pagination-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.pagination-info {
  min-width: 120px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination-bar button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sticky-head-wrap {
  position: sticky;
  top: 0;
  z-index: 12;
  overflow: hidden;
  background: #f7f9ff;
  border-bottom: 1px solid #dfe7f4;
}

.sticky-head-wrap table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.sticky-head-wrap th {
  background: #f7f9ff;
  position: static;
  white-space: nowrap;
  padding: 10px 12px;
  font-size: 0.86rem;
  box-shadow: inset 0 -1px 0 #dfe7f4;
}

.margem-filters {
  grid-template-columns: 0.9fr 0.9fr 1.1fr 1.6fr 0.9fr;
}

.historico-fornecedor-filters {
  grid-template-columns: 1.4fr 1.6fr 0.9fr 0.8fr;
}

.margin-toggle-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.metric-card {
  background: linear-gradient(180deg, #ffffff 0%, #f5f8ff 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  margin-bottom: 10px;
}

.metric-card strong {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.hist-fornecedor-secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hist-month-grid {
  display: grid;
  gap: 12px;
}

.hist-month-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid #dce6f7;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
}

.hist-month-card strong {
  font-size: 0.92rem;
  color: var(--brand-deep);
}

.hist-month-card span,
.hist-empty {
  color: var(--muted);
  font-size: 0.82rem;
}

.hist-chart-shell {
  display: grid;
  gap: 12px;
}

.hist-inline-check {
  min-height: 48px;
  align-items: center;
}

.hist-chart-legend {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.84rem;
}

.hist-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hist-chart-legend .swatch {
  width: 18px;
  height: 3px;
  border-radius: 999px;
  display: inline-block;
}

.hist-chart-legend .swatch.pedidos {
  background: #4b63d3;
}

.hist-chart-legend .swatch.valor {
  background: #2d9b63;
}

.hist-line-chart {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.hist-chart-guide {
  stroke: #dfe6f4;
  stroke-width: 1;
}

.hist-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hist-line.pedidos {
  stroke: #4b63d3;
}

.hist-line.valor {
  stroke: #2d9b63;
}

.hist-line-dot {
  stroke: #fff;
  stroke-width: 2;
}

.hist-line-dot.pedidos {
  fill: #4b63d3;
}

.hist-line-dot.valor {
  fill: #2d9b63;
}

.hist-chart-label {
  fill: #61708d;
  font-size: 13px;
}

.alert-panel {
  padding: 16px 18px;
  background: linear-gradient(180deg, #fff8e8 0%, #fffdf7 100%);
  border-color: #f3d28b;
}

.alert-panel strong {
  display: block;
  margin-bottom: 4px;
  color: #8a5700;
}

.alert-panel p {
  margin: 0;
  color: #946200;
}

.pill.ok {
  background: #dcfce7;
  color: #166534;
}

.pill.warn {
  background: #ffedd5;
  color: #9a3412;
}

.pill.danger {
  background: #fee2e2;
  color: #991b1b;
}

.placeholder-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.vendas-filters {
  grid-template-columns: 1.3fr 1fr 1.5fr 0.6fr;
}

.vendas-focus-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.vendas-chart-shell {
  display: grid;
  gap: 12px;
}

.vendas-chart-scroll {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 6px;
}

.vendas-bar {
  fill: #1f8cff;
}

.vendas-bar-value {
  fill: #41506f;
  font-size: 11px;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: 18px;
    position: static;
    height: auto;
    overflow: visible;
  }

  .filters-panel,
  .param-grid,
  .legend-grid,
  .toggle-grid,
  .metrics-grid,
  .hist-fornecedor-secondary,
  .dashboard-grid,
  .vendas-focus-grid {
    grid-template-columns: 1fr 1fr;
  }

  .minmax-detail-grid,
  .pedido-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Multi-select component ────────────────────────────────────────���──────── */

.multi-select {
  position: relative;
  display: grid;
  gap: 6px;
}

.ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  min-height: 46px;
  gap: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.ms-trigger:focus,
.multi-select.ms-active .ms-trigger {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(83, 104, 213, 0.13);
}

.ms-placeholder {
  flex: 1;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ms-chevron {
  font-size: 0.7rem;
  color: var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s;
}

.multi-select.ms-active .ms-chevron {
  transform: rotate(180deg);
}

.ms-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ms-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  border-radius: 999px;
  background: #eef1fb;
  color: var(--brand-deep);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.ms-tag-remove {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--brand-deep);
  cursor: pointer;
  line-height: 1;
}

.ms-tag-remove:hover {
  background: rgba(83, 104, 213, 0.18);
}

.ms-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 8px 28px rgba(26, 40, 72, 0.14);
  overflow: hidden;
}

.ms-dropdown.ms-open {
  display: flex;
  flex-direction: column;
}

.ms-search {
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--panel-soft);
  outline: none;
}

.ms-search:focus {
  background: var(--panel);
}

.ms-options {
  max-height: 220px;
  overflow-y: auto;
  padding: 6px 0;
}

.ms-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--text);
  transition: background 0.1s;
}

.ms-option:hover {
  background: var(--bg);
}

.ms-option.ms-checked {
  background: #eef1fb;
  color: var(--brand-deep);
  font-weight: 500;
}

.ms-option input[type="checkbox"] {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.ms-options:empty::after {
  content: "Nenhum resultado";
  display: block;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ─── Periodo range toggle ───────────────────────────────────────────────── */

.period-range-toggle {
  background: none;
  border: 1px solid var(--line);
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 6px;
  transition: background 0.15s, color 0.15s;
}

.period-range-toggle:hover,
.period-range-toggle.period-range-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.periodo-range-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.periodo-range-wrap input[type="date"] {
  flex: 1;
  padding: 11px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

.periodo-range-wrap input[type="date"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(83, 104, 213, 0.13);
}

.range-sep {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────── */

@media (max-width: 780px) {
  .dashboard-hero,
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .filters-panel,
  .param-grid,
  .legend-grid,
  .toggle-grid,
  .metrics-grid,
  .hist-fornecedor-secondary,
  .dashboard-grid,
  .placeholder-actions,
  .vendas-focus-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .workspace {
    padding: 14px;
  }

  .minmax-detail-grid,
  .pedido-detail-grid {
    grid-template-columns: 1fr;
  }

  .periodo-range-wrap {
    flex-direction: column;
    align-items: stretch;
  }
}
