:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --success: #34d399;
  --danger: #f87171;
  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --layout-gutter: clamp(1rem, 2vw, 2.5rem);
  --layout-max: calc(100vw - 2 * var(--layout-gutter));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Main app shell (index.html only — settings/login pages keep normal document
   scroll). The whole window never scrolls here; .app-header stays fixed by
   simply never being part of a scrolling container, .sidebar fills the
   remaining height without scrolling, and .main-content is the one pane that
   scrolls. This avoids guessing the header's height to offset a sticky
   sidebar — the header's height can vary (sync banner, responsive stacking)
   without breaking anything. */
.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.auth-brand h1 {
  margin: 0;
  font-size: 1.35rem;
}

.auth-brand .subtitle {
  margin: 0.35rem 0 1rem;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.auth-tab {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
}

.auth-tab.active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.auth-hint {
  margin: -0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.auth-error {
  margin: 1rem 0 0;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid var(--danger);
  color: #fecaca;
  font-size: 0.85rem;
}

.user-chip {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-status {
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 4.5rem;
  text-align: right;
}

.save-status.is-pending {
  color: var(--accent);
}

.save-status.is-error {
  color: var(--danger);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.subtitle {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.layout {
  width: 100%;
  max-width: var(--layout-max);
  margin: 0 auto;
  padding: 1rem var(--layout-gutter) 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
}

.panel-titlebar {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid transparent;
  user-select: none;
}

.panel-collapsible.is-open .panel-titlebar {
  border-bottom-color: var(--border);
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
}

.panel-titlebar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.panel-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex-shrink: 0;
}

.panel-collapse-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.panel-collapse-btn .chevron {
  display: block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.15s ease;
}

.panel-collapsible:not(.is-open) .panel-collapse-btn .chevron {
  transform: rotate(-90deg);
}

.panel-body {
  padding: 1rem clamp(0.75rem, 1.5vw, 1.5rem) 1.25rem;
}

.panel-collapsible:not(.is-open) .panel-body {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-header h2 {
  margin: 0;
}

.grid {
  display: grid;
  gap: 0.75rem;
}

.grid-3 {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.field label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-primary {
  background: var(--accent-dim);
  color: #0f172a;
}

.btn-primary:hover {
  background: var(--accent);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #2d3f56;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.offer-card,
.scenario-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.65rem;
}

#offers-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  align-items: start;
}

#offers-container > .offer-card {
  margin-bottom: 0;
  min-width: 0;
}

#offers-container .offer-renewals-layout,
#offers-container .offer-upsale-layout {
  flex-direction: row;
  gap: 0.75rem;
  align-items: flex-start;
}

#offers-container .offer-rates-col {
  flex: 0 1 auto;
  width: auto;
  min-width: 9.5rem;
  max-width: 13.75rem;
  margin-left: 0;
  margin-right: 0.35rem;
}

#offers-container .offer-renewals-fields,
#offers-container .offer-upsale-fields {
  flex: 0 0 7.25rem;
  width: 7.25rem;
  min-width: 7.25rem;
  max-width: 7.25rem;
}

#offers-container .offer-renewals-fields .field label,
#offers-container .offer-upsale-fields .field label {
  font-size: 0.62rem;
  line-height: 1.2;
}

#offers-container .offer-renewals-fields .field input,
#offers-container .offer-renewals-fields .field select,
#offers-container .offer-upsale-fields .field input,
#offers-container .offer-upsale-fields .field select {
  padding: 0.26rem 0.3rem;
  font-size: 0.72rem;
}

#offers-container .offer-renewals-fields .currency-input-wrap input,
#offers-container .offer-upsale-fields .currency-input-wrap input {
  padding-left: 1.15rem;
  font-size: 0.72rem;
}

#offers-container .grid-compact-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem 0.45rem;
}

#offers-container .grid-compact-1 {
  grid-template-columns: 1fr;
  gap: 0.35rem;
}

#offers-container .rates-scroll {
  max-height: 9rem;
}

.offer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.offer-nickname-field {
  flex: 1;
  min-width: 0;
  max-width: 16rem;
}

