/* Halper web dashboard — light theme, ParakeetAI-inspired. */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #14161a;
  --ink-soft: #5b616e;
  --ink-faint: #8a909c;
  --line: #e7e9ee;
  --line-soft: #eef0f4;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --green: #157347;
  --green-soft: #e4f5ec;
  --amber: #8a6d00;
  --amber-soft: #fbf1cf;
  --slate: #4a5160;
  --slate-soft: #eceef2;
  --radius: 14px;
  --sidebar-w: 248px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- sidebar ---------- */
.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  padding: 6px 8px 16px;
}
.brand-mark svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.nav-item svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item:hover {
  background: var(--line-soft);
  color: var(--ink);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-divider {
  height: 1px;
  background: var(--line);
  margin: 12px 8px;
}
.nav-primary,
.nav-secondary {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.account {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.account b {
  font-size: 13px;
  display: block;
}
.account small {
  color: var(--ink-faint);
  font-size: 11px;
}
.signout-btn {
  width: calc(100% - 16px);
  margin: 10px 8px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  padding: 8px 10px;
}
.signout-btn:hover {
  background: var(--line-soft);
  color: var(--ink);
}

/* ---------- content ---------- */
.content {
  padding: 32px 40px 80px;
  max-width: 1180px;
  width: 100%;
}
.auth-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 12%, rgba(79, 70, 229, 0.12), transparent 28rem),
    linear-gradient(145deg, #f6f7f9, #eef1f6);
}
.auth-card {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(20, 22, 26, 0.12);
  padding: 34px;
}
.auth-brand {
  padding: 0;
  margin-bottom: 26px;
}
.auth-card .eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.auth-card h1 {
  margin: 0 0 12px;
  font-size: 34px;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.google-button-slot {
  min-height: 44px;
  margin: 22px 0 12px;
}
.auth-note {
  margin: 0;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.5;
}
.page-head {
  margin-bottom: 22px;
}
.page-head h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.02em;
}
.muted {
  color: var(--ink-soft);
}
.page-head .muted {
  margin: 6px 0 0;
  font-size: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
}
.section-link svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.section-link.muted {
  color: var(--ink-faint);
}

/* ---------- home grid ---------- */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.span-2 {
  grid-column: 1 / -1;
}

.recent-list {
  display: flex;
  flex-direction: column;
}
.recent-row {
  display: grid;
  grid-template-columns: 34px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 12px 6px;
  border-top: 1px solid var(--line-soft);
  text-decoration: none;
  color: inherit;
}
.recent-row:first-child {
  border-top: none;
}
.recent-row:hover {
  background: var(--line-soft);
  border-radius: 10px;
}
.recent-kind svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--slate);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.recent-body {
  min-width: 0;
}
.recent-body b {
  display: block;
  font-size: 14px;
}
.recent-body small {
  display: block;
  color: var(--ink-faint);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-date {
  color: var(--ink-faint);
  font-size: 12px;
  white-space: nowrap;
}

.view-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.view-all:hover {
  background: var(--line-soft);
  color: var(--ink);
}
.view-all svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- status chips ---------- */
.status-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.status-chip.done {
  background: var(--green-soft);
  color: var(--green);
}
.status-chip.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.status-chip.created {
  background: var(--slate-soft);
  color: var(--slate);
}
.status-chip.expired {
  background: var(--amber-soft);
  color: var(--amber);
}
.status-chip.failed {
  background: #fdecec;
  color: #a12622;
}

/* ---------- stubs / placeholders ---------- */
.stub-body,
.placeholder {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.coming-soon {
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-soft);
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 13px;
  margin: 0;
}
.placeholder b {
  font-size: 13px;
}
.placeholder p {
  margin: 0;
  font-size: 13px;
}
.card.big {
  padding: 28px;
}

/* ---------- context library ---------- */
.library-teaser-body {
  display: grid;
  gap: 10px;
}
.library-count {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 23px;
  font-weight: 800;
}
.library-teaser-body p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.library-head .muted {
  max-width: 760px;
  line-height: 1.55;
}
.context-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #dde1ff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  padding: 8px 11px;
}
.context-live-pill svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.library-grid-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 18px;
  align-items: start;
}
.library-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.library-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-soft);
  background: #fcfcfd;
  border-radius: 12px;
  padding: 12px;
}
.library-row-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.library-row-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.library-row-main {
  min-width: 0;
}
.library-row-main b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.library-row-main small {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 12px;
}
.library-upload-card form {
  display: grid;
  gap: 13px;
}
.owner-enterprise-grid {
  align-items: start;
}
.owner-enterprise-form {
  display: grid;
  gap: 14px;
}
.owner-enterprise-form .field small {
  color: var(--ink-faint);
  font-size: 11px;
}
.owner-enterprise-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
}
.owner-enterprise-flow ol {
  display: grid;
  gap: 14px;
  margin: 0 0 20px;
  padding-left: 22px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.owner-enterprise-flow a {
  color: var(--accent);
}
.owner-enterprise-result {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--green-soft);
  border-radius: 12px;
  background: #f2fbf5;
}
.owner-enterprise-result[hidden] {
  display: none;
}
.owner-enterprise-result.error {
  color: #b42318;
  border-color: #f2c7c2;
  background: #fdecec;
}
.owner-enterprise-result span,
.owner-enterprise-result label {
  color: var(--ink-soft);
  font-size: 12px;
}
.owner-enterprise-result label {
  display: grid;
  gap: 5px;
}
.owner-enterprise-result input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}
.owner-enterprise-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.owner-console-operations {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}
.owner-console-unavailable {
  display: grid;
  gap: 12px;
}
.owner-console-unavailable .error-block {
  text-align: left;
}
.owner-access-card,
.owner-delivery-card {
  display: grid;
  gap: 16px;
}
.owner-access-card .card-head,
.owner-delivery-card .card-head {
  align-items: flex-start;
  margin-bottom: 0;
}
.owner-access-card .card-head p,
.owner-delivery-card .card-head p {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.5;
}
.owner-grant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line-soft);
}
.owner-grant-form .field small {
  max-width: 760px;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.45;
}
.owner-grant-result {
  grid-column: 1 / -1;
  min-height: 16px;
  color: #b42318;
  font-size: 12px;
}
.owner-record-list,
.owner-delivery-list {
  display: grid;
  gap: 12px;
}
.owner-record,
.owner-delivery {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fff;
}
.owner-record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.owner-record-head > div {
  min-width: 0;
}
.owner-record-head b,
.owner-record-head code,
.owner-record-label {
  display: block;
}
.owner-record-head b {
  margin-top: 4px;
  font-size: 13px;
}
.owner-record-head code,
.owner-record-facts code {
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 11px;
  user-select: all;
}
.owner-record-label {
  margin-bottom: 4px;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.owner-state,
.delivery-state {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: capitalize;
}
.owner-state.active,
.delivery-state.sent {
  background: var(--green-soft);
  color: var(--green);
}
.owner-state.locked,
.delivery-state.queued,
.delivery-state.retry_scheduled {
  background: #fef3c7;
  color: #92400e;
}
.owner-state.revoked,
.delivery-state.failed,
.delivery-state.bounced,
.delivery-state.suppressed {
  background: #fdecec;
  color: #b42318;
}
.owner-record-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.owner-record-facts div {
  min-width: 0;
}
.owner-record-facts dt {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}
.owner-record-facts dd {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}
.owner-delivery-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.owner-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.owner-record-terminal {
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
}
.field {
  display: grid;
  gap: 7px;
}
.field span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  padding: 10px 12px;
  outline: none;
}
.field textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.5;
}
.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.dropzone {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed #c9cdf7;
  background: #fafaff;
  color: var(--ink);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
}
.dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.dropzone > svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dropzone b,
.dropzone small {
  display: block;
}
.dropzone small {
  color: var(--ink-faint);
  font-size: 12px;
  margin-top: 2px;
}
.dropzone input {
  display: none;
}
.library-note {
  margin: 0;
  color: var(--ink-faint);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover:not(:disabled) {
  background: var(--line-soft);
}
.btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn.ghost {
  color: var(--ink-faint);
  align-self: flex-start;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover:not(:disabled) {
  background: #4338ca;
}
.btn.danger {
  color: #b42318;
  border-color: #f6d6d3;
}
.btn.danger:hover:not(:disabled) {
  background: #fdecec;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------- sessions table ---------- */
.table-card {
  padding: 0;
  overflow: hidden;
}
.table-card .pager {
  padding: 14px 20px;
}
.sessions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.sessions-table caption {
  text-align: left;
  padding: 16px 20px 4px;
  color: var(--ink-faint);
  font-size: 12px;
}
.sessions-table thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfbfc;
}
.sessions-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.sessions-table tbody tr:last-child td {
  border-bottom: none;
}
.row-link {
  cursor: pointer;
}
.row-link:hover td {
  background: var(--line-soft);
}
.cell-title b {
  font-weight: 600;
}
.cell-desc {
  color: var(--ink-soft);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cell-created {
  color: var(--ink-soft);
  white-space: nowrap;
}
.mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--slate);
}
.mode-tag svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.usage-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.usage-num.loading {
  color: var(--ink-faint);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
}
.pager-label {
  font-size: 12.5px;
  color: var(--ink-soft);
}
.pager-btns {
  display: flex;
  gap: 8px;
}

/* ---------- session detail ---------- */
.crumb {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
.crumb:hover {
  color: var(--ink);
}
.crumb svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.detail-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.review-title {
  margin-bottom: 16px;
}
.review-workspace {
  min-height: 620px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(20, 22, 26, 0.06);
}
.review-nav {
  padding: 18px 12px;
  background: #fafbfc;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.review-nav button {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 10px;
  padding: 0 11px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
}
.review-nav button:hover {
  color: var(--ink);
  background: var(--line-soft);
}
.review-nav button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line), 0 5px 16px rgba(20, 22, 26, 0.05);
}
.review-nav svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.review-nav small {
  min-width: 22px;
  border-radius: 999px;
  padding: 2px 6px;
  color: var(--ink-faint);
  background: var(--line-soft);
  text-align: center;
  font-size: 10px;
}
.review-panel {
  min-width: 0;
  min-height: 620px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
}
.review-panel-head {
  min-height: 52px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.review-panel-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.review-panel-head p {
  margin: 4px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
}
.review-panel .answers-list,
.review-panel .transcript-list {
  max-height: none;
  flex: 1;
}
.review-empty {
  flex: 1;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  color: var(--ink-soft);
}
.review-empty.compact {
  min-height: 340px;
}
.review-empty > svg {
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}
.review-empty h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 17px;
}
.review-empty p {
  max-width: 520px;
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
}
.review-empty .btn svg {
  width: 16px;
  height: 16px;
  margin: 0;
}
.review-loader {
  width: 24px;
  height: 24px;
  margin-bottom: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: review-spin 0.8s linear infinite;
}
@keyframes review-spin {
  to { transform: rotate(360deg); }
}
.derived-analysis {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fcfcfd;
  overflow: hidden;
}
.derived-meta {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}
.derived-meta small {
  color: var(--ink-faint);
}
.derived-analysis pre,
.post-call-response pre {
  margin: 0;
  padding: 18px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.65;
}
.review-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.review-suggestions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--ink-soft);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}
.review-suggestions button:hover {
  color: var(--accent);
  border-color: rgba(79, 70, 229, 0.35);
}
.typed-task-picker {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fcfcfd;
}
.typed-task-picker h3,
.typed-task-picker p {
  margin: 0;
}
.typed-task-picker h3 {
  font-size: 13px;
}
.typed-task-picker p {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 11px;
}
.typed-task-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: stretch;
}
.typed-task-actions button {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 9px 11px;
  border-radius: 10px;
  text-align: left;
}
.typed-task-actions button b {
  color: var(--ink);
  font-size: 12px;
}
.typed-task-actions button small {
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
}
.typed-task-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}
.ask-panel {
  position: relative;
}
.post-call-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 4px 2px 20px;
}
.post-call-question,
.post-call-response {
  width: min(82%, 720px);
  border-radius: 13px;
  padding: 12px 14px;
}
.post-call-question {
  align-self: flex-end;
  background: var(--accent-soft);
}
.post-call-response {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: #fcfcfd;
}
.typed-task-question {
  background: rgba(79, 70, 229, 0.1);
}
.typed-task-response {
  width: min(92%, 820px);
}
.post-call-question b,
.post-call-response b {
  display: block;
  margin-bottom: 5px;
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.post-call-question p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
}
.post-call-response pre {
  padding: 0;
}
.post-call-response small {
  display: block;
  margin-top: 9px;
  color: var(--ink-faint);
  font-size: 10px;
}
.post-call-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.post-call-form input {
  min-width: 0;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}
