:root {
  --red: #b5191a;
  --red-deep: #8e1214;
  --ink: #1c2230;
  --muted: #667085;
  --line: #e6e8f0;
  --card: #ffffff;
  --bg: #f3f5fa;
  --amber: #f0b429;
  --green: #0f7a5a;
  --down: #9d2c3c;
  --shadow: 0 10px 28px rgba(28, 34, 48, 0.06);
  --sans: "Outfit", "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
  --side: 260px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 110% -10%, rgba(210, 60, 72, 0.08), transparent 50%),
    radial-gradient(700px 380px at -10% 30%, rgba(27, 42, 74, 0.06), transparent 46%),
    var(--bg);
  min-height: 100vh;
}
button, input, select { font-family: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }

.app {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  min-height: 100vh;
}

.seller-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(900px 420px at 110% -10%, rgba(210, 60, 72, 0.12), transparent 50%),
    radial-gradient(700px 380px at -10% 30%, rgba(27, 42, 74, 0.08), transparent 46%),
    var(--bg);
}
.seller-gate-card {
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 26px 24px;
}
.seller-gate-eyebrow {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 650;
  margin-bottom: 10px;
}
.seller-gate-card h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2rem);
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.seller-gate-text {
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 18px;
}
.seller-gate-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.seller-gate-option {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: left;
  font-size: 14px;
  font-weight: 560;
  color: var(--ink);
}
.seller-gate-option:hover {
  border-color: #c5cad6;
}
.seller-gate-option.is-selected {
  background: var(--red);
  border-color: var(--red-deep);
  color: #fff;
}
.seller-gate-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
}
.seller-gate-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.btn-import:disabled {
  opacity: .55;
  cursor: not-allowed;
}

