/* 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);
}

/* ---------- 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;
}
.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;
}
.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-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.tx-row {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line-soft);
}
.tx-row:first-child {
  border-top: none;
}
.tx-src {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  width: 36px;
}
.tx-row p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.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;
  }
  .library-head {
    display: grid;
  }
  .context-live-pill {
    justify-self: start;
  }
  .cell-desc {
    max-width: 160px;
  }
}
