:root {
  color-scheme: light;
  --ink: #0b0b0b;
  --paper: #f5f2ea;
  --white: #ffffff;
  --muted: #706e68;
  --line: #d7d3c9;
  --lime: #cbff4a;
  --blue: #5f76ff;
  --orange: #ff7147;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Archivo, Arial, sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ink); }
.login-card { width: min(760px, 100%); min-height: 610px; padding: 38px; background: var(--paper); display: flex; flex-direction: column; border-radius: 2px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; width: max-content; }
.brand img { width: 48px; height: 48px; border-radius: 50%; }
.brand span { display: grid; gap: 2px; }
.brand b { font-size: 16px; letter-spacing: -.3px; }
.brand small { font-size: 9px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: var(--muted); }
.login-copy { margin: auto 0 42px; }
.eyebrow { display: block; font-size: 10px; line-height: 1; font-weight: 800; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
h1 { margin: 20px 0; font-size: clamp(54px, 8vw, 92px); line-height: .83; letter-spacing: -6px; text-transform: uppercase; }
h1 em { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; text-transform: none; }
.login-copy p { max-width: 480px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
#login-form label { display: block; margin-bottom: 9px; font-size: 10px; font-weight: 800; letter-spacing: 1.6px; text-transform: uppercase; }
.pin-row { display: flex; gap: 10px; }
.pin-row input { min-width: 0; flex: 1; height: 56px; border: 1px solid var(--ink); padding: 0 16px; border-radius: 0; background: var(--white); outline: 0; }
.pin-row input:focus { box-shadow: inset 0 0 0 2px var(--ink); }
.pin-row button { height: 56px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); padding: 0 20px; font-size: 12px; font-weight: 800; cursor: pointer; }
.pin-row button:hover { background: var(--blue); }
.form-status { min-height: 20px; margin: 8px 0 0; color: #a92323; font-size: 12px; font-weight: 700; }
.privacy-note { margin: 16px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

.dashboard { min-height: 100vh; padding-bottom: 72px; }
.topbar { height: 82px; padding: 0 clamp(22px, 4vw, 64px); display: flex; align-items: center; border-bottom: 1px solid var(--line); background: rgba(245,242,234,.94); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.brand-small img { width: 40px; height: 40px; }
.live-state { margin-left: auto; display: flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; }
.live-state i { width: 8px; height: 8px; border-radius: 50%; background: #56b35a; box-shadow: 0 0 0 5px rgba(86,179,90,.14); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(86,179,90,0); } }
.sign-out { margin-left: 24px; border: 0; border-bottom: 1px solid var(--ink); padding: 4px 0; background: transparent; font-size: 11px; font-weight: 800; cursor: pointer; }
.dashboard-head { max-width: 1500px; margin: 0 auto; padding: 76px clamp(22px, 4vw, 64px) 56px; display: grid; grid-template-columns: 1.4fr .6fr; align-items: end; gap: 36px; }
.dashboard-head h1 { margin: 20px 0 0; }
.dashboard-head p { margin: 0 0 5px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.metric-grid { max-width: 1500px; margin: 0 auto; padding: 0 clamp(22px, 4vw, 64px) 64px; display: grid; grid-template-columns: repeat(4, 1fr); }
.metric-grid article { min-height: 180px; padding: 23px; border: 1px solid var(--ink); border-right: 0; display: flex; flex-direction: column; background: var(--white); }
.metric-grid article:last-child { border-right: 1px solid var(--ink); }
.metric-grid article:nth-child(2) { background: var(--lime); }
.metric-grid article span, .metric-grid article small { font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; }
.metric-grid article small { margin-top: auto; color: var(--muted); letter-spacing: .5px; text-transform: none; }
.metric-grid article b { margin-top: 18px; font-size: clamp(48px, 6vw, 80px); line-height: .9; letter-spacing: -5px; }
.activity-panel { max-width: 1500px; margin: 0 auto; border: 1px solid var(--ink); background: var(--white); }
.activity-head { padding: 28px 30px; display: flex; align-items: end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--ink); }
.activity-head h2 { margin: 8px 0 0; font-size: 28px; letter-spacing: -1.5px; }
.filters { display: flex; gap: 10px; }
.filters label { display: grid; gap: 6px; }
.filters label span { font-size: 9px; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase; }
.filters input, .filters select { height: 42px; border: 1px solid var(--line); border-radius: 0; padding: 0 12px; background: var(--white); color: var(--ink); font-size: 12px; outline: 0; }
.filters input { width: 230px; }
.filters input:focus, .filters select:focus { border-color: var(--ink); }
.data-status { margin: 0; padding: 11px 30px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th { padding: 12px 18px; background: var(--ink); color: var(--white); text-align: left; font-size: 9px; letter-spacing: 1.3px; text-transform: uppercase; }
td { padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: 12px; vertical-align: top; }
tbody tr:hover { background: #f8f6f0; }
.when { display: grid; gap: 3px; white-space: nowrap; }
.when b { font-size: 11px; }
.when span { color: var(--muted); font-size: 10px; }
.visitor { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; font-weight: 700; }
.event { display: grid; gap: 6px; }
.event-badge { width: max-content; padding: 4px 7px; border-radius: 2px; background: #eceae4; font-size: 8px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
.event-badge.click { background: var(--lime); }
.event b { max-width: 310px; font-size: 11px; line-height: 1.4; }
.path { display: grid; gap: 4px; }
.path b { font-size: 11px; }
.path span { color: var(--muted); font-size: 10px; }
.device { display: grid; gap: 3px; }
.device span, .source { color: var(--muted); font-size: 10px; }
.empty-state { min-height: 230px; display: grid; place-content: center; gap: 8px; text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state span { color: var(--muted); font-size: 12px; }
.activity-foot { min-height: 52px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }

@media (max-width: 900px) {
  .dashboard-head { grid-template-columns: 1fr; }
  .dashboard-head p { max-width: 560px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric-grid article:nth-child(2) { border-right: 1px solid var(--ink); }
  .metric-grid article:nth-child(n+3) { border-top: 0; }
  .activity-panel { margin-inline: 22px; }
  .activity-head { align-items: stretch; flex-direction: column; }
}

@media (max-width: 620px) {
  .login-shell { padding: 0; }
  .login-card { min-height: 100vh; padding: 24px; }
  .login-copy { margin-top: auto; }
  h1 { letter-spacing: -4px; }
  .pin-row { display: grid; }
  .topbar { height: 72px; }
  .live-state span { display: none; }
  .sign-out { margin-left: 16px; }
  .dashboard-head { padding-top: 54px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid article { min-height: 150px; padding: 17px; }
  .metric-grid article b { letter-spacing: -3px; }
  .filters { display: grid; grid-template-columns: 1fr; width: 100%; }
  .filters input, .filters select { width: 100%; }
  .activity-head { padding: 22px; }
  .activity-foot { padding: 0 20px; }
  .activity-foot span:last-child { display: none; }
}