.offer-nickname-field label {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.scenario-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.scenario-card-header-main {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
}

.scenario-control-cac-field {
  margin: 0;
  min-width: 9rem;
}

.scenario-control-cac-field .currency-input-wrap {
  min-width: 7rem;
}

.scenario-card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.scenario-card-actions .control-badge {
  margin-left: 0;
}

.offer-stack {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.offer-renewals-section {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

.offer-renewals-row {
  margin-top: 0.15rem;
}

.offer-renewals-layout {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}

.offer-renewals-fields {
  flex: 0 0 auto;
  width: min(100%, 21.5rem);
  min-width: 0;
}

.offer-renewals-fields h4 {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.offer-rates-col {
  flex: 0 0 26rem;
  width: 26rem;
  min-width: 26rem;
  max-width: 26rem;
  margin-right: 0.5rem;
}

.offer-upsale-row {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}

.offer-upsale-header {
  margin-bottom: 0.35rem;
}

.offer-upsale-collapse-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0.25rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.offer-upsale-collapse-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.offer-upsale-collapse-btn .chevron {
  display: block;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.15s ease;
}

.offer-upsale-collapsible:not(.is-open) .offer-upsale-collapse-btn .chevron {
  transform: rotate(-90deg);
}

.offer-upsale-collapsible:not(.is-open) .offer-upsale-body {
  display: none;
}

.offer-upsale-collapsible.is-open .offer-upsale-header {
  margin-bottom: 0.5rem;
}

.offer-upsale-layout {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}

.offer-upsale-fields {
  flex: 0 0 auto;
  width: min(100%, 21.5rem);
  min-width: 0;
}

.offer-upsale-fields h4 {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.offer-rates-col--upsale h4 {
  color: var(--accent);
}

.offer-block {
  margin-bottom: 0.5rem;
}

.offer-block:last-child {
  margin-bottom: 0;
}

.offer-block h4 {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

#offers-container .offer-block .offer-product-price-field {
  margin-top: 0.45rem;
  max-width: 10rem;
}

#offers-container .offer-block .offer-product-price-field label {
  font-size: 0.62rem;
  line-height: 1.2;
}

#offers-container .offer-block .offer-product-price-field input {
  padding: 0.26rem 0.3rem;
  font-size: 0.72rem;
}

#offers-container .offer-block .offer-product-price-field .currency-input-wrap input {
  padding-left: 1.15rem;
}

.offer-rates-col h4 {
  margin: 0 0 0.35rem;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.rates-preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.rates-preset-bar .preset-select {
  flex: 1 1 100%;
  min-width: 0;
  padding: 0.25rem 0.35rem;
  font-size: 0.68rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

.rates-preset-bar .preset-name-input {
  flex: 1 1 100%;
  min-width: 0;
  padding: 0.25rem 0.35rem;
  font-size: 0.68rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
}

.rates-preset-bar .btn-sm {
  flex: 1 1 auto;
  padding: 0.2rem 0.35rem;
  font-size: 0.65rem;
}

.grid-compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem 0.5rem;
}

.grid-compact-2 {
  grid-template-columns: repeat(2, minmax(8.5rem, 1fr));
  gap: 0.45rem 0.8rem;
}

.grid-compact-1 {
  grid-template-columns: 1fr;
  gap: 0.4rem;
}

.grid-compact .field label,
.grid-compact-2 .field label,
.grid-compact-1 .field label {
  font-size: 0.65rem;
  margin-bottom: 0.15rem;
}

.grid-compact .field label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid-compact-2 .field label {
  white-space: normal;
  line-height: 1.25;
  font-size: 0.7rem;
}

.grid-compact-1 .field label {
  white-space: normal;
  line-height: 1.25;
  font-size: 0.68rem;
}

.grid-compact .field input,
.grid-compact .field select {
  padding: 0.28rem 0.35rem;
  font-size: 0.75rem;
}

.grid-compact-2 .field input,
.grid-compact-2 .field select {
  padding: 0.32rem 0.45rem;
  font-size: 0.8rem;
}

.grid-compact-1 .field input,
.grid-compact-1 .field select {
  padding: 0.3rem 0.4rem;
  font-size: 0.78rem;
}

.offer-renewals-toggle {
  margin: 0.35rem 0;
}

.offer-renewals-toggle .checkbox-field {
  margin: 0;
}

.offer-renewals-toggle label {
  font-size: 0.75rem;
  color: var(--muted);
}

.rates-scroll {
  max-height: 10.5rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.rates-table-compact {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.68rem;
  table-layout: fixed;
}

.rates-table-compact th,
.rates-table-compact td {
  border-bottom: 1px solid var(--border);
  padding: 0.22rem 0.5rem;
  text-align: center;
}

.rates-table-compact tr:last-child td {
  border-bottom: none;
}

.rates-table-compact th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.62rem;
  line-height: 1.2;
  white-space: normal;
  position: sticky;
  top: 0;
  z-index: 1;
}

.rates-table-compact td:first-child {
  color: var(--muted);
  width: 4.5rem;
  font-size: 0.65rem;
}

.rates-table-compact input {
  width: 100%;
  max-width: 5.5rem;
  padding: 0.2rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.68rem;
  text-align: center;
}

.pct-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  max-width: 100%;
}

.pct-input-wrap input {
  flex: 1;
  min-width: 0;
}

.pct-suffix {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  line-height: 1;
}

.field .pct-input-wrap {
  width: 100%;
}

.field .pct-input-wrap input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.impacts-row--sidebar .pct-input-wrap input {
  padding: 0.32rem 0.45rem;
  font-size: 0.8rem;
}

.rates-table-compact .pct-input-wrap {
  justify-content: center;
}

.rates-table-compact .pct-input-wrap input {
  max-width: 4.5rem;
}

.scenario-table .pct-input-wrap {
  justify-content: flex-end;
}

.scenario-table .pct-input-wrap input.table-input {
  max-width: 4.5rem;
}

.currency-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  width: 100%;
  max-width: 100%;
}

.currency-prefix {
  color: var(--muted);
  font-size: 0.8rem;
  flex-shrink: 0;
  line-height: 1;
}

.currency-input-wrap input {
  flex: 1;
  min-width: 0;
}

.field .currency-input-wrap input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.grid-compact .currency-input-wrap input,
.grid-compact-2 .currency-input-wrap input,
.grid-compact-1 .currency-input-wrap input {
  padding: 0.28rem 0.35rem;
  font-size: 0.75rem;
}

.impacts-row--sidebar .currency-input-wrap input {
  padding: 0.32rem 0.45rem;
  font-size: 0.8rem;
}

.ad-spend-sim .currency-input-wrap {
  width: 100%;
}

.ad-spend-sim .currency-input-wrap input {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.scenario-table .currency-input-wrap {
  justify-content: flex-end;
}

.scenario-table .currency-input-wrap input.table-input {
  max-width: 5.5rem;
}

.btn-add-rate {
  margin-top: 0.35rem;
  width: auto;
}

.rates-table-actions {
  margin-top: 0.35rem;
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

.rates-table-actions .btn-sm {
  flex: 0 0 auto;
}

.offer-upsale-fields .field-inline {
  max-width: 9rem;
  margin-bottom: 0.35rem;
}

.offer-upsale-fields .field-inline label {
  font-size: 0.65rem;
}

.subsection {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.subsection h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.rates-table th,
.rates-table td {
  border: 1px solid var(--border);
  padding: 0.35rem;
  text-align: center;
}

.rates-table th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 500;
}

.scenario-lines {
  margin-top: 0.75rem;
}

.line-row {
  display: grid;
  grid-template-columns: 1fr 100px 100px 100px auto;
  gap: 0.5rem;
  align-items: end;
  margin-bottom: 0.5rem;
}

.scenario-card-body {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.scenario-card-main {
  flex: 1;
  min-width: 0;
}

.scenario-card-main > .btn {
  margin-top: 0.5rem;
}

.scenario-impacts-sidebar {
  flex: 0 0 11.5rem;
  align-self: stretch;
}

.impacts-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: var(--surface2);
  border-radius: 6px;
}

.impacts-row--sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: 100%;
  margin: 0;
  box-sizing: border-box;
}

.impacts-row--sidebar .field {
  margin: 0;
}

.impacts-row--sidebar label {
  font-size: 0.7rem;
  line-height: 1.25;
}

/* ── Effective Rates panel ──────────────────────────────────────────────── */

.eff-rates-aside {
  flex: 0 0 auto;
  min-width: 13rem;
  max-width: 22rem;
  background: var(--surface2);
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.eff-rates-scroll {
  flex: 1 1 0;
  overflow-y: auto;
  min-height: 0;
}

.eff-rates-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 0.45rem;
}

.eff-rates-offer + .eff-rates-offer {
  margin-top: 0.6rem;
}

.eff-rates-offer-label {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.eff-rates-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  line-height: 1.4;
}

.eff-rates-table th,
.eff-rates-table td {
  padding: 0.15rem 0.3rem;
  text-align: right;
  white-space: nowrap;
}

.eff-rates-table th:first-child,
.eff-rates-table td:first-child {
  text-align: left;
}

.eff-rates-table thead th {
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
  border-bottom: 1px solid var(--border, #334155);
  padding-bottom: 0.2rem;
}

.eff-rates-table tbody tr:hover {
  background: var(--surface3, rgba(255,255,255,0.04));
}

.eff-rate-changed {
  color: var(--accent, #38bdf8);
  font-weight: 600;
}

/* ── Card context menu (···) ────────────────────────────────────────────── */

.card-menu {
  position: relative;
  display: inline-flex;
}

.btn-card-menu {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  letter-spacing: 0.05em;
  transition: background 0.15s, color 0.15s;
}

.btn-card-menu:hover {
  background: var(--surface2);
  color: var(--text);
}

.card-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  min-width: 130px;
  padding: 0.25rem 0;
  white-space: nowrap;
}

.card-menu-dropdown.hidden {
  display: none;
}

.card-menu-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
}

.card-menu-dropdown button:hover {
  background: var(--surface2);
}

.card-menu-dropdown button.menu-item-danger {
  color: var(--danger);
}

.impacts-row--sidebar input {
  width: 100%;
}

.control-badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  background: var(--accent-dim);
  color: #0f172a;
  border-radius: 4px;
  margin-left: 0.5rem;
}

.ad-spend-sim {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.ad-spend-sim .field {
  margin: 0;
  min-width: 160px;
}

.ad-spend-hint {
  font-size: 0.75rem;
  color: var(--muted);
  flex: 1 1 100%;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  padding: 0.5rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
}

.tab.active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}

.comparison-chart-wrap {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 6px;
  min-height: 200px;
}

/* Sticky column headers — all tables */
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface2);
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: right;
  white-space: nowrap;
}

