:root {
  --bg: #f5f3ef;
  --bg-alt: #e9eaec;
  --panel: rgba(255, 255, 255, 0.94);
  --line: rgba(35, 47, 62, 0.12);
  --text: #0f141a;
  --muted: #656d78;
  --brand: #0578ff;
  --brand-deep: #232f3e;
  --brand-soft: #0096d6;
  --amazon: #faa026;
  --cool: #0096d6;
  --danger: #ca4636;
  --shadow: 0 22px 44px rgba(15, 20, 26, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(5, 120, 255, 0.08), transparent 30%),
    radial-gradient(circle at top right, rgba(0, 150, 214, 0.1), transparent 22%),
    linear-gradient(180deg, #fbfbf9 0%, #f5f3ef 58%, #eef2f4 100%);
  font-family: "IBM Plex Sans", sans-serif;
}

[hidden] {
  display: none !important;
}

.shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 30px;
  margin-bottom: 8px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.auth-card {
  width: min(760px, 100%);
  padding: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 251, 0.94)),
    var(--panel);
}

.auth-brand-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
}

.auth-brand-copy h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.96;
  color: var(--brand-deep);
}

.auth-client,
.auth-lead {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.auth-copy {
  margin: 18px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid rgba(35, 47, 62, 0.08);
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 20px;
}

.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  min-height: 44px;
  padding: 0 12px;
  font: inherit;
  background: #fff;
  color: var(--brand-deep);
}

.auth-button {
  min-height: 44px;
}

.auth-error {
  margin: 14px 0 0;
  color: var(--danger);
  font-weight: 600;
}

.auth-logo {
  max-width: 140px;
}

.hero-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 10px;
}

.hero-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.brand-logo {
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(15, 20, 26, 0.08));
  flex: 0 0 auto;
}

.brand-logo-amazon {
  width: 118px;
  height: auto;
}

.brand-logo-tekne {
  width: 128px;
  height: auto;
}

.hero-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.session-button {
  width: auto;
  max-width: 84px;
  min-height: 28px;
  min-width: 0;
  padding: 0 10px;
  font-size: 0.74rem;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(35, 47, 62, 0.16);
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 24px;
  align-items: start;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--brand);
  font-weight: 700;
}

.campaign-name {
  margin: 0;
  max-width: min(760px, 100%);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-deep);
  line-height: 1.2;
}

.campaign-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.campaign-subnote {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.86;
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h2 {
  font-size: 1.1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.controls {
  padding: 12px 14px;
  background:
    linear-gradient(180deg, rgba(5, 120, 255, 0.05), rgba(255, 255, 255, 0.92)),
    var(--panel);
  max-width: 100%;
}

.controls-note {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.control-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(6, minmax(0, auto));
  gap: 10px;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 145px;
}

label input[type="date"],
label select,
.button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  min-height: 38px;
  padding: 0 12px;
  font: inherit;
  background: #fff;
  color: var(--brand-deep);
}

label select {
  appearance: auto;
}

.campaign-control {
  min-width: 260px;
}

.toggle {
  justify-content: center;
  min-width: 120px;
}

.toggle input {
  width: 18px;
  height: 18px;
}

.button {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-soft) 100%);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(5, 120, 255, 0.2);
  min-width: 190px;
}

.button-secondary {
  background: linear-gradient(135deg, var(--brand-deep) 0%, #314257 100%);
  box-shadow: 0 10px 22px rgba(35, 47, 62, 0.18);
}

.button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.cards-grid,
.content-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

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

.stack-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.full-width {
  width: 100%;
}

.panel {
  padding: 20px;
  min-width: 0;
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(35, 47, 62, 0.08);
}

.section-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.metric-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.metric-tab {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--brand-deep);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.metric-tab.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-soft) 100%);
  color: #fff;
  box-shadow: 0 10px 18px rgba(5, 120, 255, 0.16);
}

.metric-tab:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.error-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-color: rgba(202, 70, 54, 0.25);
  background:
    linear-gradient(180deg, rgba(202, 70, 54, 0.08), rgba(255, 255, 255, 0.96));
  color: var(--danger);
  font-weight: 600;
}

.loading-state {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(5, 120, 255, 0.08);
  color: var(--brand-deep);
  font-size: 0.92rem;
  font-weight: 600;
}

.loading-state.is-visible {
  display: inline-flex;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(5, 120, 255, 0.18);
  border-top-color: var(--brand);
  animation: spin 0.75s linear infinite;
}

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

.summary-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--brand);
}

.summary-card .value {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--brand-deep);
}

.summary-card .delta {
  font-size: 0.86rem;
  font-weight: 600;
}

.campaign-breakdown {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(35, 47, 62, 0.08);
}

