:root {
  --primary: #06c755;
  --primary-dark: #04b34a;
  --primary-light: #e3f8ec;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --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-800: #1f2937;
  --gray-900: #111827;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
  --placeholder-color: #c4c8cc;
  --phase-lead: #06c755;
  --phase-default: #6b7280;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
}

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

input::placeholder,
textarea::placeholder {
  color: var(--placeholder-color);
}

.imj-app-layout {
  display: flex;
  min-height: 100vh;
}

.imj-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: width .18s ease, transform .18s ease;
}

.imj-sidebar-brand {
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.imj-sidebar-brand a {
  color: inherit;
  text-decoration: none;
}

.imj-sidebar-brand span {
  font-size: 11px;
  font-weight: 400;
  opacity: .6;
}

.sidebar-collapse,
.nav-open {
  border: 1px solid var(--gray-200);
  background: white;
  color: var(--gray-500);
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  padding: 4px 8px;
}

.sidebar-collapse:hover,
.nav-open:hover {
  background: var(--gray-50);
  color: var(--gray-700);
}

.nav-open {
  display: none;
  flex-shrink: 0;
}

body.nav-collapsed .imj-sidebar {
  display: none;
}

body.nav-collapsed .nav-open {
  display: inline-flex;
}

.imj-sidebar-nav {
  flex: 1;
  overflow-y: auto;
}

.imj-sidebar-group {
  border-bottom: 1px solid var(--gray-200);
}

.imj-sidebar-group-title {
  width: 100%;
  border: none;
  background: var(--gray-50);
  color: var(--gray-700);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: left;
}

.imj-sidebar-group-title:hover {
  background: var(--gray-100);
}

.accordion-icon {
  color: var(--gray-400);
  font-size: 10px;
  transition: transform .15s ease;
}

.imj-sidebar-group.is-collapsed .accordion-icon {
  transform: rotate(-90deg);
}

.imj-sidebar-group.is-collapsed .imj-sidebar-group-items {
  display: none;
}

.imj-sidebar-top-link,
.imj-sidebar-group-items a {
  display: block;
  text-decoration: none;
  color: var(--gray-700);
  font-size: 13px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}

.imj-sidebar-top-link {
  padding: 10px 12px;
  margin: 4px 12px 8px;
  font-weight: 600;
}

.imj-sidebar-group-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
}

.imj-sidebar-group-items a {
  padding: 8px 10px;
  margin: 0 12px;
}

.imj-sidebar-top-link:hover,
.imj-sidebar-group-items a:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.imj-sidebar-top-link.active,
.imj-sidebar-group-items a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.imj-sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-200);
}

.imj-sidebar-manual {
  display: block;
  padding: 8px 16px;
  text-decoration: none;
  color: var(--gray-500);
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: white;
  text-align: center;
}

.sidebar-version {
  margin-top: 8px;
  text-align: center;
  font-size: 10px;
  color: var(--gray-400);
}

.imj-app-main {
  flex: 1;
  min-width: 0;
}

.imj-page-header {
  background: transparent;
  border-bottom: 1px solid var(--gray-200);
  padding: 6px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--gray-900);
}

.breadcrumb-sep {
  color: var(--gray-400);
}

.imj-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.user-name {
  font-size: 11px;
  color: var(--gray-700);
  margin-right: 2px;
}

.btn-report,
.btn-logout {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}

.btn-report {
  border: 1px solid var(--warning);
  color: #92400e;
  background: var(--warning-light);
}

.btn-logout {
  border: 1px solid var(--gray-200);
  color: var(--gray-500);
  background: white;
}

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 24px 32px;
}

.page-kickoff {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.page-eyebrow {
  font-size: 11px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-heading {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
}

.page-lead {
  font-size: 13px;
  color: var(--gray-500);
  max-width: 720px;
}

.page-actions,
.toolbar,
.pagination-actions,
.peek-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.summary-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-width: 0;
}

.summary-label {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 700;
  letter-spacing: .04em;
}

.summary-value {
  font-size: 24px;
  line-height: 1.1;
  margin-top: 3px;
  font-weight: 800;
}

.summary-item.is-primary .summary-value {
  color: var(--primary);
}

.summary-item.is-danger .summary-value {
  color: var(--danger);
}

.summary-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 3px;
}