@media (max-width: 520px) {
  .seller-gate-list {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--red);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 16px;
  overflow: auto;
}
.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.sidebar-top .brand {
  flex: 1 1 auto;
  min-width: 0;
}
.sidebar-hide-btn,
.sidebar-show-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}
.sidebar-hide-btn:hover,
.sidebar-show-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}
.sidebar-hide-btn svg,
.sidebar-show-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sidebar-show-btn {
  position: fixed;
  top: 18px;
  left: 12px;
  z-index: 40;
  background: var(--red);
  border-color: var(--red-deep);
  box-shadow: var(--shadow);
}
body.is-sidebar-collapsed .app {
  grid-template-columns: 1fr;
}
body.is-sidebar-collapsed .sidebar {
  display: none;
}
body.is-sidebar-collapsed .main {
  padding-left: 56px;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 6px 10px;
}
.brand img { width: 168px; height: auto; display: block; }
.brand small {
  opacity: .82;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.panel {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 16px;
  padding: 14px;
}
.panel-label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .75;
}
.panel-title {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 20px;
}
.panel-meta {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.4;
  opacity: .9;
}
.panel-note {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  opacity: .78;
}
.mapa-isbn-warn {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #3a0f12;
  border: 1px solid rgba(255, 196, 196, 0.35);
  color: #ffe4e4;
  font-size: 12px;
  line-height: 1.45;
}
.mapa-isbn-warn strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.mapa-isbn-banner {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff4f4;
  border: 1px solid #f0b7bc;
  color: #7a1b22;
  font-size: 14px;
  line-height: 1.45;
}
.mapa-isbn-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}
.active-filters {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.active-filters li {
  font-size: 13px;
  line-height: 1.35;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 10px;
  padding: 8px 10px;
}
.active-filters strong {
  display: block;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  opacity: .75;
  font-weight: 560;
  margin-bottom: 2px;
}
.side-clear-filters {
  margin-top: 10px;
  width: 100%;
  border: 1px solid rgba(255,255,255,.35);
  background: transparent;
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
}
.side-clear-filters:hover {
  background: rgba(255,255,255,.12);
}
.active-filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.active-filters-bar .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink);
  box-shadow: var(--shadow);
  font-family: inherit;
}
.active-filters-bar .filter-chip em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.active-filters-bar .filter-chip.is-warn {
  background: #fff4d6;
  border-color: #f0d48a;
}
.active-filters-bar .filter-chip.is-danger {
  background: #fdecee;
  border-color: #f3c4ca;
  color: var(--down);
}
.active-filters-bar .filter-chip.is-removable {
  cursor: pointer;
  padding-right: 10px;
}
.active-filters-bar .filter-chip.is-removable:hover {
  border-color: var(--red);
  color: var(--red);
}
.active-filters-bar .filter-chip .chip-x {
  margin-left: 2px;
  font-size: 15px;
  line-height: 1;
  color: var(--muted);
}
.active-filters-bar .filter-chip.is-removable:hover .chip-x {
  color: var(--red);
}
.active-filters-bar .clear-filters-main {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 7px 12px;
  border: 1px solid var(--red);
  background: #fff;
  color: var(--red);
  font-size: 13px;
  font-weight: 560;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.active-filters-bar .clear-filters-main:hover:not(:disabled) {
  background: var(--red);
  color: #fff;
}
.active-filters-bar .clear-filters-main:disabled {
  opacity: .45;
  cursor: default;
}
.btn-import {
  margin-top: 12px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  color: var(--red-deep);
  font-weight: 600;
}
.btn-import svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-import:hover { background: #fff5f5; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.side-kpis {
  display: grid;
  gap: 8px;
  margin-top: auto;
}
.side-kpis div {
  background: rgba(0,0,0,.14);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}
.side-kpis span {
  font-size: 12px;
  opacity: .8;
  line-height: 1.25;
}
.side-kpis strong {
  font-size: 18px;
  font-family: var(--serif);
}

.main {
  padding: 28px 32px 40px;
  min-width: 0;
}

.client-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px 18px 14px;
  margin-bottom: 18px;
}
.client-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.client-bar-label {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 560;
}
.client-bar-meta {
  font-size: 13px;
  color: var(--muted);
}
.client-bar {
  overflow: visible;
}
.client-bar-controls {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) minmax(220px, 1fr) minmax(260px, 1.2fr);
  gap: 10px;
  align-items: start;
}
.client-seller-wrap select {
  font-weight: 560;
}
.client-bar-secondary {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}
.isbn-toggle {
  border: 0;
  background: transparent;
  color: var(--red);
  font-size: 13px;
  font-weight: 560;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.isbn-toggle:hover {
  color: var(--red-deep);
}
.coverage-mode {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.coverage-mode-label {
  font-size: 12px;
  font-weight: 560;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.coverage-mode-toggle {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7f8fc;
  gap: 2px;
}
.coverage-mode-btn {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.2;
}
.coverage-mode-btn:hover {
  color: var(--ink);
}
.coverage-mode-btn.is-active {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 12px rgba(181, 25, 26, 0.22);
}
.isbn-search-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}
.product-search-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}
.product-search-field {
  position: relative;
  min-width: min(280px, 100%);
  max-width: 420px;
  flex: 1 1 260px;
  z-index: 30;
}
.isbn-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7f8fc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  width: 100%;
}
.isbn-search.is-open {
  border-color: var(--red);
  background: #fff;
}
.isbn-search svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  flex: 0 0 auto;
}
.isbn-search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  font-size: 13px;
}
.isbn-clear {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--muted);
  align-self: center;
}
.isbn-clear:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.product-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(28, 34, 48, 0.16);
  max-height: 280px;
  overflow: auto;
  padding: 6px;
}
.product-results-head,
.product-results-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}
.product-result {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.product-result:hover {
  background: #f7f8fc;
}
.product-result.is-selected {
  background: #fdecee;
  box-shadow: inset 0 0 0 1px #f3c4ca;
}
.product-result strong {
  font-size: 13px;
  font-weight: 560;
  color: var(--ink);
}
.product-result span,
.product-result small {
  font-size: 12px;
  color: var(--muted);
}
.product-result .pick-hint {
  font-size: 11px;
  color: var(--red);
  font-weight: 560;
}
.product-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.product-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #f3c4ca;
  background: #fdecee;
  color: var(--down);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.product-chip:hover {
  background: var(--red);
  border-color: var(--red-deep);
  color: #fff;
}
.isbn-results {
  margin-bottom: 18px;
}
.isbn-results-head {
  margin-bottom: 12px;
}
.isbn-results-label {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 560;
  margin-bottom: 4px;
}
.isbn-results-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  letter-spacing: -.02em;
}
.isbn-results-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}
.isbn-summary {
  margin-bottom: 12px;
}
.isbn-table-wrap {
  min-height: 0;
}
.isbn-table-wrap .grid tbody tr {
  cursor: pointer;
}
.isbn-table-wrap .grid tbody tr:hover {
  background: #f7f8fc;
}
.isbn-results-hint {
  padding: 12px 16px 14px;
  color: var(--muted);
  font-size: 13px;
}
.client-search-wrap {
  position: relative;
  min-width: 0;
  z-index: 40;
}
.client-search,
.client-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f7f8fc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}
.client-search.is-open {
  border-color: var(--red);
  background: #fff;
}
.client-search svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  flex: 0 0 auto;
}
.client-search input,
.client-select-wrap select {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  font-size: 14px;
  min-width: 0;
}
.client-select-wrap select {
  cursor: pointer;
}
.client-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(28, 34, 48, 0.16);
  max-height: 320px;
  overflow: auto;
  padding: 6px;
}
.client-results-head {
  padding: 8px 12px 6px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.client-result {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 4px 10px;
  align-items: start;
  cursor: pointer;
}
.client-result:hover,
.client-result.is-active {
  background: #f7f8fc;
}
.client-result strong {
  font-size: 13px;
  color: var(--red);
  grid-row: 1 / span 2;
}
.client-result span {
  font-size: 14px;
  color: var(--ink);
}
.client-result small {
  font-size: 12px;
  color: var(--muted);
  grid-column: 2;
}
.client-results-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}
.top h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.4vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -.02em;
}
.top p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
}
.title-search-wrap {
  position: relative;
  min-width: min(320px, 100%);
  z-index: 35;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.title-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 360px;
  justify-content: flex-end;
}
.title-selected .product-chip {
  max-width: 100%;
}
.title-selected .product-chip span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.title-result.is-selected {
  background: #fdecee;
}
.title-result .pick-hint {
  font-size: 11px;
  color: var(--red);
  font-weight: 560;
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.search.is-open {
  border-color: var(--red);
}
.search svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  flex: 0 0 auto;
}
.search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  font-size: 14px;
}
.search input:disabled { opacity: .55; }
.title-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(28, 34, 48, 0.16);
  max-height: 320px;
  overflow: auto;
  padding: 6px;
}
.title-results-head,
.title-results-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
}
.title-result {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.title-result:hover,
.title-result.is-active {
  background: #f7f8fc;
}
.title-result strong {
  font-size: 13px;
  font-weight: 560;
  color: var(--ink);
  line-height: 1.3;
}
.title-result span {
  font-size: 12px;
  color: var(--muted);
}
.title-result small {
  font-size: 11px;
  color: var(--muted);
}

.summary,
.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.summary-card {
  --kpi-fg: var(--ink);
  --kpi-muted: var(--muted);
  --kpi-ico: var(--red);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: var(--kpi-fg);
}
.summary-card.is-navy,
.summary-card.is-teal,
.summary-card.is-green,
.summary-card.is-slate,
.summary-card.is-maroon {
  --kpi-fg: #fff;
  --kpi-muted: rgba(255, 255, 255, 0.78);
  --kpi-ico: rgba(255, 255, 255, 0.92);
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(28, 34, 48, 0.08);
}
.summary-card.is-navy { background: #1d2d50; }
.summary-card.is-teal { background: #137a95; }
.summary-card.is-green { background: #147a57; }
.summary-card.is-slate { background: #3f4f63; }
.summary-card.is-maroon { background: #93333e; }
.summary-card.is-amber {
  background: #eab333;
  --kpi-fg: #1c2230;
  --kpi-muted: rgba(28, 34, 48, 0.72);
  --kpi-ico: rgba(28, 34, 48, 0.78);
  border-color: transparent;
}
.summary-card-wide {
  grid-column: 1 / -1;
}
.summary-card-roteiro {
  background:
    linear-gradient(135deg, rgba(181, 25, 26, 0.06), rgba(255, 255, 255, 0.9)),
    var(--card);
}
.summary-card span,
.summary-card .card-label {
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--kpi-muted);
  font-weight: 560;
}
.card-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.kpi-ico,
.chip-ico {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.summary-card .kpi-ico {
  color: var(--kpi-ico);
  width: 16px;
  height: 16px;
}
.summary-card strong {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -.02em;
  color: var(--kpi-fg);
  line-height: 1.1;
}
.summary-card strong.is-money {
  font-size: clamp(0.95rem, 1.25vw, 1.2rem);
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.summary-card small {
  font-size: 12px;
  color: var(--kpi-muted);
}
.roteiro-line {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 650;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1.35;
}
.roteiro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.roteiro-actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 560;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.roteiro-actions button:hover {
  border-color: var(--ink);
}
.roteiro-actions .is-urgent {
  background: #fdecee;
  border-color: #f3c4ca;
  color: var(--down);
}
.roteiro-actions .is-alert {
  background: #fff4d6;
  border-color: #f0d48a;
  color: #7a5608;
}
.roteiro-actions .is-idle {
  background: #e8eef8;
  border-color: #c5d2e8;
  color: #2f4a73;
}
.roteiro-actions .is-return {
  background: #efe8f4;
  border-color: #d5c6e4;
  color: #5a3d73;
}
.roteiro-actions button.is-active {
  font-weight: 650;
  box-shadow: 0 4px 14px rgba(28, 34, 48, 0.18);
  color: #fff;
}
.roteiro-actions .is-urgent.is-active {
  background: var(--red);
  border-color: var(--red-deep);
  box-shadow: 0 4px 14px rgba(181, 25, 26, 0.28);
}
.roteiro-actions .is-alert.is-active {
  background: #b8840a;
  border-color: #8f6808;
}
.roteiro-actions .is-idle.is-active {
  background: #2f4a73;
  border-color: #223656;
}
.roteiro-actions .is-return.is-active {
  background: #5a3d73;
  border-color: #432d57;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 460;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.chip:hover {
  border-color: #b8beca;
  color: var(--ink);
}
.chip.is-active {
  background: var(--red);
  border-color: var(--red-deep);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 4px 14px rgba(181, 25, 26, 0.28);
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: auto;
  min-height: 420px;
}
.empty {
  padding: 56px 40px;
  max-width: 560px;
}
.empty h2 {
  font-family: var(--serif);
  font-size: 1.7rem;
  margin-bottom: 10px;
}
.empty p {
  color: var(--muted);
  line-height: 1.55;
  font-size: 15px;
}
.btn-import-main {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 14px;
  padding: 14px 22px;
  background: var(--red);
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  box-shadow: 0 8px 20px rgba(181, 25, 26, 0.22);
}
.btn-import-main svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-import-main:hover {
  background: var(--red-deep);
}
.btn-import-main:disabled {
  opacity: .55;
  cursor: not-allowed;
  box-shadow: none;
}
.empty-hint {
  margin-top: 10px;
  font-size: 13px !important;
}

.portfolio-overview {
  padding: 22px 20px 24px;
  display: grid;
  gap: 14px;
}
.portfolio-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: end;
}
.portfolio-head h2 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  letter-spacing: -.02em;
  margin: 0;
}
.portfolio-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  max-width: 46rem;
}
.portfolio-head-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
}
.portfolio-scope {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.portfolio-clear-filter {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 560;
  color: var(--red-deep);
}
.portfolio-clear-filter:hover {
  border-color: var(--red);
}
.portfolio-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.portfolio-expand-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 2px 0 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .01em;
  cursor: pointer;
  text-align: left;
}
.portfolio-expand-toggle:hover {
  border-color: rgba(181, 25, 26, 0.35);
  color: var(--red-deep);
}
.portfolio-expand-toggle[aria-expanded="true"] {
  border-color: rgba(181, 25, 26, 0.4);
  background: rgba(181, 25, 26, 0.04);
  color: var(--red-deep);
}
.portfolio-expand-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  position: relative;
}
.portfolio-expand-icon::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 4px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .18s ease;
}
.portfolio-expand-toggle[aria-expanded="true"] .portfolio-expand-icon::before {
  top: 7px;
  transform: rotate(-135deg);
}
.portfolio-details {
  display: grid;
  gap: 14px;
}
.portfolio-details[hidden] {
  display: none;
}
.portfolio-kpi {
  --kpi-fg: #fff;
  --kpi-muted: rgba(255, 255, 255, 0.78);
  background: #1d2d50;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  text-align: left;
  font: inherit;
  color: var(--kpi-fg);
  cursor: default;
  box-shadow: 0 10px 24px rgba(28, 34, 48, 0.08);
  min-height: 112px;
  align-content: start;
}
.portfolio-kpi.is-navy { background: #1d2d50; }
.portfolio-kpi.is-teal { background: #137a95; }
.portfolio-kpi.is-maroon { background: #93333e; }
.portfolio-kpi.is-green { background: #147a57; }
.portfolio-kpi.is-amber {
  background: #eab333;
  --kpi-fg: #1c2230;
  --kpi-muted: rgba(28, 34, 48, 0.72);
}
.portfolio-kpi.is-slate {
  background: #3f4f63;
}
.portfolio-kpi.is-clickable {
  cursor: pointer;
}
.portfolio-kpi.is-clickable:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}
.portfolio-kpi.is-active {
  outline: 2px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(181, 25, 26, 0.35), 0 12px 28px rgba(28, 34, 48, 0.14);
}
.portfolio-kpi-label {
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--kpi-muted);
  font-weight: 560;
  line-height: 1.3;
}
.portfolio-kpi-value {
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  font-weight: 650;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--kpi-fg);
}
.portfolio-kpi-value.is-money {
  font-size: clamp(0.95rem, 1.25vw, 1.15rem);
  letter-spacing: -.02em;
  overflow-wrap: anywhere;
  line-height: 1.15;
}
.portfolio-kpi-meta {
  font-size: 11px;
  color: var(--kpi-muted);
  line-height: 1.35;
}

.portfolio-mid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.portfolio-lists {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.portfolio-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  min-width: 0;
}
.portfolio-panel h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}
.portfolio-panel-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.portfolio-roteiro {
  background:
    linear-gradient(135deg, rgba(181, 25, 26, 0.05), rgba(255, 255, 255, 0.9)),
    var(--bg);
}
.portfolio-bands {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.portfolio-bands li {
  margin: 0;
}
.portfolio-band {
  width: 100%;
  display: grid;
  grid-template-columns: 110px 1fr 28px;
  gap: 8px;
  align-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 6px 4px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.portfolio-band:hover,
.portfolio-band.is-active {
  background: #fff;
  border-color: var(--line);
}
.portfolio-band.is-active {
  border-color: var(--red);
}
.portfolio-band-label {
  font-size: 12px;
  font-weight: 560;
}
.portfolio-band-track {
  height: 10px;
  border-radius: 999px;
  background: #e8ebf2;
  overflow: hidden;
}
.portfolio-band-fill {
  display: block;
  height: 100%;
  width: var(--w, 0%);
  border-radius: inherit;
  background: #5b6b8c;
}
.portfolio-band-fill.is-down { background: var(--down); }
.portfolio-band-fill.is-ok { background: var(--green); }
.portfolio-band-n {
  text-align: right;
  font-size: 12px;
  font-weight: 650;
}
.portfolio-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.portfolio-list li {
  margin: 0;
}
.portfolio-list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 4px 6px 2px;
  border-radius: 10px;
}
.portfolio-list-row:hover {
  background: #fff;
}
.portfolio-list-open {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns:
    minmax(220px, 1.6fr)
    minmax(210px, 1.1fr)
    minmax(190px, 1fr);
  gap: 12px 18px;
  align-items: center;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 4px 6px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.portfolio-list-row.no-stock .portfolio-list-open {
  grid-template-columns:
    minmax(260px, 1.8fr)
    minmax(160px, 0.8fr);
}
.portfolio-list .portfolio-item-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.portfolio-list .portfolio-item-main strong {
  font-size: 13px;
  font-weight: 560;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
}
.portfolio-list .portfolio-item-main span {
  font-size: 11px;
  color: var(--muted);
}
.portfolio-item-stock {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.35;
  white-space: normal;
}
.portfolio-item-metric,
.portfolio-list em {
  font-style: normal;
  font-weight: 650;
  font-size: 12px;
  color: var(--red-deep);
  line-height: 1.35;
  white-space: normal;
}
button.portfolio-ignore-btn {
  flex: none;
  width: auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  border: 1px solid rgba(28, 34, 48, 0.12);
  background: #e8ebf2;
  color: #5b6578;
  border-radius: 8px;
  padding: 0 9px;
  margin: 0 4px 0 0;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: none;
}
button.portfolio-ignore-btn:hover {
  color: var(--red-deep);
  border-color: rgba(142, 18, 20, 0.22);
  background: #f3e4e5;
}
button.portfolio-ignore-btn.is-restore:hover {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.28);
  background: #e7f4f1;
}
.portfolio-list-row.is-ignored {
  opacity: 0.78;
}
.portfolio-list-row.is-ignored .portfolio-item-metric,
.portfolio-list-row.is-ignored em {
  color: var(--muted);
  font-weight: 500;
}
.portfolio-ignored {
  margin-top: 4px;
}
.portfolio-ignored-label {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.portfolio-ignored-label:first-child {
  margin-top: 8px;
}
.portfolio-empty-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.grid-panel {
  display: grid;
  gap: 0;
  min-width: 0;
}
.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafbfe;
}
.grid-sit-filters {
  display: none;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}
.grid-sit-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 11px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
}
.grid-sit-btn:hover {
  border-color: rgba(181, 25, 26, 0.35);
}
.grid-sit-btn.is-active {
  box-shadow: inset 0 0 0 1px currentColor;
}
.grid-sit-btn.is-urgent {
  background: #fdecee;
  color: var(--down);
  border-color: rgba(181, 25, 26, 0.22);
}
.grid-sit-btn.is-alert {
  background: #fff4d6;
  color: #7a5608;
  border-color: rgba(122, 86, 8, 0.22);
}
.grid-sit-btn.is-idle {
  background: #e8eef8;
  color: #2f4a73;
  border-color: rgba(47, 74, 115, 0.22);
}
.grid-sit-btn.is-return {
  background: #efe8f4;
  color: #5a3d73;
  border-color: rgba(90, 61, 115, 0.22);
}
.grid-sit-btn.is-zero {
  background: #eef0f5;
  color: var(--muted);
  border-color: rgba(90, 98, 112, 0.22);
}
.grid-sit-btn.is-ok {
  background: #e7f6ef;
  color: var(--green);
  border-color: rgba(34, 120, 80, 0.22);
}
.grid-sit-btn.is-distribute {
  background: #fde8d8;
  color: #9a3f12;
  border-color: rgba(154, 63, 18, 0.22);
}
.grid-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.grid.is-consignado-only th[data-sort="comprado"],
.grid.is-consignado-only th[data-sort="total"],
.grid.is-consignado-only th[data-sort="fisico"],
.grid.is-consignado-only td.col-comprado,
.grid.is-consignado-only td.col-total,
.grid.is-consignado-only td.col-fisico {
  display: none;
}
.grid-expand-btn[aria-pressed="true"] {
  border-color: rgba(181, 25, 26, 0.4);
  background: rgba(181, 25, 26, 0.06);
  color: var(--red-deep);
}
.grid-toolbar-title {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}
.grid-expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
}
.grid-expand-btn:hover {
  border-color: rgba(181, 25, 26, 0.35);
  color: var(--red-deep);
}
.grid-expand-ico {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.grid-scroll {
  overflow: auto;
  min-width: 0;
}
.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
body.is-grid-expanded {
  overflow: hidden;
}
body.is-grid-expanded .grid-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-shadow: none;
}
body.is-grid-expanded .grid-toolbar {
  flex: 0 0 auto;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}
