:root {
  color-scheme: light;
  --ink: #17201d;
  --muted: #66716d;
  --line: #dce2df;
  --line-strong: #c7d0cc;
  --surface: #ffffff;
  --surface-soft: #f5f7f6;
  --teal: #0f766e;
  --teal-soft: #e6f4f1;
  --coral: #d65f38;
  --coral-soft: #fcece6;
  --blue: #2563eb;
  --warning: #a75d0a;
  --warning-soft: #fff4dc;
  --shadow: 0 12px 32px rgba(23, 32, 29, 0.08);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: #eef2f0;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.header-inner,
.dashboard-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
}

.header-inner {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 7px;
  color: #ffffff;
  background: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.brand-name,
.brand-context {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
}

.brand-context {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions form {
  margin: 0;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.connection-status i {
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #94a3b8;
}

.connection-status.is-online i {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.connection-status.is-error i {
  background: #dc2626;
}

.text-button,
.primary-button {
  min-height: 36px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 600;
}

.text-button {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.text-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.primary-button {
  color: #ffffff;
  background: var(--teal);
}

.primary-button:hover {
  background: #0b625c;
}

.dashboard-shell {
  padding: 28px 0 56px;
}

.toolbar-band {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
}

.toolbar-band h1,
.section-heading h2,
.detail-header h2 {
  margin: 0;
  font-weight: 700;
}

.toolbar-band h1 {
  font-size: 24px;
}

.toolbar-band p,
.section-heading p,
.detail-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.toolbar-controls {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-control {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.toolbar-control-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.time-range-control {
  position: relative;
  width: 300px;
}

.date-range-trigger {
  display: flex;
  width: 300px;
  height: 40px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 0 12px;
  color: #45524e;
  background: var(--surface);
  font-size: 13px;
  text-align: left;
}

.date-range-trigger:hover,
.date-range-trigger[aria-expanded="true"] {
  border-color: var(--teal);
}

.date-range-trigger:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.12);
  outline-offset: 1px;
}

.date-range-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 8px);
  right: 0;
  width: min(600px, calc(100vw - 32px));
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: 0 24px 44px rgba(21, 32, 29, 0.22);
}

.date-range-popover[hidden] {
  display: none;
}

.date-range-summary {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--ink);
  background: #eef7f4;
  font-size: 14px;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
}

.date-range-inputs label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.date-range-inputs input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
}

.date-range-inputs input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.date-range-separator {
  padding-bottom: 13px;
  color: var(--muted);
}

.date-range-hint,
.date-range-error {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.5;
}

.date-range-hint {
  color: var(--muted);
}

.date-range-error {
  color: #b42318;
}

.date-range-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.date-range-shortcuts,
.date-range-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-range-shortcuts button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 9px;
  color: var(--muted);
  background: #eef7f4;
  font-size: 11px;
}

.date-range-shortcuts button:hover {
  color: var(--teal);
  background: var(--teal-soft);
}

.date-range-actions .text-button,
.date-range-actions .primary-button {
  min-width: 72px;
}

.business-channel-filter {
  min-width: 280px;
}

.business-channel-filter select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  padding: 0 36px 0 11px;
  color: var(--ink);
  background: var(--surface);
}

.business-channel-filter select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.business-channel-filter select:disabled {
  color: var(--muted);
  background: #edf1ef;
  cursor: wait;
}

.segmented-control,
.tab-list {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #edf1ef;
}

.segmented-control button,
.tab-list button {
  min-height: 32px;
  border: 0;
  border-radius: 5px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.segmented-control button.is-active,
.tab-list button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(23, 32, 29, 0.1);
  font-weight: 600;
}

.metric-band {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dashboard-waiting-state {
  display: grid;
  min-height: 420px;
  place-content: center;
  justify-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 44px 24px;
  background: var(--surface);
  text-align: center;
}

.dashboard-waiting-state[hidden] {
  display: none;
}

.dashboard-waiting-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 50%;
  color: var(--teal);
  background: var(--teal-soft);
  font-size: 26px;
}

.dashboard-waiting-state strong {
  font-size: 19px;
}

