:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #15203a;
  background: #f3f6fb;
  font-synthesis: none;
  --blue: #005bff;
  --blue-dark: #0044c8;
  --ink: #15203a;
  --muted: #69748d;
  --line: #dde3ee;
  --panel: #fff;
  --green: #09824b;
  --red: #c9324c;
  --amber: #9a6500;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 44px); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 22px; letter-spacing: -.018em; }
a { color: inherit; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 70px;
  border-bottom: 1px solid rgba(221, 227, 238, .9);
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(12px);
  padding: 10px max(18px, calc((100vw - 1260px) / 2));
}

.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand > span:last-child { display: grid; line-height: 1.2; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--blue);
  color: white;
  font-size: 28px;
  font-weight: 850;
  box-shadow: 0 12px 26px rgba(0, 91, 255, .24);
}
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; font-size: 21px; box-shadow: none; }
.topbar-actions, .heading-actions, .form-actions { display: flex; align-items: center; gap: 10px; }
.topbar-actions { min-width: 0; max-width: 100%; }
.topbar-actions > * { flex: 0 0 auto; }
.topbar form { margin: 0; }

.dashboard-shell { width: min(1260px, calc(100% - 36px)); margin: 34px auto 80px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; margin-bottom: 24px; }
.page-heading .muted { max-width: 720px; margin-bottom: 0; }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .13em; }
.muted { color: var(--muted); line-height: 1.5; }
.compact { margin: 4px 0 0; font-size: 13px; }