.post-call-form input:focus {
  outline: 2px solid rgba(79, 70, 229, 0.18);
  border-color: var(--accent);
}
.call-detail-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.call-detail-groups section {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: #fcfcfd;
}
.call-detail-groups section:last-child {
  grid-column: 1 / -1;
}
.call-detail-groups h3 {
  margin: 0 0 12px;
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.call-detail-groups dl {
  margin: 0;
}
.call-detail-groups dl > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}
.call-detail-groups dl > div:first-child {
  border-top: 0;
}
.call-detail-groups dt {
  color: var(--ink-faint);
  font-size: 12px;
}
.call-detail-groups dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.call-detail-row dd {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.call-detail-row dd small,
.call-detail-source {
  color: var(--ink-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.call-detail-row dd em {
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
}
.call-detail-row.unavailable dd > span,
.call-detail-row.stored_null dd > span {
  color: var(--ink-faint);
}
.detail-schema {
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  padding: 5px 8px;
}
.call-detail-head-actions {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.call-detail-lineage-section {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 20px;
}
.call-detail-lineage-section > h3 {
  margin: 0 0 4px;
}
.call-detail-lineage {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 12px;
  padding: 14px;
}
.call-detail-lineage > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.call-detail-lineage > div:first-child small {
  color: var(--ink-faint);
}
.call-detail-lineage dl {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  margin: 12px 0;
}
.call-detail-lineage dl > div {
  min-width: 0;
}
.call-detail-lineage dt {
  color: var(--ink-faint);
  font-size: 10px;
  text-transform: uppercase;
}
.call-detail-lineage dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.call-detail-artifacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
}
.call-detail-artifacts span {
  color: var(--ink-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  overflow-wrap: anywhere;
}
.screenshot-lineage-timeline {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.screenshot-lineage-entry {
  background: #fcfcfd;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}
.screenshot-lineage-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}
.download-state {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
}
.download-state.listed {
  background: #dcfce7;
  color: #166534;
}
.download-state.unavailable,
.download-state.not_checked {
  background: #fef3c7;
  color: #92400e;
}
.screenshot-lineage-entry dl {
  display: grid;
  gap: 7px;
  grid-template-columns: 1fr 1fr;
  margin: 12px 0;
}
.screenshot-lineage-entry dt {
  color: var(--ink-faint);
  font-size: 10px;
  text-transform: uppercase;
}
.screenshot-lineage-entry dd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.download-unavailable {
  color: #92400e;
  font-size: 11px;
  margin: 10px 0;
}
.call-detail-export-contract {
  background: rgba(79, 70, 229, 0.05);
  border: 1px solid rgba(79, 70, 229, 0.16);
  border-radius: 12px;
  margin-top: 20px;
  padding: 14px;
}
.call-detail-export-contract h3,
.call-detail-export-contract p {
  margin: 0;
}
.call-detail-export-contract p {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  margin-top: 5px;
}
.detail-meta {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 18px;
}
.detail-meta > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.meta-k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  font-weight: 700;
}
.meta-v {
  font-size: 14px;
  font-weight: 600;
}

.detail-cols {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
  align-items: start;
}
.count-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--line-soft);
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 4px;
}

.answers-list,
.transcript-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 62vh;
  overflow-y: auto;
}
.answer-detail {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px;
  background: #fcfcfd;
}
.answer-q,
.answer-a-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.answer-q svg,
.answer-a-head svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-top: 2px;
  flex: none;
}
.lbl {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}
.answer-q p {
  margin: 2px 0 0;
  font-size: 13.5px;
  font-weight: 500;
}
.answer-a {
  margin-top: 12px;
}
.answer-text {
  margin: 8px 0 0;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}