#comparison-table.data-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  --scenario-count: 1;
}

#comparison-table.data-table th,
#comparison-table.data-table td {
  padding: 0.35rem 0.45rem;
  font-size: 0.78rem;
}

#comparison-table .comparison-month-col {
  width: 4.75rem;
  min-width: 4.75rem;
}

#comparison-table col.comparison-scenario-col {
  width: calc((100% - 4.75rem) / var(--scenario-count) / 3);
}

#comparison-table .comparison-scenario-col {
  width: calc((100% - 4.75rem) / var(--scenario-count) / 3);
  overflow: hidden;
  text-overflow: ellipsis;
}

#comparison-table .comparison-scenario-header {
  text-align: center;
  font-weight: 600;
  color: var(--text);
  border-top: 2px solid var(--scenario-color);
  border-left: 2px solid var(--scenario-color);
  border-right: 2px solid var(--scenario-color);
  background: color-mix(in srgb, var(--scenario-color) 14%, var(--surface2));
}

#comparison-table .comparison-scenario-col-first {
  border-left: 2px solid var(--scenario-color);
}

#comparison-table .comparison-scenario-col-last {
  border-right: 2px solid var(--scenario-color);
}

#comparison-table .comparison-scenario-group-gap {
  box-shadow: 10px 0 0 0 var(--surface);
}

#comparison-table tbody tr:last-child .comparison-scenario-col {
  border-bottom: 2px solid var(--scenario-color);
}

#comparison-table.data-table tbody tr:hover td.comparison-scenario-col {
  background: color-mix(in srgb, var(--scenario-color) 10%, var(--surface));
}

#comparison-table tbody tr:hover .comparison-month-col {
  background: var(--surface2);
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}

.data-table thead th:first-child {
  background: var(--surface2);
  z-index: 3;
}

#comparison-table.data-table th.comparison-month-col,
#comparison-table.data-table td.comparison-month-col {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 2;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.08);
}

.data-table thead th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 500;
}

.cogs-group-header {
  text-align: center !important;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}

