:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #05070d;
  color: #e8f2ff;
  line-height: 1.45;
  --bg: #05070d;
  --bg-2: #08111e;
  --panel: rgba(9, 18, 32, 0.86);
  --panel-strong: rgba(13, 28, 48, 0.92);
  --panel-soft: rgba(15, 35, 58, 0.68);
  --line: rgba(112, 199, 255, 0.2);
  --line-strong: rgba(94, 234, 212, 0.42);
  --text: #e8f2ff;
  --muted: #91a4bc;
  --muted-2: #6f8198;
  --cyan: #44d7ff;
  --teal: #2ef0c2;
  --green: #55f38a;
  --amber: #ffcf5c;
  --red: #ff6578;
  --violet: #b39cff;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at 18% 8%, rgba(68, 215, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 88% 16%, rgba(46, 240, 194, 0.12), transparent 24rem),
    linear-gradient(135deg, rgba(68, 215, 255, 0.08) 0 1px, transparent 1px 100%),
    linear-gradient(45deg, rgba(46, 240, 194, 0.05) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, #05070d 0%, #07111d 54%, #05070d 100%);
  background-attachment: fixed;
  background-size: auto, auto, 54px 54px, 84px 84px, auto;
  margin: 0;
  min-height: 100vh;
}

body::before {
  background:
    linear-gradient(90deg, transparent 0 72%, rgba(68, 215, 255, 0.08) 72% 73%, transparent 73% 100%),
    linear-gradient(180deg, transparent 0 68%, rgba(46, 240, 194, 0.07) 68% 69%, transparent 69% 100%);
  content: "";
  inset: 0;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 82%);
  pointer-events: none;
  position: fixed;
  z-index: -1;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.link-button {
  align-items: center;
  background: rgba(11, 25, 43, 0.86);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  gap: 0.4rem;
  min-height: 2.05rem;
  padding: 0.42rem 0.68rem;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.link-button:hover {
  background: rgba(18, 45, 73, 0.92);
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(68, 215, 255, 0.08);
}

.primary-action,
.link-button.strong {
  background: linear-gradient(135deg, #13b8e8, #20d59f);
  border-color: rgba(108, 255, 227, 0.52);
  color: #03101a;
  box-shadow: 0 10px 34px rgba(32, 213, 159, 0.18);
}

.danger {
  color: #ff92a0;
}

.danger.solid {
  background: #b9283e;
  border-color: #ff6578;
  color: #ffffff;
}

.app-shell {
  margin: 0 auto;
  max-width: 1320px;
  padding: 1.25rem;
  position: relative;
}

.version-stamp {
  bottom: 0.65rem;
  color: var(--muted-2);
  font-size: 0.72rem;
  line-height: 1;
  opacity: 0.82;
  pointer-events: none;
  position: fixed;
  right: 0.75rem;
  z-index: 10;
}

.topbar,
.detail-header {
  align-items: flex-start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 0.25rem;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  color: #f5fbff;
  font-size: clamp(1.75rem, 3vw, 2.7rem);
  line-height: 1.05;
  margin-bottom: 0.45rem;
  text-shadow: 0 0 28px rgba(68, 215, 255, 0.2);
}

h2 {
  color: #f4fbff;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.lead {
  color: var(--muted);
  max-width: 68ch;
}

.content-panel {
  background:
    linear-gradient(180deg, rgba(68, 215, 255, 0.08), transparent 9rem),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 1rem;
  position: relative;
}

.content-panel::before,
.modal::before {
  border-left: 1px solid var(--cyan);
  border-top: 1px solid var(--cyan);
  content: "";
  height: 18px;
  left: -1px;
  opacity: 0.8;
  position: absolute;
  top: -1px;
  width: 18px;
}

.section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.section-heading p,
.muted {
  color: var(--muted);
  display: block;
  font-size: 0.86rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 860px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid rgba(112, 199, 255, 0.13);
  padding: 0.68rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: #89ddff;
  font-size: 0.76rem;
  text-transform: uppercase;
}

tr:hover td {
  background: rgba(68, 215, 255, 0.04);
}

.table-json {
  background: rgba(2, 7, 14, 0.5);
  border: 1px solid rgba(112, 199, 255, 0.12);
  border-radius: 6px;
  color: #dcefff;
  font-size: 0.82rem;
  margin: 0;
  max-height: 8rem;
  overflow: auto;
  padding: 0.55rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.row-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.status-badge {
  background: rgba(68, 215, 255, 0.1);
  border: 1px solid rgba(68, 215, 255, 0.26);
  border-radius: 999px;
  color: #8ae9ff;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 750;
  padding: 0.2rem 0.55rem;
}

.status-badge.empty {
  background: rgba(145, 164, 188, 0.1);
  border-color: rgba(145, 164, 188, 0.24);
  color: #a9b6c7;
}

.status-badge.draft {
  background: rgba(68, 215, 255, 0.12);
  border-color: rgba(68, 215, 255, 0.32);
  color: #8ae9ff;
}

.status-badge.proposed {
  background: rgba(179, 156, 255, 0.12);
  border-color: rgba(179, 156, 255, 0.32);
  color: #d5c9ff;
}

.status-badge.needsReview {
  background: rgba(255, 207, 92, 0.12);
  border-color: rgba(255, 207, 92, 0.38);
  color: #ffd978;
}

.status-badge.approved {
  background: rgba(85, 243, 138, 0.12);
  border-color: rgba(85, 243, 138, 0.36);
  color: #9cffb9;
}

.method-badge {
  background: rgba(179, 156, 255, 0.12);
  border: 1px solid rgba(179, 156, 255, 0.3);
  border-radius: 6px;
  color: #d5c9ff;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.18rem 0.45rem;
}

.empty-state {
  align-items: flex-start;
  background: var(--panel-soft);
  border: 1px dashed rgba(112, 199, 255, 0.34);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  justify-content: center;
  padding: 1.4rem;
}

.empty-state.compact {
  min-height: 128px;
}

.notice {
  background: rgba(46, 240, 194, 0.12);
  border: 1px solid rgba(46, 240, 194, 0.34);
  border-radius: 6px;
  color: #a9ffed;
  padding: 0.65rem 0.85rem;
}

.back-link {
  color: #7defff;
  display: inline-block;
  font-weight: 750;
  margin-bottom: 0.7rem;
  text-decoration: none;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.tabs a {
  align-items: center;
  background: rgba(8, 17, 30, 0.74);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #b6c9de;
  font-weight: 750;
  padding: 0.52rem 0.72rem;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex;
  gap: 0.45rem;
}

.tabs a.active {
  background: linear-gradient(135deg, rgba(68, 215, 255, 0.22), rgba(46, 240, 194, 0.12));
  border-color: var(--line-strong);
  color: #f5fbff;
}

.detail-grid {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 0.8rem;
}

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

.section-status-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0.8rem;
}

.section-status-card {
  align-items: center;
  background: var(--panel-soft);
  border: 1px solid rgba(112, 199, 255, 0.16);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  min-height: 3.55rem;
  padding: 0.68rem;
  text-decoration: none;
}

.section-status-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.tab-dot {
  border-radius: 999px;
  height: 0.55rem;
  width: 0.55rem;
}

.tab-dot.empty {
  background: #91a4bc;
}

.tab-dot.draft {
  background: var(--cyan);
}

.tab-dot.needsReview {
  background: var(--amber);
}

.tab-dot.approved {
  background: var(--green);
}

.section-preview {
  display: grid;
  gap: 0.85rem;
}

.artifact-grid {
  display: grid;
  gap: 0.85rem;
}

.artifact-card {
  background: var(--panel-soft);
  border: 1px solid rgba(112, 199, 255, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem;
}

.artifact-card header,
.artifact-card footer {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.artifact-card h3 {
  font-size: 1rem;
  margin: 0 0 0.2rem;
}

.artifact-card p,
.artifact-card footer {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0;
}

.artifact-card pre {
  background: rgba(2, 7, 14, 0.84);
  border: 1px solid rgba(112, 199, 255, 0.16);
  border-radius: 8px;
  color: #dcefff;
  margin: 0;
  max-height: 26rem;
  overflow: auto;
  padding: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.interview-layout {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
}

.conversation-panel,
.summary-panel,
.answer-panel {
  background: var(--panel-soft);
  border: 1px solid rgba(112, 199, 255, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 0.7rem;
  padding: 0.8rem;
}

.conversation-panel {
  max-height: 620px;
  overflow: auto;
}

.chat-message {
  background: rgba(5, 10, 19, 0.72);
  border: 1px solid rgba(112, 199, 255, 0.18);
  border-radius: 8px;
  display: grid;
  gap: 0.55rem;
  padding: 0.72rem;
}

.chat-message.user {
  border-color: rgba(46, 240, 194, 0.36);
}

.chat-message header {
  align-items: center;
  display: flex;
  gap: 0.65rem;
  justify-content: space-between;
}

.chat-message header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.chat-message pre,
.summary-panel pre {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.summary-panel h3 {
  font-size: 1rem;
  margin: 0;
}

.answer-panel {
  margin-top: 1rem;
}

.divider {
  border-top: 1px solid rgba(112, 199, 255, 0.14);
  margin: 1rem 0;
}

.settings-panel {
  display: grid;
  gap: 1rem;
}

.provider-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.provider-option {
  background: var(--panel-soft);
  border: 1px solid rgba(112, 199, 255, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 0.55rem;
  padding: 0.78rem;
}

.provider-option.selected {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(46, 240, 194, 0.1);
}

.provider-option input {
  width: auto;
}

.provider-option small,
.provider-option em {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.settings-row {
  align-items: end;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.section-preview h3 {
  font-size: 0.95rem;
  margin: 0;
}

.section-preview pre {
  background: rgba(2, 7, 14, 0.84);
  border: 1px solid rgba(112, 199, 255, 0.16);
  border-radius: 8px;
  color: #dcefff;
  margin: 0;
  overflow-x: auto;
  padding: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-grid div,
.next-step {
  background: var(--panel-soft);
  border: 1px solid rgba(112, 199, 255, 0.15);
  border-radius: 8px;
  padding: 0.78rem;
}

dt {
  color: #89ddff;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-backdrop {
  align-items: center;
  background: rgba(1, 5, 12, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 50;
}

.modal {
  background:
    linear-gradient(180deg, rgba(68, 215, 255, 0.08), transparent 8rem),
    var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.52);
  max-height: calc(100vh - 2rem);
  max-width: 720px;
  overflow: auto;
  padding: 1.25rem;
  position: relative;
  width: 100%;
}

.modal.narrow {
  max-width: 460px;
}

.modal-header,
.modal-footer {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.modal form {
  display: grid;
  gap: 0.9rem;
}

.icon-button {
  border-radius: 999px;
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
}

label {
  color: #cfe7ff;
  display: grid;
  font-weight: 750;
  gap: 0.35rem;
}

.form-grid-two {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: minmax(130px, 0.35fr) minmax(0, 1fr);
}

.checkbox-label {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 0.65rem;
}

.checkbox-label input {
  width: auto;
}

input,
select,
textarea {
  background: rgba(2, 7, 14, 0.74);
  border: 1px solid rgba(112, 199, 255, 0.22);
  border-radius: 6px;
  color: var(--text);
  padding: 0.56rem 0.7rem;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(68, 215, 255, 0.12);
  outline: none;
}

textarea {
  resize: vertical;
}

.field-error,
.form-error {
  color: #ff92a0;
  font-size: 0.9rem;
  font-weight: 700;
}

@media (max-width: 720px) {
  .app-shell {
    padding: 1rem;
  }

  .version-stamp {
    bottom: 0.45rem;
    font-size: 0.68rem;
    right: 0.55rem;
  }

  .topbar,
  .detail-header,
  .section-heading,
  .artifact-card header,
  .artifact-card footer {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 2.1rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .section-status-grid,
  .compact-grid,
  .provider-grid,
  .form-grid-two,
  .settings-row,
  .interview-layout {
    grid-template-columns: 1fr;
  }

  .row-actions {
    min-width: 260px;
  }
}