.campaign-breakdown-title {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.campaign-breakdown-bar {
  display: flex;
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(35, 47, 62, 0.1);
  border-radius: 999px;
  background: rgba(35, 47, 62, 0.08);
}

.campaign-breakdown-segment {
  display: block;
  height: 100%;
}

.campaign-breakdown-legend {
  display: grid;
  gap: 4px;
  margin-top: 7px;
}

.campaign-breakdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.campaign-breakdown-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
}

.campaign-breakdown-text {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px;
  color: #374151;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
}

.campaign-breakdown-text span {
  color: var(--muted);
}

.delta.up {
  color: var(--cool);
}

.delta.down {
  color: var(--danger);
}

.delta.neutral {
  color: var(--muted);
}

.chart {
  min-height: 350px;
}

.chart.short {
  min-height: 280px;
}

.quality-list {
  display: grid;
  gap: 12px;
}

.quality-item,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(5, 120, 255, 0.04), rgba(255, 255, 255, 0.9));
}

.quality-item strong,
.mini-card strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
  margin-top: 4px;
  color: var(--brand-deep);
}

.mini-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

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

.video-chart-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(5, 120, 255, 0.03), rgba(255, 255, 255, 0.92));
}

.video-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}

.video-chart-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.video-chart-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  color: var(--brand-deep);
}

.video-vtr-badge {
  min-width: 110px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(5, 120, 255, 0.12);
  background: linear-gradient(180deg, rgba(5, 120, 255, 0.06), rgba(255, 255, 255, 0.96));
  text-align: right;
}

.video-vtr-badge strong {
  display: block;
  margin-top: 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
  color: var(--brand-deep);
}

.video-chart {
  min-height: 260px;
}

.heatmap-module {
  display: grid;
  gap: 16px;
}

.heatmap-legend {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(5, 120, 255, 0.03), rgba(255, 255, 255, 0.94));
}

.heatmap-legend-scale {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.heatmap-legend-chip {
  width: 28px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 20, 26, 0.08);
}

.heatmap-legend-chip.is-low {
  background: #e8b9ad;
}

.heatmap-legend-chip.is-mid {
  background: #dfe8d9;
}

.heatmap-legend-chip.is-high {
  background: #b9d8b8;
}

.heatmap-legend-label {
  color: var(--brand-deep);
  font-size: 0.9rem;
  font-weight: 600;
}

.heatmap-context,
.heatmap-insights {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.heatmap-context-card,
.heatmap-insight-card {
  min-height: 100%;
}

.heatmap-context-card p,
.heatmap-insight-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.heatmap-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.84);
}

.heatmap-table {
  min-width: 980px;
}

.heatmap-table th,
.heatmap-table td {
  text-align: center;
  white-space: nowrap;
}

.heatmap-table thead th {
  background: rgba(5, 120, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 1;
}

.heatmap-row-label {
  text-align: left !important;
  min-width: 260px;
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  left: 0;
  z-index: 1;
}

.heatmap-cell {
  font-variant-numeric: tabular-nums;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.heatmap-cell:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(15, 20, 26, 0.06);
}

.heatmap-cell.is-score {
  font-weight: 700;
}

.heatmap-value {
  display: inline-block;
  font-weight: 600;
  color: var(--brand-deep);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(35, 47, 62, 0.35) rgba(35, 47, 62, 0.08);
}

.table-scroll::-webkit-scrollbar {
  height: 10px;
}

.table-scroll::-webkit-scrollbar-track {
  background: rgba(35, 47, 62, 0.08);
  border-radius: 999px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: rgba(35, 47, 62, 0.35);
  border-radius: 999px;
}

.table-scroll table {
  width: max-content;
  min-width: 100%;
}

#assetGroupTable,
#adsTable,
#formatsTable,
#placementsTable,
#imageTable {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody tr:hover {
  background: rgba(5, 120, 255, 0.04);
}

@media (max-width: 1100px) {
  .auth-form {
    grid-template-columns: 1fr;
  }

  .hero,
  .cards-grid,
  .mini-cards,
  .video-grid {
    grid-template-columns: 1fr;
  }

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

  label,
  .toggle,
  .button {
    min-width: 0;
  }

  .hero-heading {
    gap: 12px;
  }

  .hero-side {
    width: auto;
    flex-direction: column;
    align-items: center;
  }

  .brand-logo-amazon {
    width: 88px;
  }

  .brand-logo-tekne {
    width: 96px;
  }

  .heatmap-context,
  .heatmap-insights {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .auth-card {
    padding: 22px 18px;
  }

  .auth-brand-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .auth-logo {
    margin: 0 auto;
  }

  .shell {
    width: min(100% - 20px, 1400px);
    padding-top: 18px;
  }
}