.cogs-approval-banner {
  margin: 0.75rem 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  border: 1px solid #d97706;
  background: #fffbeb;
  color: #92400e;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.cogs-approval-banner strong { color: #78350f; }
.cogs-approval-banner-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.cogs-approval-banner-months {
  font-size: 0.82rem;
  opacity: 0.85;
}
.cogs-pending-row td {
  background: #fffbeb !important;
  font-style: italic;
  color: #92400e;
}
.cogs-pending-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0 0.35rem;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  background: #d97706;
  color: #fff;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

.data-table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

.scenario-result-block {
  margin-bottom: 1.5rem;
}

.scenario-result-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.scenario-table-wrap {
  margin-top: 0;
}

.scenario-table.data-table {
  font-size: 0.78rem;
}

.scenario-table.data-table th,
.scenario-table.data-table td {
  padding: 0.35rem 0.45rem;
}

.scenario-table .table-input {
  width: 100%;
  min-width: 58px;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  text-align: right;
}

.scenario-table .table-input:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.scenario-table .table-select {
  width: 100%;
  min-width: 108px;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
}

.scenario-table tr.row-sub td:first-child {
  padding-left: 1.75rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.scenario-table tr.row-sub td:first-child::before {
  content: "↳ ";
  color: var(--accent);
}

.scenario-table tr.row-entry-start td {
  border-top: 2px solid var(--border);
}

.scenario-table .cell-readonly {
  color: var(--muted);
}

.scenario-table .table-input.price-overridden {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.scenario-table .col-actions {
  width: 1%;
  min-width: 2.5rem;
  max-width: 4.25rem;
  padding-left: 0.2rem;
  padding-right: 0.25rem;
  text-align: right;
  white-space: nowrap;
}

.scenario-table .col-actions .btn-sm {
  font-size: 0.62rem;
  padding: 0.15rem 0.3rem;
  line-height: 1.2;
}

.scenario-table .col-actions .btn-icon {
  padding: 0.1rem 0.3rem;
  font-size: 0.8rem;
  line-height: 1;
}

.scenario-table tr.row-upsale-toggle td {
  color: var(--muted);
  font-size: 0.78rem;
}

.btn-icon {
  padding: 0.2rem 0.45rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
}

.btn-icon:hover {
  background: rgba(248, 113, 113, 0.1);
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--danger);
  color: white;
  border-radius: 6px;
  font-size: 0.875rem;
  z-index: 100;
}

.toast--error  { background: var(--danger); }
.toast--success { background: #16a34a; }
.toast--info   { background: #2563eb; }

.toast.hidden,
.hidden {
  display: none !important;
}

/* ── Sync progress banner ───────────────────────────────────────────────── */

.header-title-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.header-brand-logo {
  height: 32px;
  max-width: 120px;
  object-fit: contain;
  border-radius: 4px;
}

.sync-banner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.sync-spinner {
  flex-shrink: 0;
  animation: sync-spin 1s linear infinite;
}

@keyframes sync-spin {
  to { transform: rotate(360deg); }
}

.clickable-cell {
  cursor: pointer;
}

.clickable-cell:hover {
  background: rgba(56, 189, 248, 0.18);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-panel {
  width: min(1200px, 95vw);
  height: min(85vh, 900px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1rem;
}

.modal-body {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.45;
  font-family: var(--font);
  font-size: 0.9rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.checkbox-field input {
  width: auto;
}

.offer-name-input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}

.offer-name-input:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.offer-name-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

@media (max-width: 1400px) {
  #offers-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #offers-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .offer-renewals-layout,
  .offer-upsale-layout {
    flex-direction: column;
  }

  .offer-rates-col {
    width: 100%;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    margin-left: 0;
  }

  .rates-scroll {
    max-height: 8rem;
  }

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

  .offer-renewals-fields,
  .offer-upsale-fields {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
  }
  .line-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Brand selector bar ──────────────────────────────────────────────── */

.brand-bar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 0.45rem var(--layout-gutter);
}

.brand-bar-inner {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  max-width: var(--layout-max);
  margin: 0 auto;
  flex-wrap: wrap;
}

.brand-bar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  flex-shrink: 0;
}

.brand-select-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.brand-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
  max-width: 260px;
  transition: border-color 0.15s;
}

.brand-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.brand-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  padding: 0;
}

.brand-action-btn:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.brand-action-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.brand-action-btn--danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Small modal variant (brand create/rename/delete) ────────────────── */

.modal-panel--sm {
  width: min(420px, 92vw);
  height: auto;
  max-height: 80vh;
}

.modal-body-form {
  padding: 1.25rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-body-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.modal-body-form .field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.modal-body-form input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  width: 100%;
  transition: border-color 0.15s;
}

.modal-body-form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.modal-form-actions {
  display: flex;
  gap: 0.5rem;
}

.brand-delete-warning {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

/* ── App body + Sidebar ──────────────────────────────────────────── */

.app-body {
  display: flex;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0; /* let children scroll internally instead of growing past the viewport */
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  transition: width 0.2s ease, min-width 0.2s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.is-collapsed {
  width: 52px;
  min-width: 52px;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.75rem 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-toggle:hover {
  background: var(--surface2);
  color: var(--text);
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
}

.sidebar-section-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0.75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.9rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-link:hover {
  background: var(--surface2);
  color: var(--text);
}

.sidebar-link.is-active {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.08);
  border-left-color: var(--accent);
}

.sidebar-icon {
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

/* ── Profile avatar button ───────────────────────────────────────── */

.profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
  padding: 0;
  transition: border-color 0.15s, background 0.15s;
}

.profile-btn:hover {
  border-color: var(--accent);
  background: var(--surface);
}

/* ── Profile / Settings panel (right drawer) ─────────────────────── */

.profile-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
}

.profile-panel-overlay.is-open {
  pointer-events: auto;
}

.profile-panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  opacity: 0;
  transition: opacity 0.2s;
}

.profile-panel-overlay.is-open .profile-panel-backdrop {
  opacity: 1;
}

.profile-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 340px;
  max-width: 92vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.profile-panel-overlay.is-open .profile-panel {
  transform: translateX(0);
}

.profile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-panel-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.profile-panel-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.55rem;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}

.profile-panel-close:hover {
  background: var(--surface2);
  color: var(--text);
}

.profile-panel-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.settings-section {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
  border-bottom: none;
  margin-top: auto;
}

.settings-section h4 {
  margin: 0 0 0.85rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.settings-section-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.settings-save-msg {
  font-size: 0.8rem;
  color: var(--success);
}

.api-connection-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.api-connection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.api-connection-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.connection-badge {
  font-size: 0.68rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
}

.connection-badge--connected {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.connection-badge--disconnected {
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
}

.api-connection-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.api-connection-actions {
  display: flex;
  gap: 0.5rem;
}

.api-connection-error {
  margin: 0;
  font-size: 0.8rem;
  color: var(--danger);
}

.settings-section--footer {
  padding-top: 1rem;
  padding-bottom: 1.25rem;
}

/* ── Inventory Stats page ────────────────────────────────────────── */

.inventory-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.empty-state p {
  margin: 0.2rem 0;
  font-size: 0.95rem;
}

.empty-state-sub {
  font-size: 0.85rem;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 4rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-banner {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: #fecaca;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
}

.link-btn:hover {
  color: var(--text);
}

/* ── Header brand switcher ───────────────────────────────────────────────── */

.header-brand-select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(56, 189, 248, 0.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2338bdf8' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 0.55rem center;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  padding: 0.25rem 1.8rem 0.25rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  max-width: 180px;
}

.header-brand-select:hover {
  background-color: rgba(56, 189, 248, 0.18);
  border-color: rgba(56, 189, 248, 0.6);
}

.header-brand-select:focus {
  outline: none;
  border-color: var(--accent);
}

.header-brand-select option {
  background: var(--surface);
  color: var(--text);
}

/* ── Auth: role toggle ────────────────────────────────────────────────────── */

.role-toggle {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.role-btn {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.role-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.role-btn:not(.active):hover {
  border-color: var(--text-secondary);
  color: var(--text);
}

/* ── Header: active brand chip ───────────────────────────────────────────── */

.active-brand-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-brand-chip:empty {
  display: none;
}

/* ── Settings: brand section ─────────────────────────────────────────────── */

.brand-switcher-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}

.brand-switcher-select {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
}

.brand-code-field {
  margin-bottom: 0.75rem;
}

.brand-code-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.brand-code-input {
  flex: 1;
  font-family: monospace;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.4rem 0.6rem;
}

.invite-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.invite-row input {
  flex: 1;
}

.invite-result {
  font-size: 0.825rem;
  margin-top: 0.35rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius);
}

.invite-result--ok {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
}

.invite-result--error {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.08);
}

/* ── Brand members list ──────────────────────────────────────────────────── */

.brand-logo-preview {
  display: block;
  max-width: 200px;
  max-height: 80px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 6px;
  background: var(--surface);
}

.brand-members-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.brand-member-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  background: var(--surface2);
  font-size: 0.875rem;
}

.member-email {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-role {
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-weight: 500;
  white-space: nowrap;
  margin-left: 0.5rem;
}

.member-role--admin {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.member-role--member {
  background: rgba(156, 163, 175, 0.12);
  color: var(--muted);
}

/* ── Roles settings ──────────────────────────────────────────────────────── */

.roles-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.roles-table th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.roles-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.role-name-cell { font-weight: 500; }
.role-perms-cell { color: var(--text-muted); font-size: 0.8rem; max-width: 340px; }
.role-actions-cell { white-space: nowrap; text-align: right; }

.roles-form {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.roles-form-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.roles-perms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.roles-perms-table th {
  text-align: center;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.roles-perms-table th:first-child { text-align: left; }

.roles-perms-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.roles-perms-table td:first-child { font-weight: 500; }

.role-form-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-left: 0.75rem;
}

/* ── Analytics pages ─────────────────────────────────────────────────────── */

.analytics-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.analytics-section-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 2rem 0 0.75rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.stat-card-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.stat-card-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.stat-card-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.analytics-raw-pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 400px;
  overflow-y: auto;
}

/* ── Customer Service (Richpanel ticket detail) ──────────────────── */

.cs-ticket-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.cs-ticket-subject {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  flex: 1 1 auto;
}

.cs-ticket-badges {
  display: flex;
  gap: 0.4rem;
}

.cs-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem 1.5rem;
}

.cs-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cs-meta-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.cs-meta-value {
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-word;
}

.cs-empty-note {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.cs-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.cs-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 0.2rem 0.3rem 0.2rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
}

.cs-tag-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

.cs-tag-remove:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.12);
}

.cs-tag-add {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.65rem;
}

.cs-tag-select {
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  max-width: 220px;
}

.cs-tag-load-error {
  color: var(--danger);
}

/* ── Settings — Richpanel Operators table ────────────────────────── */

.operators-table th,
.operators-table td {
  text-align: left;
}

.operators-table input[type="text"],
.operators-table select {
  width: 100%;
  min-width: 160px;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
}

.operator-save-status {
  font-size: 0.75rem;
  color: var(--success);
  white-space: nowrap;
}

.cs-comments {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cs-comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.cs-comment--operator {
  border-left: 3px solid var(--accent);
}

.cs-comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.cs-comment-author {
  font-weight: 700;
  color: var(--text);
}

.cs-comment-body {
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.cs-comment-body a {
  color: var(--accent);
}

.cs-comment-body img {
  max-width: 100%;
  border-radius: 4px;
}

.cs-comment-body p {
  margin: 0 0 0.75rem;
}

.cs-comment-body p:last-child {
  margin-bottom: 0;
}

.cs-raw-details {
  margin-top: 1rem;
}

.cs-lookup-bar {
  display: flex;
  gap: 0.5rem;
  max-width: 420px;
  margin-bottom: 1.5rem;
}

.cs-ticket-input {
  flex: 1 1 auto;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
}

.cs-ticket-input:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.cs-reply-panel {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.cs-reply-textarea {
  width: 100%;
  resize: vertical;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.5;
}

.cs-reply-textarea:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}

.cs-reply-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin: 0.65rem 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.cs-reply-controls label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.cs-reply-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cs-reply-status {
  font-size: 0.8rem;
  color: var(--success);
}

.cs-reply-status--error {
  color: var(--danger);
}

.order-status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

/* ── Inventory search bar ─────────────────────────────────────────────────── */

.inventory-search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.inventory-search-wrap {
  position: relative;
  flex: 1;
  max-width: 380px;
}

.inventory-search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.inventory-search-input {
  width: 100%;
  padding: 0.45rem 0.75rem 0.45rem 2.1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.inventory-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.inventory-search-input::placeholder {
  color: var(--muted);
}

.inventory-count {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.brand-member-empty {
  color: var(--muted);
  font-size: 0.875rem;
  font-style: italic;
}

/* ── Settings page ────────────────────────────────────────────────────────── */

.settings-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.settings-layout {
  display: flex;
  flex: 1;
  min-height: 100vh;
}

/* Left nav */
.settings-nav {
  width: 230px;
  min-width: 230px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.75rem 0 2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  gap: 0;
}

.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.35rem 1.35rem;
  margin-bottom: 1.75rem;
  border-radius: var(--radius);
  transition: color 0.15s;
}

.settings-back:hover {
  color: var(--text);
}

.settings-back svg {
  flex-shrink: 0;
}

.settings-nav-heading {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 1.35rem;
  margin: 0.25rem 0 0.35rem;
}

.settings-nav-heading + .settings-nav-heading {
  margin-top: 1.25rem;
}

.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1.35rem;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  border-left: 2px solid transparent;
}

.settings-nav-item:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.settings-nav-item.active {
  background: rgba(56, 189, 248, 0.08);
  color: var(--text);
  font-weight: 500;
  border-left-color: var(--accent);
}

/* Right content */
.settings-content {
  flex: 1;
  padding: 3rem 4rem;
  overflow-y: auto;
}

.settings-panel {
  max-width: 520px;
}

.settings-panel-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--text);
}

.settings-panel-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.settings-action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.settings-save-msg {
  font-size: 0.825rem;
  color: var(--success);
}

/* Connection card on settings page */
.settings-connection-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.settings-connection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.settings-connection-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.conn-collapsed {
  padding: 0.25rem 0 0.5rem;
}

.conn-form {
  /* no extra styles needed; hidden class controls visibility */
}

/* Password field with inline reveal button */
.field-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-input-wrap input {
  flex: 1;
  padding-right: 2.5rem;
}

.reveal-btn {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  color: var(--muted);
  line-height: 1;
  border-radius: 4px;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
}

.reveal-btn:hover {
  color: var(--fg);
}

/* Danger zone */
.settings-danger-zone {
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 0.5rem;
}

.settings-danger-zone h5 {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--danger);
}

.settings-danger-zone p {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 680px) {
  .settings-layout {
    flex-direction: column;
  }
  .settings-nav {
    width: 100%;
    min-width: 0;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem 0 0.5rem;
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
  }
  .settings-back {
    width: 100%;
    margin-bottom: 0.5rem;
  }
  .settings-nav-heading {
    display: none;
  }
  .settings-nav-item {
    padding: 0.5rem 1rem;
    border-left: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
  }
  .settings-nav-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
  .settings-content {
    padding: 1.5rem 1.25rem;
  }
}

/* ── Onboarding ────────────────────────────────────────────────────────────── */
.onboarding-page {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.onboarding-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.onboarding-logo {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.onboarding-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.onboarding-brand-label {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.onboarding-step-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.onboarding-progress-bar {
  height: 3px;
  background: var(--border);
}

.onboarding-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.35s ease;
}

.onboarding-main {
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  flex: 1;
}

.ob-step { }

.ob-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.4rem;
}

.ob-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 2rem;
}

.ob-section-heading {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1.75rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.ob-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  justify-content: flex-end;
}

.ob-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

.ob-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.ob-optional {
  color: var(--muted);
  font-size: 0.78rem;
}

/* Loading spinner */
.ob-loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  padding: 1.5rem 0;
}

