:root {
  --ink: #24453c;
  --muted: #567068;
  --green: #166b53;
  --line: #d3e9df;
  --paper: #f3fbf7;
  --white: #fff;
  --mint: #a4ebce;
  --mint-hover: #86dfbb;
  --mint-soft: #e1f8ec;
  --lavender: #eee7ff;
  --peach: #ffe9dd;
  --pink: #fce5ee;
  --lemon: #fff4ce;
  --gold: #a64d71;
  --action: #166b53;
  --action-hover: #11533f;
  --action-border: #8dab9e;
  --action-soft: #eaf4ef;
  --danger: #a33046;
  --danger-border: #d59ba6;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    15px/1.65 -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    sans-serif;
}
a {
  color: var(--green);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
.button {
  border: 1px solid var(--action);
  border-radius: 12px;
  background: var(--action);
  color: var(--white);
  cursor: pointer;
  padding: 11px 19px;
  font: inherit;
  display: inline-block;
  font-weight: 600;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}
button:hover:not(:disabled),
.button:hover {
  background: var(--action-hover);
  border-color: var(--action-hover);
  text-decoration: none;
}
a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
.secondary {
  background: var(--white);
  border-color: var(--action-border);
  color: var(--green);
}
.secondary:hover:not(:disabled) {
  background: var(--action-soft);
  border-color: var(--green);
}
.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding: 5px;
}
.quiet:hover:not(:disabled) {
  background: var(--mint-soft);
  border-color: var(--action-border);
}
button.danger { color: var(--danger); background: #fff8f9; border-color: var(--danger-border); }
button.danger:hover:not(:disabled) { background: #fce9ed; border-color: var(--danger); }
#inbox-editor[hidden], .inbox-delete-confirm[hidden] { display: none; }
#inbox-editor { scroll-margin-top: 20px; }
#inbox-edit-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.inbox-delete-confirm { border: 1px solid #eebcc6; border-radius: 12px; padding: 16px; margin: 16px 0; }
#inbox-edit-original { max-height: 300px; overflow: auto; }
.source-type-picker { min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.source-type-picker legend { margin-bottom: 8px; font-size: 13px; }
.source-type-options { display: flex; flex-wrap: wrap; gap: 8px; }
.source-type-option { position: relative; display: block; margin: 0; cursor: pointer; }
.source-type-option input { position: absolute; opacity: 0; width: 1px; height: 1px; padding: 0; margin: 0; }
.source-type-option span { display: block; min-height: 44px; padding: 9px 17px; border: 1px solid var(--action-border); border-radius: 12px; background: var(--white); color: var(--green); line-height: 24px; transition: background-color 140ms ease, border-color 140ms ease; }
.source-type-option:hover span { background: var(--action-soft); border-color: var(--green); }
.source-type-option input:checked + span { background: var(--green); border-color: var(--green); color: var(--white); font-weight: 600; }
.source-type-option input:focus-visible + span { outline: 3px solid var(--green); outline-offset: 3px; }
.capture-primary-fields { align-items: start; margin-top: 18px; }
.capture-project-field { min-width: 0; margin-bottom: 14px; }
.capture-project-heading { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 6px; }
.capture-project-heading label { margin: 0; }
.capture-project-heading a { font-size: 12px; }
.capture-project-controls { display: flex; align-items: stretch; gap: 8px; font-size: 13px; }
.capture-project-controls > select, .capture-project-controls > .pos-select { flex: 1; min-width: 0; margin-top: 0; }
.capture-project-controls button { align-self: stretch; height: auto; min-height: 44px; }
#capture-projects-status { margin: 6px 0 0; font-size: 12px; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 235px;
  border-right: 1px solid var(--line);
  background: #dff6eb;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.logo {
  font-size: 31px;
  letter-spacing: -2px;
  font-weight: 750;
  color: var(--ink);
}
.logo span {
  color: var(--gold);
}
.side-caption,
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
  color: var(--muted);
}
.side-caption {
  margin-top: 0;
}
.sidebar nav {
  margin-top: 22px;
  display: grid;
  gap: 0;
}
.sidebar nav a {
  display: block;
  padding: 10px 13px;
  border-radius: 12px;
  color: var(--ink);
}
.sidebar nav a span {
  margin-right: 15px;
  font-size: 11px;
  color: var(--muted);
}
.sidebar nav a:hover {
  background: #ccefdc;
  text-decoration: none;
}
.sidebar nav a.active {
  background: var(--mint);
  font-weight: 600;
  color: var(--green);
}
.nav-group { border-top: 1px solid #bfdccc; margin-top: 14px; padding-top: 14px; }
.nav-group h2 { margin: 0 13px 8px; font-size: 10px; letter-spacing: 1.5px; color: var(--muted); font-weight: 600; }
.nav-items { display: grid; gap: 3px; }
.side-bottom { padding-top: 24px; }
.use-entry-grid, .use-intents { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.use-entry-grid a, .use-intents a { display: grid; gap: 7px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fbfefd; color: var(--ink); }
.use-entry-grid a:hover, .use-intents a:hover { background: #e9f9f1; text-decoration: none; }
.use-entry-grid small, .use-intents small { font-size: 12px; color: var(--muted); line-height: 1.6; }
.use-intents { margin-bottom: 24px; }
.use-intents a[aria-current="page"] { border-color: var(--green); background: #e3f7ed; box-shadow: inset 0 0 0 1px var(--green); }
.use-question { display: grid; grid-template-columns: minmax(0, 2fr) minmax(150px, 1fr) auto; gap: 12px; align-items: end; }
.use-question label { margin: 0; }
.use-question button { align-self: end; margin-bottom: 0; }
.use-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.use-context { min-width: 0; }
.use-selection { background: #edf9f3; border: 1px solid #bfdecd; border-radius: 14px; padding: 16px; margin-bottom: 20px; }
.use-selection ul { padding-left: 20px; font-size: 13px; }
.use-selection .actions { align-items: center; }
.use-result { display: grid; gap: 12px; border-bottom: 1px solid var(--line); padding: 22px 0; min-width: 0; }
.use-result:first-child { padding-top: 0; }
.use-result:last-child { border-bottom: 0; }
.use-result h3 { margin: 0; font-size: 18px; }
.use-result p, .use-result blockquote { margin: 0; }
.use-result .use-evidence { border-radius: 10px; background: #f5faf7; padding: 12px 15px; }
.use-result .use-source { font-size: 12px; line-height: 1.7; color: var(--muted); overflow-wrap: anywhere; }
.use-result .use-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.use-result .check { margin: 0; }
.use-scope-link { font-size: 13px; }
.use-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; margin-top: 24px; }
.use-context [aria-busy="true"] { opacity: .6; }
@media (max-width: 1000px) {
  .use-question { grid-template-columns: 1fr 1fr; }
  .use-question label:first-child { grid-column: 1 / -1; }
  .use-entry-grid, .use-intents { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .use-question { grid-template-columns: 1fr; }
  .use-question label:first-child { grid-column: auto; }
  .use-entry-grid a, .use-intents a { padding: 13px; }
  .use-start .section-title, .use-context .section-title { align-items: start; flex-direction: column; gap: 12px; }
  .use-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .use-result .use-actions { align-items: start; flex-direction: column; }
}
.side-bottom {
  margin-top: auto;
  font-size: 12px;
  color: var(--muted);
}
.workspace {
  max-width: 1600px;
  margin-left: 235px;
  padding: 45px 5vw 24px;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
h1 {
  font-size: 29px;
  letter-spacing: -0.7px;
  margin: 8px 0;
  font-weight: 650;
}
h2 {
  font-size: 18px;
  font-weight: 650;
  margin: 0 0 17px;
}
h3 {
  font-size: 15px;
}
p {
  margin: 10px 0;
}
.intro {
  color: var(--muted);
  margin-bottom: 29px;
}
.panel {
  padding: 25px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  margin-bottom: 22px;
  box-shadow: 0 5px 22px #245b4210;
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 22px;
}
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.section-title > span {
  color: var(--muted);
  font-size: 12px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
  margin: 30px 0;
}
.stat {
  background: #fff;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
}
.stat:nth-child(1) {
  background: var(--mint-soft);
}
.stat:nth-child(2) {
  background: var(--lavender);
}
.stat:nth-child(3) {
  background: var(--peach);
}
.stat:nth-child(4) {
  background: var(--lemon);
}
.stat strong {
  font-size: 32px;
  font-weight: 500;
  display: block;
}
.stat span {
  font-size: 13px;
  color: var(--muted);
}
.quadrants {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.quadrant {
  background: var(--mint-soft);
  border-radius: 14px;
  padding: 20px;
}
.quadrant:nth-child(2) {
  background: var(--lavender);
}
.quadrant:nth-child(3) {
  background: var(--peach);
}
.quadrant:nth-child(4) {
  background: var(--lemon);
}
.quadrant strong {
  float: right;
  font-size: 25px;
}
.quadrant small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.7px;
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.project-tile {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: #fbfefc;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition:
    background-color 140ms ease,
    border-color 140ms ease;
}
.project-tile:hover,
.project-tile[aria-current="page"] {
  background: var(--mint-soft);
  border-color: #7cc8aa;
  text-decoration: none;
}
.project-name {
  overflow-wrap: anywhere;
  font-weight: 600;
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: auto;
}
.project-meta .badge {
  margin: 0;
  padding: 4px 10px;
  font-size: 12px;
}
.project-meta .project-status {
  background: var(--mint-soft);
  border-color: #b4dcc8;
  color: #245f48;
}
.project-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
}
.project-meta .project-tag {
  background: var(--lavender);
  border-color: #dcd0f3;
  color: #634a88;
}
.project-meta .project-tag:nth-of-type(2n + 1) {
  background: var(--pink);
  border-color: #efcede;
  color: #82465f;
}
.project-heading { align-items: center; flex-wrap: wrap; gap: 12px; }
#project-edit-form { margin: 20px 0; padding-top: 16px; border-top: 1px solid var(--line); }
#project-edit-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.list-row {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}
.list-row:last-child {
  border-bottom: 0;
}
.list-row a {
  font-size: 16px;
  font-weight: 550;
}
.list-row p {
  font-size: 13px;
  color: var(--muted);
}
.badge {
  font-size: 11px;
  border: 1px solid #c3e1d2;
  border-radius: 9px;
  padding: 3px 7px;
  color: #32664e;
  background: var(--mint-soft);
  display: inline-block;
  margin: 4px 5px 4px 0;
}
.badge.warning {
  background: var(--peach);
  color: #874e30;
  border-color: #f0cfba;
}
.empty {
  padding: 30px 0;
  color: var(--muted);
  font-size: 14px;
}
.muted {
  color: var(--muted);
  font-size: 13px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
}
label {
  display: block;
  font-size: 13px;
  margin-bottom: 14px;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid #789c8d;
  border-radius: 10px;
  padding: 11px;
  background: #fcfffd;
  color: var(--ink);
  font: inherit;
  margin-top: 6px;
}
textarea {
  resize: vertical;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}
.row {
  display: flex;
  align-items: center;
  gap: 22px;
}
.row > label {
  min-width: 180px;
}
.check {
  display: flex;
  align-items: center;
  gap: 9px;
}
.check input {
  width: auto;
  margin: 0;
  accent-color: var(--green);
}
details {
  margin: 14px 0;
}
summary {
  cursor: pointer;
  color: var(--green);
  font-size: 13px;
  margin-bottom: 15px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 14px;
  line-height: 1.9;
  padding: 18px;
  border-radius: 12px;
  background: #effaf3;
  max-height: 600px;
  overflow: auto;
}
.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 24px;
}
.source-panel {
  align-self: start;
  position: sticky;
  top: 20px;
}
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 15px;
}
.actions button {
  font-size: 13px;
}
#review-summary .actions > :is(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: 13px;
  line-height: 1.5;
}
#review-summary .actions > a {
  padding: 10px 12px;
  border-radius: 12px;
}
#review-summary .actions > a:hover {
  background: var(--mint-soft);
  text-decoration: none;
}
@media (max-width: 600px) {
  #review-summary .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }
  #review-summary .actions > :is(button, a) {
    padding: 10px 8px;
  }
}
.search-bar {
  display: flex;
  gap: 13px;
}
.search-bar input {
  margin: 0;
  min-width: 0;
}
.search-bar button {
  flex-shrink: 0;
  white-space: nowrap;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.filter-grid input,
.filter-grid select {
  font-size: 13px;
}
.card-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.9;
}
#notice {
  padding: 0;
  margin: 0;
}
#notice:not(:empty) {
  margin: 10px 0 20px;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--mint-soft);
  color: var(--green);
}
#notice.error {
  background: var(--pink);
  color: #8b3654;
}
blockquote {
  margin: 15px 0;
  border-left: 3px solid #81c8a8;
  padding-left: 16px;
  color: var(--muted);
}
footer {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 30px;
}
footer span {
  float: right;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #d8f7e8, #f3ecff 62%, #ffe8ef);
  padding: 24px;
}
.login-panel {
  max-width: 500px;
  padding: 45px;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 18px 70px #386c5420;
}
.login-panel form {
  margin-top: 35px;
}
.login-panel h1 {
  font-size: 28px;
}
.login-panel button {
  width: 100%;
}
.login-panel small {
  color: var(--muted);
  font-size: 11px;
}
#login-error {
  color: #963b57;
}
.definition {
  display: grid;
  grid-template-columns: 150px 1fr;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.definition span {
  font-size: 13px;
  color: var(--muted);
}
@media (max-width: 1000px) {
  .sidebar {
    width: 190px;
    padding: 25px 15px;
  }
  .workspace {
    margin-left: 190px;
    padding: 30px;
  }
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
  .project-grid {
    grid-template-columns: 1fr 1fr;
  }
  .split,
  .review-layout {
    grid-template-columns: 1fr;
  }
  .source-panel {
    position: static;
  }
}
@media (max-width: 680px) {
  .sidebar {
    position: static;
    width: auto;
    padding: 18px;
  }
  .sidebar .side-caption,
  .side-bottom {
    display: none;
  }
  .sidebar .logo {
    font-size: 23px;
  }
  .sidebar nav {
    display: grid;
    overflow: visible;
    margin-top: 8px;
    gap: 7px;
  }
  .sidebar nav .nav-home { width: fit-content; }
  .sidebar .nav-group { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; border-top: 1px solid #bfdccc; margin: 0; padding-top: 7px; }
  .sidebar .nav-group h2 { margin: 0; font-size: 10px; letter-spacing: 0; }
  .sidebar .nav-items { display: flex; flex-wrap: wrap; gap: 2px; }
  .sidebar nav a {
    white-space: nowrap;
    font-size: 12px;
    padding: 7px;
  }
  .sidebar nav a span {
    display: none;
  }
  .workspace {
    margin: 0;
    padding: 25px 18px;
  }
  h1 {
    font-size: 23px;
  }
  header > .button {
    font-size: 12px;
    padding: 8px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stat {
    padding: 15px;
  }
  .form-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }
  .project-grid {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 18px;
  }
  .row {
    flex-wrap: wrap;
    gap: 5px;
  }
  .login-panel {
    padding: 30px;
  }
  .definition {
    grid-template-columns: 100px 1fr;
  }
  footer span {
    float: none;
    display: block;
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.system-status {
  --status-color: #a85a0c; --status-soft: #fff1dd;
  position: fixed; z-index: 40; right: max(20px, env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom)); margin: 0; font-size: 12px;
}
.system-status[data-state="ok"], .system-status-page[data-state="ok"], .status-row[data-state="ok"] { --status-color: #166b53; --status-soft: #e0f7ec; }
.system-status[data-state="attention"], .system-status-page[data-state="attention"], .status-row[data-state="attention"] { --status-color: #a85a0c; --status-soft: #fff1dd; }
.system-status[data-state="error"], .system-status-page[data-state="error"], .status-row[data-state="error"] { --status-color: #b53646; --status-soft: #ffebee; }
.system-status > summary {
  display: flex; align-items: center; gap: 7px; cursor: pointer; white-space: nowrap;
  padding: 8px 12px; border: 1px solid currentColor; border-radius: 999px;
  background: var(--status-soft); color: var(--status-color);
  list-style: none; margin: 0; box-shadow: 0 3px 15px #24453c18;
}
.system-status > summary::-webkit-details-marker { display: none; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.system-status-popover {
  position: absolute; bottom: calc(100% + 10px); right: 0; width: 350px;
  max-height: min(calc(100dvh - 90px - env(safe-area-inset-bottom)), 700px); overflow: auto; padding: 18px; border: 1px solid var(--line);
  border-radius: 18px; background: var(--white); box-shadow: 0 12px 40px #24453c20;
  color: var(--ink); overflow-wrap: anywhere;
}
.system-status-popover h2 { margin: 0; font-size: 16px; }
.system-status-popover .section-title { margin-bottom: 5px; }
.status-panel-actions { display: flex; gap: 8px; align-items: center; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; padding: 10px; flex-shrink: 0; }
.refresh-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; font-size: 13px; white-space: nowrap; }
.refresh-button svg { width: 18px; height: 18px; flex: none; }
button[aria-busy="true"] svg { animation: status-spin 1s linear infinite; }
@keyframes status-spin { to { transform: rotate(360deg); } }
.refresh-icon { display: block; flex-shrink: 0; }
#system-status-close { font-size: 20px; line-height: 1; min-width: 28px; }
.system-status-popover p { margin: 4px 0; }
.status-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-row-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.status-row-heading > span { flex-shrink: 0; padding-top: 3px; }
.status-badge { font-weight: 600; text-align: right; border-radius: 8px; padding: 3px 8px; color: var(--status-color); background: var(--status-soft); }
.status-badge::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: currentColor; vertical-align: middle; }
.status-legend { font-size: 11px; padding-top: 6px; }
.status-links { display: flex; justify-content: space-between; gap: 12px; padding-top: 12px; }
.status-queue-preview { padding-top: 6px; }
.status-queue-card { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-queue-card[hidden], .status-queue-preview[hidden] { display: none; }
.status-queue-label { color: var(--muted); font-size: 11px; line-height: 20px; }
.status-queue-content { min-width: 0; }
.status-queue-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-weight: 600; font-size: 13px; line-height: 20px; }
.status-queue-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.status-queue-model { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-queue-progress { flex-shrink: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#system-status-page-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
#system-status-page-items .status-row { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; overflow-wrap: anywhere; }
.system-status-page .section-title { align-items: center; flex-wrap: wrap; gap: 12px; }
.system-status-page .status-links { justify-content: flex-start; flex-wrap: wrap; gap: 20px; margin-top: 16px; }
@media (max-width: 800px) {
  #system-status-page-items { grid-template-columns: minmax(0, 1fr); }
}
.stats.task-counts { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.task-counts .stat { min-width: 0; background: var(--white); }
.task-heading { align-items: center; gap: 12px; }
.task-item { padding: 18px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.task-item > a { font-weight: 600; }
.task-item p { margin: 6px 0 0; }
.task-meta { font-size: 13px; color: var(--muted); }
.task-state { display: inline-block; padding: 2px 9px; border-radius: 6px; background: var(--action-soft); color: var(--ink); font-weight: 600; }
.task-item[data-state="leased"] .task-state { background: var(--mint-soft); color: var(--green); }
.task-item[data-state="queued"] .task-state { background: var(--lemon); color: #80510b; }
.task-item[data-state="failed"] .task-state { background: var(--pink); color: var(--danger); }
.task-item[data-state="succeeded"] .task-state { background: var(--mint-soft); color: var(--green); }
#task-list[data-stale="true"] { border-left: 3px solid #c68b36; padding-left: 14px; }
#task-updated { font-size: 12px; }
.task-pages { display: flex; gap: 10px; margin-top: 20px; }
@media (max-width: 1000px) {
  .stats.task-counts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .stats.task-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .task-counts .stat { padding: 14px; }
}
.project-field { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 14px; }
.project-field label { flex: 1; min-width: 0; margin: 0; }
.project-field button { flex-shrink: 0; margin-bottom: 0; }
body > .workspace { padding-bottom: 80px; }
.status-footnote { padding: 10px 0 5px; font-size: 11px; }
.help-link {
  font-size: 13px;
}
.welcome-panel {
  padding: 26px;
  border: 1px solid #bfe8d4;
  border-radius: 20px;
  background: linear-gradient(115deg, #d5f7e5, #ebfaf0 70%, #fff4ce);
  margin: 0 0 22px;
}
.welcome-panel h2 {
  font-size: 22px;
  line-height: 1.5;
  margin: 10px 0;
}
.welcome-panel > p {
  max-width: 850px;
}
.journey {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 24px 0;
}
.journey > a {
  background: #ffffffd9;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--ink);
}
.journey strong,
.journey small {
  display: block;
}
.journey small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.6;
}
.mode-note {
  padding: 13px 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--mint-soft);
  color: var(--green);
  font-size: 13px;
  margin-bottom: 22px;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.guide-grid h3 {
  margin: 0;
}
.guide-grid p {
  font-size: 14px;
}
.guide-steps {
  padding-left: 22px;
}
.guide-steps li {
  padding: 0 0 22px 10px;
}
.guide-steps li:last-child {
  padding-bottom: 0;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
}
th {
  background: var(--paper);
}
.stats {
  grid-template-columns: repeat(4, 1fr);
}
#capture-next-actions:not(:empty) {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
#card-form {
  margin-top: 20px;
}
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
@media (max-width: 1000px) {
  .journey {
    grid-template-columns: repeat(2, 1fr);
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 680px) {
  .header-actions {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 175px;
  }
  .system-status { right: max(12px, env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); }
  .system-status > summary { padding: 7px 10px; font-size: 11px; }
  .system-status-popover { width: min(350px, calc(100vw - 24px)); max-height: calc(100dvh - 90px - env(safe-area-inset-bottom)); }
  .help-link {
    font-size: 11px;
  }
  .header-actions > .button {
    font-size: 12px;
    padding: 9px;
  }
  .welcome-panel {
    padding: 18px;
  }
  .welcome-panel h2 {
    font-size: 19px;
  }
  .journey {
    gap: 10px;
  }
  .journey > a {
    padding: 12px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

#manual-fields {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

/* A stable reading surface: only the current card moves. */
.review-toolbar {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  background: #f5fff9f5;
  box-shadow: 0 6px 24px #245b4214;
  padding: 16px 22px;
}
.review-toolbar label {
  margin: 0;
}
.review-toolbar .eyebrow {
  margin: 0;
}
#review-progress {
  margin: 4px 0 0;
  font-weight: 600;
}
.review-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(265px, 1fr);
  gap: 24px;
  align-items: start;
}
.review-main,
.review-reference {
  min-width: 0;
}
.review-reference {
  position: sticky;
  top: 148px;
}
.review-reference .source-panel {
  position: static;
}
.review-source pre {
  max-height: 310px;
  font-size: 13px;
}
.review-source h2 {
  overflow-wrap: anywhere;
  font-size: 16px;
}
.review-source a {
  overflow-wrap: anywhere;
}
.review-directory {
  max-height: 360px;
  overflow-y: auto;
}
.review-directory summary,
.review-source summary,
.review-advanced > summary {
  font-weight: 600;
  font-size: 14px;
}
.directory-item {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  width: 100%;
  padding: 11px;
  margin: 5px 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  font-weight: 400;
}
.directory-item .badge {
  flex-shrink: 0;
  margin: 0;
}
.directory-title {
  overflow-wrap: anywhere;
}
.directory-item[aria-current="step"] {
  background: var(--mint-soft);
  border-color: #98cfb5;
}
.directory-item:hover {
  background: var(--mint-soft);
}
.review-card {
  padding: 30px;
  margin: 0;
}
.review-card h2 {
  font-size: 24px;
  line-height: 1.5;
  margin: 20px 0 14px;
  overflow-wrap: anywhere;
}
.review-card .card-body {
  font-size: 16px;
  padding: 12px 0;
  min-height: 110px;
}
.review-card .card-body:empty {
  min-height: 0;
}
.review-card h2:focus,
#review-summary h2:focus {
  outline: none;
}
.review-card:focus-within {
  border-color: #98cfb5;
}
.decision-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0;
}
.decision-actions button {
  flex: 1 1 auto;
}
.decision-actions [data-decision="rejected"] {
  background: #fff8f9;
  border-color: var(--danger-border);
  color: var(--danger);
}
.decision-actions [data-decision="rejected"]:hover:not(:disabled) {
  background: #fce9ed;
  border-color: var(--danger);
}
.decision-warning {
  color: #874e30;
  background: var(--peach);
  padding: 12px;
  border-radius: 10px;
}
.decision-approved {
  background: var(--mint-soft);
  color: #245f48;
}
.decision-deferred {
  background: var(--lemon);
  color: #775b21;
  border-color: #ead696;
}
.decision-rejected {
  background: var(--pink);
  color: #82465f;
  border-color: #efcede;
}
.review-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.review-navigation button {
  padding: 9px 13px;
}
#proposals {
  scroll-margin-top: 150px;
  margin-bottom: 22px;
}
#proposals[aria-busy="true"] {
  cursor: progress;
}
.review-advanced {
  margin-top: 22px;
}
#ai-panel .section-title {
  flex-wrap: wrap;
  gap: 8px;
}
#ai-provider {
  overflow-wrap: anywhere;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 9px;
  background: var(--paper);
  font-size: 12px;
}
.ai-state { display: flex; align-items: flex-start; gap: 13px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); margin: 18px 0 14px; }
.ai-state-icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--mint-soft); color: var(--green); font-weight: 700; }
.ai-state-icon::before { content: "✦"; }
.ai-state[data-state="running"] .ai-state-icon::before { content: ""; width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: status-spin 1s linear infinite; }
.ai-state[data-state="success"] .ai-state-icon::before { content: "✓"; }
.ai-state[data-state="error"], .ai-state[data-state="attention"] { background: #fff9ee; border-color: #ecd3a9; }
.ai-state[data-state="error"] .ai-state-icon::before, .ai-state[data-state="attention"] .ai-state-icon::before { content: "!"; color: #92520c; }
.ai-state-content { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#ai-status { margin: 0; font-weight: 600; }
#ai-status-hint { margin: 5px 0 0; font-size: 13px; }
#ai-progress { display: block; width: 100%; height: 7px; margin-top: 13px; appearance: none; border: 0; border-radius: 5px; overflow: hidden; background: var(--line); accent-color: var(--green); }
#ai-progress::-webkit-progress-bar { background: var(--line); border-radius: 5px; }
#ai-progress::-webkit-progress-value { background: var(--green); border-radius: 5px; }
#ai-progress::-moz-progress-bar { background: var(--green); border-radius: 5px; }
.ai-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.ai-primary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-focus-fields { margin: 16px 0; }
.ai-focus-fields label { margin-bottom: 0; }
.ai-focus-fields textarea { margin-top: 6px; }
.ai-focus-fields p { font-size: 12px; margin: 6px 0 0; }
.ai-focus-fields textarea[readonly] { background: var(--paper); }
.ai-refresh-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; font-size: 12px; }
#ai-options { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.ai-recovery { border: 1px solid #ecd3a9; border-radius: 12px; padding: 18px; margin-top: 18px; background: #fff9ee; overflow-wrap: anywhere; }
.ai-recovery h3 { margin-top: 0; }
.ai-recovery p { font-size: 13px; }
.mini-health { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin: 16px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font-size: 13px; }
.mini-health > div { flex: 1; min-width: 180px; }
.mini-health p { margin: 3px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.mini-health[data-state="offline"], .mini-health[data-state="unavailable"], .mini-health[data-state="mismatch"], .mini-health[data-state="unknown"] { border-color: #ecd3a9; background: #fff9ee; }
#ai-attempts { font-size: 12px; margin: 5px 0 0; }
#ai-failure-reason { font-size: 13px; margin: 7px 0; color: #92520c; }
@media (max-width: 680px) { .ai-toolbar, .ai-refresh-controls { align-items: flex-start; } .ai-toolbar { flex-direction: column; } .ai-state { padding: 14px; } #ai-updated { flex-basis: 100%; } }
#ai-panel.is-generated {
  padding: 17px 22px;
  background: var(--mint-soft);
}
#ai-panel.is-generated h2 {
  font-size: 15px;
  margin: 0;
}
#ai-panel.is-generated #ai-distill,
#ai-panel.is-generated > #ai-disclosure {
  display: none;
}
#ai-panel.is-generated #ai-status {
  font-size: 13px;
}
#notice button {
  margin-left: 12px;
  padding: 6px 12px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1150px) {
  .review-workbench {
    grid-template-columns: minmax(0, 1.5fr) minmax(240px, 1fr);
    gap: 16px;
  }
  .review-navigation .muted {
    width: 100%;
    order: 3;
    text-align: center;
  }
}
@media (max-width: 800px) {
  body[data-page="review"] .system-status { bottom: calc(88px + env(safe-area-inset-bottom)); }
  body[data-page="review"] .system-status-popover { max-height: calc(100dvh - 166px - env(safe-area-inset-bottom)); }
  .review-workbench {
    grid-template-columns: minmax(0, 1fr);
  }
  .review-reference {
    position: static;
  }
  .review-toolbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    top: 0;
    padding: 13px 16px;
  }
  .review-toolbar .eyebrow {
    display: none;
  }
  .review-card {
    padding: 20px;
  }
  .review-card h2 {
    font-size: 21px;
  }
  .review-directory {
    max-height: 320px;
  }
  body[data-page="review"] {
    padding-bottom: 88px;
  }
  .decision-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 6;
    margin: 0;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 20px #245b4210;
    background: #fffffffa;
  }
  .decision-actions button {
    font-size: 13px;
    padding: 11px 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}

