:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: #11161d;
  --panel-2: #151b23;
  --text: #ece9df;
  --muted: #8d9298;
  --line: rgba(236, 233, 223, .13);
  --line-strong: rgba(236, 233, 223, .24);
  --coral: #ff765e;
  --yellow: #ffe4a3;
  --blue: #91b8c5;
  --green: #9ed6af;
  --serif: "Iowan Old Style", Baskerville, "Times New Roman", serif;
  --sans: "Avenir Next", Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(145, 184, 197, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(145, 184, 197, .035) 1px, transparent 1px);
  background-size: 48px 48px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 14, 19, .94);
  backdrop-filter: blur(12px);
}

.wordmark { display: flex; align-items: center; gap: 7px; letter-spacing: .08em; }
.wordmark .orbit { color: var(--yellow); font-size: 22px; margin-right: -5px; }
.wordmark > span:nth-child(2) { font-family: var(--serif); font-size: 18px; }
.wordmark b { margin-left: 16px; font-size: 11px; letter-spacing: .19em; font-weight: 600; }

.profile-signals { display: flex; gap: 24px; color: var(--muted); font-size: 10px; letter-spacing: .15em; }
.profile-signals span { display: flex; align-items: center; gap: 7px; }
.signal { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--muted); box-shadow: 0 0 0 3px rgba(141, 146, 152, .09); }
.signal.online { background: var(--green); box-shadow: 0 0 0 3px rgba(158, 214, 175, .09), 0 0 12px rgba(158, 214, 175, .25); }
.signal.offline, .signal.suspended { background: var(--coral); box-shadow: 0 0 0 3px rgba(255, 118, 94, .09); }
.signal.idle { background: var(--blue); }

.sidebar {
  position: fixed;
  z-index: 10;
  top: 64px;
  bottom: 0;
  left: 0;
  width: 184px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px 24px 28px;
  border-right: 1px solid var(--line);
  background: rgba(11, 14, 19, .72);
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { padding: 10px 12px; color: var(--muted); border-left: 1px solid transparent; font-size: 13px; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--text); border-color: var(--coral); background: linear-gradient(90deg, rgba(255,118,94,.08), transparent); }
.link-button { border: 0; background: transparent; padding: 0; color: var(--muted); cursor: pointer; font-size: 12px; }
.link-button:hover { color: var(--text); }
.link-button.coral { color: var(--coral); }

.workspace { width: min(1080px, calc(100% - 184px)); min-height: 100vh; margin-left: 184px; padding: 112px 58px 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 42px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 10px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
.eyebrow.coral { color: var(--coral); }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.02; }
h1 { margin: 0; font-size: clamp(42px, 7vw, 72px); letter-spacing: -.035em; }
h2 { margin: 0; font-size: 30px; }

.periods { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 3px; }
.periods a { padding: 7px 10px; color: var(--muted); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; border-radius: 2px; }
.periods a:hover { color: var(--text); }
.periods a.active { color: var(--bg); background: var(--yellow); }

.traffic-hero { position: relative; min-height: 260px; padding: 38px 0 30px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overflow: hidden; }
.traffic-hero strong { position: relative; z-index: 2; display: block; margin-top: 28px; font-family: var(--serif); font-size: clamp(68px, 12vw, 132px); font-weight: 400; line-height: .9; letter-spacing: -.055em; }
.horizon { position: absolute; left: 42%; right: 0; bottom: 62px; height: 80px; border-bottom: 1px solid rgba(145,184,197,.5); transform: skewY(-2deg); }
.horizon::before, .horizon::after { content: ""; position: absolute; right: 0; left: 0; border-top: 1px solid rgba(145,184,197,.12); }
.horizon::before { top: 28px; transform: skewY(5deg); }
.horizon::after { top: 54px; transform: skewY(-4deg); }
.horizon span { position: absolute; right: 18%; bottom: -5px; width: 11px; height: 11px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 30px rgba(255,228,163,.45); }

.metric-strip { display: grid; grid-template-columns: repeat(2, 1fr); border-bottom: 1px solid var(--line); }
.metric-strip a { display: flex; justify-content: space-between; align-items: center; padding: 25px 28px 25px 0; border-right: 1px solid var(--line); text-transform: uppercase; color: var(--muted); font-size: 10px; letter-spacing: .16em; }
.metric-strip a + a { padding-left: 28px; border-right: 0; }
.metric-strip b { color: var(--text); font-family: var(--serif); font-size: 32px; font-weight: 400; }

.problems { margin-top: 40px; padding: 24px; border: 1px solid rgba(255,118,94,.28); background: rgba(255,118,94,.04); }
.problem { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(255,118,94,.12); }
.problem i { width: 6px; height: 6px; background: var(--coral); border-radius: 50%; }
.all-clear { display: flex; align-items: center; gap: 12px; margin-top: 36px; color: var(--muted); font-size: 13px; }