body.is-grid-expanded .grid-sit-filters {
  display: flex;
}
body.is-grid-expanded .grid-scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0 8px 12px;
}
body.is-grid-expanded .grid {
  table-layout: fixed;
  font-size: 12.5px;
  width: 100%;
  min-width: 0;
}
body.is-grid-expanded .grid th,
body.is-grid-expanded .grid td {
  padding: 8px 8px;
}
body.is-grid-expanded .grid th.sortable button {
  padding: 8px;
}
body.is-grid-expanded .grid th[data-sort="ranking"],
body.is-grid-expanded .grid td:nth-child(1) {
  width: 5%;
  max-width: none;
}
body.is-grid-expanded .grid th[data-sort="titulo"],
body.is-grid-expanded .grid td:nth-child(2) {
  width: 22%;
  max-width: none;
}
body.is-grid-expanded .grid th[data-sort="isbn"],
body.is-grid-expanded .grid td:nth-child(3) {
  width: 10%;
}
body.is-grid-expanded .grid th[data-sort="preco"],
body.is-grid-expanded .grid td:nth-child(4),
body.is-grid-expanded .grid th[data-sort="consignado"],
body.is-grid-expanded .grid td:nth-child(5),
body.is-grid-expanded .grid th[data-sort="comprado"],
body.is-grid-expanded .grid td:nth-child(6),
body.is-grid-expanded .grid th[data-sort="total"],
body.is-grid-expanded .grid td:nth-child(7),
body.is-grid-expanded .grid th[data-sort="fisico"],
body.is-grid-expanded .grid td:nth-child(8),
body.is-grid-expanded .grid th[data-sort="fdias"],
body.is-grid-expanded .grid td:nth-child(9),
body.is-grid-expanded .grid th[data-sort="vendido"],
body.is-grid-expanded .grid td:nth-child(10) {
  width: 7%;
}
body.is-grid-expanded .grid th[data-sort="situacao"],
body.is-grid-expanded .grid td:nth-child(11) {
  width: 10%;
  max-width: none;
}
body.is-grid-expanded .grid th[data-sort="ranking"] button,
body.is-grid-expanded .grid th[data-sort="situacao"] button {
  max-width: none;
}
body.is-grid-expanded .badge {
  max-width: none;
}
.grid th,
.grid td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: top;
}
.grid th {
  position: sticky;
  top: 0;
  background: #fafbfe;
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  letter-spacing: .04em;
  text-transform: uppercase;
  z-index: 1;
}
.grid th.sortable {
  padding: 0;
}
.grid th.sortable button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  padding: 12px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  white-space: normal;
  line-height: 1.25;
  text-align: center;
}
.grid th.num.sortable button {
  justify-content: center;
  text-align: center;
}
.grid th[data-sort="titulo"] button {
  justify-content: flex-start;
  text-align: left;
}
.grid th.sortable button::after {
  content: "↕";
  font-size: 11px;
  opacity: .35;
}
.grid th.sortable.is-asc button::after {
  content: "↑";
  opacity: 1;
  color: var(--red);
}
.grid th.sortable.is-desc button::after {
  content: "↓";
  opacity: 1;
  color: var(--red);
}
.grid th.sortable:hover button {
  color: var(--ink);
}
.grid th.num,
.grid td.num { text-align: center; white-space: nowrap; }
.grid tbody tr:hover { background: #faf7f7; }
.grid th[data-sort="ranking"],
.grid td:nth-child(1) {
  width: 72px;
  max-width: 72px;
}
.grid th[data-sort="ranking"] button {
  white-space: normal;
  text-align: center;
  line-height: 1.25;
  max-width: 72px;
}
.grid th[data-sort="titulo"],
.grid td:nth-child(2) {
  width: 220px;
  max-width: 220px;
  text-align: left;
}
.grid .title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  font-weight: 560;
  line-height: 1.3;
}
.grid .author {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.price-cell {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.15;
}
.price-value {
  display: block;
}
.promo-tag {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 650;
  color: var(--green);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.grid .isbn {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12.5px;
}

.grid th[data-sort="situacao"],
.grid td:nth-child(11) {
  width: 118px;
  max-width: 118px;
}
.grid th[data-sort="situacao"] button {
  white-space: normal;
  line-height: 1.25;
  max-width: 118px;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 12px;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 560;
  line-height: 1.25;
  white-space: normal;
  max-width: 110px;
}
.badge-ok { background: #e7f6ef; color: var(--green); }
.badge-distribute { background: #fde8d8; color: #9a3f12; }
.badge-zero,
.badge-urgent { background: #fdecee; color: var(--down); }
.badge-alert { background: #fff4d6; color: #7a5608; }
.badge-idle { background: #e8eef8; color: #2f4a73; }
.badge-return { background: #efe8f4; color: #5a3d73; }
.badge-miss { background: #eef0f5; color: var(--muted); }

.row-zero td { background: rgba(157, 44, 60, 0.03); }
.row-alert td { background: rgba(240, 180, 41, 0.06); }
.row-idle .fdias { color: #7a5608; font-weight: 650; }
.row-extra td { background: rgba(27, 42, 74, 0.02); }
.rank-extra {
  display: inline-block;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.saldo-zero { color: var(--down); font-weight: 650; }

@media (max-width: 1100px) {
  .portfolio-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .portfolio-list-open {
    grid-template-columns: 1fr;
    gap: 4px 0;
  }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
  }
  .client-bar-controls { grid-template-columns: 1fr; }
  .summary,
  .actions { grid-template-columns: 1fr; }
  .portfolio-kpis,
  .portfolio-mid {
    grid-template-columns: 1fr;
  }
  .portfolio-head-meta {
    justify-items: start;
  }
  .top { flex-direction: column; }
  .title-search-wrap,
  .search { width: 100%; }
}

/* Portal do cliente: sem importação; exportação permanece */
body.is-portal .seller-gate { display: none !important; }
body.is-portal #btnImport,
body.is-portal #btnImportMain,
body.is-portal #btnChangeSeller,
body.is-portal #fileMapa {
  display: none !important;
}
body.is-portal .panel-import .panel-note {
  margin-top: 0;
}
body.is-portal #btnExportGrid {
  display: inline-flex;
}

/* Portal: sidebar e seletor de cliente/vendedor — o shell do portal já identifica o cliente */
body.is-portal .sidebar,
body.is-portal .sidebar-show-btn {
  display: none !important;
}
body.is-portal .app {
  grid-template-columns: 1fr !important;
}
body.is-portal .main {
  margin-left: 0 !important;
  max-width: none;
}
body.is-portal #clientBar .client-bar-head,
body.is-portal #clientBar .client-bar-controls,
body.is-portal #clientBar .coverage-mode {
  display: none !important;
}
body.is-portal #clientBar {
  padding-top: 8px;
}
body.is-portal #clientBar .client-bar-secondary {
  margin-top: 0;
}
body.is-portal #mainActiveFilters,
body.is-portal .active-filters-bar,
body.is-portal .clear-filters-main,
body.is-portal #btnClearFiltersMain,
body.is-portal #btnPortfolioDetails,
body.is-portal .portfolio-expand-toggle,
body.is-portal #portfolioDetails,
body.is-portal #portfolioOverview {
  display: none !important;
}
