/* Pulse dashboard. Light palette on :root, dark redefined below. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e0e4ea;
  --border-strong: #c9d0da;
  --text: #171a1f;
  --text-dim: #5c6673;
  --text-faint: #8a939f;
  --accent: #44c4a1;
  --accent-soft: rgba(68, 196, 161, 0.14);
  --brand: #44c4a1;
  --up: #1f7a4d;
  --up-soft: rgba(31, 122, 77, 0.10);
  --warn: #a8600a;
  --warn-soft: rgba(168, 96, 10, 0.10);
  --bad: #b3261e;
  --bad-soft: rgba(179, 38, 30, 0.10);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.06);
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1117;
    --surface: #151b23;
    --surface-2: #1c232d;
    --border: #262d38;
    --border-strong: #38414f;
    --text: #e6edf3;
    --text-dim: #9aa7b6;
    --text-faint: #6e7d8f;
    --accent: #44c4a1;
    --accent-soft: rgba(68, 196, 161, 0.16);
    --brand: #44c4a1;
    --up: #44c4a1;
    --up-soft: rgba(68, 196, 161, 0.16);
    --warn: #e3a008;
    --warn-soft: rgba(227, 160, 8, 0.12);
    --bad: #f6685e;
    --bad-soft: rgba(246, 104, 94, 0.12);
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: #151b23;
  --surface-2: #1c232d;
  --border: #262d38;
  --border-strong: #38414f;
  --text: #e6edf3;
  --text-dim: #9aa7b6;
  --text-faint: #6e7d8f;
  --accent: #44c4a1;
  --accent-soft: rgba(68, 196, 161, 0.16);
  --brand: #44c4a1;
  --up: #44c4a1;
  --up-soft: rgba(68, 196, 161, 0.16);
  --warn: #e3a008;
  --warn-soft: rgba(227, 160, 8, 0.12);
  --bad: #f6685e;
  --bad-soft: rgba(246, 104, 94, 0.12);
  --shadow: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ------------------------------------------------------------- top bar */

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 58px;
}

.brand { display: flex; align-items: center; gap: 10px; }

/* The logo. Its background is transparent, so it sits on the bar in either theme. */
.brand-mark {
  width: 22px;
  height: 22px;
  display: block;
  flex: none;
}

.brand-name {
  font-weight: 620;
  letter-spacing: -0.01em;
  font-size: 17px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 13px;
}

.meta-item { white-space: nowrap; }

.ghost-btn {
  font: inherit;
  font-size: 13px;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
}

/* Square icon button. The icon shows the theme you would switch TO. */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
}

.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn:focus-visible { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* Light on screen means the moon is offered. Dark means the sun is. The three
   cases below cover an explicit choice either way, plus following the system. */
.icon-btn .icon-sun { display: none; }
.icon-btn .icon-moon { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-btn .icon-moon { display: none; }
}

:root[data-theme="dark"] .icon-btn .icon-sun { display: block; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: none; }
:root[data-theme="light"] .icon-btn .icon-sun { display: none; }
:root[data-theme="light"] .icon-btn .icon-moon { display: block; }

.ghost-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

/* -------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 18px 0;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.panel-actions { display: flex; align-items: center; gap: 10px; }

.search {
  font: inherit;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  width: 190px;
}

.search:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
}

.pill-unread { background: var(--up-soft); color: var(--up); }

/* ------------------------------------------------------------- events */

.events { list-style: none; margin: 0; padding: 0; }

.event {
  display: flex;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.event:last-child { border-bottom: 0; }
.event.is-unread { background: var(--up-soft); }

.event-body { flex: 1; min-width: 0; }

.event-title {
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.event-move {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 3px;
}

.event-move b { color: var(--text); font-weight: 600; }

.event-when {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
}

/* ------------------------------------------------------------ sources */

.source {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.source:last-child { border-bottom: 0; }

.source-top {
  display: flex;
  gap: 14px;
  align-items: baseline;
}

.source-id { flex: 1; min-width: 0; }

.source-name {
  font-weight: 550;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.source-sub {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

/* Version and date travel together: the "what" is meaningless without the "when". */
.source-ver {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  white-space: nowrap;
}

.source-when {
  font-size: 12px;
  color: var(--text-faint);
}

.version {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
}

.version.is-fresh { background: var(--up-soft); color: var(--up); }

.tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-dim);
  white-space: nowrap;
}

.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-bad { background: var(--bad-soft); color: var(--bad); }

/* ------------------------------------------- release notes, the "why" */

.notes { margin-top: 9px; }

.notes > summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-dim);
  padding: 3px 9px 3px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  list-style: none;
  user-select: none;
}

.notes > summary::-webkit-details-marker { display: none; }

.notes > summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  opacity: 0.65;
  transition: transform 0.12s ease;
}

.notes[open] > summary::before { transform: rotate(90deg); }
.notes > summary:hover { color: var(--text); }

.note-list {
  margin: 9px 0 2px;
  padding: 0 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}

.note-list li { margin: 0 0 4px; }
.note-list li::marker { color: var(--text-faint); }
.note-list b { color: var(--text); font-weight: 600; }
.note-list b.is-security { color: var(--bad); }

.notes-none {
  margin: 9px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
  font-style: italic;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 9px;
  font-size: 12.5px;
}

.source-links a { color: var(--text-dim); text-decoration: none; }
.source-links a:hover { color: var(--accent); text-decoration: underline; }

.event-date { color: var(--text-faint); font-family: var(--sans); }

.sort {
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.sort:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.source.has-error .source-name { color: var(--bad); }

.empty {
  padding: 26px 18px;
  margin: 0;
  color: var(--text-faint);
  font-size: 14px;
  text-align: center;
}

.foot {
  padding: 8px 20px 40px;
  color: var(--text-faint);
  font-size: 12.5px;
}

.foot p { margin: 0; }

@media (max-width: 620px) {
  .panel-head { flex-wrap: wrap; }
  .search, .sort { width: 100%; }
  .event, .source-top { flex-direction: column; gap: 6px; }
  .source-ver { align-items: flex-start; flex-direction: row; gap: 8px; }
  .event-when { align-self: flex-start; }
}