.notice { position: relative; margin: -24px 0 28px; padding: 12px 16px; border: 1px solid rgba(158,214,175,.25); background: rgba(158,214,175,.06); color: var(--green); font-size: 13px; }
.notice.error { border-color: rgba(255,118,94,.3); color: var(--coral); background: rgba(255,118,94,.06); }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid var(--line-strong); border-radius: 2px; background: transparent; color: var(--text); cursor: pointer; font-size: 10px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.button:hover { border-color: var(--text); }
.button.primary { border-color: var(--coral); background: var(--coral); color: #14100f; }
.button.primary:hover { background: #ff8a75; }
.button.secondary { background: rgba(236,233,223,.035); }
.button.danger { border-color: rgba(255,118,94,.42); color: var(--coral); }
.button.danger:hover { background: rgba(255,118,94,.08); }
.button.wide { width: 100%; min-height: 48px; }

.field { display: grid; gap: 7px; }
.field > span { color: var(--muted); font-size: 9px; letter-spacing: .18em; }
.field input, .field textarea { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 2px; outline: 0; background: rgba(236,233,223,.035); color: var(--text); resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(145,184,197,.08); }
.field textarea { min-height: 68px; }
.form-grid { display: grid; grid-template-columns: minmax(0,1fr) 140px; gap: 18px; padding-top: 22px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid > .button { justify-self: start; }

.create-panel { margin: -14px 0 28px; }
.create-panel > summary { width: max-content; list-style: none; }
.create-panel > summary::-webkit-details-marker, .inline-details > summary::-webkit-details-marker { display: none; }
.create-panel[open] { padding: 22px; border: 1px solid var(--line); background: rgba(17,22,29,.7); }
.create-panel[open] > summary { margin-top: -4px; background: transparent; color: var(--coral); }

.people-list { border-top: 1px solid var(--line); }
.person-row { display: grid; grid-template-columns: minmax(160px, 1fr) 190px 110px; align-items: center; gap: 24px; min-height: 92px; border-bottom: 1px solid var(--line); transition: background .16s ease; }
.person-row:hover { background: linear-gradient(90deg, rgba(145,184,197,.055), transparent 74%); }
.person-name { font-family: var(--serif); font-size: 28px; }
.person-state { color: var(--muted); font-size: 9px; letter-spacing: .15em; text-align: right; }
.person-row strong { font-weight: 500; text-align: right; }

.empty-state { padding: 76px 20px; text-align: center; color: var(--muted); border-bottom: 1px solid var(--line); }
.empty-state h2 { margin: 14px 0 8px; color: var(--text); }
.empty-state p { max-width: 450px; margin: 0 auto; }
.empty-state.small { padding: 28px; }
.orbit-large { color: var(--yellow); font-size: 40px; }

.back { display: inline-block; margin-bottom: 34px; color: var(--muted); font-size: 12px; }
.back:hover { color: var(--text); }
.person-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.person-note { max-width: 600px; margin: 16px 0 0; color: var(--muted); }
.person-total { text-align: right; }
.person-total span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.person-total strong { font-family: var(--serif); font-size: 32px; font-weight: 400; white-space: nowrap; }
.person-controls { display: flex; align-items: center; gap: 16px; min-height: 76px; border-bottom: 1px solid var(--line); }
.person-controls form { margin: 0; }
.inline-details > summary { cursor: pointer; color: var(--muted); font-size: 11px; }
.inline-details[open] { flex: 1; padding: 22px 0; }
.edit-form { max-width: 680px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding: 42px 0 20px; }
.section-head h2 { font-size: 25px; }
.compact-create { margin: 0; }
.compact-create[open] { position: absolute; right: 58px; z-index: 4; width: min(500px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.device-create-form { display: flex; align-items: flex-end; gap: 14px; padding-top: 18px; }
.device-create-form .field { flex: 1; }

.device-list { border-top: 1px solid var(--line); }
.device-row { border-bottom: 1px solid var(--line); }
.device-summary { width: 100%; min-height: 70px; display: grid; grid-template-columns: minmax(140px,1fr) 150px 100px 24px; gap: 18px; align-items: center; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.device-summary:hover { background: linear-gradient(90deg, rgba(145,184,197,.045), transparent); }
.device-name { font-size: 16px; }
.device-presence { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; }
.device-summary strong { font-size: 13px; text-align: right; }
.chevron { color: var(--muted); transition: transform .15s ease; text-align: right; }
.device-summary[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.device-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 6px 0 22px; }
.device-actions form { margin: 0; }
.device-meta { flex: 1 1 240px; color: var(--muted); font-size: 10px; }
.danger-zone { margin-top: 64px; padding: 24px 0; border-top: 1px solid rgba(255,118,94,.24); }

.settings-section { padding: 34px 0 44px; border-top: 1px solid var(--line); }
.section-copy { max-width: 610px; }
.section-copy p:last-child { margin: 12px 0 0; color: var(--muted); }
.passkey-list { margin: 28px 0 20px; border-top: 1px solid var(--line); }
.passkey-row { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 17px 0; border-bottom: 1px solid var(--line); }
.passkey-row strong, .passkey-row span { display: block; }
.passkey-row span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.inline-form { display: flex; align-items: flex-end; gap: 12px; max-width: 540px; }
.inline-form .field { flex: 1; }
.split-settings { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: start; gap: 40px; }
.recovery-export { width: min(380px, 100%); display: grid; gap: 14px; }
.inline-error { min-height: 21px; margin: 12px 0 0; color: var(--coral); font-size: 12px; }

.auth-body { overflow-x: hidden; }
.auth-workspace { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.auth-workspace::before { content: ""; position: fixed; left: -20vw; right: -20vw; top: 64%; border-top: 1px solid rgba(145,184,197,.28); transform: rotate(-2deg); }
.auth-card { position: relative; z-index: 2; width: min(470px, 100%); padding: 48px; border: 1px solid var(--line); background: rgba(11,14,19,.88); box-shadow: 0 34px 120px rgba(0,0,0,.35); overflow: hidden; }
.auth-card > :not(.auth-sun) { position: relative; z-index: 1; }
.auth-card h1 { position: relative; margin-bottom: 22px; font-size: clamp(38px, 7vw, 56px); }
.auth-copy { position: relative; max-width: 390px; margin: 0 0 28px; color: var(--muted); }
.auth-card .field { position: relative; margin-bottom: 14px; }
.auth-sun { position: absolute; z-index: 0; top: -165px; right: -165px; width: 310px; height: 310px; border: 1px solid rgba(255,228,163,.22); border-radius: 50%; pointer-events: none; }
.auth-sun span { position: absolute; left: 76px; bottom: 42px; width: 120px; height: 60px; overflow: hidden; }
.auth-sun span::after { content: ""; position: absolute; left: 0; top: 0; width: 120px; height: 120px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 55px rgba(255,228,163,.18); }
.recovery-login { margin-top: 20px; color: var(--muted); font-size: 12px; }
.recovery-login summary { cursor: pointer; text-align: center; }
.recovery-login[open] { padding-top: 8px; }
.recovery-login .field { margin-top: 15px; }

.modal { width: min(480px, calc(100% - 28px)); padding: 34px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,.6); }
.modal::backdrop { background: rgba(4,6,9,.78); backdrop-filter: blur(4px); }
.modal-close { position: absolute; top: 13px; right: 16px; border: 0; background: transparent; color: var(--muted); font-size: 25px; cursor: pointer; }
.modal p { color: var(--muted); }
.modal pre { max-height: 270px; padding: 18px; overflow: auto; border: 1px solid var(--line); background: var(--bg); color: var(--yellow); line-height: 1.7; user-select: all; }

.mobile-nav { display: none; }

@media (max-width: 760px) {
  body { background-size: 36px 36px; }
  .topbar { height: 56px; padding: 0 16px; }
  .wordmark b { margin-left: 8px; }
  .profile-signals { gap: 10px; }
  .profile-signals span { font-size: 0; gap: 5px; }
  .profile-signals span::first-letter { font-size: 10px; }
  .sidebar { display: none; }
  .workspace { width: 100%; margin-left: 0; padding: 88px 18px 102px; }
  .page-head { display: grid; margin-bottom: 28px; }
  h1 { font-size: 46px; }
  .periods { width: 100%; }
  .periods a { flex: 1; text-align: center; padding-inline: 5px; }
  .traffic-hero { min-height: 220px; }
  .traffic-hero strong { margin-top: 36px; font-size: 70px; }
  .horizon { left: 18%; bottom: 40px; }
  .metric-strip a { padding: 20px 15px 20px 0; }
  .metric-strip a + a { padding-left: 15px; }
  .person-row { grid-template-columns: minmax(0,1fr) auto; gap: 8px 16px; padding: 19px 0; }
  .person-state { grid-column: 1; grid-row: 2; text-align: left; }
  .person-row strong { grid-column: 2; grid-row: 1 / 3; }
  .person-header { display: grid; }
  .person-total { text-align: left; }
  .person-controls { flex-wrap: wrap; padding: 16px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .compact-create[open] { right: 16px; }
  .device-summary { grid-template-columns: minmax(100px,1fr) auto 18px; gap: 10px; padding: 12px 0; }
  .device-presence { grid-column: 1; grid-row: 2; }
  .device-summary strong { grid-column: 2; grid-row: 1 / 3; }
  .chevron { grid-column: 3; grid-row: 1 / 3; }
  .device-meta { flex-basis: 100%; }
  .split-settings { grid-template-columns: 1fr; }
  .inline-form { display: grid; }
  .auth-workspace { padding: 16px; }
  .auth-card { padding: 36px 24px; }
  .mobile-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(67px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(3, 1fr); padding: 7px 10px env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(11,14,19,.96); backdrop-filter: blur(14px); }
  .mobile-nav a { display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); font-size: 9px; }
  .mobile-nav a span { font-size: 18px; }
  .mobile-nav a.active { color: var(--coral); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