.ob-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ob-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes ob-spin { to { transform: rotate(360deg); } }

/* ── SKU list ── */
.ob-sku-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ob-sku-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  transition: opacity 0.2s;
}

.ob-sku-row--ignored {
  opacity: 0.45;
}

.ob-sku-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.ob-sku-name {
  font-weight: 600;
  color: var(--text);
}

.ob-sku-code {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: monospace;
}

.ob-sku-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ob-sku-extra {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  margin-top: 0.25rem;
}

.ob-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.ob-check-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.ob-alias-field label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  display: block;
}

.ob-alias-input {
  width: 100%;
  max-width: 280px;
}

/* ── Kit composition ── */
.ob-kit-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.ob-kit-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.ob-kit-components {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ob-component-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ob-component-select {
  flex: 1;
  min-width: 0;
}

.ob-component-qty {
  width: 70px;
  flex-shrink: 0;
}

.ob-no-kits {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Launch products ── */
.ob-launch-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  position: relative;
}

.ob-launch-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ob-launch-product-select {
  width: 100%;
}

.ob-launch-dates {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ob-date-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  flex: 1;
  min-width: 120px;
}

.ob-date-label input[type="date"] {
  color-scheme: dark;
}

.ob-launch-permanent {
  margin-top: 0.25rem;
}

.ob-launch-tags {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ob-tags-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.ob-tags-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ob-tag-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.ob-tag-input {
  flex: 1;
}

.ob-add-tag-btn {
  align-self: flex-start;
  margin-top: 0.25rem;
}

.ob-add-launch-btn {
  margin-bottom: 1rem;
}

.ob-launch-remove-btn {
  margin-top: 0.75rem;
}

/* ── Raw Data nav section (index.html) ── */
.nav-raw-data-list {
  margin-top: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-raw-data-table-btn {
  background: none;
  border: none;
  padding: 0.3rem 0.5rem 0.3rem 1.25rem;
  text-align: left;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  width: 100%;
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}

.nav-raw-data-table-btn:hover,
.nav-raw-data-table-btn.active {
  background: var(--surface2);
  color: var(--text);
}

/* Raw Data sidebar grouping */
.raw-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.5rem 0.75rem 0.2rem;
}

.raw-brand-section {
  margin-bottom: 0.25rem;
}

.raw-brand-summary {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  user-select: none;
}

.raw-brand-summary::-webkit-details-marker { display: none; }

.raw-brand-summary::before {
  content: '▶';
  font-size: 0.55rem;
  color: var(--muted);
  transition: transform 0.15s;
}

details[open] > .raw-brand-summary::before {
  transform: rotate(90deg);
}

.raw-table-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Raw data panel */
.raw-data-panel {
  overflow-x: auto;
}

.raw-data-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.raw-data-table-info {
  font-size: 0.8rem;
  color: var(--muted);
}

.raw-data-toolbar-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.raw-data-scroll {
  overflow-x: auto;
}

.raw-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  font-family: monospace;
}

.raw-data-table th {
  background: var(--surface2);
  color: var(--muted);
  padding: 0.4rem 0.6rem;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.raw-data-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.raw-data-table tr:hover td {
  background: var(--surface);
}

.raw-data-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 1rem 0;
}

/* Locked (read-only) cells in edit mode */
.raw-locked {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

/* Editable cells */
.raw-editing {
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)) !important;
  outline: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  cursor: text;
  white-space: pre-wrap;
  min-width: 60px;
  max-width: 320px;
}

