:root {
  color-scheme: light;
  --page: #f6f8fb;
  --paper: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --teal: #0d9488;
  --teal-soft: #ccfbf1;
  --blue: #1c789c;
  --blue-soft: #dff3f9;
  --pink: #e11979;
  --pink-dark: #9d2054;
  --pink-soft: #fdeff6;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --yellow: #febc32;
  --yellow-soft: #fff7df;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--gray-900);
  background: var(--page);
  font-family: Montserrat, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--paper);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--blue);
  font-size: 13px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--gray-500);
  font-size: 12px;
  font-weight: 600;
}

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

h1 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sync-status {
  color: var(--gray-500);
  font-size: 12px;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  color: var(--gray-700);
  background: var(--paper);
}

.icon-button:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}

.workspace {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
  height: calc(100vh - 112px);
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--paper);
}

.nav-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  background: transparent;
  text-align: left;
  font-weight: 600;
}

.nav-button:hover {
  background: var(--gray-50);
}

.nav-button.active {
  color: var(--blue);
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
}

.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--gray-600);
  background: var(--gray-100);
  font-size: 12px;
  text-align: center;
}

.active .nav-count {
  color: var(--blue);
  background: #ffffff;
}

.sidebar-card {
  margin: 14px;
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.sidebar-card h3 {
  margin-bottom: 8px;
  font-size: 14px;
}

.sidebar-card p {
  margin-bottom: 8px;
  color: var(--gray-600);
  font-size: 12px;
  line-height: 1.5;
}

.content-sheet {
  width: 100%;
  max-width: 1440px;
  min-height: calc(100vh - 112px);
  margin: 0 auto;
  padding: 32px;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
}

.page-header h2 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1.2;
}

.page-header p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--gray-600);
  line-height: 1.5;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  color: var(--gray-700);
  background: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
  text-decoration: none;
}

.button.primary {
  border-color: var(--pink);
  color: #ffffff;
  background: var(--pink);
}

.button.primary:hover {
  border-color: var(--pink-dark);
  background: var(--pink-dark);
}

.button.danger {
  border-color: var(--red-soft);
  color: var(--red);
  background: var(--red-soft);
}

.button.success {
  border-color: var(--green-soft);
  color: var(--green);
  background: var(--green-soft);
}

.section-stack {
  display: grid;
  gap: 24px;
  padding-top: 24px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.kpi-card {
  min-height: 120px;
  padding: 20px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--paper);
  text-align: center;
}

.kpi-value {
  margin-bottom: 4px;
  color: var(--gray-900);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-label {
  color: var(--gray-700);
  font-weight: 600;
}

.kpi-subtitle {
  margin-top: 4px;
  color: var(--gray-500);
  font-size: 12px;
}

.panel {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.panel-header h3 {
  margin-bottom: 0;
  font-size: 16px;
  line-height: 1.3;
}

.panel-body {
  padding: 16px;
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.grid-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid-four {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.compact-grid {
  gap: 16px;
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.info-card,
.hypothesis-card,
.profile-card,
.competitor-card {
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--paper);
}

.info-card h3,
.hypothesis-card h3,
.profile-card h3,
.competitor-card h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.35;
}

.info-card p,
.hypothesis-card p,
.profile-card p,
.competitor-card p {
  margin-bottom: 0;
  color: var(--gray-600);
  line-height: 1.5;
}

.belief-card {
  padding: 2px 0 0;
}

.belief-card h3 {
  margin: 10px 0 8px;
  font-size: 18px;
  line-height: 1.35;
}

.panel-lede {
  margin-bottom: 16px;
  color: var(--gray-700);
  font-weight: 600;
  line-height: 1.5;
}

.section-label {
  margin: 0 0 8px;
  color: var(--gray-600);
  font-size: 12px;
  text-transform: uppercase;
}

.quote-card {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-left: 4px solid var(--blue);
  border-radius: 0 8px 8px 0;
  color: var(--gray-900);
  background: var(--blue-soft);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.question-card {
  display: grid;
  min-height: 92px;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.question-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--blue);
  font-weight: 700;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--gray-700);
  background: var(--gray-100);
  font-size: 12px;
  font-weight: 600;
}

.pill.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.pill.teal {
  color: var(--teal);
  background: var(--teal-soft);
}

.pill.pink {
  color: var(--pink-dark);
  background: var(--pink-soft);
}

.pill.green {
  color: var(--green);
  background: var(--green-soft);
}

.pill.yellow {
  color: #8a5a00;
  background: var(--yellow-soft);
}

.pill.red {
  color: var(--red);
  background: var(--red-soft);
}

.bar-list {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) 44px;
  align-items: center;
  gap: 12px;
}

.bar-label {
  color: var(--gray-700);
  font-weight: 600;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--gray-100);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.bar-fill.teal {
  background: var(--teal);
}

.bar-fill.pink {
  background: var(--pink);
}

.bar-fill.yellow {
  background: var(--yellow);
}

.bar-value {
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

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

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

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--gray-100);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 700;
}