.answer-artifact-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid rgba(79, 70, 229, 0.18);
  border-radius: 10px;
  color: var(--accent);
  background: rgba(79, 70, 229, 0.06);
  font-size: 12px;
  font-weight: 700;
}
.answer-artifact-summary svg,
.artifact-chip svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.artifact-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.artifact-list.missing {
  display: block;
  padding: 9px 11px;
  border-radius: 10px;
  color: #92400e;
  background: #fef3c7;
  font-size: 12px;
}
.artifact-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
.artifact-chip:hover {
  border-color: rgba(79, 70, 229, 0.32);
  color: var(--accent);
}
.artifact-chip small {
  color: var(--ink-faint);
  font-weight: 600;
}
.artifact-chip:disabled {
  cursor: progress;
  opacity: 0.7;
}
.answer-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.tx-row {
  display: flex;
  padding: 6px 0;
}
.tx-row.self {
  justify-content: flex-end;
}
.tx-bubble {
  width: fit-content;
  max-width: min(78%, 680px);
  border-radius: 12px;
  padding: 10px 12px 8px;
  background: var(--line-soft);
}
.tx-row.self .tx-bubble {
  background: var(--accent-soft);
}
.tx-row p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.tx-bubble span {
  display: block;
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 10px;
}
.tx-row.self .tx-bubble span {
  text-align: right;
}
.read-only-note {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- states ---------- */
.loading,
.empty,
.error-block {
  padding: 26px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
}
.empty.small {
  padding: 16px;
  font-size: 13px;
}
.error-block {
  color: #b42318;
  background: #fdecec;
  border-radius: 10px;
}

/* ---------- runtime badge ---------- */
.runtime-badge {
  position: fixed;
  bottom: 14px;
  right: 16px;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink-faint);
}
.runtime-badge.ok {
  color: var(--green);
  border-color: var(--green-soft);
}
.runtime-badge.bad {
  color: #b42318;
  border-color: #f6d6d3;
}

