:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --paper: #f8fafc;
  --white: #ffffff;
  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --green: #15803d;
  --green-soft: #ecfdf5;
  --purple: #6d28d9;
  --purple-soft: #f5f3ff;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: #f1f5f9;
  font: 14px/1.5 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

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

.eyebrow {
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(32px, 4vw, 48px);
  letter-spacing: -.04em;
  line-height: 1.05;
  margin: 0 0 8px;
  color: #0f172a;
}

.subtitle {
  color: var(--muted);
  font-size: 16px;
  margin: 0;
  max-width: 700px;
}

.hero-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  white-space: nowrap;
}

.ai-badge {
  background: var(--purple-soft);
  color: var(--purple);
  border: 1px solid #ddd6fe;
}

.safe-badge {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid #a7f3d0;
}

.neutral-badge {
  background: #e2e8f0;
  color: #334155;
}

/* Reset Button */
.reset-btn {
  background: var(--white);
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  padding: 6px 14px;
  cursor: pointer;
  transition: all .15s ease;
  box-shadow: var(--shadow-sm);
}

.reset-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: var(--blue);
  transform: translateY(-1px);
}

/* 4 Cases in a Row */
.cases-section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.section-header h2 {
  font-size: 20px;
  margin: 0;
}

.section-header .hint {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.case-cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.case-card {
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all .18s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.case-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
  box-shadow: var(--shadow);
}

.case-card.active {
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .18), var(--shadow);
}

.case-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.card-ref {
  font-size: 11px;
  font-weight: 750;
  color: var(--muted);
}

.case-card h3 {
  font-size: 14px;
  line-height: 1.35;
  margin: 0 0 6px;
  color: #0f172a;
}

.case-card-summary {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.case-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* Status Pills */
.status-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  padding: 3px 9px;
  display: inline-block;
  white-space: nowrap;
}

.status-new { background: #e2e8f0; color: #475569; }
.status-clarify { background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
.status-waiting { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; font-weight: 800; }
.status-ready { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.status-delegated { background: #dcfce7; color: #166534; border: 1px solid #86efac; font-weight: 800; }

.tag-new { color: var(--muted); font-size: 11px; font-weight: 750; }
.tag-clarify { color: #c2410c; font-size: 11px; font-weight: 750; }
.tag-waiting { color: #1d4ed8; font-size: 11px; font-weight: 800; }
.tag-ready { color: #15803d; font-size: 11px; font-weight: 750; }
.tag-delegated { color: #166534; font-size: 11px; font-weight: 800; }

/* Workspace Grid */
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.panel-head h3 {
  font-size: 18px;
  margin: 0;
}

.label-heading {
  display: block;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #334155;
  margin-bottom: 6px;
}

textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--paper);
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

.intake-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  margin-bottom: 16px;
}

.source-tag {
  color: var(--muted);
  font-size: 11px;
}

button {
  border: none;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 10px 16px;
  transition: all .15s ease;
}

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

.primary:hover {
  background: #1e40af;
}

.secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.secondary:hover {
  background: #e2e8f0;
}

.success-btn {
  background: var(--green);
  color: var(--white);
}

.success-btn:hover {
  background: #166534;
}

.small-btn {
  padding: 6px 12px;
  font-size: 12px;
}

/* AI Legal Research Box */
.legal-research-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--purple);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
}

.box-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.box-head .icon {
  font-size: 22px;
}

.box-head h4 {
  margin: 0;
  font-size: 15px;
  color: var(--purple);
}

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

.research-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.research-card h5 {
  margin: 0 0 4px;
  font-size: 13.5px;
  color: #0f172a;
}

.research-card p {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.research-action {
  font-size: 12px;
  color: #1e3a8a;
  background: #eff6ff;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-block;
  font-weight: 600;
}

/* Facts Grid */
.facts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.fact-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #475569;
  margin: 0 0 8px;
}

.clean-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.clean-list li {
  font-size: 12.5px;
  padding: 6px 0;
  border-top: 1px solid #f1f5f9;
  color: #1e293b;
}

.clean-list li:first-child {
  border-top: none;
}

.signal-chip {
  background: #fef2f2;
  border-left: 3px solid var(--red);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #991b1b;
  margin-bottom: 6px;
}

/* Right Panel: Workflow Area */
.workflow-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workflow-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.workflow-header h4 {
  margin: 0 0 4px;
  font-size: 16px;
}

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

.question-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.question-item input[type="checkbox"] {
  margin-top: 3px;
  cursor: pointer;
}

.question-item label {
  font-size: 13px;
  color: #1e293b;
  cursor: pointer;
  flex: 1;
}

.draft-box {
  background: #fdfdfd;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
}

.draft-box textarea {
  background: #ffffff;
  min-height: 140px;
}

/* Delegation Box */
.delegation-card {
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
  border: 1px solid #86efac;
  border-radius: 12px;
  padding: 20px;
}

.delegation-card h4 {
  color: #15803d;
  font-size: 18px;
  margin: 0 0 8px;
}

.delegation-card p {
  color: #166534;
  margin: 0 0 14px;
  font-size: 13.5px;
}

.audit-meta {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 12px;
  margin: 14px 0;
  font-size: 12.5px;
  color: #166534;
}

.audit-meta strong {
  color: #14532d;
}

/* Bottom Pending Registry */
.pending-drawer {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.drawer-header h3 {
  font-size: 16px;
  margin: 0;
}

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

.pending-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.pending-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.pending-table td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.pending-table tr:hover td {
  background: #f8fafc;
}

footer {
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

@media (max-width: 1024px) {
  .case-cards-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .workspace-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .case-cards-row {
    grid-template-columns: 1fr;
  }
  .hero {
    flex-direction: column;
  }
}

/* Clarification Fulfillment Audit Styles */
.clarification-audit-card {
  background: var(--white);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.clarification-audit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.clarification-audit-header h4 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
}

.clarification-audit-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.audit-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}

.audit-item.received {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.audit-item.missing {
  background: #fff7ed;
  border: 1px solid #fed7aa;
}

.audit-icon {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
}

.audit-item.received .audit-icon {
  color: #15803d;
}

.audit-item.missing .audit-icon {
  color: #c2410c;
}

.audit-content {
  flex: 1;
}

.audit-content strong {
  display: block;
  color: #0f172a;
  margin-bottom: 2px;
}

.audit-content p {
  margin: 0;
  font-size: 12px;
  color: #475569;
}

.audit-badge-received {
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.audit-badge-missing {
  background: #ffedd5;
  color: #9a3412;
  font-size: 11px;
  font-weight: 750;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-partial { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; font-weight: 800; }
.tag-partial { color: #854d0e; font-size: 11px; font-weight: 800; }
