:root {
  --ink: #14221c;
  --ink-soft: #2a3d34;
  --mist: #e7eee9;
  --paper: #f3f7f4;
  --paper-deep: #dce8e1;
  --teal: #0f6e66;
  --teal-hot: #0a8f7c;
  --amber: #b7791f;
  --coral: #c45c4a;
  --sage: #5b7c6e;
  --slate: #5a6760;
  --charcoal: #2b3030;
  --line: rgba(20, 34, 28, 0.12);
  --card: rgba(255, 255, 255, 0.72);
  --shadow: 0 18px 40px rgba(20, 34, 28, 0.08);
  --radius: 14px;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", serif;
  --sans: "Figtree", "Avenir Next", "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(15, 110, 102, 0.14), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(183, 121, 31, 0.12), transparent 50%),
    linear-gradient(165deg, var(--paper) 0%, var(--mist) 48%, var(--paper-deep) 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 3rem));
  margin: 0 auto;
  padding: 1.75rem 0 4rem;
}

a { color: var(--teal); }

/* ---------- hero ---------- */
.hero { display: grid; gap: 0.6rem; padding-bottom: 1rem; animation: fade-up 0.5s ease both; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand {
  font-family: var(--serif);
  font-weight: 560;
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}
.hero-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.hero-status { margin: 0; color: var(--ink-soft); font-size: 0.98rem; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-soft);
}
.chip.subtle { color: var(--slate); background: transparent; }
.btn-chip { cursor: pointer; font: inherit; font-size: 0.78rem; font-weight: 650; }
.btn-chip:hover { background: #fff; }

.mode-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.65);
}
.mode-toggle button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  padding: 0.38rem 0.9rem;
  cursor: pointer;
  color: var(--slate);
}
.mode-toggle button[aria-pressed="true"] { background: var(--ink); color: #f4faf7; }

.tabs {
  display: inline-flex;
  gap: 0.2rem;
  padding: 0.2rem;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}
.tabs button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.45rem 1.05rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--slate);
}
.tabs button em {
  font-style: normal;
  font-size: 0.72rem;
  margin-left: 0.25rem;
  opacity: 0.75;
}
.tabs button[aria-selected="true"] { background: var(--teal); color: #f4faf7; }

/* ---------- sections ---------- */
section { margin-top: 1.25rem; animation: fade-up 0.45s ease both; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.section-head h2 { font-family: var(--serif); font-size: 1.35rem; font-weight: 550; margin: 0; }
.section-head p { margin: 0; color: var(--slate); font-size: 0.88rem; }
.spaced { margin-top: 1.75rem; }

.empty { padding: 0.9rem; color: var(--slate); font-size: 0.88rem; }
.notes { margin: 0.25rem 0 0; font-size: 0.82rem; color: var(--slate); line-height: 1.4; }

/* ---------- rows (review + pipeline) ---------- */
.rows { display: grid; gap: 0.5rem; }

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem 1.25rem;
  align-items: start;
  padding: 0.8rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--sage);
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.row:hover { background: #fff; box-shadow: 0 6px 18px rgba(20, 34, 28, 0.06); }
.row[data-excitement="hot"] { border-left-color: var(--teal-hot); }
.row[data-excitement="warm"] { border-left-color: var(--amber); }
.row[data-excitement="cool"] { border-left-color: #8b98a0; }
.row[data-age="stale"] { opacity: 0.85; }
.row.review[data-kind="ask"] { border-left-color: var(--amber); }
.row.review[data-kind="recommendation"] { border-left-color: var(--teal); }

.row-main { min-width: 0; }
.row-title {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.row-title .employer { display: block; font-weight: 750; font-size: 1rem; }
.row-title .role { display: block; font-size: 0.86rem; color: var(--ink-soft); margin-top: 0.1rem; }
.row-title:hover .employer { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.row-heading { margin: 0.3rem 0 0; font-weight: 650; font-size: 0.95rem; line-height: 1.4; }

.why { display: flex; align-items: center; gap: 0.5rem; margin: 0.45rem 0 0; font-size: 0.82rem; color: var(--slate); }

.row-side { display: grid; gap: 0.45rem; justify-items: end; }
.row-links { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

.meta { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.pill {
  font-size: 0.7rem;
  font-weight: 650;
  padding: 0.16rem 0.48rem;
  border-radius: 999px;
  background: rgba(20, 34, 28, 0.06);
  color: var(--slate);
}
.pill.exc-hot { background: rgba(10, 143, 124, 0.16); color: var(--teal); }
.pill.exc-warm { background: rgba(183, 121, 31, 0.16); color: #8a5a12; }
.pill.exc-cool { background: rgba(107, 122, 132, 0.16); color: #4a5660; }
.pill.quiet { background: rgba(196, 92, 74, 0.14); color: #9a3f32; }
.pill.age-new { background: rgba(47, 125, 77, 0.14); color: #1f5c38; }

.kind-tag {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.16rem 0.5rem;
  border-radius: 6px;
  background: rgba(196, 92, 74, 0.12);
  color: #9a3f32;
  white-space: nowrap;
}
.kind-tag[data-kind="hot_silent"] { background: rgba(10, 143, 124, 0.14); color: var(--teal); }
.kind-tag[data-kind="confirm"],
.kind-tag[data-kind="ask"] { background: rgba(183, 121, 31, 0.16); color: #7a4e0e; }
.kind-tag[data-kind="recommendation"] { background: rgba(15, 110, 102, 0.14); color: var(--teal); }
.kind-tag[data-kind="withdraw"] { background: rgba(90, 103, 96, 0.14); color: var(--slate); }

/* ---------- buttons / links ---------- */
.btn-ghost, .btn-solid {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.42rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
}
.btn-ghost { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.8); color: var(--ink-soft); }
.btn-ghost:hover { background: #fff; border-color: rgba(15, 110, 102, 0.35); }
.btn-solid { border: 1px solid var(--ink); background: var(--ink); color: #f4faf7; }
.btn-solid:hover { background: var(--ink-soft); }
.small { font-size: 0.74rem; padding: 0.3rem 0.7rem; }

.link-btn {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.76rem;
  padding: 0.3rem 0.75rem;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
}
.link-btn.saved, .link-btn.found { background: var(--teal); color: #f4faf7; }
.link-btn.saved:hover, .link-btn.found:hover { background: var(--teal-hot); }
.link-btn.search { background: rgba(255, 255, 255, 0.8); color: var(--teal); border-color: rgba(15, 110, 102, 0.35); }
.link-btn.search:hover { background: #fff; }
.link-btn.big { font-size: 0.9rem; padding: 0.55rem 1.1rem; }

.btn { display: inline-flex; padding: 0.7rem 1.2rem; border-radius: 999px; text-decoration: none; font-weight: 700; border: 1px solid var(--line); color: var(--ink); background: rgba(255, 255, 255, 0.7); }
.btn.primary { background: var(--ink); color: #f4faf7; border-color: var(--ink); }
.login-shell { max-width: 40rem; }
.login-actions { margin: 0.5rem 0 0; }

/* ---------- status chips ---------- */
.status-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.status-chips.compact { justify-content: flex-end; max-width: 30rem; }
.status-chips.busy { opacity: 0.6; }
.status-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
}
.status-chips.compact .status-chip { font-size: 0.68rem; padding: 0.2rem 0.5rem; }
.status-chip:hover:not(:disabled) { border-color: rgba(15, 110, 102, 0.45); color: var(--teal); }
.status-chip.current {
  background: var(--teal);
  border-color: var(--teal);
  color: #f4faf7;
  cursor: default;
  opacity: 1;
}
.status-chip:disabled:not(.current) { cursor: progress; }
.status-chip.answer { background: var(--teal); border-color: var(--teal); color: #f4faf7; }

/* ---------- asks ---------- */
.asks-list { display: grid; gap: 0.6rem; }
.ask-card {
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.ask-card.answered { border-left-color: var(--slate); opacity: 0.85; }
.ask-q { margin: 0.4rem 0 0.35rem; font-weight: 700; font-size: 0.98rem; }
.ask-options { margin: 0 0 0.4rem; padding-left: 1.1rem; font-size: 0.84rem; color: var(--ink-soft); }
.ask-options li + li { margin-top: 0.2rem; }
.ask-card .status-chips { margin-top: 0.6rem; }
.chk { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.55rem; font-size: 0.78rem; color: var(--slate); }
.subhead { margin: 1.1rem 0 0.45rem; font-family: var(--serif); font-size: 1.05rem; font-weight: 550; }

/* ---------- pipeline toolbar + filters ---------- */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  margin-bottom: 0.4rem;
  background: linear-gradient(180deg, var(--paper) 70%, rgba(243, 247, 244, 0));
}
#filter-q {
  flex: 1 1 18rem;
  max-width: 24rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.48rem 0.9rem;
  font: inherit;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.9);
}
.filter-wrap { position: relative; }
.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 0.68rem;
}
.filter-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 30;
  width: min(44rem, calc(100vw - 2rem));
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(20, 34, 28, 0.18);
  animation: fade-up 0.18s ease both;
}
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.9rem; }
.filter-grid fieldset { border: 0; margin: 0; padding: 0; }
.filter-grid legend {
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate);
  margin-bottom: 0.35rem;
}
.opt { display: flex; align-items: center; gap: 0.45rem; padding: 0.2rem 0; font-size: 0.85rem; cursor: pointer; text-transform: capitalize; }
.opt em { font-style: normal; color: var(--slate); font-size: 0.75rem; margin-left: auto; }
.filter-foot { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.active-filters { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.token {
  border: 1px solid rgba(15, 110, 102, 0.3);
  background: rgba(15, 110, 102, 0.1);
  color: var(--teal);
  border-radius: 999px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  cursor: pointer;
  text-transform: capitalize;
}
.toggle-inline { margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; color: var(--slate); }

/* ---------- groups ---------- */
.groups { display: grid; gap: 1.1rem; }
.group-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 0.45rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}
.group-head h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.group-head .count { font-size: 0.78rem; color: var(--slate); font-variant-numeric: tabular-nums; }

/* ---------- modal ---------- */
.modal {
  width: min(760px, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(20, 34, 28, 0.28);
}
.modal::backdrop { background: rgba(20, 34, 28, 0.38); backdrop-filter: blur(2px); }
.modal-inner { padding: 1.4rem 1.5rem 1.6rem; overflow-y: auto; max-height: calc(100vh - 3rem); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.eyebrow { margin: 0; font-size: 0.7rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--teal); }
.modal-head h2 { margin: 0.2rem 0 0; font-family: var(--serif); font-size: 1.7rem; font-weight: 560; }
.modal-role { margin: 0.2rem 0 0; color: var(--ink-soft); }
.modal-links { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1rem; }
.link-form { margin-top: 0.8rem; }
.link-form label { display: block; font-size: 0.72rem; font-weight: 700; color: var(--slate); margin-bottom: 0.3rem; }
.link-input-row { display: flex; gap: 0.45rem; }
.link-input-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.86rem;
  background: #fff;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 0;
}
.facts div { padding: 0.55rem 0.7rem; background: rgba(255, 255, 255, 0.7); border: 1px solid var(--line); border-radius: 10px; }
.facts dt { font-size: 0.68rem; font-weight: 750; letter-spacing: 0.05em; text-transform: uppercase; color: var(--slate); }
.facts dd { margin: 0.25rem 0 0; font-weight: 650; font-size: 0.9rem; }
.facts select, .facts input[type="date"] {
  font: inherit;
  font-size: 0.86rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.22rem 0.4rem;
  background: #fff;
}
.facts .touch { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.modal-notes { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--ink-soft); }
.mentions { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.mentions li { padding: 0.6rem 0.75rem; background: rgba(255, 255, 255, 0.7); border: 1px solid var(--line); border-radius: 10px; }
.mentions li.muted { opacity: 0.7; }
.mentions p { margin: 0; font-size: 0.85rem; line-height: 1.45; }
.mentions .src { margin-top: 0.3rem; font-size: 0.74rem; color: var(--slate); }

/* ---------- context ---------- */
.two-col { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; }
.panel { background: rgba(255, 255, 255, 0.5); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 0.6rem; font-family: var(--serif); font-size: 1.12rem; font-weight: 550; }
.panel ul { margin: 0; padding-left: 1.1rem; color: var(--ink-soft); }
.panel li + li { margin-top: 0.35rem; }
.source-line { margin: 0 0 0.5rem; font-size: 0.82rem; color: var(--slate); }
.passed-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.passed-table th, .passed-table td { text-align: left; padding: 0.4rem 0.35rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.passed-table th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--slate); }
details.lanes { background: rgba(255, 255, 255, 0.4); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.35rem 0.9rem 0.9rem; }
details.lanes summary { cursor: pointer; font-weight: 700; padding: 0.6rem 0; }
.lane-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.5rem; }
.lane { padding: 0.5rem 0.6rem; border-radius: 10px; background: rgba(255, 255, 255, 0.65); border: 1px solid var(--line); }
.lane .name { font-weight: 700; font-size: 0.85rem; }
.lane .when { font-size: 0.72rem; color: var(--slate); margin-top: 0.2rem; }

/* ---------- toast / misc ---------- */
.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 50;
  max-width: 26rem;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  background: var(--ink);
  color: #f4faf7;
  font-weight: 650;
  font-size: 0.86rem;
  box-shadow: 0 16px 40px rgba(20, 34, 28, 0.25);
  animation: fade-up 0.2s ease both;
}
.toast.err { background: #8e3a2e; }
.warnings { margin-top: 1.25rem; padding: 0.75rem 0.95rem; border-radius: var(--radius); background: rgba(183, 121, 31, 0.1); border: 1px solid rgba(183, 121, 31, 0.25); font-size: 0.82rem; }
.footer-note { margin-top: 2rem; color: var(--slate); font-size: 0.76rem; }

.family-only { display: none; }
body.family-mode .you-only { display: none !important; }
body.family-mode .family-only { display: block; }
body.family-mode .cause-codes, body.family-mode .atsy { display: none; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) {
  .shell { width: calc(100% - 1.5rem); padding-top: 1.2rem; }
  .row { grid-template-columns: 1fr; }
  .row-side { justify-items: start; }
  .row-links, .status-chips.compact { justify-content: flex-start; }
  .two-col { grid-template-columns: 1fr; }
  .toggle-inline { margin-left: 0; }
}
