:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #61717f;
  --line: #d7dde3;
  --panel: #ffffff;
  --surface: #f6f8f9;
  --nav: #17212b;
  --nav-2: #22303c;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --gold: #b7791f;
  --red: #b42318;
  --blue: #315c94;
  --green: #26734d;
  --shadow: 0 14px 40px rgba(28, 38, 48, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--surface);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: var(--nav);
  color: #f8fafc;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: #0f766e;
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: #aeb9c4;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  padding: 11px 12px;
  background: transparent;
  color: #dbe4ea;
  border-radius: 8px;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--nav-2);
  color: #ffffff;
}

.icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
}

.sidebar-note {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-note span,
.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar-note span {
  color: #9fb0bf;
}

.sidebar-note strong {
  display: block;
  margin-top: 4px;
}

.sidebar-note p {
  margin: 8px 0 0;
  color: #cbd5df;
  font-size: 13px;
  line-height: 1.6;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.12;
  letter-spacing: 0;
}

.topbar-actions,
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.ghost-button,
.service-card button,
.pricing-card button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 750;
}

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

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

.ghost-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.ghost-button:hover {
  border-color: #aab5bf;
}

.full-width {
  width: 100%;
}

.review-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #c9d8e8;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  margin-bottom: 24px;
  padding: 11px 14px;
  background: #f2f7fc;
  color: #405364;
  line-height: 1.5;
}

.review-banner strong {
  color: var(--blue);
  white-space: nowrap;
}

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

.tool-card {
  display: grid;
  min-height: 178px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
  color: var(--ink);
  text-align: left;
}

.tool-card:hover,
.tool-card.is-active {
  border-color: var(--teal);
  box-shadow: 0 10px 26px rgba(15, 118, 110, 0.12);
}

.tool-card.is-future {
  border-color: #d9c390;
  background: #fffaf0;
}

.tool-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: #e7f4ef;
  color: var(--teal-dark);
  font-weight: 900;
}

.tool-card strong {
  font-size: 18px;
}

