:root {
  color-scheme: dark;
  --black: #050505;
  --ink: #0a0a0a;
  --paper: #f2f2ef;
  --muted: rgba(242,242,239,.56);
  --faint: rgba(242,242,239,.32);
  --line: rgba(242,242,239,.13);
  --line-strong: rgba(242,242,239,.28);
  --panel: rgba(255,255,255,.022);
  --danger: #ff6b6b;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--black); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--black); color: var(--paper); font-family: var(--sans); }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 1px solid var(--paper); outline-offset: 3px; }
[hidden] { display: none !important; }

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .48;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 96px 96px; mask-image: linear-gradient(to bottom, #000, transparent 78%);
}
.eyebrow { margin: 0; color: var(--muted); font: 10px/1.3 var(--mono); letter-spacing: .16em; }
.z-mark { width: 54px; height: 38px; display: grid; align-content: space-between; }
.z-mark i { display: block; height: 4px; border-radius: 5px; background: var(--paper); transform-origin: center; }
.z-mark i:nth-child(2) { transform: rotate(-18deg); }
.z-mark--small { width: 38px; height: 28px; }
.z-mark--small i { height: 3px; }

.login { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.login__panel { width: min(640px, 100%); border-top: 1px solid var(--paper); border-bottom: 1px solid var(--line); padding: 42px 0 34px; }
.login .z-mark { margin-bottom: 62px; }
.login h1 { margin: 12px 0 14px; font-size: clamp(48px, 8vw, 94px); line-height: .9; font-weight: 520; letter-spacing: -.07em; }
.login__intro { max-width: 430px; margin: 0 0 40px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.login__form label { display: block; margin-bottom: 10px; color: var(--muted); font: 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.login__row { display: grid; grid-template-columns: minmax(0,1fr) auto; border: 1px solid var(--line-strong); }
.login__row input { min-width: 0; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--paper); padding: 16px; }
.login__row button { border: 0; background: var(--paper); color: var(--ink); padding: 0 26px; cursor: pointer; font-weight: 650; }
.login__error { min-height: 18px; margin: 12px 0 0; color: var(--danger); font-size: 12px; opacity: 0; }
.login__error.show { opacity: 1; }

.dashboard { position: relative; z-index: 1; width: min(1680px, 100%); margin: 0 auto; padding: 26px 34px 72px; }
.dashboard__header { min-height: 84px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line-strong); }
.brand-lockup { display: flex; align-items: center; gap: 22px; }
.brand-lockup h1 { margin: 5px 0 0; font-size: clamp(21px, 2.1vw, 32px); line-height: 1; font-weight: 530; letter-spacing: -.045em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.sync-state { margin-right: 8px; color: var(--faint); font: 10px/1 var(--mono); letter-spacing: .08em; }
.quiet-button { border: 1px solid var(--line); background: transparent; padding: 9px 14px; cursor: pointer; font-size: 12px; }
.quiet-button:hover { background: var(--paper); color: var(--ink); }

.method-note { display: flex; align-items: center; gap: 10px; margin: 18px 0 30px; color: var(--muted); font-size: 12px; }
.method-note p { margin: 0; }
.method-note strong { color: var(--paper); font-weight: 600; }
.pulse-dot { width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 0 rgba(255,255,255,.3); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.stat { min-height: 150px; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; }
.stat span { color: var(--muted); font-size: 12px; }
.stat strong { margin: auto 0 8px; font-size: clamp(34px, 4vw, 64px); line-height: .8; font-weight: 400; letter-spacing: -.07em; font-variant-numeric: tabular-nums; }
.stat small { color: var(--faint); font: 9px/1 var(--mono); letter-spacing: .14em; }

.overview-grid { display: grid; grid-template-columns: minmax(0,1.45fr) minmax(320px,.55fr); gap: 18px; margin-top: 18px; }
.panel { border: 1px solid var(--line); background: var(--panel); }
.panel__head { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; border-bottom: 1px solid var(--line); }
.panel__head h2 { margin: 6px 0 0; font-size: 18px; font-weight: 500; letter-spacing: -.03em; }
.chart { height: 254px; display: flex; align-items: flex-end; gap: 3px; padding: 30px 18px 28px; overflow: hidden; }
.chart__bar { min-width: 4px; flex: 1 1 0; height: max(2px, var(--height)); background: var(--paper); opacity: .7; position: relative; transition: opacity .18s; }
.chart__bar:hover { opacity: 1; }
.chart__bar:nth-child(6n+1)::after { content: attr(data-time); position: absolute; left: 0; bottom: -18px; color: var(--faint); font: 8px/1 var(--mono); white-space: nowrap; }
.compact-list { max-height: 254px; overflow: auto; scrollbar-color: var(--line-strong) transparent; }
.compact-item { min-height: 51px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 16px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.compact-item:last-child { border-bottom: 0; }
.compact-item__name { font-size: 12px; }
.compact-item__meta { margin-top: 4px; color: var(--faint); font: 9px/1.3 var(--mono); }
.compact-item strong { font: 13px/1 var(--mono); font-weight: 400; }

.visits-panel { margin-top: 18px; }
.panel__head--visits { min-height: 90px; }
.filters { display: flex; border: 1px solid var(--line); }
.filter { border: 0; border-right: 1px solid var(--line); background: transparent; padding: 8px 12px; color: var(--muted); font-size: 11px; cursor: pointer; }
.filter:last-child { border-right: 0; }
.filter.is-active { background: var(--paper); color: var(--ink); }
.visits-head, .visit__summary { display: grid; grid-template-columns: minmax(180px,1.1fr) minmax(135px,.65fr) minmax(260px,1.6fr) 100px 24px; gap: 18px; align-items: center; }
.visits-head { padding: 11px 18px; border-bottom: 1px solid var(--line); color: var(--faint); font: 9px/1 var(--mono); letter-spacing: .08em; }
.visit { border-bottom: 1px solid var(--line); }
.visit:last-child { border-bottom: 0; }
.visit__summary { width: 100%; min-height: 78px; padding: 13px 18px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.visit__summary:hover { background: rgba(255,255,255,.025); }
.visit__ip { display: block; font: 13px/1.3 var(--mono); }
.visit__location, .visit__time-sub { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.visit__time { font-variant-numeric: tabular-nums; font-size: 12px; }
.visit__content { display: flex; gap: 6px; flex-wrap: wrap; }
.content-chip { border: 1px solid var(--line); padding: 5px 7px; color: var(--muted); font: 9px/1 var(--mono); white-space: nowrap; }
.content-chip--primary { border-color: var(--line-strong); color: var(--paper); }
.visit__duration { font: 16px/1 var(--mono); font-variant-numeric: tabular-nums; }
.visit__chevron { color: var(--faint); transform: rotate(0); transition: transform .2s; }
.visit.is-open .visit__chevron { transform: rotate(45deg); }
.visit__details { display: none; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.visit.is-open .visit__details { display: grid; }
.detail { min-height: 78px; padding: 14px 18px; background: var(--ink); }
.detail span { display: block; margin-bottom: 9px; color: var(--faint); font: 9px/1 var(--mono); letter-spacing: .08em; }
.detail strong { display: block; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.55; word-break: break-word; }
.empty-state { padding: 42px 18px; color: var(--muted); text-align: center; font-size: 12px; }

@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(3,1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .visits-head { display: none; }
  .visit__summary { grid-template-columns: 1fr auto 22px; }
  .visit__summary > :nth-child(2) { display: none; }
  .visit__content { grid-column: 1 / 2; }
  .visit__duration { grid-column: 2; grid-row: 1 / span 2; }
  .visit__chevron { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 680px) {
  body::before { background-size: 64px 64px; }
  .dashboard { padding: 18px 14px 48px; }
  .dashboard__header { align-items: flex-start; }
  .brand-lockup .z-mark { display: none; }
  .sync-state { display: none; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .stat { min-height: 124px; }
  .panel__head--visits { align-items: flex-start; flex-direction: column; }
  .visit__details { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
  .login__row { grid-template-columns: 1fr; }
  .login__row input { border-right: 0; border-bottom: 1px solid var(--line); }
  .login__row button { min-height: 48px; }
  .header-actions .quiet-button:first-of-type { display: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat strong { font-size: 36px; }
  .visit__summary { padding: 13px 12px; }
  .visit__details { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.access-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 22px;
  padding: 24px 28px;
}

.access-control__copy h2 {
  margin: 4px 0 8px;
  font-size: clamp(22px, 2vw, 32px);
}

.access-control__copy p:last-child {
  margin: 0;
  color: var(--muted, #777);
}

.access-control__actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
}

.access-control__status {
  color: #111;
  font-size: 13px;
  letter-spacing: .08em;
}

.access-control__status.is-open {
  color: #16834d;
}

.access-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(0, 0, 0, .18);
  border-radius: 999px;
  background: #fff;
  padding: 8px 14px 8px 8px;
  color: #111;
  cursor: pointer;
}

.access-switch:disabled {
  cursor: wait;
  opacity: .55;
}

.access-switch__track {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #c9c9c9;
  transition: background .2s ease;
}

.access-switch__track i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .28);
  transition: transform .2s ease;
}

.access-switch.is-on .access-switch__track {
  background: #111;
}

.access-switch.is-on .access-switch__track i {
  transform: translateX(20px);
}

@media (max-width: 720px) {
  .access-control {
    align-items: flex-start;
    flex-direction: column;
  }

  .access-control__actions {
    justify-content: space-between;
    width: 100%;
  }
}