.sub-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 14px;
  overflow-x: auto;
}

.sub-tabs a {
  padding: 10px 16px;
  text-decoration: none;
  color: var(--gray-500);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.sub-tabs a.active,
.sub-tabs a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}

.workbench-main {
  min-width: 0;
}

.toolbar {
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.toolbar input,
.toolbar select,
.field input,
.field select,
.field textarea {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  outline: none;
}

.toolbar input,
.toolbar select {
  padding: 8px 12px;
  font-size: 13px;
}

.search-input {
  min-width: 320px;
  flex: 1 1 320px;
}

.toolbar input:focus,
.toolbar select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--gray-200);
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  background: white;
  color: var(--gray-700);
  transition: all .15s ease;
}

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

.btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-sm {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
  font-weight: 500;
}

.btn-ai-subtle {
  background: white;
  color: var(--primary);
  border-color: var(--gray-200);
}

.btn-ai-subtle:hover {
  background: var(--primary-light);
}

.table-wrap {
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
}

thead th {
  padding: 10px 13px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .4px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

td {
  padding: 11px 13px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tbody tr {
  cursor: pointer;
}

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

tbody tr.is-hot {
  background: #ecfdf5;
}

td strong {
  display: block;
  font-size: 13.5px;
  color: var(--gray-900);
  font-weight: 600;
}

td span {
  display: block;
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 2px;
}

.inquiry-table table {
  table-layout: fixed;
}

.inquiry-table th:nth-child(1),
.inquiry-table td:nth-child(1) { width: 82px; }
.inquiry-table th:nth-child(2),
.inquiry-table td:nth-child(2) { width: 210px; }
.inquiry-table th:nth-child(3),
.inquiry-table td:nth-child(3) { width: 86px; }
.inquiry-table th:nth-child(4),
.inquiry-table td:nth-child(4) { width: 72px; }
.inquiry-table th:nth-child(5),
.inquiry-table td:nth-child(5) { width: 110px; }
.inquiry-table th:nth-child(6),
.inquiry-table td:nth-child(6) { width: 92px; }
.inquiry-table th:nth-child(8),
.inquiry-table td:nth-child(8) { width: 68px; }

.score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 24px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

.score-high {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.score-mid {
  background: var(--gray-100);
  color: var(--gray-700);
}

.score-low {
  background: var(--gray-100);
  color: var(--gray-600);
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.state-new {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.state-contacted {
  background: var(--gray-100);
  color: var(--gray-700);
}

.state-qualified {
  background: var(--gray-100);
  color: var(--gray-700);
}

.state-pending {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-warning {
  background: var(--gray-100);
  color: var(--gray-700);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  color: var(--gray-500);
  font-size: 12px;
}

.pagination button {
  padding: 5px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: white;
  color: var(--gray-700);
  font-size: 12px;
  cursor: pointer;
}

.workbench-side {
  display: grid;
  gap: 12px;
}

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

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

.side-panel h2 {
  font-size: 14px;
  font-weight: 700;
}

.task-list {
  display: grid;
  gap: 0;
}

.task-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
}

.task-card:last-child {
  border-bottom: none;
}

.task-card.priority-high {
  background: var(--gray-50);
}

.task-card strong {
  display: block;
  font-size: 13px;
}

.task-card span {
  display: block;
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.section {
  margin-top: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}

.pipeline-board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.pipeline-column {
  flex: 0 0 190px;
  min-width: 190px;
  background: var(--gray-50);
  border-radius: var(--radius);
  overflow: hidden;
}

.pipeline-header {
  padding: 9px 12px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}

.pipeline-header--new { background: var(--phase-lead); }
.pipeline-header--hearing { background: var(--phase-default); }
.pipeline-header--proposal { background: var(--phase-default); }
.pipeline-header--contract { background: var(--phase-default); }

.pipeline-body {
  background: var(--gray-100);
  padding: 8px;
  min-height: 96px;
}

.pipeline-card {
  background: white;
  border-radius: 6px;
  padding: 10px;
  border: 1px solid var(--gray-200);
}

.pipeline-card .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
}

.pipeline-card .store,
.pipeline-card .meta {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.design-notes {
  margin-top: 16px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

.design-notes summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--gray-700);
  font-size: 13px;
  font-weight: 600;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.notes-grid article {
  border: 1px solid var(--gray-100);
  border-radius: 6px;
  padding: 12px;
  background: var(--gray-50);
}

.notes-grid h2 {
  font-size: 13px;
  margin-bottom: 4px;
}

.notes-grid p {
  font-size: 12px;
  color: var(--gray-600);
}

.peek-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.18);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  z-index: 900;
}

.peek-overlay.show {
  opacity: 1;
  visibility: visible;
}

.side-peek {
  position: fixed;
  top: 0;
  right: 0;
  width: 430px;
  max-width: 92vw;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 8px rgba(17, 24, 39, .04);
  transform: translateX(100%);
  transition: transform .2s ease;
  z-index: 901;
  display: flex;
  flex-direction: column;
}

.side-peek.open {
  transform: translateX(0);
}

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

.peek-eyebrow {
  color: var(--gray-500);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.peek-header h2 {
  font-size: 18px;
  line-height: 1.3;
  margin-top: 2px;
}

.peek-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--gray-400);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.peek-close:hover {
  background: var(--gray-100);
}

.peek-body {
  padding: 18px 20px;
  overflow-y: auto;
}

.peek-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
  background: var(--gray-50);
}

.peek-score span {
  display: block;
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
}

.peek-score strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  color: var(--primary);
  margin-top: 2px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
}

.field textarea {
  resize: vertical;
}

.timeline {
  margin-top: 20px;
  border-top: 1px solid var(--gray-200);
  padding-top: 14px;
}

.timeline h3 {
  font-size: 14px;
  margin-bottom: 10px;
}

.timeline div {
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 10px;
  align-items: start;
  margin-bottom: 10px;
}

.timeline div span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 6px;
}

.timeline p {
  font-size: 13px;
}

.timeline small {
  color: var(--gray-500);
  margin-left: 6px;
}

.report-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 950;
  display: none;
  justify-content: center;
  align-items: center;
}

