:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #0f172a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #e0f2fe 0, rgba(224, 242, 254, 0) 280px),
    #f8fafc;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: #0f172a;
  color: #ffffff;
  padding: 0 14px;
  font-weight: 750;
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

button:active {
  transform: translateY(1px);
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(18px);
}

.brand,
.top-actions,
.capture-head,
.request-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #0f172a;
  color: #ffffff;
  font-size: 20px;
  font-weight: 850;
}

.brand h1,
.panel-head h2,
.capture-head h2,
.auth-card h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 22px;
  line-height: 1.1;
}

.eyebrow,
.section-kicker {
  margin: 0 0 3px;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  font-size: 20px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 0 14px;
  font-weight: 750;
  text-decoration: none;
}

.ghost {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 12px;
}

.metric-value {
  display: block;
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
}

.metric-label {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 12px;
  font-weight: 750;
}

.inbox-grid {
  display: grid;
  grid-template-columns: minmax(310px, 390px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.inbox-panel,
.detail-panel,
.request-card,
.timeline,
.auth-card {
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.inbox-panel {
  position: sticky;
  top: 84px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 12px;
  height: calc(100vh - 102px);
  max-height: calc(100vh - 102px);
  overflow: hidden;
  padding: 14px;
}

.panel-head,
.capture-head {
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2,
.capture-head h2,
.auth-card h2 {
  font-size: 18px;
  line-height: 1.2;
}

.compact h2 {
  font-size: 16px;
}

.count-pill {
  min-width: 34px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  padding: 5px 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 850;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 11px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16);
}

textarea {
  min-height: 142px;
  resize: vertical;
}

.segmented,
.preset-grid {
  display: grid;
  gap: 6px;
}

.segmented {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-radius: 9px;
  background: #e2e8f0;
  padding: 4px;
}

.segment {
  min-height: 34px;
  border-radius: 7px;
  background: transparent;
  color: #475569;
  padding: 0 6px;
  font-size: 12px;
}

.segment.is-active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.issue-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
  -webkit-overflow-scrolling: touch;
}

.issue-item {
  display: grid;
  gap: 6px;
  width: 100%;
  height: auto;
  min-height: 110px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  padding: 11px;
  text-align: left;
}

.issue-item.is-selected {
  border-color: #0284c7;
  box-shadow: inset 3px 0 0 #0284c7;
}

.issue-topline,
.label-row,
.comment header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.issue-topline {
  justify-content: space-between;
}

.issue-number,
.issue-source,
.issue-updated,
.muted {
  color: #64748b;
  font-size: 12px;
}

.issue-number {
  font-weight: 850;
}

.issue-title {
  overflow-wrap: anywhere;
  font-weight: 800;
  line-height: 1.35;
}

.issue-source,
.issue-updated {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.state-chip,
.label-badge {
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 850;
}

.state-chip.fresh {
  background: #dcfce7;
  color: #166534;
}

.state-chip.research {
  background: #e0f2fe;
  color: #075985;
}

.state-chip.waiting {
  background: #fef3c7;
  color: #92400e;
}

.detail-panel {
  min-height: calc(100vh - 146px);
  padding: 14px;
}

.empty-state {
  display: grid;
  place-content: center;
  min-height: 380px;
  text-align: center;
}

.capture {
  display: grid;
  gap: 14px;
}

.capture-head {
  align-items: flex-start;
}

.capture-head h2 {
  max-width: 900px;
  overflow-wrap: anywhere;
  font-size: 23px;
}

.label-row {
  flex-wrap: wrap;
}

.label-badge {
  background: #f1f5f9;
  color: #334155;
}

.markdown-body pre {
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.55;
}

.capture-body {
  overflow: auto;
  overflow-wrap: anywhere;
  max-height: 340px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
  font-size: 14px;
  line-height: 1.65;
}

.request-card,
.timeline {
  display: grid;
  gap: 12px;
  padding: 14px;
  box-shadow: none;
}

.preset-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.preset-grid button {
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  color: #075985;
  font-size: 13px;
}

.request-actions {
  justify-content: space-between;
  gap: 10px;
}

.comments {
  display: grid;
  gap: 10px;
}

.comment {
  display: grid;
  gap: 8px;
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

.comment:first-child {
  border-top: 0;
  padding-top: 0;
}

.comment header {
  justify-content: space-between;
  color: #64748b;
  font-size: 12px;
}

.comment-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.comment-copy {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  min-height: 34px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: #475569;
  padding: 0;
}

.comment-copy:hover,
.comment-copy:focus {
  border-color: #7dd3fc;
  color: #075985;
}

.comment-copy svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.markdown-body {
  display: grid;
  gap: 10px;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.65;
}

.markdown-body h3,
.markdown-body h4,
.markdown-body h5 {
  margin: 6px 0 0;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.35;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote {
  margin: 0;
}

.markdown-body ul,
.markdown-body ol {
  display: grid;
  gap: 6px;
  padding-left: 20px;
}

.markdown-body li {
  padding-left: 2px;
}

.markdown-body a {
  color: #0369a1;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.markdown-image-link {
  display: block;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  text-decoration: none;
}

.markdown-image-link img {
  display: block;
  width: 100%;
  max-height: min(520px, 70vh);
  object-fit: contain;
}

.markdown-body code {
  border-radius: 5px;
  background: #e2e8f0;
  color: #0f172a;
  padding: 2px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.markdown-body pre {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  font-size: 12px;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

.markdown-body blockquote {
  border-left: 3px solid #38bdf8;
  background: #f0f9ff;
  color: #334155;
  padding: 10px 12px;
}

.markdown-body hr {
  width: 100%;
  height: 1px;
  border: 0;
  background: #e2e8f0;
}

.list-empty {
  margin: 0;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  padding: 18px;
  text-align: center;
}

.auth-dialog {
  width: min(480px, calc(100% - 28px));
  border: 0;
  border-radius: 12px;
  padding: 0;
  background: transparent;
}

.auth-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.auth-card header,
.auth-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
}

.repo-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 8px;
  background: #f1f5f9;
  padding: 12px;
  color: #475569;
}

.repo-lock strong {
  color: #0f172a;
  overflow-wrap: anywhere;
  text-align: right;
}

.status {
  position: sticky;
  bottom: 0;
  z-index: 9;
  border-top: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(255, 255, 255, 0.94);
  color: #334155;
  padding: 10px 16px;
  font-size: 13px;
  backdrop-filter: blur(14px);
}

.status[data-error="true"] {
  color: #b91c1c;
}

@media (max-width: 920px) {
  .inbox-grid {
    grid-template-columns: 1fr;
  }

  .inbox-panel {
    position: static;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    height: min(560px, calc(100svh - 120px));
    max-height: min(560px, calc(100svh - 120px));
  }

  .issue-list {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    padding: 12px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand h1 {
    font-size: 19px;
  }

  .shell {
    padding: 10px;
  }

  .metrics,
  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inbox-panel {
    height: min(520px, calc(100svh - 112px));
    max-height: min(520px, calc(100svh - 112px));
  }

  .capture-head,
  .request-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .capture-head .secondary-button,
  .request-actions button {
    width: 100%;
  }

  .repo-lock {
    align-items: flex-start;
    flex-direction: column;
  }

  .repo-lock strong {
    text-align: left;
  }
}
