:root {
  color-scheme: light;
  --bg: #ffffff;
  --wash: #f6f7f8;
  --line: #e6e8eb;
  --ink: #14181f;
  --ink-2: #4b5563;
  --ink-3: #8a93a0;
  --accent: #0b7a55;
  --accent-ink: #086244;
  --accent-wash: #e8f5ef;
  --bad: #b3261e;
  --bad-wash: #fdecea;
  --top: 60px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--accent-ink); }
button, select, input { font: inherit; color: inherit; }

/* Header */
.top {
  height: var(--top);
  flex: none;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.top h1 span { color: var(--accent); }
.top h1::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }

.tabs { display: flex; gap: 4px; align-self: stretch; }
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.tab span { font-size: 12.5px; color: var(--ink-3); background: var(--wash); padding: 1px 7px; border-radius: 20px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.tab.on span { color: var(--accent-ink); background: var(--accent-wash); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.tagline, .runstate { font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.runstate { color: var(--accent-ink); max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.runstate:empty, .refreshing .tagline { display: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--wash); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.on { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; color: var(--ink-2); }

/* Filter bar */
.filters {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
}
#q {
  width: 270px;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--wash) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a93a0' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E") 11px center no-repeat;
  font-size: 14px;
}
#q:focus, select:focus-visible, .chip > summary:focus-visible, .btn:focus-visible, .row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#q:focus { background-color: var(--bg); }

.chip { position: relative; font-size: 14px; }
.chip > summary, .chip-select, .chip-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.chip > summary::-webkit-details-marker { display: none; }
.chip > summary::after { content: ''; width: 6px; height: 6px; margin: -3px 0 0 2px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); opacity: .6; }
.chip > summary:hover, .chip-select:hover, .chip-toggle:hover { background: var(--wash); }
.chip.active > summary, .chip-toggle.active { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); }
.chip-select select { border: 0; background: none; font-weight: 600; color: var(--ink); cursor: pointer; padding: 0; }
.chip-select span { color: var(--ink-3); font-weight: 400; }
.badge { font-size: 12px; font-weight: 600; min-width: 18px; padding: 0 5px; border-radius: 20px; background: var(--accent); color: #fff; text-align: center; line-height: 18px; }
.badge:empty { display: none; }
.chip-toggle .badge { background: var(--line); color: var(--ink-2); }
.chip-toggle.active .badge { background: var(--accent); color: #fff; }
.reset { border: 0; background: none; color: var(--ink-3); font-size: 14px; padding: 6px; cursor: pointer; }
.reset:hover { color: var(--bad); }

.pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  width: 290px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 12px 32px rgba(20, 24, 31, .12), 0 2px 6px rgba(20, 24, 31, .06);
}
.pop.right { left: auto; right: 0; }
.pop-tall { max-height: min(70vh, 520px); overflow-y: auto; }
.pop-head, .checks-head { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 10px 8px 4px; }
.pop-empty { font-size: 13px; color: var(--ink-3); padding: 6px 8px; }
.pop-link { border: 0; background: none; color: var(--accent-ink); font-size: 13px; padding: 8px; cursor: pointer; }
.check, .field { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; color: var(--ink); font-weight: 400; }
.check { cursor: pointer; }
.check:hover { background: var(--wash); }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.check span:first-of-type { flex: 1; min-width: 0; }
.check .n { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }
.check.dim { opacity: .5; }
.field { justify-content: space-between; color: var(--ink-2); }
select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); font-size: 14px; }
.field select { max-width: 150px; }

/* Two panes */
.panes {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.list-pane { overflow-y: auto; border-right: 1px solid var(--line); }
.detail-pane { overflow-y: auto; background: var(--wash); }

.list-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 10px 24px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
}
.count strong { color: var(--ink); }
.list-bar-right { display: flex; align-items: center; gap: 12px; }
.list-bar select { border: 0; background: none; color: var(--ink-2); font-size: 13.5px; padding: 2px; cursor: pointer; }
.quiet-link { color: var(--ink-3); font-size: 13px; text-decoration: none; }
.quiet-link:hover { color: var(--accent-ink); }

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex;
  gap: 12px;
  padding: 14px 16px 14px 21px;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.row:hover { background: var(--wash); }