td {
  color: var(--gray-700);
  line-height: 1.45;
}

tbody tr:hover {
  background: var(--gray-50);
}

.numeric {
  text-align: right;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) repeat(3, minmax(130px, 0.7fr));
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--gray-600);
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  color: var(--gray-900);
  background: #ffffff;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.inbox-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  min-height: 640px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.signal-list {
  border-right: 1px solid var(--gray-200);
  background: #ffffff;
  overflow-y: auto;
}

.signal-item {
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--gray-100);
  background: #ffffff;
  text-align: left;
}

.signal-item:hover {
  background: var(--gray-50);
}

.signal-item.selected {
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
}

.signal-title {
  margin-bottom: 6px;
  color: var(--gray-900);
  font-weight: 700;
  line-height: 1.35;
}

.signal-preview {
  display: -webkit-box;
  margin-bottom: 9px;
  overflow: hidden;
  color: var(--gray-600);
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.signal-detail {
  min-width: 0;
  background: #ffffff;
}

.detail-hero {
  padding: 20px;
  border-bottom: 1px solid var(--gray-200);
}

.detail-hero h3 {
  margin-bottom: 10px;
  font-size: 21px;
  line-height: 1.3;
}

.detail-body {
  display: grid;
  gap: 20px;
  padding: 20px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(230px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.kanban-column {
  min-width: 230px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.kanban-header h3 {
  margin-bottom: 0;
  font-size: 14px;
}

.kanban-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.hypothesis-card {
  background: #ffffff;
}

.hypothesis-card.pinned {
  border-color: var(--pink);
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.mini-select {
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: #ffffff;
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 12px;
}

.score-tile {
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.score-tile strong {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
}

.profile-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-section {
  margin-top: 12px;
}

.profile-section h4 {
  margin: 0 0 6px;
  color: var(--gray-700);
  font-size: 12px;
  text-transform: uppercase;
}

.inline-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inline-list li {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--gray-700);
  background: var(--gray-100);
  font-size: 12px;
}

.inline-list li.list-green {
  color: var(--green);
  background: var(--green-soft);
}

.inline-list li.list-red {
  color: var(--red);
  background: var(--red-soft);
}

.workflow-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.workflow-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--paper);
}

.workflow-list span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 700;
}

.split-list {
  display: grid;
  gap: 12px;
}

.brief-panel > .panel-body {
  display: grid;
  gap: 20px;
}

.brief-body {
  display: grid;
  gap: 12px;
  color: var(--gray-700);
  line-height: 1.6;
}

.brief-body p {
  margin: 0;
}

.brief-intel-item {
  padding: 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50);
}

.brief-intel-item h4 {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.35;
}

.brief-intel-item p {
  margin-bottom: 8px;
  color: var(--gray-600);
  line-height: 1.5;
}

.source-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.definition-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 12px;
}

.definition-list dt {
  color: var(--gray-600);
  font-weight: 700;
}

.definition-list dd {
  margin: 0;
  color: var(--gray-700);
  line-height: 1.45;
}

.code-block {
  overflow-x: auto;
  padding: 16px;
  border-radius: var(--radius);
  color: #f8fafc;
  background: #172033;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 32px;
  color: var(--gray-600);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  color: var(--gray-900);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 150ms ease, transform 150ms ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  #navigation {
    display: flex;
    overflow-x: auto;
  }

  .nav-button {
    min-width: 184px;
    border-right: 1px solid var(--gray-100);
  }

  .sidebar-card {
    display: none;
  }

  .kpi-grid,
  .strategy-grid,
  .grid-four,
  .workflow-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-two,
  .profile-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    min-height: 64px;
    align-items: flex-start;
    padding: 14px 16px;
  }

  .brand-lockup {
    align-items: flex-start;
  }

  .sync-status {
    display: none;
  }

  .workspace {
    gap: 16px;
    padding: 16px;
  }

  .content-sheet {
    min-height: 0;
    padding: 20px;
  }

  .page-header {
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .kpi-grid,
  .strategy-grid,
  .grid-three,
  .grid-four,
  .filters,
  .score-grid,
  .workflow-list {
    grid-template-columns: 1fr;
  }

  .inbox-layout {
    grid-template-columns: 1fr;
  }

  .signal-list {
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--gray-200);
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .bar-value {
    text-align: left;
  }
}