.report-overlay.show {
  display: flex;
}

.report-modal {
  background: white;
  border-radius: 12px;
  width: 480px;
  max-width: 95vw;
  border: 1px solid var(--gray-200);
  box-shadow: 0 4px 12px rgba(17, 24, 39, .05);
}

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

.rm-header h2 {
  font-size: 16px;
}

.rm-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--gray-400);
}

.rm-body {
  padding: 20px;
}

.rm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
}

.imj-sidebar-toggle {
  display: none;
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 20px;
  box-shadow: 0 2px 6px rgba(6,199,85,.2);
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

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

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

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

@media (max-width: 820px) {
  .imj-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform .25s;
    box-shadow: 2px 0 8px rgba(17,24,39,.05);
  }

  .imj-sidebar.open {
    transform: translateX(0);
  }

  body.nav-collapsed .imj-sidebar {
    display: flex;
  }

  body.nav-collapsed .nav-open {
    display: none;
  }

  .imj-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .imj-page-header {
    padding: 8px 16px;
  }

  .container {
    padding: 18px 16px 82px;
  }

  .page-kickoff {
    flex-direction: column;
  }

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

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

  .inquiry-table table {
    min-width: 920px;
  }

  .workbench-side,
  .notes-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .page-actions,
  .toolbar {
    width: 100%;
  }

  .page-actions .btn,
  .toolbar .btn,
  .toolbar input,
  .toolbar select {
    width: 100%;
  }

  .imj-header-actions .user-name {
    display: none;
  }
}
