:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687386;
  --line: #dce2ea;
  --surface: #ffffff;
  --canvas: #f4f6f8;
  --blue: #2855d9;
  --blue-soft: #edf2ff;
  --green: #25845b;
  --green-soft: #eaf6ef;
  --coral: #d95f3d;
  --coral-soft: #fff0eb;
  --amber: #a96708;
  --amber-soft: #fff5dc;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef1f5;
}

.login-shell {
  width: min(430px, calc(100% - 32px));
}

.login-panel {
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(30, 42, 66, 0.08);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  color: white;
  background: var(--blue);
  border-radius: 7px;
  font-weight: 800;
}

.brand-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 7px;
}

.brand-icon-large {
  width: 50px;
  height: 50px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-panel .eyebrow {
  margin-top: 24px;
}

.login-panel h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.login-copy {
  margin: 12px 0 26px;
  color: var(--muted);
  line-height: 1.5;
}

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

.login-form label,
.custom-period label,
.table-search {
  display: grid;
  gap: 7px;
  color: #3d4759;
  font-size: 13px;
  font-weight: 600;
}

input {
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  border: 1px solid #cbd3de;
  border-radius: 6px;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 85, 217, 0.12);
}

.password-control {
  position: relative;
  display: block;
  min-width: 0;
}

.password-control input {
  width: 100%;
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--blue);
  background: var(--blue-soft);
  outline: none;
}

.password-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

select,
textarea {
  min-width: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid #cbd3de;
  border-radius: 6px;
  outline: none;
}

select {
  height: 42px;
}

textarea {
  min-height: 70px;
  resize: vertical;
  line-height: 1.45;
}

select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 85, 217, 0.12);
}

