:root {
  color-scheme: light;
  --ink: #24272c;
  --muted: #6f7782;
  --line: #e1e4e8;
  --line-soft: #edf0f2;
  --page: #f4f5f6;
  --panel: #ffffff;
  --soft: #f8f9fa;
  --orange: #f36f21;
  --orange-dark: #d9550a;
  --orange-soft: #fff2e9;
  --blue: #4778d0;
  --blue-soft: #edf3ff;
  --green: #2f9d7e;
  --green-soft: #eaf7f2;
  --gold: #d99b2b;
  --gold-soft: #fff7e5;
  --shadow: 0 6px 18px rgba(30, 35, 40, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.42;
}

.app-shell {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: #f1f3f4;
  padding: 32px;
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 430px;
  width: min(1040px, 100%);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(31, 36, 41, 0.12);
}

.auth-intro {
  display: grid;
  align-content: center;
  min-height: 590px;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 58px;
}

.auth-intro img,
.auth-loading img {
  display: block;
  width: 190px;
  max-height: 48px;
  margin-bottom: 54px;
  object-fit: contain;
}

.auth-intro h1 {
  max-width: 520px;
  margin-bottom: 16px;
  font-size: 42px;
}

.auth-intro > p {
  max-width: 540px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.login-card {
  display: grid;
  align-content: center;
  gap: 18px;
  min-height: 590px;
  background: #eef0f2;
  padding: 48px;
}

.login-card h2 {
  margin-bottom: 8px;
  font-size: 26px;
}

.login-card > div > p {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-card label {
  display: grid;
  gap: 7px;
}

.login-card label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-card input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d6dbe0;
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
}

.login-card input:focus {
  border-color: var(--orange);
  outline: 3px solid rgba(243, 111, 33, 0.13);
}

.login-card > button {
  min-height: 46px;
  border: 1px solid var(--orange);
  border-radius: 8px;
  background: var(--orange);
  color: #fff;
  font-weight: 800;
}

.login-card > button:hover {
  border-color: var(--orange-dark);
  background: var(--orange-dark);
}

.login-error {
  border: 1px solid #f0c4a8;
  border-radius: 8px;
  background: var(--orange-soft);
  padding: 10px 12px;
  color: #9f480e;
  font-size: 12px;
}

.auth-loading {
  display: grid;
  justify-items: center;
}

.auth-loading img {
  margin-bottom: 24px;
}

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

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1440px, calc(100% - 48px));
  min-height: 68px;
  margin: 0 auto;
}

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

.brand img {
  display: block;
  width: 164px;
  max-height: 42px;
  object-fit: contain;
}

