:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5b6475;
  --line: #d9e1e8;
  --panel: #ffffff;
  --page: #f5f7fa;
  --accent: #1f7a68;
  --accent-strong: #155d50;
  --gold: #d6a13a;
  --danger: #b42318;
  font-family: Inter, Arial, Helvetica, sans-serif;
}

html {
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  overflow-x: clip;
}

a {
  color: inherit;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

.material-symbols-rounded {
  flex: 0 0 auto;
  display: inline-flex;
  font-size: 1.25rem;
  line-height: 1;
  vertical-align: -0.2em;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-180%);
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
  text-decoration: none;
  font-weight: 900;
}

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

.login-page {
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    linear-gradient(135deg, rgba(31, 122, 104, 0.10), rgba(214, 161, 58, 0.08)),
    var(--page);
}

.login-shell {
  width: min(1080px, 100%);
  min-height: min(680px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.14);
}

.brand-panel,
.login-card {
  padding: clamp(28px, 5vw, 58px);
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.92)),
    repeating-linear-gradient(90deg, rgba(31, 122, 104, 0.13) 0 1px, transparent 1px 68px),
    repeating-linear-gradient(0deg, rgba(214, 161, 58, 0.14) 0 1px, transparent 1px 68px);
}

.brand-mark,
.login-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  background: var(--ink);
  color: #bff4df;
}

.brand-mark .material-symbols-rounded,
.login-icon .material-symbols-rounded {
  font-size: 2rem;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
  overflow-wrap: anywhere;
}

h1 {
  margin-bottom: 16px;
  font-size: 4rem;
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.45rem;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.signal-grid {
  display: grid;
  gap: 12px;
  margin-top: 34px;
  color: #273244;
  font-weight: 700;
}

.signal-grid span {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signal-grid i {
  width: 10px;
  height: 10px;
  background: var(--gold);
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: #273244;
  font-weight: 800;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink);
  padding: 13px 14px;
  font: inherit;
}

input:focus {
  outline: 3px solid rgba(31, 122, 104, 0.22);
  border-color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 11px 15px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
  text-align: center;
  overflow-wrap: anywhere;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.ghost {
  margin-top: 10px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button.compact {
  min-height: 38px;
  padding: 8px 12px;
}

.alert {
  margin: 12px 0 0;
  padding: 11px 12px;
  border-left: 5px solid var(--danger);
  background: #fff0ed;
  color: #641e16;
  font-weight: 700;
}

.app-page {
  background: #f7f8fb;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.app-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 900;
  min-width: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 10px;
  color: #273244;
  text-decoration: none;
  font-weight: 900;
}

.nav-link.active {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.session-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.dashboard {
  width: min(1120px, calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  margin: 0 auto;
  padding: 44px 0 max(44px, env(safe-area-inset-bottom));
}

.dashboard-hero {
  padding: 12px 0 30px;
}

.dashboard-hero h1 {
  max-width: 760px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  min-height: 210px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  background: #fff;
}

.metric-card .material-symbols-rounded {
  margin-bottom: 28px;
  color: var(--accent);
  font-size: 2rem;
}

.metric-card p,
.secure-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.secure-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
  min-width: 0;
}

.panel-icon {
  color: var(--gold);
  font-size: 4rem;
}

.pwa-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
}

.pwa-copy {
  min-width: 0;
}

.pwa-copy p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.6;
}

.pwa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pwa-actions .button {
  min-width: 190px;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pwa-status {
  padding: 12px 14px;
  border-left: 5px solid var(--accent);
  background: #edf8f6;
  color: #273244;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.pwa-status[data-kind="ok"] {
  border-color: var(--accent);
  background: #edf8f6;
}

.pwa-status[data-kind="warn"] {
  border-color: var(--gold);
  background: #fff8e6;
}

.pwa-status[data-kind="error"] {
  border-color: var(--danger);
  background: #fff0ed;
}

.ios-install-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.form-panel,
.event-list {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
}

.form-panel p,
.event-list p {
  color: var(--muted);
  line-height: 1.6;
}

.token-form {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

.compact-form {
  max-width: 340px;
}

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink);
  padding: 13px 14px;
  font: inherit;
  line-height: 1.45;
}

textarea:focus {
  outline: 3px solid rgba(31, 122, 104, 0.22);
  border-color: var(--accent);
}

code {
  padding: 2px 5px;
  background: #eef3f6;
  color: #273244;
  overflow-wrap: anywhere;
}

.event-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.event-row .material-symbols-rounded {
  color: var(--accent);
}

.event-row p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

@media (max-width: 820px) {
  .login-page {
    padding: 0;
    place-items: stretch;
  }

  .login-shell {
    min-height: 100svh;
    grid-template-columns: 1fr;
    border: 0;
  }

  .brand-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  h1 {
    font-size: 2.75rem;
    line-height: 1;
  }

  .topbar {
    min-height: 64px;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .site-nav {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .nav-link,
  .session-pill,
  .button.compact {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .button.ghost {
    margin-top: 0;
  }

  .dashboard {
    width: min(100% - 24px, 1120px);
    padding-top: 30px;
  }

  .metric-grid,
  .token-grid {
    grid-template-columns: 1fr;
  }

  .secure-panel {
    align-items: stretch;
    flex-direction: column;
    padding: 24px;
  }

  .pwa-panel {
    padding: 24px;
  }

  .form-panel,
  .event-list {
    padding: 24px;
  }

  .pwa-actions {
    flex-direction: column;
  }

  .pwa-actions .button {
    width: 100%;
    min-width: 0;
  }

  .panel-icon {
    align-self: flex-start;
  }
}

@media (max-width: 520px) {
  .brand-panel,
  .login-card {
    padding: 26px 20px;
  }

  .brand-mark,
  .login-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 22px;
  }

  .signal-grid {
    margin-top: 26px;
  }

  .button {
    width: 100%;
  }

  .metric-card {
    min-height: 0;
    padding: 20px;
  }
}

@media (max-width: 360px) {
  .brand-panel,
  .login-card {
    padding: 22px 16px;
  }

  h1 {
    font-size: 2rem;
  }

  .lede {
    font-size: 1rem;
  }

  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .dashboard {
    width: calc(100% - 20px);
  }
}
