:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #181b20;
  --panel-alt: #1d2128;
  --panel-strong: #242b35;
  --line: #2d3541;
  --text: #f4f5f7;
  --muted: #a2adba;
  --accent: #7dc1ff;
  --accent-2: #c6a7ff;
  --good: #7fd5a7;
  --warn: #ffcf78;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

.appShell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #14171c 0%, #111318 100%);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brandBlock,
.panelHeader,
.topbar,
.topbarActions,
.titleMeta,
.meterLabel,
.tableHead,
.tableRow,
.searchBox,
.filterRow,
.tagRow,
.brandMark,
.navItem,
.relationshipItem,
.activityItem {
  display: flex;
  align-items: center;
}

.brandBlock,
.panelHeader,
.topbar,
.tableRow,
.relationshipItem,
.activityItem {
  justify-content: space-between;
}

.brandBlock {
  align-items: flex-start;
  gap: 12px;
}

.brandMark {
  width: 44px;
  height: 44px;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0f1319;
  font-weight: 800;
}

.eyebrow,
.sectionLabel,
.statPanel span,
.titleMeta p,
.titleMeta small,
.activityItem small,
.relationshipItem span,
.queryLabel,
.matchList span,
.taskList,
.navItem,
.promptChip {
  color: var(--muted);
}

