@font-face {
  font-family: "Inter Display";
  src: url("/static/fonts/InterDisplay.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter Display";
  src: url("/static/fonts/InterDisplay-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Inter Display";
  src: url("/static/fonts/InterDisplay-SemiBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Inter Display";
  src: url("/static/fonts/InterDisplay-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #111318;
  --bg-deep: #0c0e12;
  --surface: #181b21;
  --surface-raised: #20242b;
  --surface-hover: #272c34;
  --border: #353a43;
  --border-strong: #505763;
  --text: #f2f4f8;
  --text-secondary: #c6cbd3;
  --text-muted: #8f96a3;
  --accent: #78a9ff;
  --accent-strong: #a6c8ff;
  --accent-surface: #152f55;
  --ok: #42be65;
  --ok-surface: #102c1a;
  --warning: #f1c21b;
  --warning-surface: #332b0a;
  --error: #ff8389;
  --error-surface: #3a1619;
  --focus: #a6c8ff;
  --radius: 2px;
  --header-height: 48px;
  --side-width: 224px;
  --content-max: 1440px;
  font-family: "Inter Display", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

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

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--text);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

::selection {
  background: var(--accent);
  color: var(--bg-deep);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--text);
  color: var(--bg-deep);
  border-radius: var(--radius);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.global-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: var(--side-width);
  height: 100%;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  display: inline-grid;
  place-items: center;
  width: var(--header-height);
  height: var(--header-height);
  flex: 0 0 var(--header-height);
  background: var(--accent);
  color: var(--bg-deep);
  font-weight: 760;
  font-size: 17px;
  letter-spacing: -0.04em;
}

.brand__mark--large {
  width: 56px;
  height: 56px;
  flex-basis: 56px;
  font-size: 22px;
}

.brand__name {
  margin-left: 14px;
  font-weight: 680;
  letter-spacing: -0.015em;
}

.brand__section {
  margin-left: 8px;
  color: var(--text-muted);
}

.logout-form {
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
}

.app-frame {
  display: grid;
  grid-template-columns: var(--side-width) minmax(0, 1fr);
  min-height: calc(100dvh - var(--header-height));
}

.admin-shell--login .app-frame {
  display: block;
  min-height: 100dvh;
}

.side-nav {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: calc(100dvh - var(--header-height));
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.side-nav__items {
  display: grid;
  padding-top: 16px;
}

.side-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.side-nav__link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.side-nav__link.is-active {
  background: var(--accent-surface);
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 600;
}

.side-nav__note {
  margin: 0;
  padding: 16px 20px;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

.main-content {
  width: min(100%, var(--content-max));
  min-width: 0;
  padding: 36px 40px 64px;
}

.admin-shell--login .main-content {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  padding: 0;
}

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

.page-header--detail {
  align-items: center;
}

.page-header h1,
.login-panel h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.08;
  font-weight: 620;
  letter-spacing: -0.035em;
}

.section-label {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 630;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-header__meta,
.page-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.page-subtitle {
  margin-top: 9px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 24px;
  color: var(--text-secondary);
  text-decoration: none;
}

.back-link::before {
  content: "←";
  margin-right: 8px;
}

.back-link:hover {
  color: var(--text);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-raised);
  font-weight: 620;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  color: var(--text-muted);
  background: var(--surface);
  cursor: wait;
}

.button--primary {
  color: var(--bg-deep);
  background: var(--accent);
  border-color: var(--accent);
}

.button--primary:hover {
  color: var(--bg-deep);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button--secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border-strong);
}

.button--secondary:hover {
  background: var(--surface-hover);
}

.button--quiet {
  height: var(--header-height);
  min-height: var(--header-height);
  padding-inline: 18px;
  background: transparent;
  border-left-color: var(--border);
}

.button--quiet:hover {
  background: var(--surface-hover);
}

.button--wide {
  width: 100%;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 32px 20px;
  background: var(--bg-deep);
}

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

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
  color: var(--text);
  font-size: 18px;
  font-weight: 680;
}

.login-copy {
  max-width: 42ch;
  margin: 18px 0 28px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.login-status {
  min-height: 58px;
  margin-top: 20px;
  padding: 13px 14px;
  color: var(--text-muted);
  background: var(--bg);
  border-left: 3px solid var(--border-strong);
}

.login-status.is-working {
  color: var(--text-secondary);
  border-left-color: var(--accent);
}

.login-status.is-error {
  color: var(--error);
  border-left-color: var(--error);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.kpi {
  min-width: 0;
  min-height: 142px;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
}

.kpi:last-child {
  border-right: 0;
}

.kpi__label,
.kpi__detail {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.kpi__label {
  font-weight: 620;
}

.kpi__value {
  display: block;
  min-height: 43px;
  margin: 16px 0 6px;
  overflow: hidden;
  color: var(--text);
  font-size: clamp(23px, 3vw, 34px);
  font-weight: 560;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel--spaced {
  margin-top: 24px;
}

.panel__header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
  min-height: 70px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel__header h2,
.privacy-state h2 {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 640;
  letter-spacing: -0.012em;
}

.panel__header p,
.privacy-state p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.panel__meta {
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.chart-wrap {
  padding: 24px 20px 16px;
}

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

.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  vector-effect: non-scaling-stroke;
}

.chart-point {
  fill: var(--bg-deep);
  stroke: var(--accent-strong);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-secondary);
  background: var(--bg);
  font-size: 12px;
  font-weight: 620;
  line-height: 1.2;
  white-space: nowrap;
}

.status--ok {
  color: var(--ok);
  background: var(--ok-surface);
  border-color: #26783c;
}

.status--warning {
  color: var(--warning);
  background: var(--warning-surface);
  border-color: #806c0f;
}

.status--error {
  color: var(--error);
  background: var(--error-surface);
  border-color: #8d343a;
}

.status--neutral {
  color: var(--text-secondary);
  background: var(--bg);
  border-color: var(--border-strong);
}

.detail-list,
.detail-grid {
  margin: 0;
}

.detail-list > div {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.detail-list > div:last-child {
  border-bottom: 0;
}

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

.detail-list--two > div {
  display: block;
  border-right: 1px solid var(--border);
  border-bottom: 0;
}

.detail-list--two > div:last-child {
  border-right: 0;
}

.detail-list dt,
.detail-grid dt {
  color: var(--text-muted);
  font-size: 12px;
}

.detail-list dd,
.detail-grid dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

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

.detail-grid > div {
  min-height: 96px;
  padding: 16px 20px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.detail-grid > div:nth-child(3n) {
  border-right: 0;
}

.detail-grid > div:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.detail-grid dd {
  margin-top: 12px;
  color: var(--text);
  font-size: 16px;
}

.notice {
  display: grid;
  gap: 4px;
  margin-bottom: 24px;
  padding: 13px 16px;
  color: var(--text-secondary);
  background: var(--surface-raised);
  border-left: 3px solid var(--border-strong);
}

.notice strong {
  color: var(--text);
}

.notice--error {
  background: var(--error-surface);
  border-left-color: var(--error);
}

.notice--error strong {
  color: var(--error);
}

.notice--inside {
  margin: 16px 20px;
}

.empty-state,
.collection-off {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 150px;
  padding: 28px 20px;
  color: var(--text-muted);
}

.empty-state strong,
.collection-off strong {
  color: var(--text-secondary);
  font-size: 15px;
}

.empty-state--bordered {
  background: var(--surface);
  border: 1px solid var(--border);
}

.collection-off {
  min-height: 112px;
  background: var(--bg);
  border-left: 3px solid var(--border-strong);
}

.collection-off--standalone {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
}

.privacy-note {
  display: grid;
  gap: 5px;
  padding: 14px 20px;
  color: var(--text-secondary);
  background: var(--accent-surface);
  border-left: 3px solid var(--accent);
}

.privacy-note strong {
  color: var(--text);
}

.privacy-note--standalone {
  margin-bottom: 24px;
  border: 1px solid #335f94;
  border-left: 3px solid var(--accent);
}

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

.field label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 620;
}

.field input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  caret-color: var(--accent);
}

.field input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.field input:hover {
  border-color: var(--text-muted);
}

.field input:focus {
  border-color: var(--focus);
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(240px, 520px) auto auto;
  align-items: end;
  justify-content: start;
  gap: 12px;
  margin-bottom: 24px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  background: var(--surface);
  border: 1px solid var(--border);
}

.table-wrap--embedded {
  border: 0;
}

.data-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  color: var(--text-secondary);
  text-align: left;
}

.data-table th {
  height: 42px;
  padding: 9px 14px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

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

.data-table tbody tr:hover td {
  background: var(--surface-raised);
}

.table-primary,
.table-primary-link,
.table-secondary {
  display: block;
}

.table-primary,
.table-primary-link {
  color: var(--text);
  font-weight: 610;
}

.table-primary-link {
  width: fit-content;
  text-decoration: none;
}

.table-primary-link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.table-secondary {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
}

.numeric,
.domain-name {
  font-variant-numeric: tabular-nums;
}

.domain-name {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.privacy-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
}

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

.plain-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  position: relative;
  min-height: 46px;
  padding: 13px 20px 13px 42px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.plain-list li:last-child {
  border-bottom: 0;
}

.plain-list li::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 20px;
  width: 8px;
  height: 2px;
  background: var(--accent);
}

.prose-block {
  display: grid;
  gap: 14px;
  max-width: 78ch;
  padding: 20px;
  color: var(--text-secondary);
  line-height: 1.65;
}

.prose-block p {
  margin: 0;
}

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

  .kpi:nth-child(2) {
    border-right: 0;
  }

  .kpi:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

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

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

  .detail-grid > div:nth-child(3n) {
    border-right: 1px solid var(--border);
  }

  .detail-grid > div:nth-child(2n) {
    border-right: 0;
  }

  .detail-grid > div:nth-last-child(-n + 3) {
    border-bottom: 1px solid var(--border);
  }

  .detail-grid > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 767px) {
  :root {
    --header-height: 48px;
  }

  .brand {
    min-width: 0;
  }

  .brand__section {
    display: none;
  }

  .app-frame {
    display: block;
  }

  .side-nav {
    position: static;
    display: block;
    width: 100%;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .side-nav__items {
    display: flex;
    padding: 0;
    overflow-x: auto;
  }

  .side-nav__link {
    flex: 1 0 auto;
    justify-content: center;
    min-height: 44px;
    padding: 10px 15px;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .side-nav__link.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .side-nav__note {
    display: none;
  }

  .main-content {
    width: 100%;
    padding: 26px 16px 48px;
  }

  .admin-shell--login .main-content {
    padding: 0;
  }

  .page-header {
    align-items: start;
    margin-bottom: 24px;
  }

  .page-header--detail {
    align-items: start;
  }

  .page-header h1,
  .login-panel h1 {
    font-size: 30px;
  }

  .kpi {
    min-height: 128px;
    padding: 16px;
  }

  .panel__header {
    padding: 14px 16px;
  }

  .chart-wrap {
    padding: 20px 16px 14px;
  }

  .line-chart {
    height: 210px;
  }

  .search-form {
    grid-template-columns: 1fr auto;
  }

  .search-form .field {
    grid-column: 1 / -1;
  }

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

  .detail-grid > div,
  .detail-grid > div:nth-child(2n),
  .detail-grid > div:nth-child(3n),
  .detail-grid > div:nth-last-child(-n + 2),
  .detail-grid > div:nth-last-child(-n + 3) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .detail-grid > div:last-child {
    border-bottom: 0;
  }

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

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

  .detail-list--two > div,
  .detail-list--two > div:last-child {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .detail-list--two > div:last-child {
    border-bottom: 0;
  }

  .privacy-note,
  .collection-off {
    padding-inline: 16px;
  }
}

@media (max-width: 520px) {
  .brand__name {
    margin-left: 10px;
    font-size: 13px;
  }

  .button--quiet {
    padding-inline: 13px;
  }

  .login-page {
    place-items: start center;
    padding: 0;
  }

  .login-panel {
    min-height: 100dvh;
    padding: 28px 20px;
    border: 0;
  }

  .login-brand {
    margin-bottom: 64px;
  }

  .page-header {
    display: grid;
    gap: 14px;
  }

  .page-header__meta {
    text-align: left;
  }

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

  .kpi,
  .kpi:nth-child(2),
  .kpi:nth-child(-n + 2) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .kpi:last-child {
    border-bottom: 0;
  }

  .kpi__value {
    font-size: 26px;
  }

  .panel__header,
  .privacy-state {
    display: grid;
    gap: 12px;
  }

  .panel__meta {
    text-align: left;
  }

  .detail-list > div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .line-chart {
    height: 180px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .skip-link,
  .button {
    transform: none !important;
  }
}