.button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 750;
  padding: 9px 15px;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { background: var(--ink); color: #fff; }
.button.accent { background: var(--blue); color: #fff; }
.button.accent:hover { background: var(--blue-dark); }
.button.secondary { border-color: #cbd3e1; background: #fff; color: var(--ink); }
.button.ghost { background: transparent; color: var(--muted); }
.button.danger { border-color: #f0c4cc; background: #fff3f5; color: var(--red); }
.button.small-button { min-height: 34px; border-radius: 9px; padding: 6px 10px; font-size: 12px; }
.wide { width: 100%; }
.nav-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.nav-link.active { border-color: #abc4f6; background: #edf3ff; color: var(--blue); }

.status-pill, .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 29px;
  border-radius: 999px;
  background: #edf1f7;
  color: #59657c;
  font-size: 12px;
  font-weight: 750;
  padding: 5px 10px;
  white-space: nowrap;
}
.status-pill::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.status-pill.online, .tag.ok { background: #e7f8ef; color: var(--green); }
.status-pill.offline, .tag.error { background: #fff0f3; color: var(--red); }
.tag.pending { background: #fff5d8; color: var(--amber); }
.tag.own { background: #e8f0ff; color: var(--blue); }

.flash { margin-bottom: 18px; border: 1px solid #bcd0fa; border-radius: 12px; background: #edf3ff; color: #174fbd; padding: 12px 15px; }
.flash.error { border-color: #f1bdc6; background: #fff0f3; color: var(--red); }
.flash.success { border-color: #bae6ce; background: #ecf9f2; color: var(--green); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.summary-card, .panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 10px 34px rgba(28, 42, 72, .045);
}
.summary-card { display: grid; min-height: 130px; align-content: center; border-radius: 17px; padding: 20px; }
.summary-card span { color: var(--muted); font-size: 13px; font-weight: 700; }
.summary-card strong { margin: 4px 0 0; font-size: 34px; letter-spacing: -.04em; }
.summary-card small { color: #8b94a7; }
.summary-card.danger-card strong { color: var(--red); }
.summary-card.warning-card strong { color: var(--amber); }

.panel { margin-bottom: 18px; border-radius: 19px; padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 20px; }
.panel-heading .eyebrow { margin-bottom: 5px; }
.store-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.store-card { border: 1px solid var(--line); border-radius: 15px; background: #fafbfe; padding: 16px; }
.store-card.error-card { border-color: #f1c7ce; background: #fffafb; }
.store-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.store-card h3 { overflow: hidden; margin: 0 0 5px; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.store-card a { color: var(--blue); font-size: 12px; text-decoration: none; }
.store-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 17px 0; }
.store-meta div { border-radius: 10px; background: #fff; padding: 9px; }
.store-meta span { display: block; color: var(--muted); font-size: 10px; }
.store-meta strong { display: block; margin-top: 3px; font-size: 13px; }
.store-error { margin: 10px 0; color: var(--red); font-size: 12px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.loading-block, .empty-state { color: #8a93a5; padding: 18px 0; }

.filters { display: flex; gap: 9px; }
input, select, textarea {
  min-height: 43px;
  border: 1px solid #ccd4e2;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 9px 11px;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 91, 255, .12); }
label > span { display: block; margin-bottom: 6px; color: #515d75; font-size: 12px; font-weight: 700; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th { border-bottom: 1px solid var(--line); color: #7b8598; font-size: 11px; letter-spacing: .035em; text-align: left; text-transform: uppercase; padding: 10px 12px; }
td { border-bottom: 1px solid #edf0f5; padding: 13px 12px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.product-cell { display: grid; max-width: 360px; gap: 4px; }
.product-cell a { overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 750; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.product-cell small, td small { color: var(--muted); }
.price-value { white-space: nowrap; font-weight: 730; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.empty-cell { color: #8a93a5; text-align: center; padding: 34px; }
.disabled-row { opacity: .5; }

.two-column { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.two-column > * { min-width: 0; }
.two-column .panel { margin-bottom: 0; }
.event-list { display: grid; gap: 9px; }
.event-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; border-radius: 11px; background: #f7f9fc; padding: 11px; }
.event-item > div { min-width: 0; }
.event-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 10px; background: #eaf1ff; }
.event-item strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.event-item small { color: var(--muted); font-size: 11px; }
.event-values { font-size: 12px; font-weight: 700; white-space: nowrap; }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.settings-form label input { width: 100%; }
.check-line { display: flex; align-items: center; grid-column: 1 / -1; gap: 8px; cursor: pointer; }
.check-line input { width: 17px; min-height: 17px; }
.check-line span { margin: 0; }
.settings-form .form-actions, .settings-form .compact { grid-column: 1 / -1; }
.settings-form .form-actions { flex-wrap: wrap; }
#priceControlPanel .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.price-control-form { display: grid; gap: 14px; }
.price-control-form .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.price-control-form .form-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; }
.price-control-form .form-grid input { width: 100%; }
.price-control-form .check-line { justify-content: flex-start; }
.price-control-form .check-line input { flex: 0 0 17px; width: 17px; margin: 0; }
.price-control-form .form-actions { flex-wrap: wrap; }
.price-control-form .hint { margin: 0; }
@media (max-width: 650px) {
  #priceControlPanel .summary-grid, .price-control-form .form-grid { grid-template-columns: 1fr; }
  .price-control-form .form-actions { flex-direction: column; align-items: stretch; }
}

.modal { width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 24px); border: 0; border-radius: 20px; box-shadow: 0 30px 80px rgba(18, 31, 58, .22); padding: 25px; }
.modal::backdrop { background: rgba(21, 32, 58, .45); backdrop-filter: blur(3px); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 9px; background: #f0f3f8; color: #5c6880; cursor: pointer; font-size: 22px; }
.modal label { display: block; margin-bottom: 14px; }
.modal label input, .modal label select, .modal label textarea { width: 100%; }
.modal textarea { min-height: 170px; resize: vertical; }
.links-preview { display: grid; max-height: 220px; margin: -4px 0 14px; gap: 7px; overflow: auto; }
.link-choice { display: grid !important; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; margin: 0 !important; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.link-choice input { width: 17px !important; min-height: 17px; }
.link-choice span { margin: 0; color: var(--ink); font-size: 12px; }
.link-choice small { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.modal-check { align-self: end; min-height: 43px; margin-bottom: 14px !important; }
.hint { border-radius: 11px; background: #f1f5fd; color: #5d6a84; font-size: 12px; line-height: 1.5; padding: 11px 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.history-modal { width: min(820px, calc(100% - 24px)); }
.chart { min-height: 240px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; overflow: hidden; }
.chart svg { display: block; width: 100%; height: 250px; }
.chart-legend { display: flex; gap: 18px; margin: 10px 2px 18px; color: var(--muted); font-size: 12px; }
.legend-dot { display: inline-block; width: 9px; height: 9px; margin-right: 5px; border-radius: 50%; }
.legend-dot.bank { background: #005bff; }
.legend-dot.regular { background: #7e8ca8; }
.history-list { max-height: 260px; overflow: auto; }
.history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 15px; border-bottom: 1px solid #edf0f5; font-size: 12px; padding: 10px 2px; }
.history-row.error { color: var(--red); }

.rentability-shell { width: min(1540px, calc(100% - 36px)); }
.rentability-summary { grid-template-columns: repeat(4, 1fr); }
.rentability-summary .summary-card strong { font-size: clamp(24px, 2.4vw, 34px); }
.rentability-day-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 8px; }
.rentability-day-totals .summary-card { border-color: #b9ceff; background: #f5f8ff; min-width: 0; }
.rentability-day-totals strong { font-size: clamp(24px, 2.4vw, 34px); overflow-wrap: anywhere; }
.rentability-profit-note { margin: 0 0 20px; font-size: 12px; }
@media (max-width: 650px) { .summary-grid.rentability-day-totals { grid-template-columns: 1fr; } }
.rentability-panel { scroll-margin-top: 88px; }
.spp-panel { margin-bottom: 18px; }
.spp-summary { grid-template-columns: repeat(4, 1fr); margin: 18px 0; }
.spp-average-card { border-color: #9fc0ff; background: #f2f7ff; }
.spp-average-card strong { color: var(--blue); }
.spp-table-wrap { max-height: 560px; border: 1px solid var(--line); border-radius: 13px; }
.spp-table { min-width: 1120px; font-variant-numeric: tabular-nums; }
.spp-table th { position: sticky; z-index: 2; top: 0; background: #f5f7fb; white-space: nowrap; }
.spp-table th:first-child, .spp-table td:first-child { width: 390px; text-align: left; }
.spp-table td { text-align: right; white-space: nowrap; }
.spp-table td:first-child a { display: block; max-width: 390px; overflow: hidden; color: var(--ink); font-weight: 750; text-overflow: ellipsis; text-decoration: none; }
.spp-value { font-weight: 850; }
.spp-formula { margin: 12px 2px 0; }
.rentability-heading { align-items: flex-end; }
.rentability-filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.rentability-period-control {
  display: grid;
  width: 370px;
  max-width: 100%;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .02em;
}
.rentability-period-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.rentability-period-dates label { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px; }
.rentability-period-dates input { width: 100%; min-height: 40px; }
.rentability-period-presets { display: flex; gap: 5px; }
.rentability-period-presets .button { flex: 1 1 auto; min-height: 30px; padding: 5px 9px; }
.rentability-period-status { margin: 0 0 14px; padding: 10px 12px; border: 1px solid #b9ceff; border-radius: 9px; background: #f5f8ff; color: #315381; font-size: 13px; }
.rentability-period-status.error { color: var(--red); border-color: #f2a6b7; background: #fff3f5; }
.rentability-period-status.success { color: var(--green); background: #f3faf5; border-color: #c3e4ca; }
#rentabilityWorkbookTop[aria-disabled="true"], #rentabilityWorkbookTable[aria-disabled="true"] { pointer-events: none; opacity: .5; }
.rentability-filters > input { min-width: 230px; }
.rentability-filters > #rentabilityArticles { min-width: 285px; }
.rentability-filters > select { min-width: 170px; }
.column-picker { position: relative; }
.column-picker > summary { min-width: 130px; list-style: none; cursor: pointer; }
.column-picker > summary::-webkit-details-marker { display: none; }
.column-picker-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  width: min(520px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(30, 45, 76, .18);
  padding: 13px;
}
.column-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.column-options { display: grid; grid-template-columns: 1fr 1fr; max-height: 330px; overflow: auto; gap: 5px 12px; }
.column-option { display: flex; align-items: center; gap: 8px; border-radius: 8px; color: #44516a; font-size: 12px; padding: 6px 7px; }
.column-option:hover { background: #f5f8fd; }
.column-option input { margin: 0; }
.column-hidden { display: none !important; }
.scenario-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: -4px 0 16px;
  border: 1px solid #bfd0f3;
  border-radius: 12px;
  background: #f4f7ff;
  padding: 11px 13px;
}
.scenario-copy { display: flex; align-items: center; gap: 10px; min-width: 0; }
.scenario-copy p { margin: 0; color: #526079; font-size: 12px; line-height: 1.45; }
.scenario-badge { flex: 0 0 auto; border-radius: 999px; background: #dce8ff; color: var(--blue); font-size: 11px; font-weight: 850; padding: 5px 9px; }
.scenario-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.scenario-actions .compact { margin: 0; }
.rentability-table-wrap { max-height: min(68vh, 760px); border: 1px solid var(--line); border-radius: 13px; }
.rentability-table { min-width: 3950px; font-variant-numeric: tabular-nums; }
.rentability-table th { position: sticky; z-index: 2; top: 0; background: #f5f7fb; white-space: normal; }
.rentability-table .column-title-row th { min-width: 135px; height: 64px; padding: 8px 40px 8px 12px; vertical-align: middle; }
.column-title-label { display: block; overflow: visible; line-height: 1.3; text-overflow: clip; white-space: normal; }
.column-title-row .excel-filter-button {
  position: absolute;
  top: 50%;
  right: 7px;
  float: none;
  margin: 0;
  transform: translateY(-50%);
}
.excel-filter-button {
  float: right;
  display: inline-grid;
  width: 26px;
  min-height: 26px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #78849a;
  cursor: pointer;
  font-size: 13px;
  margin: -2px 0 -2px 6px;
  padding: 0;
}
.excel-filter-button:hover, .excel-filter-button.is-open { border-color: #b9c9e7; background: #fff; color: var(--blue); }
.excel-filter-button.is-active { border-color: #7fa8fa; background: #e8f0ff; color: var(--blue); }
.excel-filter-menu {
  position: fixed;
  z-index: 100;
  max-height: min(620px, calc(100vh - 24px));
  overflow: hidden;
  border: 1px solid #cbd5e6;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(27, 40, 72, .25);
  color: #31405c;
  padding: 13px;
}
.excel-filter-menu[hidden] { display: none; }
.excel-filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.excel-filter-heading strong { overflow: hidden; color: var(--ink); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.excel-filter-close { flex: 0 0 auto; width: 28px; height: 28px; font-size: 19px; }
.excel-sort-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 11px; }
.excel-sort-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fd;
  color: #44516a;
  cursor: pointer;
  font-size: 11px;
  padding: 6px 8px;
}
.excel-sort-actions button:hover { border-color: #9fb8e8; background: #eef4ff; color: var(--blue); }
.excel-filter-field { display: grid; gap: 5px; margin: 9px 0; color: #66738b; font-size: 11px; font-weight: 750; }
.excel-filter-field input {
  width: 100%;
  min-height: 34px;
  border: 1px solid #ccd6e7;
  border-radius: 8px;
  background: #fff;
  color: #31405c;
  font-size: 12px;
  padding: 7px 9px;
}
.excel-filter-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0, 91, 255, .1); outline: none; }
.excel-select-all, .excel-filter-value {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border-radius: 7px;
  font-size: 12px;
  padding: 6px 7px;
}
.excel-select-all { border-bottom: 1px solid #e6eaf1; border-radius: 0; font-weight: 800; }
.excel-select-all input, .excel-filter-value input { width: 15px; min-height: 15px; margin: 0; }
.excel-filter-values { max-height: 230px; overflow: auto; margin-top: 4px; scrollbar-width: thin; }
.excel-filter-value:hover { background: #f3f7ff; }
.excel-filter-value span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.excel-filter-value small { color: #8a96ab; font-size: 10px; }
.excel-filter-footer { display: flex; justify-content: flex-end; gap: 7px; border-top: 1px solid #e6eaf1; margin-top: 10px; padding-top: 10px; }
.rentability-table td { color: #48525a; font-size: 12px; text-align: right; white-space: nowrap; }
.rentability-table th:first-child, .rentability-table th:nth-child(2),
.rentability-table td:first-child, .rentability-table td:nth-child(2) { text-align: left; }
.rentability-table th:first-child, .rentability-table td:first-child { width: 160px; }
.rentability-table th:nth-child(2), .rentability-table td:nth-child(2) { width: 440px; }
.rentability-table th:nth-child(2), .rentability-table td:nth-child(2) {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
  box-shadow: 10px 0 14px -14px rgba(21, 32, 58, .55);
}
.rentability-table th:nth-child(2) { z-index: 3; background: #f5f7fb; }
.rentability-name { max-width: 440px; overflow: hidden; text-overflow: ellipsis; }
.article-cell { color: var(--ink) !important; font-weight: 700; }
.assumption-cell { background: #fff8dc; }
.scenario-cell { background: #f5f8ff; padding: 7px 8px; }
.scenario-input, .scenario-select {
  width: 104px;
  min-height: 32px;
  border-color: #a9bfe9;
  border-radius: 8px;
  background: #fff;
  color: #31405c;
  font-size: 12px;
  text-align: right;
  padding: 5px 8px;
}
.scenario-input:focus, .scenario-select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(0, 91, 255, .12); }
.scenario-input.is-modified, .scenario-select.is-modified { border-color: var(--blue); background: #eaf1ff; color: #154ba7; font-weight: 750; }
.scenario-select { width: 190px; text-align: left; }
.scenario-cell.missing-value .scenario-input { border-color: #d69b28; background: #fff8e9; }
.emphasis-cell { font-weight: 850; }
.negative-value { background: #fde9e7; color: #c00000 !important; }
.positive-value { background: #e2f0d9; color: #008000 !important; }
.missing-value { background: #fff0d6; color: var(--amber) !important; font-weight: 750; }
.loss-row td:first-child { box-shadow: inset 3px 0 0 #e9a4af; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }

.sales-shell { width: min(1380px, calc(100% - 36px)); }
.sales-actions { align-items: flex-end; }
.date-select-label { min-width: 230px; }
.date-select-label select { width: 100%; }
.comparison-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  border: 1px solid #bdd1fa;
  border-radius: 16px;
  background: #edf3ff;
  padding: 15px 18px;
}
.comparison-strip .eyebrow { margin-bottom: 4px; }
.comparison-strip strong { display: block; font-size: 15px; }
.comparison-strip span { display: block; margin-top: 3px; color: #5c6b84; font-size: 12px; line-height: 1.45; }
.day-navigation { display: flex; flex: 0 0 auto; gap: 8px; }
.summary-card small.trend-positive, .trend-positive { color: var(--green); }
.summary-card small.trend-negative, .trend-negative { color: var(--red); }
.summary-card small.trend-neutral, .trend-neutral { color: #8b94a7; }
.sales-overview { grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr); }
.sales-overview > .panel { margin-bottom: 18px; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--line); }
.metric-item { min-height: 78px; background: #fff; padding: 13px 14px; }
.metric-item span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-item strong { display: block; margin-top: 6px; font-size: 17px; letter-spacing: -.02em; }
.sales-chart { min-height: 338px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; padding: 10px 12px 0; }
.sales-chart svg { display: block; width: 100%; min-height: 290px; }
.chart-grid-line { stroke: #e2e7f0; stroke-width: 1; }
.chart-axis-label { fill: #7b8598; font-size: 11px; font-family: Inter, "Segoe UI", sans-serif; }
.sales-line { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 4; vector-effect: non-scaling-stroke; }
.sales-line.orders { stroke: var(--blue); }
.sales-line.revenue { stroke: var(--green); }
.sales-line.previous { stroke-dasharray: 8 6; stroke-width: 2; opacity: .52; }
.legend-dot.sales-orders { background: var(--blue); }
.legend-dot.sales-revenue { background: var(--green); }
.legend-dash { display: inline-block; width: 16px; margin: 0 6px 3px 0; border-top: 2px dashed #7e8ca8; }
.sales-history-table { min-width: 1420px; font-variant-numeric: tabular-nums; }
.sales-archive-table { min-width: 960px; font-variant-numeric: tabular-nums; }
.sales-history-table td, .sales-archive-table td { white-space: nowrap; }
.sales-history-table td > small, .sales-archive-table td > small, .comparison-cell small { display: block; margin-top: 4px; font-size: 11px; }
.comparison-cell { min-width: 184px; background: #f8faff; }
.comparison-cell strong { display: block; color: #536079; font-size: 11px; }
.selected-row { background: #f0f5ff; }
.table-date-button { border: 0; background: transparent; color: var(--blue); cursor: pointer; font-weight: 800; padding: 0; }
.table-date-button:hover { text-decoration: underline; }

.agent-shell { width: min(1480px, calc(100% - 36px)); }
.agent-page-heading { align-items: center; }
.agent-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.agent-title-line h1 { margin-bottom: 0; }
.agent-summary .summary-card { min-height: 118px; }
.agent-summary .summary-card strong { font-size: clamp(25px, 2.25vw, 34px); }

.budget-optimizer-panel { scroll-margin-top: 88px; border-color: #b9cdf8; }
.budget-optimizer-heading { align-items: flex-start; }
.budget-optimizer-heading h2 { margin: 3px 0 0; font-size: 26px; }
.budget-optimizer-settings { display: grid; gap: 18px; margin-top: 16px; }
.budget-optimizer-safety-grid {
  display: grid;
  grid-template-columns: minmax(270px, 1.45fr) repeat(4, minmax(130px, .7fr));
  align-items: end;
  gap: 10px;
  border: 1px solid #cfdbf4;
  border-radius: 13px;
  background: #f7faff;
  padding: 13px;
}
.budget-optimizer-safety-grid label { display: grid; gap: 6px; color: #536079; font-size: 11px; font-weight: 750; }
.budget-optimizer-safety-grid input { width: 100%; }
.budget-optimizer-safety-grid .switch-label { display: flex; min-height: 44px; align-items: center; gap: 9px; }
.budget-optimizer-safety-grid .switch-label input { width: 18px; height: 18px; }
.budget-rule-layout { display: grid; gap: 17px; }
.budget-rule-layout > section { min-width: 0; }
.budget-rule-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 8px; }
.budget-rule-heading h3 { margin: 0; font-size: 16px; }
.budget-rule-heading span { color: var(--muted); font-size: 11px; }
.budget-rule-table-wrap { border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.budget-rule-table { min-width: 1600px; table-layout: fixed; font-variant-numeric: tabular-nums; }
.budget-rule-table th { background: #f4f7fb; color: #68738a; font-size: 10px; white-space: normal; }
.budget-rule-table th:nth-child(1) { width: 100px; }
.budget-rule-table th:nth-child(2), .budget-rule-table th:nth-child(3) { width: 118px; }
.budget-rule-table th:nth-child(n+4):not(:last-child) { width: 145px; }
.budget-rule-table th:last-child { width: 480px; }
.budget-rule-table td { padding: 7px; vertical-align: top; }
.budget-rule-table input, .budget-rule-table select { width: 100%; min-height: 36px; border-radius: 8px; font-size: 12px; padding: 6px 7px; }
.budget-rule-unconfigured td { background: #f8fafc; }
.budget-rule-unconfigured input::placeholder { color: #8a96aa; opacity: 1; }
.budget-extra-condition-cell { background: #f8fbff; }
.budget-extra-condition-list { display: grid; gap: 6px; }
.budget-extra-condition {
  display: grid;
  grid-template-columns: auto 58px 80px auto 80px auto 30px;
  align-items: center;
  gap: 5px;
  color: #536079;
  font-size: 11px;
  white-space: nowrap;
}
.budget-extra-condition input, .budget-extra-condition select { min-height: 32px; padding: 4px 6px; }
.budget-condition-add, .budget-condition-remove {
  border: 1px solid #b9cdf8;
  background: #fff;
  color: #075eff;
  cursor: pointer;
}
.budget-condition-add { width: 100%; margin-top: 7px; padding: 7px 10px; border-radius: 8px; font-size: 11px; font-weight: 750; }
.budget-condition-remove { width: 30px; height: 30px; border-radius: 8px; font-size: 18px; line-height: 1; }
.optimizer-management-state { color: #b26a00 !important; font-weight: 750; }
.budget-holiday-field { display: grid; gap: 7px; color: #536079; font-size: 11px; font-weight: 750; }
.budget-holiday-field textarea { width: 100%; resize: vertical; }
.budget-optimizer-save-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; }
.budget-optimizer-save-row .campaign-safety-note { margin: 0; }
.optimizer-preview-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-radius: 10px; background: #edf3ff; color: #34517f; padding: 10px 12px; }
.optimizer-preview-summary strong { color: var(--blue); }
.button.disabled { pointer-events: none; cursor: not-allowed; opacity: .5; }
.budget-restore-panel { scroll-margin-top: 88px; }
.budget-restore-heading { align-items: flex-start; }
.budget-restore-heading h2 { margin: 3px 0 0; font-size: 26px; }
.budget-restore-title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.budget-restore-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.budget-restore-actions .button { min-height: 40px; white-space: nowrap; }
.budget-agent-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #edf0f5;
  gap: 1px;
}
.budget-agent-summary > div { display: grid; gap: 4px; min-height: 95px; align-content: center; background: #f8faff; padding: 13px 15px; }
.budget-agent-summary span { color: var(--muted); font-size: 11px; font-weight: 700; }
.budget-agent-summary strong { font-size: 20px; letter-spacing: -.03em; }
.budget-agent-summary small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.budget-restore-settings {
  display: grid;
  grid-template-columns: minmax(230px, .7fr) minmax(300px, 1.3fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
  border: 1px solid #c9d7f5;
  border-radius: 13px;
  background: #f5f8ff;
  padding: 14px;
}
.budget-restore-settings label { display: grid; gap: 7px; color: #536079; font-size: 11px; font-weight: 750; }
.budget-restore-settings input[type="time"] { width: 100%; }
.budget-restore-settings .switch-label { display: flex; min-height: 44px; align-items: center; gap: 9px; }
.budget-restore-settings input[type="checkbox"] { width: 18px; height: 18px; }
.budget-restore-details { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.budget-restore-details article { min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfe; padding: 14px; }
.budget-restore-details h3 { margin: 0 0 10px; font-size: 14px; }
.budget-restore-list { display: grid; max-height: 230px; gap: 7px; overflow: auto; font-size: 12px; }
.budget-restore-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; border-bottom: 1px solid #edf0f5; padding: 7px 0; }
.budget-restore-item:last-child { border-bottom: 0; }
.budget-restore-item strong, .budget-restore-item span, .budget-restore-item small { display: block; }
.budget-restore-item strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.budget-restore-item small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.budget-restore-change { align-self: center; color: var(--blue); font-weight: 800; white-space: nowrap; }
.budget-restore-change.negative { color: var(--red); }
.campaign-category-panel { scroll-margin-top: 88px; }
.campaign-category-heading { align-items: flex-start; }
.campaign-category-heading h2 { margin-top: 3px; font-size: 26px; }
.campaign-heading-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.campaign-heading-actions .button { min-height: 40px; white-space: nowrap; }
.campaign-export-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.campaign-category-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #edf0f5;
  gap: 1px;
}
.campaign-category-summary > div { display: grid; gap: 4px; background: #f8faff; padding: 13px 15px; }
.campaign-category-summary span { color: var(--muted); font-size: 11px; font-weight: 700; }
.campaign-category-summary strong { font-size: 22px; letter-spacing: -.03em; }
.campaign-unassigned-warning {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 15px;
  border: 1px solid #f0c46a;
  border-radius: 13px;
  background: #fff8e7;
  color: #744b00;
  padding: 14px 15px;
}
.campaign-unassigned-warning[hidden] { display: none; }
.campaign-unassigned-warning strong { color: #5d3a00; }
.campaign-unassigned-warning p { margin: 5px 0 8px; font-size: 12px; line-height: 1.45; }
.campaign-unassigned-warning ul { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; }
.campaign-unassigned-warning li { display: flex; gap: 5px; min-width: 0; font-size: 11px; }
.campaign-unassigned-warning li span { overflow: hidden; max-width: 270px; text-overflow: ellipsis; white-space: nowrap; }
.campaign-unassigned-warning .button { flex: 0 0 auto; white-space: nowrap; }
.campaign-unassigned-more { font-weight: 750; }
.campaign-category-toolbar { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 15px; }
.campaign-category-toolbar label:first-child { flex: 1 1 330px; }
.campaign-category-toolbar label:last-child { flex: 0 1 210px; }
.campaign-category-toolbar input,
.campaign-category-toolbar select { width: 100%; }
.campaign-notice { margin-bottom: 13px; border: 1px solid #bad0fb; border-radius: 11px; background: #edf3ff; color: #174fbd; font-size: 12px; padding: 10px 13px; }
.campaign-notice.success { border-color: #bae6ce; background: #ecf9f2; color: var(--green); }
.campaign-notice.error { border-color: #f1bdc6; background: #fff0f3; color: var(--red); }
.campaign-category-table-wrap { max-height: 720px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.campaign-category-table { min-width: 1390px; table-layout: fixed; font-variant-numeric: tabular-nums; }
.campaign-category-table th { position: sticky; z-index: 2; top: 0; background: #f4f7fb; white-space: nowrap; }
.campaign-category-table th:nth-child(1) { width: 130px; }
.campaign-category-table th:nth-child(2) { width: 260px; }
.campaign-category-table th:nth-child(3) { width: 455px; }
.campaign-category-table th:nth-child(4) { width: 145px; }
.campaign-category-table th:nth-child(5) { width: 170px; }
.campaign-category-table th:nth-child(6) { width: 125px; }
.campaign-category-table th:nth-child(7) { width: 120px; }
.campaign-category-table td { vertical-align: top; }
.campaign-category-table select,
.campaign-category-table input { width: 100%; min-height: 38px; border-radius: 8px; font-size: 12px; padding: 7px 8px; }
.campaign-id-cell strong,
.campaign-id-cell small,
.campaign-name-cell strong,
.campaign-name-cell small { display: block; }
.campaign-id-cell strong { font-size: 13px; }
.campaign-id-cell small { margin-top: 6px; color: var(--green); }
.campaign-name-cell strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.campaign-name-cell small { margin-top: 7px; }
.campaign-products-list { display: grid; gap: 8px; }
.campaign-product { display: grid; grid-template-columns: minmax(105px, .42fr) minmax(0, 1fr); column-gap: 9px; row-gap: 2px; }
.campaign-product + .campaign-product { border-top: 1px solid #edf0f5; padding-top: 8px; }
.campaign-product strong { color: #254b91; font-size: 12px; word-break: break-word; }
.campaign-product span { overflow: hidden; color: var(--ink); font-size: 12px; line-height: 1.38; text-overflow: ellipsis; white-space: nowrap; }
.campaign-product small { grid-column: 2; font-size: 10px; }
.campaign-products-more { margin-top: 9px; }
.campaign-products-more summary { width: max-content; cursor: pointer; color: var(--blue); font-size: 11px; font-weight: 750; }
.campaign-products-more[open] summary { margin-bottom: 8px; }
.campaign-validity-cell small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.campaign-category-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  background: #edf1f7;
  color: #637089;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 9px;
  white-space: nowrap;
}
.campaign-category-status.active { background: #e7f8ef; color: var(--green); }
.campaign-category-status.expired { background: #fff0f3; color: var(--red); }
.campaign-pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.campaign-pagination > div { display: flex; gap: 8px; }
.campaign-safety-note { margin: 14px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.agent-workspace { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(350px, .72fr); align-items: start; gap: 18px; }
.agent-main-column, .agent-side-column { min-width: 0; }
.agent-lead-panel { display: flex; align-items: center; gap: 18px; border-color: #b9cdf8; background: #f6f9ff; }
.agent-lead-mark, .agent-avatar, .department-role-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  background: var(--blue);
  color: #fff;
  font-weight: 850;
}
.agent-lead-mark { width: 52px; height: 52px; border-radius: 15px; font-size: 23px; }
.agent-lead-panel span { color: var(--blue); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.agent-lead-panel h2 { margin-top: 5px; line-height: 1.25; }
.recommendation-list { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.recommendation-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 98px;
  gap: 14px;
  border: 0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  padding: 15px;
  text-align: left;
  transition: background .16s ease, box-shadow .16s ease;
}
.recommendation-item:hover { background: #f8faff; }
.recommendation-item:focus-visible { position: relative; z-index: 1; outline: 3px solid rgba(30, 99, 230, .25); outline-offset: -3px; }
.recommendation-item.selected { background: #f1f6ff; box-shadow: inset 0 0 0 2px #9ab8f6; }
.recommendation-item.critical { box-shadow: inset 3px 0 0 var(--red); }
.recommendation-item.warning { box-shadow: inset 3px 0 0 #d99519; }
.recommendation-item.info { box-shadow: inset 3px 0 0 var(--blue); }
.recommendation-item.success { box-shadow: inset 3px 0 0 var(--green); }
.recommendation-item.critical.selected { box-shadow: inset 3px 0 0 var(--red), inset 0 0 0 2px #9ab8f6; }
.recommendation-item.warning.selected { box-shadow: inset 3px 0 0 #d99519, inset 0 0 0 2px #9ab8f6; }
.recommendation-item.info.selected { box-shadow: inset 3px 0 0 var(--blue), inset 0 0 0 2px #9ab8f6; }
.recommendation-item.success.selected { box-shadow: inset 3px 0 0 var(--green), inset 0 0 0 2px #9ab8f6; }
.recommendation-rank { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; background: #edf2fa; color: #5d6a82; font-size: 12px; font-weight: 850; }
.recommendation-copy h3 { margin: 0 0 5px; font-size: 15px; }
.recommendation-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.48; }
.recommendation-details { margin-top: 18px; border: 1px solid #bfd0f2; border-radius: 14px; background: #f9fbff; padding: 16px; }
.recommendation-details-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.recommendation-details-heading h3 { margin: 4px 0 3px; font-size: 19px; }
.recommendation-details-heading .eyebrow { color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.recommendation-table-wrap { max-height: 520px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.recommendation-products-table { min-width: 1160px; font-variant-numeric: tabular-nums; }
.recommendation-products-table th { position: sticky; z-index: 1; top: 0; background: #f3f6fb; }
.recommendation-products-table td { vertical-align: top; white-space: nowrap; }
.recommendation-products-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.recommendation-products-table .recommendation-product-name { min-width: 330px; max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.negative-text { color: var(--red); }
.warning-text { color: #a76b00; }
.empty-table-cell { color: var(--muted); padding: 30px !important; text-align: center; }
.agent-activity-list { display: grid; }
.agent-activity-item { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; border-top: 1px solid #edf0f5; padding: 13px 0; }
.agent-activity-item:first-child { border-top: 0; padding-top: 0; }
.agent-activity-item time { color: #8993a7; font-size: 11px; }
.agent-activity-item strong { display: block; font-size: 13px; }
.agent-activity-item p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.agent-profile-head { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.agent-avatar { width: 48px; height: 48px; border-radius: 14px; font-size: 21px; }
.agent-profile-head h2 { font-size: 18px; }
.agent-profile-facts { display: grid; overflow: hidden; margin: 0 0 20px; border: 1px solid var(--line); border-radius: 12px; }
.agent-profile-facts div { display: flex; justify-content: space-between; gap: 16px; border-top: 1px solid #edf0f5; padding: 10px 12px; }
.agent-profile-facts div:first-child { border-top: 0; }
.agent-profile-facts dt { color: var(--muted); font-size: 12px; }
.agent-profile-facts dd { margin: 0; color: var(--ink); font-size: 12px; font-weight: 800; text-align: right; }
.positive-text { color: var(--green) !important; }
.agent-source-block + .agent-source-block { margin-top: 17px; }
.agent-source-block h3 { margin: 0 0 8px; font-size: 12px; }
.agent-source-block ul { display: grid; margin: 0; gap: 7px; list-style: none; padding: 0; }
.agent-source-block li { position: relative; color: #58657c; font-size: 12px; padding-left: 15px; }
.agent-source-block li::before { position: absolute; top: .52em; left: 0; width: 6px; height: 6px; border-radius: 50%; background: #83a9f6; content: ""; }
.agent-task-list { display: grid; gap: 8px; }
.agent-task-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; border-radius: 10px; background: #f7f9fc; padding: 10px; }
.agent-task-item > span:nth-child(2) { overflow: hidden; font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.agent-task-item small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.task-priority { width: 8px; height: 8px; border-radius: 50%; background: #8fa0ba; }
.task-priority.critical { background: var(--red); }
.task-priority.warning { background: #d99519; }
.task-priority.info { background: var(--blue); }
.task-priority.success { background: var(--green); }
.agent-chat-panel { position: sticky; top: 88px; }
.agent-messages { display: grid; max-height: 290px; min-height: 150px; gap: 9px; overflow-y: auto; padding: 2px 2px 10px; }
.agent-message { max-width: 90%; border-radius: 12px 12px 12px 3px; background: #edf3ff; color: #29436f; font-size: 12px; line-height: 1.5; padding: 10px 12px; }
.agent-message.user { justify-self: end; border-radius: 12px 12px 3px; background: var(--blue); color: #fff; }
.agent-message.error { background: #fff0f3; color: var(--red); }
.agent-quick-questions { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 11px; }
.agent-quick-questions button { min-height: 29px; border: 1px solid #cbd7ed; border-radius: 8px; background: #fff; color: #4c5d78; cursor: pointer; font-size: 10px; padding: 5px 8px; }
.agent-quick-questions button:hover { border-color: #8eaff0; color: var(--blue); }
.agent-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.agent-chat-form textarea { width: 100%; min-height: 58px; resize: vertical; }
.agent-chat-form .button { min-height: 58px; }
.department-panel { margin-top: 18px; }
.department-rail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #edf0f5; gap: 1px; }
.department-role { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; min-height: 112px; gap: 11px; background: #fafbfc; padding: 15px; }
.department-role.active { background: #f2f7ff; }
.department-role-mark { width: 36px; height: 36px; border-radius: 11px; }
.department-role:not(.active) .department-role-mark { background: #e5e9f0; color: #7d899f; }
.department-role strong, .department-role span { display: block; }
.department-role strong { font-size: 13px; }
.department-role span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.department-role small { grid-column: 2; color: #8a94a8; font-size: 10px; }
.department-role.active small { color: var(--blue); font-weight: 750; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }

.login-page { display: grid; min-height: 100vh; place-items: center; background: radial-gradient(circle at 25% 15%, #e3edff, transparent 34%), #f4f7fc; padding: 20px; }
.login-card { width: min(430px, 100%); border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: 0 25px 70px rgba(21, 32, 58, .1); padding: 34px; }
.login-card .brand-mark { margin-bottom: 25px; }
.login-card h1 { font-size: 32px; }
.login-form { display: grid; gap: 16px; margin-top: 25px; }
.login-form input { width: 100%; }
.form-error { margin: -5px 0 0; color: var(--red); font-size: 13px; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; min-width: 0; }
  .topbar-actions { width: 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .rentability-summary { grid-template-columns: 1fr 1fr; }
  .spp-summary { grid-template-columns: 1fr 1fr; }
  .two-column { grid-template-columns: 1fr; }
  .sales-overview { grid-template-columns: 1fr; }
  .agent-workspace { grid-template-columns: 1fr; }
  .budget-agent-summary { grid-template-columns: 1fr 1fr; }
  .budget-optimizer-safety-grid { grid-template-columns: 1fr 1fr; }
  .budget-optimizer-safety-grid .switch-label { grid-column: 1 / -1; }
  .budget-restore-settings { grid-template-columns: 1fr 1fr; }
  .budget-restore-settings .button { grid-column: 1 / -1; }
  .campaign-category-summary { grid-template-columns: 1fr 1fr; }
  .agent-chat-panel { position: static; }
  .department-rail { grid-template-columns: 1fr 1fr; }
  .store-grid { grid-template-columns: 1fr; }
  .rentability-heading { align-items: stretch; flex-direction: column; }
  .rentability-filters { justify-content: stretch; }
  .rentability-filters > * { flex: 1 1 100%; }
  .rentability-period-control { width: 100%; }
  .column-picker-menu { right: auto; left: 0; }
  .scenario-toolbar { align-items: flex-start; flex-direction: column; }
  .scenario-actions { width: 100%; justify-content: space-between; }
}

@media (max-width: 650px) {
  .topbar { min-height: 62px; padding: 9px 12px; }
  .brand small { display: none; }
  .brand-mark.small { width: 38px; height: 38px; }
  .topbar-actions { gap: 4px; }
  .topbar .button { padding-inline: 8px; }
  .topbar .nav-link { font-size: 12px; }
  .dashboard-shell { width: min(100% - 20px, 1260px); margin-top: 22px; }
  .page-heading, .panel-heading, .products-heading { align-items: stretch; flex-direction: column; }
  .heading-actions, .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters { min-width: 0; }
  .filters select { width: 100%; min-width: 0; }
  .sales-actions { width: 100%; grid-template-columns: 1fr; }
  .date-select-label { min-width: 0; }
  .comparison-strip { align-items: stretch; flex-direction: column; }
  .day-navigation { display: grid; grid-template-columns: 1fr 1fr; }
  .heading-actions .button:first-child { grid-column: 1 / -1; }
  .summary-grid { gap: 9px; }
  .sales-shell .summary-grid { grid-template-columns: 1fr; }
  .sales-shell .summary-card { min-height: 100px; }
  .sales-shell .summary-card strong { font-size: clamp(25px, 9vw, 32px); overflow-wrap: anywhere; }
  .rentability-summary { grid-template-columns: 1fr; }
  .spp-summary { grid-template-columns: 1fr; }
  .summary-card { min-height: 108px; padding: 15px; }
  .summary-card strong { font-size: 29px; }
  .metric-grid { grid-template-columns: 1fr; }
  .sales-chart { min-height: 275px; padding-inline: 4px; }
  .sales-chart svg { min-height: 240px; }
  .panel { border-radius: 15px; padding: 16px; }
  .store-meta { grid-template-columns: 1fr 1fr; }
  .settings-form, .form-grid { grid-template-columns: 1fr; }
  .settings-form label, .settings-form .form-actions, .settings-form .compact, .check-line { grid-column: auto; }
  .settings-form .form-actions { align-items: stretch; flex-direction: column; }
  .modal { padding: 18px; }
  .history-row { grid-template-columns: 1fr 1fr; }
  .history-row span:first-child { grid-column: 1 / -1; }
  .scenario-copy { align-items: flex-start; flex-direction: column; }
  .scenario-actions { align-items: stretch; flex-direction: column; }
  .agent-page-heading { align-items: stretch; }
  .agent-summary { grid-template-columns: 1fr; }
  .budget-restore-panel { padding: 17px; }
  .budget-optimizer-panel { padding: 17px; }
  .budget-optimizer-heading { align-items: stretch; }
  .budget-optimizer-safety-grid { grid-template-columns: 1fr; }
  .budget-optimizer-safety-grid .switch-label { grid-column: auto; }
  .budget-optimizer-save-row { grid-template-columns: 1fr; }
  .budget-optimizer-save-row .button { width: 100%; }
  .budget-rule-heading { display: grid; gap: 3px; }
  .budget-restore-heading { align-items: stretch; }
  .budget-restore-actions { display: grid; grid-template-columns: 1fr; }
  .budget-restore-actions .button { width: 100%; }
  .budget-agent-summary, .budget-restore-settings, .budget-restore-details { grid-template-columns: 1fr; }
  .budget-restore-settings .button { grid-column: auto; }
  .campaign-category-panel { padding: 17px; }
  .campaign-category-heading { align-items: stretch; }
  .campaign-heading-actions { display: grid; grid-template-columns: 1fr; }
  .campaign-heading-actions .button { width: 100%; }
  .campaign-category-summary { grid-template-columns: 1fr; }
  .campaign-unassigned-warning { align-items: stretch; flex-direction: column; }
  .campaign-unassigned-warning .button { width: 100%; }
  .campaign-category-toolbar { display: grid; }
  .campaign-pagination { align-items: stretch; flex-direction: column; }
  .campaign-pagination > div { display: grid; grid-template-columns: 1fr 1fr; }
  .recommendation-item { grid-template-columns: auto minmax(0, 1fr); }
  .recommendation-item .button { grid-column: 2; justify-self: start; }
  .agent-activity-item { grid-template-columns: 1fr; gap: 5px; }
  .agent-chat-form { grid-template-columns: 1fr; }
  .agent-chat-form .button { min-height: 42px; }
  .department-rail { grid-template-columns: 1fr; }
}
/* Operations uses existing design tokens; long journal values stay inside panels. */
.operations-shell .panel { min-width: 0; max-width: 100%; }
.operations-shell p, .operations-shell summary { overflow-wrap: anywhere; }
.operations-shell .heading-actions { display: flex; flex-wrap: wrap; }
.operations-shell .heading-actions label { min-width: 0; max-width: 100%; }
.operations-shell select, .operations-shell input { max-width: 100%; }