.brand span {
  border-left: 1px solid var(--line);
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.sync-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.sync-status.loading i {
  background: var(--orange);
  animation: status-pulse 1s ease-in-out infinite alternate;
}

.topbar-actions,
.account-chip {
  display: flex;
  align-items: center;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 16px;
}

.account-chip {
  gap: 12px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

.account-chip div,
.account-chip strong,
.account-chip span {
  display: block;
}

.account-chip strong {
  max-width: 220px;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chip span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.account-chip button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.account-chip button:hover {
  border-color: var(--orange);
  color: var(--orange-dark);
}

.account-chip .access-button {
  border-color: #f2c6aa;
  background: var(--orange-soft);
  color: var(--orange-dark);
}

@keyframes status-pulse {
  to { opacity: 0.35; }
}

.report {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 44px;
}

.report-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.12;
  letter-spacing: 0;
}

.report-heading p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.print-button {
  min-width: 134px;
  min-height: 42px;
  border: 1px solid var(--orange);
  border-radius: 8px;
  background: var(--orange);
  padding: 0 16px;
  color: #fff;
  font-weight: 800;
}

.print-button:hover {
  border-color: var(--orange-dark);
  background: var(--orange-dark);
}

.filter-bar {
  display: grid;
  grid-template-columns: 190px 190px minmax(260px, 1fr) 210px;
  align-items: end;
  gap: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.filter-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.filter-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.filter-field select,
.filter-button,
.search-input,
.locked-project {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d6dbe0;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.traffic-scope {
  border-color: #f2c6aa;
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.locked-project {
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 12px;
  background: var(--soft);
  color: #4f5761;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-field select {
  display: block;
  height: 42px;
  min-height: 42px;
  padding: 0 34px 0 12px;
  line-height: 42px;
  -webkit-appearance: menulist-button;
  appearance: auto;
}

.filter-button {
  overflow: hidden;
  padding: 0 12px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-button.active {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-weight: 700;
}

.filter-field select:focus,
.filter-button:focus,
.search-input:focus {
  border-color: var(--orange);
  outline: 3px solid rgba(243, 111, 33, 0.13);
}

.filter-popover-wrap {
  position: relative;
}

.popover-backdrop {
  position: fixed;
  z-index: 59;
  inset: 0;
  border: 0;
  background: transparent;
}

.calendar-popover,
.channel-popover {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(28, 33, 38, 0.16);
}

.calendar-popover {
  left: 0;
  width: 330px;
  padding: 14px;
}

.calendar-header,
.popover-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calendar-header {
  margin-bottom: 12px;
}

.calendar-header strong {
  font-size: 14px;
  text-transform: capitalize;
}

.calendar-header button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.calendar-weekdays {
  margin-bottom: 5px;
}

.calendar-weekdays span {
  color: #9299a2;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.calendar-grid > span,
.calendar-grid button {
  height: 36px;
}

.calendar-grid button {
  position: relative;
  z-index: 1;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
}

.calendar-grid button:hover {
  background: var(--soft);
}

.calendar-grid button.between {
  border-radius: 0;
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.calendar-grid button.selected {
  background: var(--orange);
  color: #fff;
  font-weight: 800;
}

.calendar-help {
  margin-top: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.channel-popover {
  right: 0;
  width: 285px;
  padding: 10px;
}

.popover-title {
  border-bottom: 1px solid var(--line-soft);
  padding: 6px 6px 10px;
}

.popover-title strong {
  font-size: 13px;
}

.popover-title button {
  border: 0;
  background: transparent;
  color: var(--orange-dark);
  font-size: 12px;
  font-weight: 700;
}

.channel-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 7px;
  font-size: 13px;
}

.channel-option:hover {
  background: var(--soft);
}

.channel-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
}

.muted {
  margin: 12px 6px;
  color: var(--muted);
  font-size: 12px;
}

.alert {
  margin-bottom: 18px;
  border: 1px solid #f0c4a8;
  border-radius: 8px;
  background: var(--orange-soft);
  padding: 14px 16px;
  color: #9f480e;
  font-size: 13px;
}

.initial-loading {
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 360px;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  text-align: center;
}

.initial-loading span {
  color: var(--muted);
  font-size: 13px;
}

.access-pending {
  display: grid;
  min-height: 360px;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
}

.access-pending h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.modal-layer {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(28, 32, 36, 0.46);
  cursor: default;
}

.access-modal {
  position: relative;
  z-index: 1;
  width: min(820px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(24, 29, 34, 0.24);
}

.access-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 22px 24px 18px;
}

.access-modal-header h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 23px;
  line-height: 1;
}

.access-modal-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(330px, 1.2fr);
  gap: 24px;
  padding: 24px;
}

.access-client-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.access-client-row {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px 14px;
  color: var(--ink);
  text-align: left;
}

.access-client-row:hover,
.access-client-row.active {
  border-color: var(--orange);
}

.access-client-row.active {
  background: var(--orange-soft);
}

.access-client-row span {
  font-size: 13px;
  font-weight: 800;
}

.access-client-row strong {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.access-calendar {
  min-width: 0;
}

.access-calendar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.access-calendar-title strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-calendar-title span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.access-calendar-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.access-calendar-footer button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.access-calendar-footer span {
  margin-left: auto;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.access-calendar-footer .save-error {
  color: #b94720;
}

.pdf-exporting .report {
  width: 1040px;
  padding: 0 16px;
  background: #fff;
}

.pdf-exporting .report-heading {
  margin-bottom: 16px;
}

.pdf-exporting .dashboard {
  gap: 12px;
}

.pdf-exporting .kpi-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pdf-exporting .kpi-card {
  min-height: 124px;
  padding: 15px;
}

.pdf-exporting .kpi-label {
  min-height: 20px;
}

.pdf-exporting .content-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pdf-exporting .pdf-page-break {
  break-before: page;
  page-break-before: always;
}

.pdf-exporting .table-scroll {
  overflow: visible;
}

.pdf-exporting .products-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.pdf-exporting .filter-bar,
.pdf-exporting .print-button,
.pdf-exporting .refresh-line,
.pdf-exporting .pagination,
.pdf-exporting .table-tools {
  display: none !important;
}

.pdf-exporting .panel,
.pdf-exporting .kpi-card {
  box-shadow: none;
}

.loader {
  width: 34px;
  height: 34px;
  border: 3px solid var(--orange-soft);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.dashboard {
  position: relative;
  display: grid;
  gap: 18px;
}

.dashboard.refreshing {
  opacity: 0.76;
  transition: opacity 160ms ease;
}

.refresh-line {
  position: fixed;
  z-index: 80;
  top: 67px;
  left: 0;
  width: 32%;
  height: 2px;
  background: var(--orange);
  animation: refresh-move 1.2s ease-in-out infinite;
}

@keyframes refresh-move {
  0% { left: -32%; }
  100% { left: 100%; }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.kpi-card {
  position: relative;
  min-width: 0;
  min-height: 142px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: var(--shadow);
}

.kpi-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--orange);
  content: "";
}

.kpi-card.blue::before { background: var(--blue); }
.kpi-card.green::before { background: var(--green); }
.kpi-card.gold::before { background: var(--gold); }

.kpi-label {
  display: block;
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
}

.kpi-card strong {
  display: block;
  overflow: hidden;
  margin: 7px 0 6px;
  font-size: clamp(22px, 2vw, 29px);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 20px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 14px;
}

.panel-header > div {
  min-width: 0;
}

.panel h2 {
  margin-bottom: 6px;
  font-size: 18px;
  line-height: 1.25;
}

.panel-header p {
  max-width: 820px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.panel-badge {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  padding: 7px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.content-grid {
  display: grid;
  gap: 18px;
  min-width: 0;
}

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

.channel-layout {
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.85fr);
}

.funnel-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 12px;
  min-height: 332px;
  overflow-x: auto;
  padding: 4px 2px 2px;
}

.funnel-step {
  display: grid;
  grid-template-rows: 24px 210px auto auto;
  min-width: 110px;
  text-align: center;
}

.funnel-rate {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.funnel-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  border-bottom: 1px solid #cfd4da;
  background-image: linear-gradient(to top, transparent 49%, var(--line-soft) 50%, transparent 51%);
}

.funnel-bar {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: min(74%, 96px);
  min-height: 22px;
  border-radius: 5px 5px 0 0;
  padding-top: 9px;
  color: #fff;
}

.funnel-bar strong {
  font-size: 13px;
}

.funnel-color-0 { background: #59636f; }
.funnel-color-1 { background: var(--blue); }
.funnel-color-2 { background: var(--gold); }
.funnel-color-3 { background: #e58635; }
.funnel-color-4 { background: var(--orange); }
.funnel-color-5 { background: var(--green); }

.funnel-step h3 {
  margin: 11px 0 4px;
  font-size: 12px;
  line-height: 1.35;
}

.funnel-step > span {
  color: var(--muted);
  font-size: 10px;
}

.svg-chart {
  width: 100%;
  min-height: 250px;
}

.svg-chart svg {
  display: block;
  width: 100%;
  height: 250px;
  overflow: visible;
}

.chart-gridline {
  stroke: #e8ebee;
  stroke-width: 1;
}

.axis-label,
.axis-value {
  fill: #858d97;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
}

.axis-value {
  font-weight: 700;
}

.audience-layout,
.habits-layout {
  display: grid;
  gap: 18px;
}

.audience-hero {
  border-left: 3px solid var(--orange);
  background: var(--soft);
  padding: 15px 16px;
}

.audience-hero span,
.audience-hero strong,
.audience-hero small,
.habit-facts span,
.habit-facts strong {
  display: block;
}

.audience-hero span,
.habit-facts span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.audience-hero strong {
  margin: 5px 0;
  font-size: 27px;
}

.audience-hero small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.audience-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.audience-groups h3,
.daypart-section h3 {
  margin-bottom: 11px;
  font-size: 12px;
}

.audience-bars {
  display: grid;
  gap: 10px;
}

.audience-bar-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: #4f5761;
  font-size: 11px;
}

.audience-bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #edf0f2;
}

.audience-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.audience-muted {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 11px;
}

.habit-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.habit-facts article {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--soft);
  padding: 13px;
}

.habit-facts strong {
  overflow: hidden;
  margin-top: 7px;
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.daypart-section {
  border-top: 1px solid var(--line-soft);
  padding-top: 15px;
}

.channel-quality {
  display: grid;
  gap: 2px;
}

.channel-quality-head,
.channel-quality-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 86px 74px 94px;
  align-items: center;
  gap: 12px;
}

.channel-quality-head {
  min-height: 30px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: right;
  text-transform: uppercase;
}

.channel-quality-head span:first-child {
  text-align: left;
}

.channel-quality-row {
  min-height: 54px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  text-align: right;
}

.channel-name {
  min-width: 0;
  text-align: left;
}

.channel-name strong {
  display: block;
  overflow: hidden;
  margin-bottom: 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-track,
.assist-track {
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: #edf0f2;
}

.channel-track i,
.assist-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
}

.conversion-value {
  color: var(--green);
}

.assist-list {
  display: grid;
  gap: 15px;
  padding-top: 3px;
}

.assist-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(90px, 1fr) 46px;
  align-items: center;
  gap: 12px;
}

.assist-label {
  min-width: 0;
}

.assist-label strong,
.assist-label span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assist-label strong {
  font-size: 12px;
}

.assist-label span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.assist-track i {
  background: var(--blue);
}

.assist-row > b {
  font-size: 12px;
  text-align: right;
}

.city-sales {
  display: grid;
  gap: 15px;
  padding-top: 3px;
}

.city-sales-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.85fr) minmax(110px, 1fr) 46px;
  align-items: center;
  gap: 12px;
}

.city-sales-label {
  min-width: 0;
}

.city-sales-label strong,
.city-sales-label span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-sales-label strong {
  font-size: 12px;
}

.city-sales-label span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.city-sales-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #edf0f2;
}

.city-sales-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.city-sales-row > b {
  font-size: 12px;
  text-align: right;
}

.products-section {
  min-width: 0;
}

.table-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.search-input {
  max-width: 360px;
  padding: 0 12px;
}

.table-tools > span {
  color: var(--muted);
  font-size: 11px;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.products-table th,
.products-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 14px;
  text-align: right;
  vertical-align: middle;
}

.products-table th {
  background: var(--soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.products-table th:first-child {
  width: 58%;
}

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

.products-table tbody tr:hover {
  background: #fffaf6;
}

.products-table td strong,
.products-table td small {
  display: block;
}

.products-table td strong {
  line-height: 1.35;
}

.products-table td small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.empty-cell {
  height: 90px;
  color: var(--muted);
  text-align: center !important;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 14px;
}

.pagination > div {
  display: flex;
  gap: 5px;
}

.pagination button {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}

.pagination > button {
  padding: 0 12px;
}

.pagination button.active {
  border-color: var(--orange);
  background: var(--orange);
  color: #fff;
  font-weight: 800;
}

.supporting-grid .panel {
  min-height: 360px;
}

.keyword-list,
.insights-list {
  display: grid;
}

.keyword-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  border-bottom: 1px solid var(--line-soft);
}

.keyword-row:last-child {
  border-bottom: 0;
}

.keyword-rank {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  background: var(--orange-soft);
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 800;
}

.keyword-row strong,
.keyword-row small {
  display: block;
}

.keyword-row strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keyword-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.keyword-row > b {
  text-align: right;
}

.insights-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.insights-list article {
  min-width: 0;
  min-height: 112px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--soft);
  padding: 14px;
}

.insights-list span,
.insights-list strong,
.insights-list small {
  display: block;
}

.insights-list span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.insights-list strong {
  overflow: hidden;
  margin: 8px 0 5px;
  font-size: 14px;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.insights-list small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed #d8dde2;
  border-radius: 8px;
  background: var(--soft);
  padding: 24px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.report-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding: 18px 2px 0;
  color: var(--muted);
  font-size: 10px;
}

@media (max-width: 1240px) {
  .filter-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .channel-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .auth-layout {
    grid-template-columns: 1fr;
    max-width: 520px;
  }

  .auth-intro {
    display: none;
  }

  .login-card {
    min-height: 520px;
  }

  .topbar-inner,
  .report {
    width: min(100% - 28px, 1440px);
  }

  .report {
    padding-top: 24px;
  }

  .report-heading,
  .panel-header,
  .table-tools,
  .report-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .print-button {
    align-self: flex-start;
  }

  .content-grid.two,
  .channel-layout {
    grid-template-columns: 1fr;
  }

  .funnel-chart {
    grid-template-columns: repeat(6, 124px);
  }

  .channel-quality-head,
  .channel-quality-row {
    grid-template-columns: minmax(150px, 1fr) 70px 64px 84px;
  }

  .calendar-popover {
    left: auto;
    right: 0;
  }
}

@media (max-width: 620px) {
  .auth-shell {
    padding: 14px;
  }

  .login-card {
    min-height: calc(100vh - 28px);
    padding: 30px 22px;
  }

  .topbar-inner {
    min-height: 62px;
  }

  .brand img {
    width: 142px;
  }

  .brand span,
  .sync-status,
  .account-chip div {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .account-chip {
    border-left: 0;
    padding-left: 0;
  }

  .account-chip .access-button {
    max-width: 104px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .report-heading {
    margin-bottom: 18px;
  }

  h1 {
    font-size: 29px;
  }

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

  .audience-groups,
  .habit-facts {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    gap: 8px;
  }

  .kpi-card {
    min-height: 116px;
    padding: 15px;
  }

  .kpi-label {
    min-height: 20px;
  }

  .panel {
    padding: 16px;
  }

  .panel-badge {
    align-self: flex-start;
  }

  .calendar-popover,
  .channel-popover {
    position: fixed;
    top: 50%;
    right: 14px;
    left: 14px;
    width: auto;
    transform: translateY(-50%);
  }

  .channel-quality {
    overflow-x: auto;
  }

  .channel-quality-head,
  .channel-quality-row {
    width: 540px;
  }

  .assist-row {
    grid-template-columns: minmax(0, 1fr) 64px 34px;
  }

  .city-sales-row {
    grid-template-columns: minmax(0, 1fr) 64px 34px;
  }

  .search-input {
    max-width: none;
  }

  .pagination {
    justify-content: space-between;
  }

  .pagination > div {
    display: none;
  }

  .insights-list {
    grid-template-columns: 1fr;
  }

  .supporting-grid .panel {
    min-height: auto;
  }

  .modal-layer {
    padding: 12px;
  }

  .access-modal {
    max-height: calc(100vh - 24px);
  }

  .access-modal-body {
    grid-template-columns: 1fr;
    padding: 18px;
  }

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

@media print {
  body,
  html {
    background: #fff;
  }

  .topbar,
  .filter-bar,
  .print-button,
  .refresh-line,
  .pagination,
  .table-tools {
    display: none !important;
  }

  .report {
    width: 100%;
    padding: 0;
  }

  .dashboard {
    gap: 12px;
  }

  .panel,
  .kpi-card {
    break-inside: avoid;
    box-shadow: none;
  }

  .panel {
    padding: 14px;
  }

  .report-footer {
    margin-top: 12px;
  }
}