.dashboard-waiting-state p {
  max-width: 620px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.dashboard-waiting-state small {
  margin-top: 10px;
  color: #8a9490;
}

body.is-dashboard-waiting .metric-band,
body.is-dashboard-waiting .insight-band,
body.is-dashboard-waiting .detail-band {
  display: none;
}

.metric-band article {
  min-width: 0;
  grid-column: span 4;
  padding: 22px 24px;
  border-right: 1px solid var(--line);
}

.metric-band article:nth-child(-n + 4) {
  grid-column: span 5;
}

.metric-band article:nth-child(4),
.metric-band article:nth-child(9),
.metric-band article:nth-child(14) {
  border-right: 0;
}

.metric-band article:nth-child(n + 5) {
  border-top: 1px solid var(--line);
}

.metric-band article:last-child {
  border-right: 0;
}

.metric-band p,
.metric-band span {
  margin: 0;
  color: var(--muted);
}

.metric-band p {
  font-size: 13px;
  font-weight: 600;
}

.metric-band strong {
  display: block;
  min-height: 42px;
  margin: 8px 0 3px;
  font-size: 30px;
  line-height: 42px;
}

.metric-band span {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-pending {
  background: #fffdf8;
}

.metric-pending strong {
  color: var(--warning);
}

.metric-unavailable {
  background: var(--surface-soft);
}

.metric-unavailable strong {
  color: var(--muted);
}

.insight-band {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.8fr);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.trend-panel,
.diagnostic-panel {
  min-width: 0;
  padding: 24px;
}

.trend-panel {
  border-right: 1px solid var(--line);
}

.section-heading,
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2,
.detail-header h2 {
  font-size: 16px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
}

.chart-legend i {
  width: 18px;
  height: 3px;
  margin-right: 7px;
  border-radius: 2px;
}

.legend-add {
  background: var(--teal);
}

.legend-group {
  background: var(--coral);
}

.legend-group-rate,
.legend-retention-rate {
  height: 2px !important;
  background: repeating-linear-gradient(
    90deg,
    currentColor 0 7px,
    transparent 7px 11px
  );
}

.legend-group-rate {
  color: var(--teal);
}

.legend-retention-rate {
  color: var(--coral);
}

.chart-wrap {
  width: 100%;
  height: 230px;
  margin-top: 18px;
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.status-badge {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 5px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 600;
}

.status-ready {
  color: var(--teal);
  background: var(--teal-soft);
}

.status-pending {
  color: var(--warning);
  background: var(--warning-soft);
}

.diagnostic-list {
  margin: 12px 0 0;
}

.diagnostic-list div {
  display: flex;
  min-height: 35px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
}

.diagnostic-scope-note {
  margin: 12px 0 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 11px;
  line-height: 1.45;
}

#diagnostic-difference,
#diagnostic-coverage {
  color: var(--warning);
}

.diagnostic-list dt {
  color: var(--muted);
}

.diagnostic-list dd {
  overflow: hidden;
  margin: 0;
  font-weight: 650;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-band {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.detail-header {
  align-items: center;
  padding: 20px 22px;
}

.data-alignment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 22px 16px;
  border-left: 3px solid var(--line-strong);
  padding: 12px 14px;
  background: var(--surface-soft);
}

.data-alignment > div {
  min-width: 0;
}

.data-alignment strong,
.data-alignment span {
  display: block;
}

.data-alignment strong {
  font-size: 12px;
}

.data-alignment span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.data-alignment dl {
  display: flex;
  flex: 0 0 auto;
  gap: 22px;
  margin: 0;
}

.data-alignment dl div {
  min-width: 118px;
}

.data-alignment dt,
.data-alignment dd {
  margin: 0;
}

.data-alignment dt {
  color: var(--muted);
  font-size: 10px;
}

.data-alignment dd {
  margin-top: 3px;
  font-size: 11px;
  font-weight: 650;
  text-align: left;
}

.data-alignment.is-ready {
  border-left-color: var(--teal);
  background: var(--teal-soft);
}

.data-alignment.is-stale,
.data-alignment.is-pending {
  border-left-color: var(--warning);
  background: var(--warning-soft);
}

.data-alignment.is-unavailable {
  border-left-color: #94a3b8;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.search-field > span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.search-field input {
  width: 210px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
}

.search-field input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.tab-list {
  margin: 0 22px 16px;
}

.table-wrap {
  min-height: 250px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
}

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

table.is-creative {
  min-width: 4200px;
}

th,
td {
  height: 48px;
  border-bottom: 1px solid var(--line);
  padding: 0 18px;
  text-align: right;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #fafbfa;
  font-size: 12px;
  font-weight: 600;
}

.metric-group-row th {
  height: 38px;
  border-bottom-color: var(--line-strong);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.metric-field-row th {
  height: 46px;
}

.field-help-button {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  margin-left: 5px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  color: var(--teal);
  background: transparent;
  font-size: 11px;
  line-height: 1;
  vertical-align: middle;
}

.field-help-button:hover,
.field-help-button:focus-visible {
  background: rgba(15, 118, 110, 0.12);
  outline: 0;
}

.metric-group-row #dimension-heading {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0;
}

#dimension-heading,
td:first-child {
  position: sticky;
  left: 0;
  width: 180px;
  min-width: 180px;
  text-align: left;
}

#dimension-heading {
  z-index: 3;
  box-shadow: 1px 0 0 var(--line);
}

td:first-child {
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}

td {
  font-variant-numeric: tabular-nums;
}

td code {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.dimension-identity {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.entity-status-indicator {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid #a9b5b1;
  border-radius: 999px;
  background: #dfe5e3;
  vertical-align: middle;
}

.entity-status-indicator i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(24, 39, 35, 0.22);
}

.entity-status-indicator.is-open {
  border-color: var(--teal);
  background: var(--teal);
}

.entity-status-indicator.is-open i {
  left: 17px;
}

.entity-status-indicator.is-paused {
  border-color: #a9b5b1;
  background: #dfe5e3;
}

.entity-status-indicator.is-unknown {
  border-style: dashed;
  border-color: #b7bfbc;
  background: transparent;
}

.entity-status-indicator.is-unknown i {
  left: 10px;
  background: #aeb8b4;
  box-shadow: none;
}

.entity-status-deleted {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.rate-cell {
  font-weight: 650;
}

.money-cell {
  font-weight: 600;
}

.metric-state-copy {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.platform-group,
.metric-field-row th:nth-child(n + 1):nth-child(-n + 3),
.metric-platform {
  background: #f3f7fc;
}

.funnel-group,
.metric-field-row th:nth-child(n + 4):nth-child(-n + 8),
.metric-funnel {
  background: #f2faf7;
}

.current-group,
.metric-field-row th:nth-child(n + 9):nth-child(-n + 12),
.metric-current {
  background: #f6f9f7;
}

.base-group,
.metric-field-row th:nth-child(13),
.metric-base {
  background: #fff8ed;
}

.hour-one-group,
.metric-field-row th:nth-child(n + 14):nth-child(-n + 17),
.metric-hour-one {
  background: #eef9f7;
}

.hour-three-group,
.metric-field-row th:nth-child(n + 18):nth-child(-n + 22),
.metric-hour-three {
  background: #fbfaf2;
}

.hour-day-group,
.metric-field-row th:nth-child(n + 23):nth-child(-n + 27),
.metric-hour-day {
  background: #f7f5fb;
}

#creative-monitor-group,
.metric-field-row th:nth-child(n + 28),
.metric-creative-monitor {
  background: #f8f8f8;
}

.metric-group {
  border-right: 1px solid var(--line-strong);
}

.metric-group:last-child {
  border-right: 0;
}

.monitor-cell {
  width: 128px;
}

.monitor-switch {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 96px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.monitor-switch:disabled {
  cursor: wait;
  opacity: 0.6;
}

.monitor-switch-track {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #d7ddda;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.monitor-switch-track i {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(19, 31, 27, 0.2);
  transition: transform 140ms ease;
}

.monitor-switch.is-enabled {
  color: var(--teal);
}

.monitor-switch.is-enabled .monitor-switch-track {
  border-color: var(--teal);
  background: var(--teal);
}

.monitor-switch.is-enabled .monitor-switch-track i {
  transform: translateX(14px);
}

.monitor-switch:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
}

.monitor-switch-label {
  min-width: 42px;
  text-align: left;
  font-size: 12px;
  font-weight: 650;
}

.empty-state {
  display: grid;
  min-height: 200px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-state strong {
  color: var(--ink);
  font-size: 14px;
}

.empty-state span {
  margin-top: 6px;
  font-size: 12px;
}

.field-help-dialog {
  width: min(560px, calc(100% - 32px));
  max-height: min(720px, calc(100vh - 48px));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 26px 70px rgba(21, 32, 29, 0.24);
}

.field-help-dialog::backdrop {
  background: rgba(21, 32, 29, 0.42);
  backdrop-filter: blur(2px);
}

.field-help-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 20px 22px 16px;
}

.field-help-dialog-header span {
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
}

.field-help-dialog-header h2 {
  margin: 4px 0 0;
  font-size: 20px;
}

.field-help-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  font-size: 22px;
  line-height: 1;
}

.field-help-content {
  display: grid;
  margin: 0;
  padding: 8px 22px 22px;
}

.field-help-content div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.field-help-content div:last-child {
  border-bottom: 0;
}

.field-help-content dt,
.field-help-content dd {
  margin: 0;
}

.field-help-content dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.field-help-content dd {
  font-size: 13px;
  line-height: 1.6;
}

.login-page {
  min-height: 100vh;
  background: #eef2f0;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-heading {
  margin: 40px 0 24px;
}

.login-heading h1 {
  margin: 0;
  font-size: 24px;
}

.login-heading p {
  margin: 7px 0 0;
  color: var(--muted);
}

.login-panel form {
  display: grid;
}

.login-panel label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.login-panel input[type="password"] {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  padding: 0 12px;
}

.login-panel input[type="password"]:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.login-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 16px;
}

.form-error {
  margin: 0 0 14px;
  border-left: 3px solid #dc2626;
  padding: 9px 11px;
  color: #991b1b;
  background: #fef2f2;
  font-size: 12px;
}

@media (max-width: 980px) {
  .metric-band {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-band article,
  .metric-band article:nth-child(-n + 4) {
    grid-column: span 1;
    border-right: 1px solid var(--line);
  }

  .metric-band article:nth-child(3n) {
    border-right: 0;
  }

  .metric-band article:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }

  .insight-band {
    grid-template-columns: 1fr;
  }

  .trend-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 720px) {
  .app-header {
    position: static;
  }

  .header-inner,
  .dashboard-shell {
    width: min(100% - 24px, 1440px);
  }

  .header-inner {
    min-height: 0;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
  }

  .brand-lockup {
    width: 100%;
  }

  .connection-status {
    display: none;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 5px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .text-button {
    min-height: 34px;
    flex: 0 0 auto;
    padding: 0 10px;
    white-space: nowrap;
  }

  .dashboard-shell {
    padding-top: 20px;
  }

  .toolbar-band {
    display: block;
  }

  .toolbar-controls {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    margin-top: 16px;
    gap: 12px;
  }

  .business-channel-filter {
    width: 100%;
    min-width: 0;
  }

  .time-range-control,
  .date-range-trigger {
    width: 100%;
  }

  .date-range-popover {
    position: fixed;
    top: 50%;
    right: 16px;
    left: 16px;
    width: auto;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    transform: translateY(-50%);
  }

  .date-range-inputs {
    grid-template-columns: 1fr;
  }

  .date-range-separator {
    display: none;
  }

  .date-range-footer {
    display: grid;
  }

  .date-range-shortcuts {
    flex-wrap: wrap;
  }

  .date-range-actions {
    justify-content: flex-end;
  }

  .segmented-control {
    width: 100%;
    overflow-x: auto;
  }

  .segmented-control button {
    flex: 1 0 auto;
  }

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

  .metric-band article,
  .metric-band article:nth-child(3n),
  .metric-band article:nth-child(-n + 4) {
    grid-column: span 1;
    border-right: 1px solid var(--line);
    border-top: 1px solid var(--line);
    padding: 18px 16px;
  }

  .metric-band article:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  .metric-band article:nth-child(even) {
    border-right: 0;
  }

  .metric-band article:first-child,
  .metric-band article:nth-child(2) {
    border-top: 0;
  }

  .metric-band article:last-child {
    border-right: 0;
  }

  .metric-band strong {
    font-size: 26px;
  }

  .trend-panel,
  .diagnostic-panel {
    padding: 20px 16px;
  }

  .section-heading {
    display: block;
  }

  .chart-legend {
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 10px 14px;
  }

  .chart-wrap {
    height: 210px;
  }

  .detail-header {
    display: block;
    padding: 18px 16px;
  }

  .data-alignment {
    display: block;
    margin: 0 16px 14px;
  }

  .data-alignment dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
    gap: 10px;
  }

  .data-alignment dl div {
    min-width: 0;
  }

  .search-field {
    margin-top: 14px;
  }

  .search-field input {
    width: 100%;
  }

  .tab-list {
    width: calc(100% - 32px);
    margin: 0 16px 14px;
  }

  .tab-list button {
    flex: 1;
  }

  .table-wrap {
    overflow-x: visible;
  }

  table,
  table.is-creative {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: block;
  }

  tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 16px 16px;
    border-bottom: 1px solid var(--line);
  }

  tbody td,
  tbody td:first-child {
    display: flex;
    width: auto;
    height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 0;
    padding: 0 10px;
    text-align: right;
  }

  tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
  }

  tbody td:first-child {
    position: static;
    grid-column: 1 / -1;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
    padding: 0 10px;
    background: transparent;
    box-shadow: none;
  }

  tbody td:first-child::before {
    font-weight: 600;
  }

  .login-panel {
    padding: 26px 22px;
  }
}