.primary-command,
.secondary-command,
.text-command {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-command {
  color: white;
  background: var(--blue);
}

.primary-command.compact {
  min-height: 38px;
}

.secondary-command {
  color: var(--ink);
  background: white;
  border-color: #cbd3de;
}

.text-command {
  color: var(--muted);
  background: transparent;
}

.form-error,
.error-state {
  margin: 0;
  padding: 11px 13px;
  color: #9f301d;
  background: var(--coral-soft);
  border: 1px solid #f0c5b9;
  border-radius: 6px;
  font-size: 13px;
}

.dashboard-page {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 246px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  color: white;
  background: #1b2433;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.brand strong {
  font-size: 15px;
}

.brand span {
  margin-top: 3px;
  color: #aeb8c8;
  font-size: 12px;
}

.view-switch {
  margin-top: 30px;
  display: grid;
  gap: 5px;
}

.mobile-tab-label {
  display: none;
}

.view-tab,
.business-tab {
  position: relative;
  height: 44px;
  padding: 0 13px;
  color: #c5cddb;
  text-align: left;
  background: transparent;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 4px;
  font-weight: 700;
}

.view-tab:hover,
.view-tab.is-active,
.business-tab:hover,
.business-tab.is-active {
  color: white;
  background: #273346;
  border-left-color: #6f91ff;
}

.nav-badge {
  position: absolute;
  top: 9px;
  right: 10px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  color: white;
  background: #d95f3d;
  border-radius: 10px;
  font-size: 10px;
}

.sidebar-label {
  margin: 25px 12px 7px;
  color: #8290a4;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.business-switch {
  display: grid;
  gap: 5px;
}

.business-tab {
  height: 40px;
}

.sidebar-status {
  margin-top: auto;
  padding: 13px 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-top: 1px solid #354257;
  border-bottom: 1px solid #354257;
}

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

.sidebar-status strong {
  font-size: 12px;
}

.sidebar-status span {
  margin-top: 4px;
  color: #aeb8c8;
  font-size: 11px;
  line-height: 1.35;
}

.status-dot,
.source-indicator {
  display: block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  margin-top: 3px;
  background: #7a8799;
  border-radius: 50%;
}

.status-dot.ok,
.source-indicator.ok {
  background: #48bd83;
}

.status-dot.bad,
.source-indicator.bad {
  background: #ef7a5e;
}

.status-dot.waiting,
.source-indicator.waiting {
  background: #e8b54a;
}

.sidebar-actions {
  margin-top: 14px;
  display: grid;
  gap: 5px;
}

.sidebar .secondary-command {
  background: #273346;
  border-color: #46546b;
  color: white;
}

.sidebar .text-command {
  color: #aeb8c8;
}

.dashboard-main {
  margin-left: 246px;
  min-height: 100vh;
  padding: 30px 34px 56px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.page-header p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.period-controls {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.period-tabs {
  display: flex;
  padding: 3px;
  background: #e7ebf0;
  border-radius: 7px;
}

.cost-mode {
  display: flex;
  padding: 3px;
  background: #e7ebf0;
  border-radius: 7px;
}

.period-tabs button,
.cost-mode button {
  min-height: 34px;
  padding: 0 11px;
  color: #566174;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
}

.period-tabs button.is-active,
.cost-mode button.is-active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 4px rgba(20, 30, 48, 0.12);
}

.custom-period {
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.custom-period[hidden] {
  display: none;
}

.custom-period input {
  height: 38px;
}

.loading-state {
  margin-top: 40px;
  color: var(--muted);
}

.error-state {
  margin-top: 25px;
}

.account-finance-strip {
  margin-top: 27px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 7px;
}

.account-finance-strip.critical {
  border-left-color: var(--coral);
  background: #fff8f7;
}

.account-finance-strip.warning {
  border-left-color: #c88716;
  background: #fffaf1;
}

.account-finance-strip article {
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.account-finance-strip article:last-child {
  border-right: 0;
}

.account-finance-strip span,
.account-finance-strip small,
.account-finance-strip strong {
  display: block;
}

.account-finance-strip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.account-finance-strip strong {
  margin-top: 7px;
  font-size: 22px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.account-finance-strip small {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.account-finance-strip.critical #account-balance-status {
  color: var(--coral);
  font-weight: 800;
}

.account-finance-strip.warning #account-balance-status {
  color: #9b6407;
  font-weight: 800;
}

.kpi-grid {
  margin-top: 27px;
  display: grid;
  grid-template-columns: repeat(4, minmax(155px, 1fr));
  gap: 12px;
}

.kpi-card {
  min-height: 126px;
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid #9aa6b5;
  border-radius: var(--radius);
}

.kpi-card.accent-green {
  border-top-color: var(--green);
}

.kpi-card.accent-coral {
  border-top-color: var(--coral);
}

.kpi-card > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi-card > strong {
  display: block;
  margin-top: 13px;
  font-size: 24px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.kpi-card small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.kpi-card small.positive {
  color: var(--green);
}

.kpi-card small.negative {
  color: var(--coral);
}

.kpi-secondary {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.overview-band,
.details-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.85fr);
  gap: 22px;
}

.chart-panel,
.funnel-panel,
.warnings-panel,
.queries-panel,
.data-quality,
.campaign-section {
  min-width: 0;
  padding-top: 19px;
  border-top: 1px solid #cfd6e0;
}

.section-heading {
  min-height: 45px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.chart-legend {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
}

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

.chart-legend i {
  width: 10px;
  height: 10px;
  display: block;
}

.legend-cost {
  background: var(--blue);
}

.legend-clicks {
  background: var(--coral);
  border-radius: 50%;
}

.chart-wrap {
  height: 285px;
  margin-top: 9px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.funnel {
  margin-top: 13px;
  display: grid;
  gap: 15px;
}

.funnel-row {
  display: grid;
  gap: 6px;
}

.funnel-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.funnel-copy span {
  color: #465064;
}

.funnel-track {
  height: 7px;
  overflow: hidden;
  background: #e1e6ed;
  border-radius: 3px;
}

.funnel-track i {
  height: 100%;
  display: block;
  background: var(--green);
  border-radius: 3px;
}

.funnel-row small,
.quality-note {
  color: var(--muted);
  font-size: 10px;
}

.quality-note {
  margin: 19px 0 0;
  padding: 11px;
  line-height: 1.45;
  background: var(--amber-soft);
  border: 1px solid #edd59a;
  border-radius: 6px;
}

.campaign-section {
  margin-top: 31px;
}

.campaign-heading {
  align-items: end;
}

.campaign-tools {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
}

.campaign-filter {
  display: flex;
  padding: 3px;
  background: #e7ebf0;
  border-radius: 7px;
}

.campaign-filter button {
  min-height: 38px;
  padding: 0 10px;
  color: #566174;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.campaign-filter button.is-active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 4px rgba(20, 30, 48, 0.12);
}

.campaign-filter button span {
  margin-left: 3px;
  color: #7a8495;
}

.table-search {
  width: min(260px, 100%);
}

.table-search input {
  height: 38px;
}

.table-shell {
  margin-top: 13px;
  overflow-x: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  padding: 13px 11px;
  text-align: right;
  border-bottom: 1px solid #e5e9ef;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  color: #5e697b;
  background: #f7f8fa;
  font-size: 10px;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #f7f9fc;
}

.campaign-group-row td {
  padding: 10px 12px;
  color: #465064;
  background: #eef2f7;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.campaign-group-row td span {
  margin-left: 5px;
  color: #7a8495;
}

td:first-child {
  min-width: 220px;
  white-space: normal;
}

td:first-child strong,
td:first-child small {
  display: block;
}

td:first-child small {
  margin-top: 4px;
  color: #8791a0;
  font-size: 10px;
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  padding: 0 8px;
  color: #5d6675;
  background: #edf0f4;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
}

.status-badge.ok {
  color: #236644;
  background: var(--green-soft);
}

.status-badge.bad {
  color: #9f301d;
  background: var(--coral-soft);
}

.metric-bad {
  color: var(--coral);
  font-weight: 700;
}

.empty-cell,
.empty-copy {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.warning-list,
.query-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.warning-item,
.query-item,
.source-item {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.warning-item {
  padding: 12px 13px;
  border-left: 4px solid #9ba5b4;
}

.warning-item.high {
  border-left-color: var(--coral);
}

.warning-item.medium {
  border-left-color: #d59b2a;
}

.warning-item.ok {
  border-left-color: var(--green);
}

.warning-item strong {
  font-size: 12px;
}

.warning-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.query-item {
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.query-item > div:last-child {
  text-align: right;
}

.query-item strong,
.query-item span {
  display: block;
}

.query-item strong {
  font-size: 11px;
  overflow-wrap: anywhere;
}

.query-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.data-quality {
  margin-top: 31px;
}

.source-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
}

.source-item {
  min-height: 77px;
  padding: 13px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.source-item strong {
  font-size: 12px;
}

.source-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.recommendations-page {
  margin-top: 26px;
}

.recommendation-summary {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(420px, 2fr);
  gap: 18px;
  border-top: 1px solid #cfd6e0;
  border-bottom: 1px solid #cfd6e0;
}

.recommendation-score {
  padding: 22px 0;
  border-right: 1px solid #cfd6e0;
}

.recommendation-score > span,
.recommendation-counters span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.recommendation-score > strong {
  margin-top: 10px;
  display: block;
  font-size: 32px;
}

.recommendation-score p {
  max-width: 540px;
  margin: 9px 24px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.recommendation-counters {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
}

.recommendation-counters article {
  min-width: 0;
  padding: 22px 16px;
  border-right: 1px solid #dce2ea;
}

.recommendation-counters article:last-child {
  border-right: 0;
}

.recommendation-counters strong {
  display: block;
  margin-top: 12px;
  font-size: 26px;
}

.recommendation-heading {
  margin-top: 30px;
}

.recommendations-list {
  margin-top: 13px;
  display: grid;
  gap: 10px;
}

.recommendation-item {
  min-width: 0;
  padding: 16px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 128px;
  gap: 18px;
  align-items: start;
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid #9ba5b4;
  border-radius: 6px;
}

.recommendation-item.urgent {
  border-left-color: #bd3c27;
}

.recommendation-item.high {
  border-left-color: var(--coral);
}

.recommendation-item.medium {
  border-left-color: #d59b2a;
}

.recommendation-item.opportunity {
  border-left-color: var(--green);
}

.recommendation-meta span,
.recommendation-meta small {
  display: block;
}

.recommendation-meta span {
  color: #384357;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.recommendation-meta small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.recommendation-body h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.recommendation-campaign {
  margin: 6px 0 0;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
}

.recommendation-body dl {
  margin: 12px 0 0;
  display: grid;
  gap: 8px;
}

.recommendation-body dl div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
}

.recommendation-body dt {
  color: #7b8595;
  font-size: 10px;
  font-weight: 700;
}

.recommendation-body dd {
  margin: 0;
  color: #4d586b;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.approval-label {
  min-height: 27px;
  padding: 6px 8px;
  color: #8d5410;
  background: var(--amber-soft);
  border-radius: 5px;
  text-align: center;
  font-size: 9px;
  font-weight: 800;
}

.approval-label.automatic {
  color: #236644;
  background: var(--green-soft);
}

.recommendation-action {
  display: grid;
  gap: 8px;
}

.recommendation-action .approval-label {
  width: 100%;
}

.recommendation-action-button {
  min-height: 34px;
  padding: 0 10px;
  color: white;
  background: var(--blue);
  border: 0;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
}

.recommendation-action-button:disabled {
  cursor: wait;
}

.ai-recommendations-panel {
  margin-top: 34px;
  padding-top: 19px;
  border-top: 1px solid #cfd6e0;
}

.analysis-time {
  color: var(--muted);
  font-size: 11px;
}

.ai-summary {
  margin: 11px 0 0;
  color: #465064;
  font-size: 13px;
  line-height: 1.55;
}

.privacy-note {
  margin-top: 28px;
  padding: 14px 16px;
  background: #eef2f7;
  border-left: 3px solid #8794a7;
}

.privacy-note strong {
  font-size: 12px;
}

.privacy-note p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.control-page {
  min-width: 0;
  margin-top: 26px;
  display: grid;
  gap: 30px;
}

.settings-page {
  min-width: 0;
  margin-top: 26px;
  display: grid;
  gap: 30px;
}

.settings-page[hidden] {
  display: none;
}

#overview-page[hidden],
.recommendations-page[hidden],
.control-page[hidden] {
  display: none;
}

.settings-section {
  min-width: 0;
  padding-top: 19px;
  border-top: 1px solid #cfd6e0;
}

.password-form {
  max-width: 760px;
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 13px;
  align-items: end;
}

.password-form label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: #3d4759;
  font-size: 12px;
  font-weight: 700;
}

.password-form .primary-command {
  white-space: nowrap;
}

.session-settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.session-settings h2,
.session-settings p {
  margin: 0;
}

.session-settings h2 {
  font-size: 18px;
}

.session-settings p:last-child {
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.control-section {
  min-width: 0;
  padding-top: 19px;
  border-top: 1px solid #cfd6e0;
}

.notification-settings {
  margin-top: 12px;
  min-height: 72px;
  padding: 13px 0;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto auto auto auto;
  gap: 16px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.notification-copy strong,
.notification-copy span {
  display: block;
}

.notification-copy strong {
  font-size: 13px;
}

.notification-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.setting-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #3d4759;
  font-size: 11px;
  font-weight: 700;
}

.setting-toggle input {
  position: relative;
  width: 40px;
  min-width: 40px;
  height: 23px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: #aab3c1;
  border: 0;
  border-radius: 12px;
  box-shadow: none;
  cursor: pointer;
}

.setting-toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  background: white;
  border-radius: 50%;
  transition: transform 150ms ease;
}

.setting-toggle input:checked {
  background: var(--green);
}

.setting-toggle input:checked::after {
  transform: translateX(17px);
}

.setting-toggle input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.action-dialog {
  width: min(540px, calc(100% - 28px));
  padding: 24px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(18, 28, 46, 0.24);
}

.action-dialog::backdrop {
  background: rgba(17, 24, 39, 0.52);
}

.action-dialog h2 {
  margin: 0;
  font-size: 20px;
}

.action-dialog-copy {
  margin: 16px 0;
  color: #465064;
  font-size: 13px;
  line-height: 1.55;
}

.action-dialog-risk {
  padding: 12px 0;
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.action-dialog-risk strong {
  font-size: 11px;
}

.action-dialog-risk span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.action-dialog-buttons {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.section-status,
.quality-score-label {
  padding-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: right;
}

.control-alerts {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.control-alert {
  min-width: 0;
  padding: 13px 14px;
  display: grid;
  grid-template-columns: minmax(150px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
  align-items: start;
  background: white;
  border: 1px solid var(--line);
  border-left: 4px solid #9ba5b4;
  border-radius: 6px;
}

.control-alert.urgent,
.control-alert.high {
  border-left-color: var(--coral);
}

.control-alert.medium {
  border-left-color: #d59b2a;
}

.control-alert.ok,
.control-alert.opportunity {
  border-left-color: var(--green);
}

.control-alert span,
.control-alert strong {
  display: block;
}

.control-alert span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.control-alert strong {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.35;
}

.control-alert p {
  margin: 0;
  color: #556073;
  font-size: 11px;
  line-height: 1.48;
}

.control-metrics,
.feed-summary {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.control-metrics article,
.feed-summary article {
  min-width: 0;
  padding: 15px 14px;
  border-right: 1px solid var(--line);
}

.control-metrics article:last-child,
.feed-summary article:last-child {
  border-right: 0;
}

.control-metrics span,
.feed-summary span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.control-metrics strong,
.feed-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 21px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.compact-table table {
  min-width: 820px;
}

.compact-table td:first-child {
  min-width: 205px;
}

.status-badge.warning {
  color: #8d5410;
  background: var(--amber-soft);
}

.control-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.two-column-control {
  margin-top: 17px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.two-column-control h3 {
  margin: 0 0 9px;
  font-size: 13px;
}

.risk-list {
  display: grid;
  gap: 7px;
}

.risk-list > .empty-copy {
  margin: 0;
  background: white;
  border: 1px dashed #cfd6e0;
  border-radius: 6px;
}

.risk-item {
  min-width: 0;
  padding: 11px 12px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  background: white;
  border: 1px solid var(--line);
  border-left: 3px solid #d59b2a;
  border-radius: 6px;
}

.risk-item > div {
  min-width: 0;
}

.risk-item > div:last-child {
  flex: 0 0 auto;
  text-align: right;
}

.risk-item strong,
.risk-item span {
  display: block;
}

.risk-item strong {
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.risk-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.breakdown-heading {
  align-items: end;
}

.breakdown-switch {
  display: flex;
  padding: 3px;
  background: #e7ebf0;
  border-radius: 7px;
}

.breakdown-switch button {
  min-height: 34px;
  padding: 0 10px;
  color: #566174;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 700;
}

.breakdown-switch button.is-active {
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 4px rgba(20, 30, 48, 0.12);
}

.risk-row {
  background: #fff8e9;
}

.feed-summary {
  margin-bottom: 12px;
}

.change-form {
  margin-top: 12px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(220px, 1.1fr) minmax(130px, 0.55fr) minmax(180px, 0.8fr);
  gap: 12px;
  align-items: end;
  background: #eef2f7;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.change-form label {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.change-form label > span {
  color: #4d586b;
  font-size: 10px;
  font-weight: 800;
}

.change-description {
  grid-column: 1 / -2;
}

.change-form button {
  min-height: 42px;
}

.form-status {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}

.form-status.ok {
  color: #236644;
  background: var(--green-soft);
}

.form-status.bad,
.error-copy {
  color: #9f301d;
  background: var(--coral-soft);
}

.error-copy {
  margin: 0;
  padding: 12px;
  border: 1px solid #f0c5b9;
  border-radius: 6px;
  font-size: 11px;
}

.change-log {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.change-item {
  min-width: 0;
  padding: 15px;
  display: grid;
  grid-template-columns: minmax(230px, 0.8fr) minmax(500px, 1.7fr);
  gap: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.change-copy > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.change-copy span {
  color: var(--blue);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.change-copy small {
  color: var(--muted);
  font-size: 9px;
  text-align: right;
}

.change-copy h3 {
  margin: 9px 0 0;
  font-size: 13px;
  line-height: 1.35;
}

.change-copy p {
  margin: 6px 0 0;
  color: #586376;
  font-size: 10px;
  line-height: 1.45;
}

.change-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(145px, 1fr));
  gap: 7px;
}

.change-stage {
  padding: 10px;
  border: 1px solid #dce2ea;
  border-top: 3px solid #9ba5b4;
  border-radius: 6px;
}

.change-stage.positive {
  border-top-color: var(--green);
}

.change-stage.negative {
  border-top-color: var(--coral);
}

.change-stage.waiting {
  border-top-color: #d59b2a;
}

.change-stage span,
.change-stage strong,
.change-stage small {
  display: block;
}

.change-stage span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.change-stage strong {
  margin-top: 5px;
  font-size: 11px;
}

.change-stage small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.report-list {
  margin-top: 12px;
  display: grid;
  gap: 7px;
}

.report-item {
  min-width: 0;
  min-height: 58px;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
}

.report-item:hover {
  border-color: #aab5c5;
}

.report-item strong,
.report-item div span {
  display: block;
}

.report-item strong {
  font-size: 12px;
}

.report-item div span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.report-item > span {
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .account-finance-strip {
    grid-template-columns: 1fr 1fr;
  }

  .account-finance-strip article:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .account-finance-strip article:nth-child(2) {
    border-right: 0;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .overview-band,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .source-grid {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .page-header {
    display: grid;
  }

  .period-controls {
    justify-items: start;
  }

  .campaign-heading {
    display: grid;
  }

  .campaign-tools {
    width: 100%;
    justify-content: space-between;
  }

  .recommendation-summary {
    grid-template-columns: 1fr;
  }

  .recommendation-score {
    border-right: 0;
    border-bottom: 1px solid #cfd6e0;
  }

  .control-alerts {
    grid-template-columns: 1fr;
  }

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

  .change-description {
    grid-column: 1 / -1;
  }

  .change-item {
    grid-template-columns: 1fr;
  }

  .notification-settings {
    grid-template-columns: minmax(190px, 1fr) auto;
  }
}

@media (max-width: 760px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand {
    margin-bottom: 14px;
  }

  .view-switch,
  .business-switch {
    margin: 0;
    gap: 4px;
  }

  .view-switch {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .business-switch {
    grid-template-columns: 1fr 1fr;
  }

  .view-tab,
  .business-tab {
    text-align: center;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .view-tab {
    height: 52px;
    min-width: 0;
    padding: 13px 3px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .view-tab .nav-badge {
    top: 3px;
    right: auto;
    left: 50%;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 9px;
    transform: translateX(-50%);
  }

  .desktop-tab-label {
    display: none;
  }

  .mobile-tab-label {
    display: inline;
  }

  .view-tab:hover,
  .view-tab.is-active,
  .business-tab:hover,
  .business-tab.is-active {
    border-left-color: transparent;
    border-bottom-color: #6f91ff;
  }

  .sidebar-label {
    margin-top: 15px;
  }

  .sidebar-status {
    margin-top: 14px;
  }

  .sidebar-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-main {
    margin-left: 0;
    padding: 22px 15px 40px;
  }

  .period-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .cost-mode {
    width: 100%;
  }

  .cost-mode button {
    flex: 1 1 50%;
  }

  .period-tabs button {
    flex: 0 0 auto;
  }

  .custom-period {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .custom-period button {
    grid-column: 1 / -1;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-card {
    min-height: 118px;
    padding: 14px;
  }

  .kpi-card > strong {
    font-size: 20px;
  }

  .campaign-heading {
    align-items: start;
    display: grid;
  }

  .campaign-tools {
    display: grid;
  }

  .campaign-filter {
    width: 100%;
    overflow-x: auto;
  }

  .campaign-filter button {
    flex: 1 0 auto;
  }

  .table-search {
    width: 100%;
  }

  .source-grid {
    grid-template-columns: 1fr;
  }

  .recommendation-counters {
    grid-template-columns: 1fr 1fr;
  }

  .recommendation-counters article:nth-child(2) {
    border-right: 0;
  }

  .recommendation-counters article:nth-child(-n+2) {
    border-bottom: 1px solid #dce2ea;
  }

  .recommendation-item {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .approval-label {
    grid-column: 2;
    justify-self: start;
  }

  .recommendation-action {
    grid-column: 2;
    justify-self: start;
  }

  .control-metrics,
  .feed-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-metrics article:nth-child(2),
  .feed-summary article:nth-child(2) {
    border-right: 0;
  }

  .control-metrics article:nth-child(-n+2),
  .feed-summary article:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .two-column-control {
    grid-template-columns: 1fr;
  }

  .breakdown-heading {
    display: grid;
    align-items: start;
  }

  .breakdown-switch {
    width: 100%;
    overflow-x: auto;
  }

  .breakdown-switch button {
    flex: 1 0 auto;
  }

  .change-form {
    grid-template-columns: 1fr;
  }

  .change-description {
    grid-column: 1;
  }

  .change-stages {
    overflow-x: auto;
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .notification-settings {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .notification-copy {
    grid-column: 1 / -1;
  }

  .password-form {
    grid-template-columns: 1fr 1fr;
  }

  .password-form button[type="submit"] {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  .login-panel {
    padding: 28px 22px;
  }

  .view-tab {
    padding: 13px 2px 0;
    font-size: 10px;
  }

  .page-header h1 {
    font-size: 24px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .account-finance-strip {
    grid-template-columns: 1fr;
  }

  .account-finance-strip article,
  .account-finance-strip article:nth-child(2),
  .account-finance-strip article:last-child {
    grid-column: 1;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .account-finance-strip article:last-child {
    border-bottom: 0;
  }

  .password-form {
    grid-template-columns: 1fr;
  }

  .password-form button[type="submit"] {
    grid-column: 1;
  }

  .session-settings {
    display: grid;
  }

  .session-settings button {
    width: 100%;
  }

  .chart-legend {
    display: none;
  }

  .recommendation-item {
    grid-template-columns: 1fr;
  }

  .approval-label {
    grid-column: 1;
  }

  .recommendation-action {
    grid-column: 1;
    justify-self: stretch;
  }

  .recommendation-body dl div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .control-alert {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .control-metrics,
  .feed-summary {
    grid-template-columns: 1fr;
  }

  .control-metrics article,
  .feed-summary article,
  .control-metrics article:nth-child(2),
  .feed-summary article:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .control-metrics article:last-child,
  .feed-summary article:last-child {
    border-bottom: 0;
  }

  .risk-item {
    display: grid;
  }

  .risk-item > div:last-child {
    text-align: left;
  }

  .notification-settings {
    grid-template-columns: 1fr;
  }

  .notification-copy {
    grid-column: 1;
  }

  .setting-toggle {
    justify-content: space-between;
  }

  .action-dialog-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