.raw-editing:focus {
  outline: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface)) !important;
}

/* Toast notification inside the panel */
.raw-data-toast {
  font-size: 0.82rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  background: color-mix(in srgb, var(--success) 15%, var(--surface));
  color: var(--success);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
}

.raw-data-toast--error {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

/* ── Products section ───────────────────────────────────────────────────────── */

.products-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.products-ignored-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.products-ignored-toggle input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
}

.products-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0 0.75rem;
  gap: 1rem;
}

.products-section-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.products-section-header h3 span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
}

#products-search-regular,
#products-search-kits {
  width: 220px;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
}

#products-search-regular:focus,
#products-search-kits:focus {
  outline: none;
  border-color: var(--primary);
}

.products-table-wrap {
  overflow-x: auto;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.products-table th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface2);
}

.products-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.products-table tbody tr:last-child td {
  border-bottom: none;
}

.products-table tbody tr:hover {
  background: color-mix(in srgb, var(--primary) 4%, transparent);
}

.products-row-ignored td {
  opacity: 0.5;
}

.products-row-deprecated td {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.products-sku {
  font-family: monospace;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.products-components {
  max-width: 260px;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: normal;
  word-break: break-word;
}

.products-none {
  color: var(--text-muted);
}

.products-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--border);
  color: var(--text-muted);
}