@media (max-width: 940px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .sidebar-foot {
    margin: 0;
    border: none;
    padding: 0;
  }
  .nav-divider {
    display: none;
  }
  .content {
    padding: 24px 18px 80px;
  }
  .home-grid,
  .detail-cols,
  .detail-meta,
  .library-grid-page {
    grid-template-columns: 1fr;
  }
  .owner-grant-form,
  .owner-record-facts,
  .owner-delivery-facts {
    grid-template-columns: 1fr;
  }
  .owner-grant-form .btn {
    justify-self: start;
  }
  .owner-record-head {
    display: grid;
  }
  .owner-state,
  .delivery-state {
    justify-self: start;
  }
  .review-workspace {
    grid-template-columns: 1fr;
  }
  .review-nav {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    overflow-x: auto;
  }
  .review-nav button {
    width: auto;
    min-width: max-content;
  }
  .review-panel {
    min-height: 560px;
    padding: 20px 16px;
  }
  .typed-task-actions {
    grid-template-columns: 1fr;
  }
  .call-detail-groups {
    grid-template-columns: 1fr;
  }
  .call-detail-groups section:last-child {
    grid-column: auto;
  }
  .call-detail-lineage dl {
    grid-template-columns: 1fr;
  }
  .screenshot-lineage-entry dl {
    grid-template-columns: 1fr;
  }
  .call-detail-head-actions {
    align-items: flex-start;
  }
  .library-head {
    display: grid;
  }
  .context-live-pill {
    justify-self: start;
  }
  .cell-desc {
    max-width: 160px;
  }
}
.account-privacy-card {
  display: grid;
  gap: 14px;
}

.account-delete-boundary {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--danger, #b42318) 28%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--danger, #b42318) 4%, white);
}

.account-delete-boundary h3,
.account-delete-boundary p,
.account-delete-boundary ul {
  margin: 0;
}

.account-delete-boundary code {
  user-select: all;
  overflow-wrap: anywhere;
}