.tool-card p,
.tool-card small {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.tool-card small {
  align-self: end;
  color: var(--blue);
  font-weight: 800;
}

.section {
  display: none;
}

.section.is-active {
  display: block;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 20px;
}

.intake-panel,
.agent-panel,
.process-strip,
.file-panel,
.knowledge-panel,
.service-card,
.pricing-card,
.matter-item {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
}

.intake-panel,
.agent-panel {
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.status-pill,
.risk-chip,
.matter-status,
.service-code {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill {
  background: #e7f4ef;
  color: var(--green);
}

.risk-chip {
  background: #fff4de;
  color: var(--gold);
}

.risk-chip.high {
  background: #fee4e2;
  color: var(--red);
}

.risk-chip.low {
  background: #e7f4ef;
  color: var(--green);
}

.intake-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #354656;
  font-size: 14px;
  font-weight: 720;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

textarea {
  resize: vertical;
  min-height: 118px;
}

.route-summary {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
  background: #fbfcfd;
}

.route-summary h3 {
  margin: 0;
  font-size: 20px;
}

.route-summary p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.summary-visual {
  position: relative;
  display: grid;
  width: 112px;
  height: 88px;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.summary-visual span {
  border: 1px solid rgba(23, 33, 43, 0.12);
  border-radius: 8px;
}

.summary-visual span:nth-child(1) {
  background: #d9eee9;
}

.summary-visual span:nth-child(2) {
  background: #f7dfae;
}

.summary-visual span:nth-child(3) {
  grid-column: 1 / -1;
  background: #d8e4f4;
}

.agent-steps {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.agent-steps li {
  position: relative;
  display: grid;
  gap: 4px;
  border-left: 3px solid var(--teal);
  padding: 10px 12px 10px 16px;
  background: #f7faf9;
  border-radius: 0 8px 8px 0;
}

.agent-steps strong {
  font-size: 15px;
}

.agent-steps span {
  color: var(--muted);
  line-height: 1.55;
}

.process-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 20px;
  overflow: hidden;
}

.process-strip div {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.process-strip div:last-child {
  border-right: 0;
}

.process-strip span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.process-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
}

.process-strip p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.evidence-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 20px;
  margin-top: 20px;
}

.file-panel,
.knowledge-panel {
  padding: 20px;
}

.compact {
  min-height: 34px;
  padding: 0 12px;
}

.upload-zone {
  border: 1px dashed #aab5bf;
  border-radius: 8px;
  padding: 18px;
  background: #fbfcfd;
}

.upload-zone strong {
  display: block;
  font-size: 17px;
}

.upload-zone p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.source-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.source-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

.source-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-list strong {
  color: var(--teal-dark);
  font-size: 13px;
  white-space: nowrap;
}

.review-ladder {
  display: grid;
  gap: 12px;
}

.review-ladder div {
  border-left: 3px solid var(--blue);
  border-radius: 0 8px 8px 0;
  background: #f2f7fc;
  padding: 12px 14px;
}

.review-ladder span {
  color: var(--blue);
  font-weight: 850;
}

.review-ladder p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.service-grid,
.pricing-grid,
.matter-board {
  display: grid;
  gap: 16px;
}

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

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

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

.service-card,
.pricing-card,
.matter-item {
  padding: 18px;
}

.service-card {
  display: grid;
  gap: 14px;
  align-content: start;
  min-height: 290px;
}

.service-card h3,
.pricing-card h3,
.matter-item h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.28;
}

.service-card p,
.pricing-card p,
.matter-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.service-card strong,
.pricing-card strong {
  font-size: 22px;
}

.service-card button,
.pricing-card button {
  align-self: end;
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.service-card button:hover,
.pricing-card button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.service-code {
  width: max-content;
  background: #edf2f7;
  color: #405364;
}

.is-future {
  border-color: #d9c390;
  background: #fffaf0;
}

.pricing-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.pricing-card ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
  color: #405364;
  line-height: 1.5;
}

.pricing-card.is-featured {
  border-color: var(--teal);
  box-shadow: var(--shadow);
}

.pricing-card.is-featured button {
  border-color: var(--teal);
  background: var(--teal);
  color: #ffffff;
}

.matter-status {
  width: max-content;
  background: #edf2f7;
  color: #405364;
}

.matter-status.active {
  background: #e7f4ef;
  color: var(--green);
}

.matter-status.queued {
  background: #e7eef8;
  color: var(--blue);
}

.matter-item {
  display: grid;
  gap: 14px;
}

progress {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #edf2f7;
}

progress::-webkit-progress-bar {
  background: #edf2f7;
}

progress::-webkit-progress-value {
  background: var(--teal);
}

progress::-moz-progress-bar {
  background: var(--teal);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.38);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: min(520px, 100vw);
  height: 100vh;
  padding: 28px;
  background: #ffffff;
  box-shadow: -20px 0 45px rgba(15, 23, 42, 0.16);
  transform: translateX(100%);
  transition: transform 180ms ease;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 8px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.drawer h2 {
  margin: 22px 0 10px;
  font-size: 24px;
}

.drawer p {
  color: var(--muted);
  line-height: 1.65;
}

.drawer-list {
  display: grid;
  gap: 12px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.drawer-list li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  line-height: 1.5;
}

.mini-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.read-only-field {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 11px 12px;
  color: var(--ink);
  font-weight: 650;
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

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

  .workspace-grid,
  .tool-launcher,
  .evidence-grid,
  .pricing-grid,
  .matter-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    padding: 16px;
    gap: 16px;
  }

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

  .sidebar-note {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .route-summary,
  .review-banner {
    display: grid;
  }

  .route-summary {
    grid-template-columns: 1fr;
  }

  .summary-visual {
    width: 100%;
  }

  .process-strip,
  .service-grid,
  .tool-launcher,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

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

  .process-strip div:last-child {
    border-bottom: 0;
  }
}