.products-badge-green {
  background: color-mix(in srgb, var(--success, #22c55e) 15%, var(--surface));
  color: var(--success, #22c55e);
}

.products-badge-red {
  background: color-mix(in srgb, var(--danger) 15%, var(--surface));
  color: var(--danger);
}

.products-empty-row {
  padding: 1.25rem 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.btn-xs {
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 5px;
}

/* ── Products Edit Modal (pem) ───────────────────────────────────────────────── */

.pem-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.pem-dialog {
  background: var(--card, var(--surface));
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.pem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pem-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.pem-sku {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.pem-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.pem-close:hover {
  background: var(--border);
  color: var(--text);
}

.pem-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.products-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.products-form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pem-input {
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.pem-input:focus {
  outline: none;
  border-color: var(--primary);
}

select.pem-input {
  appearance: none;
  cursor: pointer;
}

.products-form-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.pem-checkbox {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.pem-checkbox input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
  width: 15px;
  height: 15px;
}

.pem-comp-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.pem-comp-row .pem-comp-sku {
  flex: 1;
}

.pem-comp-row .pem-comp-qty {
  width: 80px;
  flex-shrink: 0;
}

.pem-error {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
}

.pem-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding-top: 0.5rem;
}

.pem-hidden {
  display: none !important;
}

/* ── Product group column ───────────────────────────────────────────────────── */

.products-col-group {
  width: 120px;
  min-width: 100px;
}

.products-group-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  vertical-align: middle;
  text-align: center;
  padding: 0.45rem 0.6rem;
  border-right: 2px solid color-mix(in srgb, var(--primary) 25%, transparent);
  background: color-mix(in srgb, var(--primary) 5%, transparent);
  white-space: nowrap;
}

.products-group-none {
  color: var(--border);
  text-align: center;
  font-size: 0.85rem;
}

.products-row-grouped td:not(.products-group-name) {
  background: color-mix(in srgb, var(--primary) 3%, transparent);
}

.products-table tbody tr.products-row-grouped:hover td:not(.products-group-name) {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}

/* ── Manage Groups modal ────────────────────────────────────────────────────── */

.pmg-body {
  gap: 0;
  padding: 0.75rem 1.25rem 1.25rem;
}

.pmg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.pmg-row:last-child {
  border-bottom: none;
}

.pmg-name {
  font-size: 0.88rem;
  font-weight: 500;
}

.pmg-actions {
  display: flex;
  gap: 0.4rem;
}

.pmg-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.75rem 0;
}

.pmg-divider {
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.pmg-create-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pmg-create-form .pem-input {
  flex: 1;
}

/* ── Checkbox column ────────────────────────────────────────────────────────── */

.products-col-cb {
  width: 36px;
  min-width: 36px;
  text-align: center;
  padding: 0.45rem 0.4rem !important;
}

.products-col-cb input[type="checkbox"],
.products-row-cb {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
  display: block;
  margin: 0 auto;
}

.products-sync-status {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.15rem 0 0.4rem;
}
.products-sync-status.error { color: var(--danger, #e53e3e); }

/* ── Bulk-assign action bar ─────────────────────────────────────────────────── */

.products-assign-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 8px;
}

.products-assign-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.products-assign-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.products-assign-select {
  min-width: 180px;
  max-width: 260px;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
  height: auto;
}

.products-assign-new-input {
  min-width: 160px;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
}

.btn-toggled {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}

/* ── Inventory group rows ────────────────────────────────────────────────────── */

.inv-group-header {
  cursor: pointer;
  user-select: none;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

.inv-group-header:hover {
  background: color-mix(in srgb, var(--primary) 14%, var(--surface));
}

/* Center all inventory table cells/headers; Product column keeps left via inline style */
#inventory-table th { text-align: center; }
#inventory-table td { text-align: center; }
#inventory-table .inv-group-td:not(.inv-group-sum) { text-align: left; }

.inv-group-td {
  font-weight: 600;
  font-size: 0.83rem;
  letter-spacing: 0.02em;
  padding: 0.55rem 1rem !important;
  color: var(--text);
}

.inv-group-arrow {
  display: inline-block;
  font-size: 0.65rem;
  color: var(--primary);
  transition: transform 0.15s;
  vertical-align: middle;
  margin-right: 0.1rem;
}

.inv-group-count {
  display: inline-block;
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--primary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
}

.inv-group-sum {
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.inv-grouped-row td {
  background: color-mix(in srgb, var(--primary) 3%, transparent);
}

.inv-grouped-row:hover td {
  background: color-mix(in srgb, var(--primary) 7%, transparent);
}

/* ── Inventory month expand/collapse ─────────────────────────────────────── */

.inv-month-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.inv-month-th:hover {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface)) !important;
}

.inv-month-toggle-icon {
  display: inline-block;
  font-size: 0.55rem;
  color: var(--primary);
  vertical-align: middle;
  margin-left: 0.3rem;
  opacity: 0.75;
}

.inv-month-expanded-group {
  text-align: center;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border-bottom: 2px solid color-mix(in srgb, var(--primary) 35%, transparent);
}

.inv-month-quarter-th {
  font-size: 0.78rem;
  white-space: nowrap;
  text-align: center;
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
  border-left: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
}

.inv-month-q-cell {
  background: color-mix(in srgb, var(--primary) 3%, transparent);
}

/* ── Bell / Alerts ────────────────────────────────────────────────────────── */

.alerts-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-alerts {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-alerts:hover {
  background: var(--surface2);
  border-color: var(--accent);
  color: var(--accent);
}

.alerts-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 3px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.alerts-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  overflow: hidden;
}

.alerts-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.alerts-dropdown-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.alerts-dismiss-all {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.alerts-dismiss-all:hover {
  color: var(--text);
}

.alerts-list {
  max-height: 280px;
  overflow-y: auto;
}

.alerts-empty {
  padding: 1rem 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
  text-align: center;
}

.alerts-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.alerts-item:last-child {
  border-bottom: none;
}

.alerts-msg {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.45;
}

.alerts-dismiss-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-top: 1px;
}

.alerts-dismiss-btn:hover {
  color: var(--danger);
}

/* Products nav — new-product red dot badge */
.sidebar-link[data-tool="products"] {
  position: relative;
}

.products-new-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Generic modal overlay (compact dialogs) ─────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(540px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.inv-modal-box-wide {
  width: min(720px, 95vw);
}

.modal-box .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
}
.modal-box .modal-header h3 { margin: 0; font-size: 1rem; }

.modal-box .modal-body {
  padding: 1.1rem;
  overflow: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.modal-close-btn:hover { color: var(--text); }

/* Generic form utilities */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}
.form-input {
  display: block;
  width: 100%;
  padding: 0.45rem 0.7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
}
.form-input:focus {
  outline: 2px solid var(--accent-dim);
  border-color: var(--accent);
}
.form-input option { background: var(--surface); }
.form-error {
  color: var(--danger);
  font-size: 0.82rem;
  margin-top: 0.4rem;
}

/* ── Inventory Tracking ─────────────────────────────────────────────────── */
.inv-tracking-header { margin-bottom: 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.inv-tracking-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 2rem;
  overflow: hidden;
}
.inv-tracking-block.is-collapsed {
  overflow: visible;
}
.inv-tracking-block.is-collapsed .inv-section-body {
  display: none;
}
.inv-tracking-block.is-collapsed .inv-tracking-block-header {
  border-bottom: none;
}
.inv-tracking-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.inv-tracking-block-header:hover {
  background: var(--surface2, rgba(0,0,0,0.03));
}
.inv-tracking-block-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.inv-section-chevron {
  display: inline-block;
  font-size: 0.7em;
  color: var(--text-muted, #888);
  transition: transform 0.18s ease;
  line-height: 1;
}
.inv-tracking-block.is-collapsed .inv-section-chevron {
  transform: rotate(-90deg);
}
.inv-po-actions, .inv-payments-actions, .inv-starting-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Summary table */
.inv-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.inv-summary-table th, .inv-summary-table td {
  padding: 0.5rem 0.75rem;
  text-align: right;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.inv-summary-table th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.inv-section-header-row th { text-align: center; }
.inv-section-header {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  border-bottom: 2px solid var(--accent);
}
.inv-section-inventory { color: var(--accent); }
.inv-section-sales { color: var(--success); }
.inv-row-label {
  text-align: left !important;
  font-weight: 600;
  color: var(--text);
}
.inv-starting-row td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.inv-loading { text-align: center; color: var(--muted); padding: 1.5rem !important; }

/* PO table — re-uses .data-table */
.inv-po-number-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  padding: 0.4rem 0.75rem;
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--accent);
  min-height: 2rem;
}
.inv-po-meta-po-info {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
  color: var(--muted);
}
.inv-po-meta-desc { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.75rem; }

/* Compact PO fill-in modal body */
.inv-po-meta-body { padding: 0.55rem 0.9rem !important; }
.inv-po-meta-body .inv-po-meta-po-info { padding: 0.3rem 0.6rem; font-size: 0.8rem; margin-bottom: 0.45rem; }
.inv-po-meta-body .form-group { margin-bottom: 0.35rem; }
.inv-po-meta-body .form-label { font-size: 0.7rem; margin-bottom: 0.1rem; }
.inv-po-meta-body .form-input { padding: 0.28rem 0.55rem; font-size: 0.85rem; }

/* Vendor abbreviation modal form */
.inv-vendor-abbr-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.inv-vendor-abbr-form .form-input { flex: 1; min-width: 10rem; }

/* Payments */
.inv-payments-add-row-btn { margin: 0.75rem 1.25rem 1rem; }
.form-input-sm { font-size: 0.85rem; padding: 0.3rem 0.6rem; height: auto; }
.form-input-xs { font-size: 0.8rem; padding: 0.2rem 0.4rem; height: auto; width: 100%; }
.btn-xs { font-size: 0.75rem; padding: 0.2rem 0.5rem; }
.badge-success { color: var(--success); font-size: 0.9rem; }

/* COGS Calculator */
.inv-cogs-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.inv-cogs-upload-row {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.25rem;
  flex-wrap: wrap;
}
.inv-cogs-upload-area {
  flex: 1;
  min-width: 220px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--surface-alt, var(--surface));
}
.inv-cogs-upload-area:hover, .inv-cogs-upload-area.drag-over {
  border-color: var(--primary);
  background: var(--surface);
}
.inv-cogs-upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
  pointer-events: none;
}
.inv-cogs-upload-icon { font-size: 1.6rem; }
.inv-cogs-upload-hint { font-size: 0.78rem; color: var(--text-muted); }
.inv-cogs-file-count { font-size: 0.82rem; color: var(--primary); font-weight: 600; }
.inv-cogs-status {
  margin: 0 1.25rem 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--surface-alt, var(--surface));
  border: 1px solid var(--border);
}
.inv-cogs-status-error { border-color: var(--danger, #dc2626); color: var(--danger, #dc2626); }
.modal-box-lg { max-width: 720px; width: 95vw; }
.modal-divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.form-hint { font-size: 0.8rem; color: var(--text-muted); margin: 0.25rem 0 0; }

/* COGS file list */
.inv-cogs-upload-col { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.inv-cogs-file-list {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: var(--surface);
  overflow: hidden;
}
.inv-cogs-file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  background: var(--surface-alt, var(--surface));
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.inv-cogs-file-list-body { padding: 0; }
.inv-cogs-file-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.inv-cogs-file-item:last-child { border-bottom: none; }
.inv-cogs-file-month {
  font-weight: 600;
  min-width: 70px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.inv-cogs-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inv-cogs-file-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.inv-cogs-file-list-chevron { font-size: 0.65rem; color: var(--text-muted); line-height: 1; }
