:root {
  --bg: #eef1f5;
  --bg-accent: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f7f8fb;
  --border: #e2e5eb;
  --border-strong: #d1d6df;
  --text: #202127;
  --muted: #747780;
  --accent: #5b50d6;
  --accent-soft: #eeecff;
  --accent-strong: #463ab8;
  --positive: #139b8f;
  --positive-soft: #e5f7f4;
  --negative: #d95372;
  --negative-soft: #fff0f4;
  --shadow: 0 1px 2px rgba(24, 24, 35, 0.03);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --sidebar-width: 248px;
  --content-max: 1480px;
  --content-gutter: 36px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: calc(100vh - 32px);
  margin: 16px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow-x: clip;
  background: #fafbfc;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(30, 32, 50, 0.08);
}

.sidebar {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  padding: 28px 18px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand strong,
.sidebar-footer strong {
  display: block;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.brand span,
.sidebar-footer span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.sidebar-nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #696b74;
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover:not(.is-disabled) {
  background: #f4f4f7;
  color: var(--accent-strong);
}

.nav-item.is-active {
  background: #f1f1f5;
  color: var(--text);
  font-weight: 650;
}

.nav-item.is-active svg {
  color: var(--accent);
}

.nav-item.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 18px 8px 2px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.client-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1bc4c4;
  box-shadow: 0 0 0 5px #e5f9f9;
  margin: 0 4px;
}

.main-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.shared-header {
  position: sticky;
  top: 0;
  z-index: 5;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px var(--content-gutter) 12px;
  background: #fafbfc;
  border-bottom: 0;
}

.main {
  flex: 1;
  padding: 8px var(--content-gutter) 56px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

.page-intro {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  max-width: 72ch;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.card-header + .filter-row {
  margin-top: 18px;
}

.date-filter-bar {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-gutter) 16px;
  background: linear-gradient(rgba(250, 251, 252, 0.85), #fafbfc);
  border-bottom: 1px solid var(--border);
}

.date-filter-inner {
  margin: 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: grid;
  gap: 10px;
}

.date-filter-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
}

.date-presets {
  margin: 0;
  flex: 1 1 420px;
}

.date-filter-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
  color: #62656e;
  cursor: pointer;
}

.compare-toggle input {
  accent-color: var(--accent);
}

.custom-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.custom-range.is-hidden {
  display: none;
}

.custom-range input[type="date"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  font-size: 12px;
}

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

.period-active-label {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.period-static-note {
  margin-top: 0 !important;
  padding: 10px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.filter-chip {
  border: 1px solid var(--border);
  background: #fff;
  color: #62656e;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.filter-chip:hover {
  border-color: #c9cce0;
  color: var(--accent-strong);
}

.filter-chip.is-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-strong);
}

.breakdown-side {
  text-align: right;
  display: grid;
  gap: 4px;
  justify-items: end;
}

.change-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.change-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.change-item strong {
  display: block;
  font-size: 13px;
}

.change-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.table-note {
  margin: 12px 0 0;
}

.improvements-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.improvement-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.improvement-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.improvement-main {
  margin-top: 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.improvement-main strong {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.improvement-range {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.improvement-detail {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

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

@media (max-width: 640px) {
  .improvements-grid {
    grid-template-columns: 1fr;
  }
}

.work-items {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.work-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
}

.work-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.work-item-top strong {
  font-size: 13px;
}

.work-item p,
.month-summary {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.history-block + .history-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.history-block h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.keywords-table {
  min-width: 920px;
}

.keywords-table th,
.keywords-table td {
  padding: 11px 14px;
}

.keywords-table .sortable-btn {
  padding: 11px 14px;
}

.keywords-table th:nth-child(1),
.keywords-table td:nth-child(1) { width: 24%; }
.keywords-table th:nth-child(2),
.keywords-table td:nth-child(2) { width: 12%; }
.keywords-table th:nth-child(3),
.keywords-table td:nth-child(3),
.keywords-table th:nth-child(4),
.keywords-table td:nth-child(4),
.keywords-table th:nth-child(5),
.keywords-table td:nth-child(5) { width: 9%; }
.keywords-table th:nth-child(6),
.keywords-table td:nth-child(6) { width: 11%; }
.keywords-table th:nth-child(7),
.keywords-table td:nth-child(7) {
  width: 17%;
  text-align: left;
}

.status-badge.done {
  color: var(--positive);
  background: var(--positive-soft);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 11px;
  color: var(--muted);
  font-weight: 750;
}

.page-header h1,
.card h2 {
  margin: 6px 0 0;
  letter-spacing: -0.035em;
}

.page-header h1 {
  font-size: clamp(1.7rem, 2.2vw, 2rem);
  font-weight: 750;
}

.card h2 {
  font-size: 1.05rem;
  font-weight: 700;
}

.page-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.meta-sep {
  opacity: 0.5;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.period-button,
.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 9px 13px;
  color: #435049;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  font-size: 13px;
  font-weight: 600;
}

.status-pill {
  background: var(--positive-soft);
  border-color: transparent;
  color: var(--positive);
}

.data-source-badge {
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  max-width: 220px;
  line-height: 1.35;
  text-align: right;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.metric-card .metric-label {
  color: #62656e;
  font-size: 13px;
  font-weight: 620;
}

.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.metric-row strong {
  font-size: 1.75rem;
  letter-spacing: -0.04em;
  font-weight: 750;
}

.delta {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.delta.up {
  color: var(--positive);
  background: var(--positive-soft);
}

.delta.down {
  color: var(--negative);
  background: var(--negative-soft);
}

.delta.flat {
  color: var(--muted);
  background: var(--surface-soft);
}

.delta svg {
  width: 13px;
  height: 13px;
}

.metric-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.content-grid {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.content-grid.two-thirds {
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
}

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

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

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

.chart-wrap {
  height: 280px;
  margin-top: 18px;
  position: relative;
}

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

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

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.swatch.traffic {
  background: var(--accent);
}

.swatch.conversions {
  background: #20c4c6;
}

.effects-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.effects-since {
  margin: 8px 0 0;
}

.effects-list {
  margin-top: 20px;
  display: grid;
  gap: 14px;
}

.effect-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.effect-row:first-child {
  padding-top: 0;
}

.effect-label {
  color: #62656e;
  font-size: 13px;
  font-weight: 620;
}

.effect-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.effect-main strong {
  font-size: 1.7rem;
  letter-spacing: -0.04em;
  font-weight: 750;
}

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

.period-badge {
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.directions-intro {
  margin: 10px 0 0;
}

.directions-list {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.direction-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.direction-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.direction-item strong {
  display: block;
  font-size: 13px;
  letter-spacing: -0.01em;
}

.direction-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-badge {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.progress {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.status-badge.stable {
  color: #62656e;
  background: #f0f1f4;
}

.status-badge.attention {
  color: #9a6700;
  background: #fff7e8;
}

.direction-signal {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent-strong);
}

.breakdown-list {
  margin-top: 8px;
  display: grid;
}

.breakdown-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.breakdown-index {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.breakdown-copy strong {
  display: block;
  font-size: 13px;
}

.breakdown-copy span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.breakdown-value {
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.funnel-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.funnel-step {
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  border-radius: var(--radius-md);
}

.funnel-step + .funnel-step {
  margin-top: 18px;
}

.funnel-step + .funnel-step::before {
  content: "";
  position: absolute;
  left: 28px;
  top: -14px;
  width: 2px;
  height: 14px;
  background: var(--border-strong);
}

.funnel-step-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.funnel-step strong {
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.funnel-step p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.funnel-rate {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.table-wrap {
  margin-top: 12px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #c9d5cf transparent;
}

.table-wrap::-webkit-scrollbar {
  height: 6px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #c9d5cf;
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

td:first-child,
th:first-child {
  width: 42%;
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 600;
}

td:not(:first-child),
th:not(:first-child) {
  white-space: nowrap;
  text-align: right;
}

.sortable-th {
  padding: 0;
  vertical-align: bottom;
}

.sortable-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  padding: 11px 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-align: right;
}

.sortable-table th:first-child .sortable-btn {
  justify-content: flex-start;
  text-align: left;
}

.sortable-btn:hover {
  color: var(--accent-strong);
}

.sortable-th.is-sorted .sortable-btn {
  color: var(--accent-strong);
}

.sort-icon {
  font-size: 11px;
  opacity: 0.55;
  line-height: 1;
}

.sortable-th.is-sorted .sort-icon {
  opacity: 1;
}

th:nth-child(2),
td:nth-child(2) { width: 16%; }
th:nth-child(3),
td:nth-child(3) { width: 12%; }
th:nth-child(4),
td:nth-child(4) { width: 12%; }
th:nth-child(5),
td:nth-child(5) { width: 14%; }

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 0;
}

.work-list,
.plan-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.work-list li,
.plan-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 13px;
  line-height: 1.45;
  color: #383a42;
}

.work-list svg,
.plan-list svg {
  width: 17px;
  min-width: 17px;
  margin-top: 1px;
}

.work-list svg {
  color: var(--positive);
}

.plan-list svg {
  color: var(--accent);
}

.plan-block {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.plan-block .section-kicker {
  margin-bottom: 4px;
}

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

  .content-grid.two-thirds,
  .content-grid.equal {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  :root {
    --content-gutter: 16px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    margin: 8px;
    min-height: calc(100vh - 16px);
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

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

  .sidebar-footer {
    display: none;
  }

  .page-header,
  .shared-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-header-actions {
    justify-content: flex-start;
  }

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

  .chart-wrap {
    height: 240px;
  }
}