.review-views {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 18px;
}
.review-views button {
  background: var(--white);
  color: var(--green);
  border-color: var(--action-border);
}
.review-views button:hover:not(:disabled) {
  background: var(--action-soft);
  border-color: var(--green);
}
.review-views button[aria-pressed="true"] {
  background: var(--action);
  border-color: var(--action);
  color: var(--white);
}
.review-views button[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--action-hover);
  border-color: var(--action-hover);
}
#analysis-history {
  padding: 17px 22px;
}
#analysis-history label {
  margin-bottom: 8px;
}
#analysis-description {
  overflow-wrap: anywhere;
}
#reanalyze-form {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
#reanalyze-status:empty {
  display: none;
}
.analysis-comparison {
  padding: 12px 15px;
  background: var(--lemon);
  border: 1px solid #ebdcaa;
  border-radius: 12px;
  margin: 15px 0;
}
.analysis-comparison .card-body {
  font-size: 14px;
  min-height: 0;
}
#queue-empty {
  padding: 35px;
}
.passkey-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.passkey-row > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
.passkey-row p {
  margin: 5px 0 0;
}
.passkey-row button {
  flex-shrink: 0;
}
.passkey-create-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
:root button:disabled {
  background: #eef2ef;
  border-color: #d3ddd7;
  color: #748078;
  opacity: 1;
  box-shadow: none;
  cursor: not-allowed;
}
:root button:disabled[aria-busy="true"] { cursor: wait; }
@media (max-width: 680px) {
  .review-views {
    gap: 6px;
  }
  .review-views button {
    padding: 9px 11px;
    font-size: 13px;
  }
  #analysis-history {
    padding: 16px;
  }
}

/* Collection provenance and owner verification remain separate from classification. */
.knowledge-badges { display: flex; flex-wrap: wrap; gap: .3rem; margin: .65rem 0; }
.knowledge-badges .badge { margin: 0; }
.knowledge-badges .quadrant-tag { font-weight: normal; }
.source-kind { margin: .45rem 0; }
.evidence-editor { margin-top: 1rem; }
.evidence-editor form { padding-top: .75rem; }
.evidence-editor fieldset { min-width: 0; }
.conversation-hint { border-left: 3px solid var(--accent, #b0653e); padding-left: .8rem; }
.project-source h4 { margin: .25rem 0; }
