:root {
  color-scheme: light;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --ink: #131b2e;
  --muted: #5d6983;
  --line: #e3e8f2;
  --surface: #ffffff;
  --background: #f6f8fc;
  --success: #087f5b;
  --danger: #c92a2a;
  --focus: #ffe24c;
  --radius: 20px;
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--background); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--background);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: 0.68; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(2, 8px);
  grid-template-rows: repeat(2, 8px);
  gap: 3px;
  width: 36px;
  height: 36px;
  align-content: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--blue);
}

.brand-mark i { display: block; border-radius: 2px; background: #fff; }
.brand strong { display: block; font-size: 15px; line-height: 1.15; letter-spacing: -0.02em; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-page { background: var(--surface); }

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  min-height: 100vh;
}

.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(32px, 6vw, 72px);
  color: #fff;
  background:
    radial-gradient(circle at 16% 82%, rgba(96, 165, 250, 0.24), transparent 31%),
    #131b2e;
}

.login-intro .brand { color: #fff; }
.login-intro .brand small { color: #b6c0d7; }

.login-message { max-width: 610px; margin: 70px 0; }
.login-message .eyebrow { color: #93c5fd; }
.login-message h1 { margin: 0; max-width: 590px; font-size: clamp(38px, 5.2vw, 68px); line-height: 1.02; letter-spacing: -0.055em; }
.login-message > p:last-child { max-width: 520px; margin: 25px 0 0; color: #c7d0e3; font-size: 17px; line-height: 1.7; }
.login-footnote { margin: 0; color: #9ba8c2; font-size: 13px; }

.login-form-area {
  display: grid;
  place-items: center;
  padding: 40px clamp(24px, 6vw, 88px);
}

.login-form { width: min(100%, 430px); }
.login-form h2 { margin: 0; font-size: 29px; line-height: 1.2; letter-spacing: -0.035em; }
.form-intro { margin: 10px 0 34px; color: var(--muted); font-size: 14px; }

.field { margin-top: 19px; }
.field label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 750; }
.field input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid #cbd3e1;
  border-radius: 12px;
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.field input:hover { border-color: #98a6be; }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); outline: none; }

.password-field { position: relative; }
.password-field input { padding-right: 92px; }
.password-field button {
  position: absolute;
  top: 50%;
  right: 8px;
  padding: 7px 8px;
  color: var(--blue);
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  transform: translateY(-50%);
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  border: 0;
  border-radius: 11px;
  font-weight: 750;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  margin-top: 24px;
  padding: 0 18px;
  color: #fff;
  background: var(--blue);
  transition: background 150ms ease, transform 150ms ease;
}
.primary-button:hover { background: var(--blue-dark); }
.primary-button:active { transform: translateY(1px); }

.form-error { margin: 14px 0 -8px; padding: 11px 13px; color: #9c2020; border: 1px solid #fecaca; border-radius: 10px; background: #fff5f5; font-size: 13px; }
.support-copy { margin: 23px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.support-copy a { color: var(--blue); font-weight: 750; }

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(227, 232, 242, 0.86);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 40px, 1160px);
  min-height: 70px;
  margin: 0 auto;
}

.header-actions { display: flex; align-items: center; gap: 12px; }
.client-chip { max-width: 240px; overflow: hidden; color: var(--muted); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.text-button { padding: 9px 12px; color: var(--muted); background: transparent; font-size: 12px; }
.text-button:hover { color: var(--ink); background: #f1f4f9; }

.dashboard-shell { width: min(100% - 40px, 1160px); margin: 0 auto; padding: 42px 0 26px; }
.dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 26px; }
.dashboard-heading h1 { margin: 0; font-size: clamp(27px, 4vw, 40px); line-height: 1.1; letter-spacing: -0.045em; }
.dashboard-heading > div > p:last-child { margin: 9px 0 0; color: var(--muted); font-size: 14px; }

.dashboard-filters { display: flex; align-items: flex-end; gap: 10px; }
.site-control { display: grid; gap: 5px; }
.site-control span { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }
.site-control select {
  min-width: 160px;
  min-height: 42px;
  padding: 0 36px 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 750;
}
.site-control select:hover { border-color: #b6c0d2; }

.period-control { display: inline-flex; flex-shrink: 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.period-control button { padding: 8px 12px; color: var(--muted); border: 0; border-radius: 8px; background: transparent; font-size: 12px; font-weight: 750; }
.period-control button:hover { color: var(--ink); }
.period-control button.is-active { color: #fff; background: var(--ink); }

.demo-notice { margin-bottom: 14px; padding: 10px 14px; color: #7a5200; border: 1px solid #f6d98a; border-radius: 10px; background: #fff9e8; font-size: 12px; font-weight: 700; }

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 35px rgba(29, 43, 76, 0.055);
}

.kpi { min-width: 0; padding: 22px 24px; border-right: 1px solid var(--line); }
.kpi:last-child { border-right: 0; }
.kpi p { margin: 0 0 9px; color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi strong { display: block; font-size: clamp(27px, 3.5vw, 38px); line-height: 1; letter-spacing: -0.045em; }
.kpi-primary { color: #fff; background: var(--blue); }
.kpi-primary p, .kpi-primary .metric-note { color: #dbeafe; }
.metric-note { display: block; min-height: 32px; margin-top: 11px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.metric-note.is-positive { color: var(--success); font-weight: 750; }
.metric-note.is-negative { color: var(--danger); font-weight: 750; }

.insight-panel { display: grid; grid-template-columns: 190px 1fr; gap: 26px; margin: 18px 0; padding: 20px 22px; border: 1px solid #cfe0ff; border-radius: 15px; background: var(--blue-soft); }
.insight-label { display: flex; align-items: center; gap: 10px; }
.insight-label span { display: grid; flex: 0 0 24px; width: 24px; height: 24px; place-items: center; color: #fff; border-radius: 50%; background: var(--blue); font-family: Georgia, serif; font-size: 14px; font-weight: 700; }
.insight-label p { margin: 0; font-size: 12px; font-weight: 800; }
.insight-panel > p { margin: 0; color: #34425f; font-size: 13px; line-height: 1.65; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr); gap: 18px; margin-top: 18px; }
.dashboard-grid.lower-grid { grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr); }
.panel { min-width: 0; padding: 23px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.panel-heading h2 { margin: 0; font-size: 16px; letter-spacing: -0.02em; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.icon-button { display: grid; flex: 0 0 34px; width: 34px; height: 34px; place-items: center; color: var(--muted); background: #f2f5fa; font-size: 18px; }
.icon-button:hover { color: var(--blue); background: var(--blue-soft); }

.chart-wrap { display: grid; min-height: 240px; place-items: center; }
.traffic-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: #e9edf5; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--blue); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.chart-label { fill: #7c879e; font-size: 11px; }

.source-list, .conversion-list { display: grid; gap: 18px; }
.source-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 7px; font-size: 12px; }
.source-heading span { color: #34425f; }
.source-heading strong { font-size: 11px; }
.progress-track { overflow: hidden; height: 7px; border-radius: 99px; background: #edf1f7; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }

.conversion-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 37px; border-bottom: 1px solid #edf0f5; font-size: 12px; }
.conversion-row:last-child { border-bottom: 0; }
.conversion-row span { display: grid; color: #34425f; }
.conversion-row span b { font-size: 12px; font-weight: 650; }
.conversion-row span small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.conversion-row strong { min-width: 32px; color: var(--blue); font-size: 18px; text-align: right; }
.conversion-row.is-negative strong { color: var(--danger); }
.conversion-row.is-neutral strong { color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 0 0 9px; color: #8a94a8; font-size: 10px; letter-spacing: 0.07em; text-align: left; text-transform: uppercase; }
th:last-child, td:last-child { width: 70px; text-align: right; }
td { max-width: 0; padding: 12px 0; overflow: hidden; border-top: 1px solid #edf0f5; color: #34425f; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
td:last-child { color: var(--ink); font-weight: 800; }

.status-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; padding: 17px 19px; border: 1px solid #fecaca; border-radius: 14px; background: #fff5f5; }
.status-panel strong { font-size: 13px; }
.status-panel p { margin: 3px 0 0; color: #8e3434; font-size: 12px; }
.secondary-button { flex-shrink: 0; padding: 9px 13px; color: #8e3434; background: #fee2e2; font-size: 12px; }

.dashboard-footer { display: flex; justify-content: space-between; gap: 24px; padding: 25px 2px 0; color: var(--muted); font-size: 11px; }
.dashboard-footer p { margin: 0; }
.dashboard-footer a { color: var(--blue); font-weight: 750; }

.empty-message { margin: auto; padding: 25px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.chart-placeholder, .list-placeholder, .table-placeholder, .skeleton-value { position: relative; overflow: hidden; background: #edf1f7; }
.chart-placeholder { width: 100%; height: 190px; border-radius: 12px; }
.list-placeholder { height: 34px; border-radius: 8px; }
.table-placeholder { display: inline-block; width: 72%; height: 13px; border-radius: 4px; }
.skeleton-value { width: 76px; height: 38px; color: transparent; border-radius: 8px; }
.chart-placeholder::after, .list-placeholder::after, .table-placeholder::after, .skeleton-value::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.35s infinite;
}

@keyframes shimmer { to { transform: translateX(100%); } }

@media (max-width: 860px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { min-height: auto; padding: 28px 24px 46px; }
  .login-message { margin: 70px 0 20px; }
  .login-message h1 { font-size: clamp(34px, 10vw, 52px); }
  .login-footnote { display: none; }
  .login-form-area { padding: 52px 24px 70px; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .dashboard-grid, .dashboard-grid.lower-grid { grid-template-columns: 1fr; }
  .insight-panel { grid-template-columns: 1fr; gap: 9px; }
}

@media (max-width: 590px) {
  .app-header-inner, .dashboard-shell { width: min(100% - 28px, 1160px); }
  .app-header-inner { min-height: 64px; }
  .client-chip { display: none; }
  .dashboard-shell { padding-top: 27px; }
  .dashboard-heading { align-items: stretch; flex-direction: column; gap: 19px; }
  .dashboard-filters { align-items: stretch; flex-direction: column; }
  .site-control select { width: 100%; }
  .period-control { align-self: flex-start; }
  .kpi { padding: 19px 17px; }
  .kpi strong { font-size: 29px; }
  .panel { padding: 19px 17px; border-radius: 16px; }
  .dashboard-footer { align-items: flex-start; flex-direction: column; gap: 7px; }
  .status-panel { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 380px) {
  .period-control { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .period-control button { padding-inline: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