.eyebrow,
.sectionLabel,
.queryLabel {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brandBlock h1,
.topbar h2,
.panel h3,
.titleMeta h4,
.queryText,
.activityItem p {
  margin: 0;
}

.brandBlock h1 {
  font-size: 1.45rem;
}

.navGroup,
.promptList,
.activityList,
.meterList,
.taskList {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inlinePromptList {
  flex-direction: row;
  flex-wrap: wrap;
}

.navItem,
.promptChip,
.filterChip,
.primaryAction {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.navItem {
  width: 100%;
  justify-content: flex-start;
  padding: 11px 12px;
}

.navLink {
  text-decoration: none;
}

.navItemStatic {
  cursor: default;
  opacity: 0.72;
}

.navItemActive {
  background: var(--panel-strong);
  color: var(--text);
}

.sidebarPanel,
.panel,
.statPanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.sidebarPanel {
  padding: 14px;
}

.promptChip,
.filterChip {
  text-align: left;
  padding: 10px 12px;
}

.promptStatic {
  display: block;
  cursor: default;
}

.mainPane {
  padding: 28px;
}

.topbar {
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.topbar h2 {
  font-size: clamp(1.75rem, 2vw, 2.4rem);
  line-height: 1.08;
}

.topbarActions {
  gap: 12px;
  width: min(100%, 520px);
}

.searchBox {
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.searchBox input {
  width: 100%;
  border: 0;
  outline: 0;
  padding: 14px 0;
  color: var(--text);
  background: transparent;
}

.searchIcon {
  color: var(--muted);
  font-size: 1rem;
}

.primaryAction {
  padding: 0 16px;
  color: var(--text);
  background: var(--panel-strong);
}

.statsGrid,
.contentGrid,
.splitRow {
  display: grid;
  gap: 16px;
}

.statsGrid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.statPanel,
.panel {
  padding: 18px;
}

.statPanel strong {
  display: block;
  margin-bottom: 8px;
  font-size: 2rem;
}

.contentGrid {
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.9fr);
  align-items: start;
}

.primaryColumn,
.secondaryColumn {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panelHeader {
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel h3 {
  font-size: 1.1rem;
}

.messagePanel strong {
  display: block;
}

.filterRow,
.tagRow {
  flex-wrap: wrap;
  gap: 8px;
}

.filterChip,
.tag,
.badge {
  white-space: nowrap;
  font-size: 0.84rem;
}

.titleTable {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tableHead {
  padding: 0 10px;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.tableHead span:nth-child(1) {
  width: 46%;
}

.tableHead span:nth-child(2),
.tableHead span:nth-child(3) {
  width: 12%;
}

.tableHead span:nth-child(4) {
  width: 26%;
}

.tableRow {
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 8px;
  background: var(--panel-alt);
}

.tableRow > :nth-child(1) {
  width: 46%;
}

.tableRow > :nth-child(2),
.tableRow > :nth-child(3) {
  width: 12%;
}

.tableRow > :nth-child(4) {
  width: 26%;
}

.titleMeta {
  gap: 12px;
  align-items: flex-start;
}

.posterStub {
  width: 42px;
  height: 60px;
  flex: 0 0 auto;
  border-radius: 6px;
  background: linear-gradient(180deg, #2c3440, #1b2027);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 700;
}

.titleMeta h4 {
  font-size: 1rem;
}

.titleMeta h4 span {
  color: var(--muted);
  font-weight: 500;
}

.titleMeta p {
  margin: 3px 0 8px;
  font-size: 0.9rem;
}

.titleMeta small,
.activityItem small,
.matchList span {
  line-height: 1.45;
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #202733;
}

.badgeGood {
  color: var(--good);
}

.badgeWarn {
  color: var(--warn);
}

.badgeMuted {
  color: var(--muted);
}

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

.queryCard {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel-alt);
}

.queryText {
  font-size: 1.02rem;
  line-height: 1.5;
}

.matchList {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.matchList strong,
.relationshipItem strong,
.activityItem strong {
  display: block;
  margin-bottom: 4px;
}

.relationshipList {
  display: grid;
  gap: 12px;
}

.relationshipItem,
.activityItem {
  gap: 10px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.relationshipItem:first-child,
.activityItem:first-child {
  padding-top: 0;
  border-top: 0;
}

.relationshipItem,
.activityItem {
  flex-direction: column;
}

.activityDate {
  display: inline-flex;
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  background: #212833;
  color: var(--accent);
  font-size: 0.76rem;
}

.meterTrack {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #242c37;
}

.meterFill {
  height: 100%;
  border-radius: inherit;
}

.meterFillA {
  width: 68%;
  background: linear-gradient(90deg, var(--accent), #87e0cf);
}

.meterFillB {
  width: 52%;
  background: linear-gradient(90deg, #e8ba79, #f2d592);
}

.meterFillC {
  width: 41%;
  background: linear-gradient(90deg, var(--accent-2), #dab7ff);
}

.taskList {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}

.compactList {
  padding-left: 16px;
  line-height: 1.5;
}

.reviewGrid {
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.4fr);
}

.reviewQueue {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queueItem {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-alt);
  color: inherit;
  text-decoration: none;
}

.queueItem strong,
.field span {
  display: block;
}

.queueItem p,
.queueItem small,
.signalPanel p,
.signalPanel small {
  margin: 4px 0 0;
}

.queueItemActive {
  border-color: var(--accent);
  background: #202a35;
}

.reviewDetailColumn {
  gap: 16px;
}

.reviewForm {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.formGrid,
.signalGrid {
  display: grid;
  gap: 14px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: var(--panel-alt);
  color: var(--text);
}

.field textarea {
  resize: vertical;
}

.fieldWide {
  grid-column: 1 / -1;
}

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

.signalPanel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-alt);
}

.errorPanel {
  border-color: #7e4a4a;
  background: #2a1d1d;
}

.actionRow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.assistantAnswer {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.6;
}

.assistantSuggestionGrid {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 10px 14px;
  margin: 0;
}

.assistantSuggestionGrid dt {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.assistantSuggestionGrid dd {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 1200px) {
  .statsGrid,
  .splitRow,
  .contentGrid,
  .reviewGrid,
  .signalGrid {
    grid-template-columns: 1fr;
  }

  .tableHead {
    display: none;
  }

  .tableRow {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tableRow > :nth-child(1),
  .tableRow > :nth-child(2),
  .tableRow > :nth-child(3),
  .tableRow > :nth-child(4) {
    width: 100%;
  }
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar,
  .topbarActions {
    flex-direction: column;
  }

  .topbarActions {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .mainPane,
  .sidebar {
    padding: 18px;
  }

  .statPanel strong {
    font-size: 1.6rem;
  }

  .topbar h2 {
    font-size: 1.5rem;
  }

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