:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --background: #080a0c;
  --surface: #0f1215;
  --surface-raised: #15191d;
  --surface-hover: #1a1f24;
  --border: #252b31;
  --border-strong: #353d45;
  --text: #f2f4f6;
  --muted: #8d969f;
  --muted-low: #626b74;
  --accent: #d8ff52;
  --accent-ink: #10130c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--text);
}

body {
  min-width: 320px;
  padding-bottom: calc(66px + env(safe-area-inset-bottom));
  background-image:
    radial-gradient(circle at 8% 0%, rgba(216, 255, 82, 0.06), transparent 25rem),
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
}

button { font: inherit; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  border-right: 1px solid rgba(255, 255, 255, 0.025);
  border-left: 1px solid rgba(255, 255, 255, 0.025);
  background: rgba(9, 11, 13, 0.9);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(64px + env(safe-area-inset-top));
  padding: calc(10px + env(safe-area-inset-top)) 15px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 17, 20, 0.94);
  backdrop-filter: blur(16px);
}

.brand-lockup,
.count-card,
.section-heading,
.feed-header {
  display: flex;
  align-items: center;
}

.brand-lockup { gap: 10px; }

.brand-mark {
  position: relative;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #3b4530;
  border-radius: 9px;
  background: #171c14;
  transform: rotate(8deg);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  display: block;
  width: 4px;
  height: 15px;
  border-radius: 99px;
  background: var(--accent);
}

.brand-mark::before { transform: translateX(-7px); }
.brand-mark span { position: absolute; }
.brand-mark::after { position: absolute; transform: translateX(7px); }

.brand-name {
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.11em;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted-low);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.connection-chip,
.status-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-low);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.connection-chip i,
.status-item i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #505860;
}

.connection-chip.active,
.status-item.active { color: #c8db8f; }
.connection-chip.active i,
.status-item.active i { background: var(--accent); box-shadow: 0 0 0 4px rgba(216, 255, 82, 0.08); }

.clock-section { padding: 22px 14px 14px; }
.section-heading { justify-content: space-between; gap: 15px; margin-bottom: 12px; }

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.16em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 22px; letter-spacing: -0.035em; }
h2 { margin-bottom: 0; font-size: 14px; letter-spacing: -0.02em; }
.current-date { color: var(--muted); font-size: 10px; text-transform: uppercase; }

.clock-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.clock-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 12px;
  border-bottom: 1px solid #1e2328;
}

.clock-row:last-child { border-bottom: 0; }
.clock-row > div { display: flex; align-items: baseline; gap: 8px; }
.clock-row strong { font-size: 12px; }
.clock-row span { color: var(--muted-low); font-size: 8px; font-weight: 800; letter-spacing: 0.08em; }
.clock-time { font-size: 19px; font-weight: 780; font-variant-numeric: tabular-nums; letter-spacing: -0.04em; }

.counts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 0 14px 14px;
}

.count-card {
  min-width: 0;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.source-icon,
.event-source {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-raised);
  font-size: 10px;
  font-weight: 900;
}

.source-icon { width: 30px; height: 30px; }
.gmail-icon, .gmail-source { color: #ff8f87; }
.respond-icon, .respond-source { color: #8cc6ff; }
.count-card > div { display: grid; min-width: 0; gap: 2px; }
.count-card strong { font-size: 11px; }
.count-card div span { overflow: hidden; color: var(--muted-low); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.count-card b { margin-left: auto; font-size: 20px; font-variant-numeric: tabular-nums; }

.push-card {
  display: grid;
  gap: 12px;
  margin: 0 14px 14px;
  padding: 14px;
  border: 1px solid #3a442e;
  border-radius: 14px;
  background: #11160f;
}

.pairing-card {
  display: grid;
  gap: 11px;
  margin: 0 14px 14px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.pairing-card p:last-child { margin: 5px 0 0; color: var(--muted-low); font-size: 9px; }
.pairing-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }

.pairing-form input {
  min-width: 0;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  outline: 0;
  background: #0b0e10;
  color: var(--text);
  font: inherit;
  font-size: 11px;
}

.pairing-form input:focus { border-color: #667a36; box-shadow: 0 0 0 3px rgba(216, 255, 82, 0.06); }

.secondary-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
}

.push-card p:last-child { margin: 6px 0 0; color: #879170; font-size: 10px; line-height: 1.45; }

.primary-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 850;
}

.primary-button:disabled { opacity: 0.52; filter: grayscale(0.8); }

.feed-card {
  margin: 0 14px 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

.feed-header {
  justify-content: space-between;
  min-height: 60px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
}

.feed-count {
  display: grid;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 99px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.feed-list { max-height: 340px; overflow-y: auto; }

.event-row {
  display: grid;
  width: 100%;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid #1c2126;
  background: transparent;
  color: inherit;
  text-align: left;
}

.event-row:last-child { border-bottom: 0; }
.event-row.has-url:active { background: var(--surface-hover); }
.event-source { width: 29px; height: 29px; }
.event-content { display: grid; min-width: 0; gap: 2px; }
.event-content strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.event-title { overflow: hidden; color: #cdd2d7; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.event-snippet { display: -webkit-box; overflow: hidden; color: var(--muted-low); font-size: 9px; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.event-row time { color: var(--muted-low); font-size: 8px; white-space: nowrap; }

.empty-state {
  display: grid;
  min-height: 108px;
  padding: 24px;
  place-items: center;
  color: var(--muted-low);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.install-help {
  margin: 14px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}

.install-help summary {
  padding: 13px 0;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.install-help ol { margin: 0 0 12px; padding-left: 19px; color: #bdc3c9; font-size: 10px; line-height: 1.8; }
.install-help p { margin-bottom: 13px; color: var(--muted-low); font-size: 9px; line-height: 1.5; }
.privacy-note { padding: 5px 14px 24px; color: var(--muted-low); font-size: 8px; text-align: center; }

.live-status {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: calc(52px + env(safe-area-inset-bottom));
  padding: 10px max(14px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  border-top: 1px solid var(--border);
  background: rgba(14, 17, 20, 0.96);
  backdrop-filter: blur(18px);
}

.last-sync { margin-left: auto; color: var(--muted-low); font-size: 8px; font-variant-numeric: tabular-nums; }

.toast {
  position: fixed;
  right: 14px;
  bottom: calc(68px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 12;
  max-width: 470px;
  margin: auto;
  padding: 11px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: #171b1f;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  font-size: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: 160ms ease;
}

.toast.show { opacity: 1; transform: translateY(0); }

@media (min-width: 700px) {
  .app-shell { margin-top: 18px; margin-bottom: 18px; overflow: hidden; border: 1px solid var(--border); border-radius: 20px; }
  .topbar { padding-top: 10px; }
  .live-status { right: 50%; left: auto; width: 520px; transform: translateX(50%); border: 1px solid var(--border); border-radius: 14px 14px 0 0; }
}