.row.sel { background: var(--accent-wash); border-left-color: var(--accent); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-sub { font-size: 13.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.row-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.row-tags:empty { display: none; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 12.5px; color: var(--ink-3); flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.heart { display: none; color: var(--accent); font-size: 14px; line-height: 1; }
.row.saved .heart { display: block; }

.avatar {
  flex: none;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: hsl(var(--h) 55% 92%);
  color: hsl(var(--h) 45% 32%);
  font-weight: 700;
  font-size: 16px;
}
.avatar.big { width: 56px; height: 56px; border-radius: 13px; font-size: 24px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: #eef0f3;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}
.tag.good { background: var(--accent-wash); color: var(--accent-ink); }
.tag.bad { background: var(--bad-wash); color: var(--bad); }
.tag.part_time { background: #efe9fb; color: #5b3aa8; }
.tag.temporary, .tag.hybrid { background: #fdf1dc; color: #8a5a0a; }
.tag.remote { background: #e6f0fb; color: #1d5a9c; }
.tag.outline { background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.tag.new { background: var(--accent); color: #fff; }
.row.sel .tag.good { background: #d3ecdf; }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 16px; font-size: 13.5px; color: var(--ink-2); }
.pager:empty { display: none; }

.empty { padding: 56px 28px; text-align: center; color: var(--ink-2); }
.empty h3 { font-size: 16px; color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }

/* Reading pane */
.detail { max-width: 780px; margin: 24px auto; padding: 32px 36px 40px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; }
.detail-empty { height: 100%; display: grid; place-items: center; color: var(--ink-3); }
.back { display: none; border: 0; background: none; color: var(--accent-ink); font-weight: 500; padding: 0 0 16px; cursor: pointer; }
.d-head { display: flex; gap: 16px; align-items: flex-start; }
.d-head h2 { font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; }
.d-sub { color: var(--ink-2); margin-top: 4px; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.d-tags:empty { display: none; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.callout { margin-top: 20px; padding: 12px 14px; border-radius: 10px; background: var(--wash); font-size: 14px; color: var(--ink-2); }
.callout strong { color: var(--ink); }
.callout.bad { background: var(--bad-wash); color: #7a1c16; }
.callout.bad strong { color: var(--bad); }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 20px; margin: 24px 0 0; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts dt { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 2px 0 0; font-weight: 500; }

.detail section { margin-top: 24px; }
.detail h3 { font-size: 16px; margin-bottom: 8px; }
.detail section p { color: var(--ink-2); margin-top: 8px; }
.prose { line-height: 1.65; overflow-wrap: anywhere; }
.prose h4 { font-size: 14.5px; margin: 18px 0 0; }
.prose ul { margin: 8px 0 0; padding-left: 20px; color: var(--ink-2); }
.prose li { margin-top: 4px; }
.muted { color: var(--ink-3) !important; font-size: 13.5px; margin-top: 16px; }

/* Notes */
.notes { width: min(560px, calc(100vw - 32px)); padding: 26px 28px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 24px 60px rgba(20, 24, 31, .2); }
.notes::backdrop { background: rgba(20, 24, 31, .35); }
.notes h2 { font-size: 18px; }
.notes p { margin-top: 12px; font-size: 14px; color: var(--ink-2); }
.notes strong { color: var(--ink); }
.notes form { margin-top: 20px; text-align: right; }

/* Phone and narrow windows: one pane at a time */
@media (max-width: 899px) {
  html, body { height: auto; }
  body { display: block; }
  .top { height: auto; flex-wrap: wrap; gap: 6px 16px; padding: 12px 16px 0; }
  .tabs { order: 3; flex-basis: 100%; height: 42px; }
  .tab { padding: 0 10px; }
  .tagline { display: none; }
  .filters { padding: 10px 16px; }
  #q { width: 100%; }
  .pop { position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 70vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 14px 12px 24px; }
  .panes { display: block; height: auto; }
  .list-pane { border-right: 0; overflow: visible; }
  .list-bar { padding-left: 16px; }
  .row { padding-left: 13px; }
  .row.sel { background: none; border-left-color: transparent; }
  .detail-pane { display: none; position: fixed; inset: 0; z-index: 50; background: var(--bg); }
  .reading .detail-pane { display: block; }
  body.reading { overflow: hidden; }
  .detail { margin: 0; padding: 18px 16px 40px; border: 0; border-radius: 0; }
  .back { display: block; }
  .d-head h2 { font-size: 20px; }
  .facts { grid-template-columns: 1fr 1fr; }
}
