:root {
  --green: #86bc25;
  --green-dark: #4d9f16;
  --ink: #111827;
  --muted: #6b7280;
  --line: rgba(17, 24, 39, 0.08);
  --panel: rgba(255, 255, 255, 0.72);
  --page: #f7f9f7;
  --danger: #e5484d;
  --warning: #d97706;
  --info: #2563eb;
  --shadow-soft: 0 18px 50px rgba(16, 24, 40, 0.08);
  --shadow-lift: 0 24px 70px rgba(16, 24, 40, 0.14);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 18%, rgba(134, 188, 37, 0.1), transparent 24%),
    radial-gradient(circle at 82% 8%, rgba(37, 99, 235, 0.06), transparent 18%),
    linear-gradient(180deg, #fbfcfb 0%, var(--page) 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(134, 188, 37, 0.12);
}

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.home-page {
  min-height: 100vh;
  padding: 26px clamp(20px, 5vw, 72px) 116px 300px;
  position: relative;
}

.home-page.history-collapsed {
  padding-left: clamp(20px, 5vw, 72px);
}

.history-rail {
  position: fixed;
  top: 26px;
  left: 24px;
  bottom: 28px;
  width: 242px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  padding: 16px;
  overflow: auto;
  transition: transform 220ms ease, opacity 220ms ease;
  z-index: 5;
}

.history-collapsed .history-rail {
  transform: translateX(-280px);
  opacity: 0;
  pointer-events: none;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.history-peek {
  display: none;
  position: fixed;
  left: 22px;
  top: 30px;
  z-index: 6;
  border-radius: 999px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
}

.history-peek.show {
  display: inline-flex;
}

.history-search {
  width: 100%;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  outline: 0;
  padding: 0 12px;
  color: var(--ink);
}

.history-search:focus {
  border-color: rgba(134, 188, 37, 0.46);
  box-shadow: 0 0 0 4px rgba(134, 188, 37, 0.1);
}

.history-group {
  margin-top: 16px;
}

.history-group p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.new-session {
  width: 100%;
  margin-bottom: 12px;
}

.top-nav,
.home-hero,
.module-card,
.agent-composer {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.top-nav {
  height: 56px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.nav-actions {
  display: flex;
  gap: 10px;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  border: 1px solid var(--line);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.pill-button svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.pill-button:hover {
  transform: translateY(-2px);
  border-color: rgba(134, 188, 37, 0.48);
  box-shadow: 0 14px 34px rgba(16, 24, 40, 0.1);
}

.home-hero {
  width: min(920px, 100%);
  margin: clamp(62px, 10vh, 108px) auto 24px;
  border-radius: 32px;
  padding: 42px 38px 34px;
  text-align: center;
}

.hero-badge {
  width: 88px;
  height: 88px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.38)),
    radial-gradient(circle at 72% 26%, rgba(134, 188, 37, 0.25), transparent 32%);
  border: 1px solid rgba(134, 188, 37, 0.22);
  box-shadow: 0 18px 44px rgba(134, 188, 37, 0.16);
  animation: badgeBreath 3.6s ease-in-out infinite;
}

@keyframes badgeBreath {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.025);
  }
}

.hero-badge svg {
  width: 42px;
  height: 42px;
  color: var(--green-dark);
}

.home-title {
  margin: 0;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

.home-subtitle {
  width: min(680px, 100%);
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
}

.module-grid {
  width: min(920px, 100%);
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.module-card {
  min-height: 118px;
  border-radius: 22px;
  padding: 20px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.module-card:hover {
  transform: translateY(-4px);
  border-color: rgba(134, 188, 37, 0.45);
  box-shadow: var(--shadow-lift);
}

.icon-chip {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.tint-blue { background: rgba(37, 99, 235, 0.1); }
.tint-green { background: rgba(134, 188, 37, 0.16); }
.tint-rose { background: rgba(229, 72, 77, 0.1); }
.tint-violet { background: rgba(124, 58, 237, 0.1); }
.tint-cyan { background: rgba(8, 145, 178, 0.1); }
.tint-amber { background: rgba(217, 119, 6, 0.12); }

.module-title {
  margin: 0 0 6px;
  font-size: 16px;
}

.module-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.recommendations {
  width: min(920px, 100%);
  margin: 18px auto 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.question-chip {
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  color: var(--muted);
}

.agent-composer {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  width: min(1120px, calc(100vw - 42px));
  height: 66px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: 44px 152px 1fr 46px;
  align-items: center;
  gap: 12px;
  padding: 10px;
}

.model-select {
  height: 44px;
  min-width: 0;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.04);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.model-select select {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  appearance: none;
}

.composer-input {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.composer-input:focus {
  box-shadow: none;
}

.icon-button,
.send-button {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
}

.icon-button {
  background: rgba(17, 24, 39, 0.05);
}

.send-button {
  background: var(--green);
  color: white;
  box-shadow: 0 14px 34px rgba(134, 188, 37, 0.3);
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(480px, 1fr) 360px;
  gap: 16px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(247, 249, 247, 0.92), rgba(240, 244, 240, 0.92));
}

.side-panel,
.chat-panel,
.evidence-panel {
  border-radius: 26px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.side-panel {
  padding: 18px;
}

.workspace-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  margin-bottom: 22px;
}

.side-section {
  margin-top: 20px;
}

.side-title {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 10px;
}

.session-item {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--ink);
}

.session-item.active {
  background: rgba(134, 188, 37, 0.12);
  box-shadow: inset 3px 0 0 var(--green);
}

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

.task-stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.task-stat strong {
  color: var(--ink);
}

.chat-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 36px);
}

.chat-scroll {
  padding: 22px;
  overflow: auto;
  flex: 1;
}

.message {
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
}

.message.user {
  background: rgba(17, 24, 39, 0.04);
}

.answer-title {
  margin: 0 0 10px;
  font-size: 22px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 18px 0;
}

.metric-card {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.metric-card strong {
  display: block;
  font-size: 24px;
  margin-bottom: 4px;
}

.skill-timeline {
  display: grid;
  gap: 12px;
}

.skill-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.skill-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  background: transparent;
  padding: 0;
  text-align: left;
}

.skill-card-toggle {
  cursor: pointer;
}

.skill-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.6;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(134, 188, 37, 0.12);
  animation: pulseDot 1.6s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.35); opacity: 1; }
}

.workspace-composer {
  position: sticky;
  transform: none;
  width: auto;
  left: auto;
  bottom: 18px;
  margin: 0 18px 18px;
  z-index: 2;
}

.inline-composer {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  margin: 0;
  box-shadow: var(--shadow-soft);
}

.compact {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.evidence-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.tab-button {
  padding: 9px 6px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
}

.tab-button.active {
  background: rgba(134, 188, 37, 0.13);
  color: var(--ink);
}

.evidence-content {
  padding: 18px;
  overflow: auto;
  max-height: calc(100vh - 116px);
}

.evidence-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  margin-bottom: 12px;
}

.risk-high { color: var(--danger); }
.risk-medium { color: var(--warning); }
.risk-low { color: var(--green-dark); }

.analysis-page {
  min-height: 100vh;
  padding: 18px;
}

.analysis-header,
.analysis-grid,
.table-card,
.detail-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.analysis-header {
  border-radius: 24px;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.loop-ribbon {
  margin: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.loop-step {
  min-width: 0;
  min-height: 70px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  align-items: center;
  text-align: left;
  padding: 12px;
  color: var(--ink);
}

.loop-step span {
  grid-row: 1 / 3;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.06);
  color: var(--muted);
}

.loop-step small {
  color: var(--muted);
}

.loop-step.complete span,
.loop-step.active span {
  background: rgba(134, 188, 37, 0.18);
  color: var(--green-dark);
}

.loop-step.active {
  border-color: rgba(134, 188, 37, 0.48);
  box-shadow: 0 18px 42px rgba(134, 188, 37, 0.12);
}

.context-strip {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.context-strip article {
  min-width: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
  padding: 12px;
}

.context-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.context-strip strong {
  display: block;
  font-size: 13px;
  line-height: 1.4;
}

.action-notice {
  margin: 12px 0 0;
  border-radius: 16px;
  border: 1px solid rgba(134, 188, 37, 0.28);
  background: rgba(134, 188, 37, 0.1);
  color: var(--green-dark);
  padding: 12px 14px;
}

.analysis-grid {
  margin-top: 16px;
  border-radius: 26px;
  padding: 16px;
  display: grid;
  grid-template-columns: 220px minmax(520px, 1fr) 340px;
  gap: 16px;
}

.clause-tree,
.detail-panel {
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.table-card {
  border-radius: 20px;
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.data-table th {
  color: var(--muted);
  background: rgba(17, 24, 39, 0.03);
  font-weight: 650;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(17, 24, 39, 0.05);
  color: var(--muted);
  font-size: 12px;
}

.badge.high {
  background: rgba(229, 72, 77, 0.1);
  color: var(--danger);
}

.badge.medium {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.badge.low {
  background: rgba(134, 188, 37, 0.14);
  color: var(--green-dark);
}

.generated-thread,
.generated-draft-card {
  background: rgba(134, 188, 37, 0.08);
}

.thread-head,
.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.thread-preview,
.preview-body {
  margin: 14px 0 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.04);
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.65;
}

.preview-panel {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.22);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.preview-card {
  width: min(760px, 100%);
  max-height: min(80vh, 760px);
  overflow: auto;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-lift);
  padding: 20px;
}

.detail-drawer {
  align-self: start;
}

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

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

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

  .top-nav {
    height: auto;
    gap: 12px;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .agent-composer {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    margin: 28px auto 0;
  }
}

/* Homepage prototype overrides */
@media (min-width: 1181px) {
  .home-page {
    padding-left: 430px;
    padding-right: 78px;
  }

  .home-page.history-collapsed {
    padding-left: 78px;
  }

  .history-rail {
    width: 360px;
    border-radius: 28px;
    padding: 26px;
  }

  .history-head strong {
    font-size: 24px;
  }

  .home-hero {
    margin-top: clamp(74px, 12vh, 130px);
    background: transparent;
    border-color: transparent;
    box-shadow: none;
    backdrop-filter: none;
    padding: 28px 20px 22px;
  }

  .home-title {
    font-size: clamp(36px, 4vw, 48px);
  }

  .module-grid {
    width: min(1120px, 100%);
    gap: 18px 28px;
  }

  .module-card {
    min-height: 108px;
    border-radius: 16px;
    padding: 18px 22px;
    grid-template-columns: 54px 1fr 18px;
  }

  .module-card::after {
    content: "›";
    align-self: center;
    justify-self: end;
    color: var(--muted);
    font-size: 24px;
  }

  .agent-composer {
    width: min(1260px, calc(100vw - 530px));
    left: calc(430px + (100vw - 430px) / 2);
    bottom: 28px;
  }

  .history-collapsed .agent-composer,
  .conversation-page .agent-composer {
    width: min(1260px, calc(100vw - 150px));
    left: 50%;
  }
}

.penalties-layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 260px minmax(520px, 1fr) 340px;
  gap: 16px;
}

.filter-panel,
.chart-panel,
.assistant-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
  border-radius: 24px;
  padding: 16px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(17, 24, 39, 0.05);
  color: var(--muted);
  transition: transform 180ms ease, background 180ms ease;
}

.tag-chip:hover,
.tag-chip.active {
  transform: translateY(-2px);
  background: rgba(134, 188, 37, 0.16);
  color: var(--ink);
}

.dimension-context {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.03);
}

.dimension-context p {
  margin: 6px 0 0;
  color: var(--muted);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.chart-box {
  min-height: 168px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.52)),
    repeating-linear-gradient(90deg, rgba(17,24,39,0.04) 0 1px, transparent 1px 42px);
  padding: 14px;
}

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

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 42px;
  gap: 8px;
  align-items: center;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
}

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

.penalty-case {
  cursor: pointer;
}

.penalty-case.active {
  border-color: rgba(134, 188, 37, 0.4);
  box-shadow: 0 16px 30px rgba(16, 24, 40, 0.08);
}

.case-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.6;
}

.module-workbench {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 280px minmax(520px, 1fr) 340px;
  gap: 16px;
}

.module-list,
.module-main,
.module-assistant,
.hero-detail,
.clause-card,
.record-row,
.task-card,
.artifact-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.module-list,
.module-main,
.module-assistant {
  border-radius: 24px;
  padding: 16px;
  min-width: 0;
}

.module-main {
  display: grid;
  gap: 14px;
}

.record-row,
.clause-card,
.task-card {
  width: 100%;
  display: grid;
  gap: 7px;
  text-align: left;
  border-radius: 16px;
  padding: 14px;
  margin-top: 10px;
  color: var(--ink);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.record-row span,
.record-row small,
.clause-card span,
.clause-card p,
.task-card p,
.task-card small,
.artifact-card small {
  color: var(--muted);
  line-height: 1.5;
}

.record-row:hover,
.record-row.active,
.clause-card:hover,
.clause-card.active,
.task-card:hover,
.task-card.active {
  transform: translateY(-2px);
  border-color: rgba(134, 188, 37, 0.42);
  box-shadow: 0 18px 40px rgba(16, 24, 40, 0.09);
}

.hero-detail {
  border-radius: 22px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.hero-detail h2,
.rich-detail h2 {
  margin: 10px 0;
  font-size: 22px;
}

.split-detail {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.1fr);
  gap: 14px;
}

.record-stack {
  min-width: 0;
}

.rich-detail {
  min-width: 0;
}

.rich-detail h3 {
  margin: 18px 0 8px;
  font-size: 14px;
}

.mini-query {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 8px;
  margin: 12px 0;
}

.mini-query input {
  min-width: 0;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  outline: 0;
  padding: 0 12px;
}

.mini-query input:focus {
  border-color: rgba(134, 188, 37, 0.5);
  box-shadow: 0 0 0 4px rgba(134, 188, 37, 0.1);
}

.mini-send {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}

.prompt-stack {
  display: grid;
  gap: 8px;
  margin: 10px 0 14px;
}

.answer-panel {
  margin-top: 12px;
  line-height: 1.65;
}

.answer-block {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.answer-block p {
  margin: 6px 0;
}

.answer-block small {
  color: var(--muted);
}

.tag-cloud.vertical {
  display: grid;
}

.bar-track.mini {
  display: block;
  width: 100%;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.task-card {
  margin: 0;
}

.task-detail {
  background:
    linear-gradient(160deg, rgba(134, 188, 37, 0.08), transparent 42%),
    rgba(255, 255, 255, 0.68);
}

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

.artifact-card {
  border-radius: 18px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.artifact-card strong {
  font-size: 16px;
}

.delivery-workbench {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 260px minmax(560px, 1fr) 360px;
  gap: 16px;
}

.delivery-table-card,
.delivery-preview-panel,
.document-preview,
.dimension-row,
.delivery-assistant {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.delivery-table-card {
  border-radius: 22px;
  overflow: hidden;
}

.delivery-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.delivery-table tr.active-row {
  background: rgba(134, 188, 37, 0.08);
}

.delivery-preview-panel {
  border-radius: 24px;
  padding: 16px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.document-preview {
  border-radius: 20px;
  padding: 16px;
  background:
    linear-gradient(155deg, rgba(134, 188, 37, 0.08), transparent 38%),
    rgba(255, 255, 255, 0.7);
}

.document-preview h2 {
  margin: 12px 0 8px;
  font-size: 21px;
}

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

.dimension-matrix {
  display: grid;
  gap: 9px;
}

.dimension-row {
  border-radius: 16px;
  padding: 12px;
}

.dimension-row p {
  margin: 6px 0;
  color: var(--muted);
  line-height: 1.5;
}

.dimension-row small {
  color: var(--muted);
  line-height: 1.45;
}

.delivery-assistant {
  border-radius: 18px;
  padding: 14px;
  box-shadow: none;
}

.closure-strip {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.closure-strip.wide {
  margin: 0;
}

.closure-strip span {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.04);
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12px;
}

.closure-strip span.active {
  background: rgba(134, 188, 37, 0.15);
  color: var(--ink);
  border-color: rgba(134, 188, 37, 0.34);
}

.full-width {
  width: 100%;
  margin-top: 12px;
}

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

  .module-workbench,
  .split-detail,
  .delivery-workbench {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 820px) {
  .home-page {
    padding-left: 20px;
    padding-right: 20px;
  }

  .history-rail {
    position: static;
    width: 100%;
    margin-bottom: 18px;
  }

  .history-collapsed .history-rail {
    display: none;
  }

  .history-peek {
    position: static;
    margin-bottom: 12px;
  }

  .hero-detail {
    flex-direction: column;
  }

  .task-board,
  .artifact-grid,
  .chart-grid,
  .loop-ribbon,
  .context-strip,
  .closure-strip,
  .delivery-toolbar {
    grid-template-columns: 1fr;
  }

  .agent-composer,
  .inline-composer {
    height: auto;
    grid-template-columns: 44px 1fr 46px;
  }

  .model-select {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

/* Prototype-aligned surfaces */
.product-page {
  min-height: 100vh;
  padding: 18px 22px 118px;
  background:
    radial-gradient(circle at 50% 10%, rgba(134, 188, 37, 0.06), transparent 22%),
    linear-gradient(180deg, #fff 0%, #fbfcfb 100%);
}

.proto-header {
  min-height: 88px;
  margin: -18px -22px 28px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.proto-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.proto-title h1,
.delivery-head h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.proto-title p,
.delivery-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.proto-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wide-action,
.search-action {
  width: auto;
  min-width: 108px;
  padding: 0 20px;
}

.status-action {
  color: var(--info);
  background: rgba(255, 255, 255, 0.78);
}

.proto-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(166px, 1fr));
  gap: 18px;
  margin: 0 auto 26px;
}

.product-page .proto-kpi-grid:has(.proto-kpi:nth-child(6)) {
  grid-template-columns: repeat(auto-fit, minmax(166px, 1fr));
}

.proto-kpi {
  min-height: 122px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 38px rgba(16, 24, 40, 0.06);
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px 18px;
}

.proto-kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: var(--green-dark);
}

.proto-kpi-icon svg,
.row-icon svg {
  width: 28px;
  height: 28px;
}

.proto-kpi p {
  margin: 0;
  color: var(--ink);
  font-weight: 650;
}

.proto-kpi strong {
  display: block;
  margin: 6px 0;
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0;
}

.proto-kpi small {
  color: var(--muted);
}

.proto-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
  border-radius: 22px;
  padding: 22px;
  overflow: hidden;
}

.filter-row {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.compact-filter-card .filter-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr)) auto auto auto;
  gap: 12px;
}

.compact-filter-card .filter-select {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.compact-filter-card .pill-button,
.compact-filter-card .wide-action {
  min-height: 50px;
  white-space: nowrap;
}

.filter-input {
  height: 50px;
  min-width: 300px;
  flex: 1 1 360px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  outline: 0;
  padding: 0 18px;
  color: var(--ink);
}

.filter-input.wide {
  flex-basis: 720px;
}

.filter-select {
  min-height: 50px;
  min-width: 122px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  text-align: left;
}

.filter-select.active {
  border-color: rgba(134, 188, 37, 0.45);
  background: rgba(134, 188, 37, 0.1);
}

.filter-select span {
  float: right;
  color: var(--muted);
}

.prototype-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.prototype-table th,
.prototype-table td {
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.prototype-table th {
  color: #374151;
  font-weight: 700;
  background: rgba(17, 24, 39, 0.025);
}

.prototype-table tr.active-row {
  background: rgba(134, 188, 37, 0.06);
  outline: 1px solid rgba(134, 188, 37, 0.32);
}

.prototype-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.table-title {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  text-align: left;
  background: transparent;
  color: var(--ink);
}

.table-title small {
  grid-column: 2;
}

.row-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  margin-right: 10px;
  vertical-align: middle;
  color: var(--green-dark);
}

.coverage-bar {
  width: 94px;
  height: 7px;
  display: inline-block;
  margin: 0 8px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
  vertical-align: middle;
  overflow: hidden;
}

.coverage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.coverage-bar.amber span {
  background: #f59e0b;
}

.coverage-bar.rose span {
  background: #ef4444;
}

.proto-prompt {
  width: min(1280px, calc(100vw - 220px));
  margin: 34px auto 0;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
  padding: 16px;
}

.prompt-chip-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.proto-composer {
  min-height: 66px;
  border-radius: 18px;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 46px 160px 1fr 48px;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.82);
}

.proto-answer {
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid rgba(134, 188, 37, 0.24);
  background: rgba(134, 188, 37, 0.08);
  padding: 16px 18px;
}

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

.custom-tags {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.penalty-split,
.gap-layout,
.delivery-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 18px;
  margin-top: 18px;
}

.detail-drawer-v2,
.delivery-scheme-panel {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
  padding: 20px;
  align-self: start;
}

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.penalty-detail-list {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 12px 18px;
  margin: 0;
  line-height: 1.55;
}

.penalty-detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.penalty-detail-list dd {
  margin: 0;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  color: var(--muted);
}

.context-chip-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 20px;
}

.context-chip-row span {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 10px 16px;
  color: #374151;
  font-weight: 650;
}

.gap-table {
  font-size: 12px;
}

.gap-table th,
.gap-table td {
  padding: 14px 12px;
}

.gap-detail-stack {
  display: grid;
  gap: 12px;
}

.gap-detail-stack article {
  padding-left: 12px;
  border-left: 3px solid rgba(134, 188, 37, 0.3);
}

.gap-detail-stack p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.dispatch-box {
  margin-top: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(247, 249, 247, 0.72);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.dispatch-box label {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
}

.dispatch-box label span {
  min-width: 180px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: white;
  padding: 8px 10px;
  color: var(--ink);
}

.delivery-proto-page {
  padding-left: 24px;
  padding-right: 24px;
}

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

.delivery-process {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  padding: 13px 18px;
  margin-bottom: 24px;
  color: var(--muted);
}

.delivery-process b {
  color: #9ca3af;
}

.delivery-process span.active {
  color: var(--green-dark);
  font-weight: 800;
}

.delivery-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.text-action {
  background: transparent;
  color: var(--green-dark);
  font-weight: 700;
  margin-right: 12px;
}

.delivery-closure {
  margin-top: 16px;
  padding: 10px 0 0;
}

.scheme-tags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.scheme-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: start;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  padding: 14px;
  margin-bottom: 12px;
}

.scheme-row p {
  margin: 6px 0 0;
  color: var(--muted);
}

.scheme-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.dark-action {
  min-height: 46px;
  border-radius: 12px;
  background: #050807;
  color: white;
  font-weight: 700;
}

.regulation-detail-page .proto-kpi-grid {
  width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 0;
}

.interpretation-summary {
  display: grid;
  gap: 18px;
  margin-bottom: 18px;
}

.interpretation-title-card {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
}

.interpretation-title-card h2 {
  margin: 12px 0 8px;
  font-size: 24px;
  letter-spacing: 0;
}

.interpretation-title-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.interpretation-meta {
  min-width: 260px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

.interpretation-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 370px;
  gap: 18px;
  align-items: start;
}

.clause-outline {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.clause-list {
  display: grid;
  gap: 10px;
}

.clause-outline-item {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  padding: 14px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 6px 12px;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.clause-outline-item:hover,
.clause-outline-item.active {
  transform: translateY(-2px);
  border-color: rgba(134, 188, 37, 0.42);
  background: rgba(246, 251, 239, 0.9);
}

.clause-outline-item span {
  grid-row: span 3;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(134, 188, 37, 0.12);
  color: var(--green-dark);
  font-weight: 800;
}

.clause-outline-item strong {
  font-size: 14px;
}

.clause-outline-item small {
  color: var(--muted);
  line-height: 1.4;
}

.clause-outline-item em {
  width: fit-content;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  color: var(--green-dark);
  background: rgba(134, 188, 37, 0.12);
}

.clause-outline-item em.high {
  color: var(--danger);
  background: rgba(229, 72, 77, 0.1);
}

.clause-outline-item em.medium {
  color: var(--warning);
  background: rgba(217, 119, 6, 0.12);
}

.clause-decomposition {
  display: grid;
  gap: 18px;
}

.source-clause-card blockquote {
  margin: 16px 0;
  border-left: 4px solid rgba(134, 188, 37, 0.44);
  padding: 14px 18px;
  border-radius: 0 16px 16px 0;
  background: rgba(247, 250, 244, 0.9);
  color: #1f2937;
  line-height: 1.7;
}

.dimension-stack {
  display: grid;
  gap: 14px;
}

.dimension-card {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 14px 38px rgba(16, 24, 40, 0.05);
  padding: 18px;
}

.dimension-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.dimension-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px 16px;
}

.dimension-card dt {
  color: var(--muted);
  font-weight: 750;
}

.dimension-card dd {
  margin: 0;
  line-height: 1.65;
  color: #263244;
}

.interpretation-side {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 18px;
}

.vertical-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.vertical-actions .wide-action,
.vertical-actions .pill-button {
  width: 100%;
}

.interpretation-chain {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.interpretation-answer {
  width: min(1180px, 100%);
  margin: 22px auto;
}

.conversation-page .home-hero,
.conversation-page .module-grid,
.conversation-page .recommendations {
  display: none;
}

.conversation-main {
  width: min(1080px, 100%);
  margin: 42px auto 126px;
  display: grid;
  gap: 18px;
}

.chat-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.user-row {
  grid-template-columns: minmax(0, 760px) 42px;
  justify-content: end;
}

.user-row .chat-avatar {
  order: 2;
}

.user-row .chat-bubble {
  order: 1;
}

.chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.08);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.agent-avatar {
  background: rgba(134, 188, 37, 0.12);
}

.chat-bubble,
.reasoning-panel,
.final-answer {
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  padding: 20px;
}

.user-bubble {
  justify-self: end;
  max-width: 760px;
  background: rgba(17, 24, 39, 0.05);
  line-height: 1.72;
}

.reasoning-panel p,
.final-answer p {
  margin: 6px 0 0;
  color: var(--muted);
}

.agent-run-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(134, 188, 37, 0.22);
  background:
    linear-gradient(135deg, rgba(134, 188, 37, 0.11), rgba(255, 255, 255, 0.72)),
    rgba(255, 255, 255, 0.72);
}

.agent-run-status > span {
  min-width: 56px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(134, 188, 37, 0.16);
  color: var(--green-dark);
  font-weight: 800;
}

.agent-run-status.running > span {
  animation: badgeBreath 1.8s ease-in-out infinite;
}

.agent-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.06);
  margin: 12px 0 18px;
}

.agent-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #4d9f16);
  transition: width 460ms ease;
}

.thinking-console {
  margin: 16px 0;
  border-radius: 18px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background:
    linear-gradient(180deg, rgba(17, 24, 39, 0.035), rgba(17, 24, 39, 0.015)),
    rgba(255, 255, 255, 0.64);
  overflow: hidden;
}

.thinking-head {
  height: 46px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.thinking-head span {
  height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--green-dark);
  background: rgba(134, 188, 37, 0.13);
  font-size: 12px;
  font-weight: 800;
}

.thinking-stream {
  display: grid;
  gap: 0;
}

.thinking-line {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 118px;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
  transition: background 200ms ease, opacity 200ms ease, transform 200ms ease;
}

.thinking-line:last-child {
  border-bottom: 0;
}

.thinking-line > span {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(134, 188, 37, 0.13);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

.thinking-line p {
  margin: 0;
  color: var(--ink);
  line-height: 1.62;
}

.thinking-line small {
  justify-self: end;
  color: var(--muted);
  font-size: 12px;
}

.thinking-line.pending {
  opacity: 0.42;
}

.thinking-line.active {
  background: rgba(134, 188, 37, 0.08);
}

.thinking-line.active p::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -2px;
  border-radius: 999px;
  background: var(--green);
  animation: cursorBlink 900ms steps(2, start) infinite;
}

.tool-call-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.tool-call {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.025);
  padding: 10px;
  animation: revealUp 260ms ease both;
}

.tool-call.done {
  border-color: rgba(134, 188, 37, 0.16);
  background: rgba(134, 188, 37, 0.055);
}

.tool-call strong {
  color: var(--ink);
}

.tool-call > span {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(134, 188, 37, 0.16);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
}

.tool-call.active > span {
  color: transparent;
  background: conic-gradient(from 120deg, var(--green), rgba(134, 188, 37, 0.12), var(--green));
  animation: spin 1.2s linear infinite;
}

.tool-call p {
  font-size: 12px;
  color: var(--muted);
}

.reasoning-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.reasoning-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  border-radius: 16px;
  border: 1px solid rgba(17, 24, 39, 0.06);
  background: rgba(255, 255, 255, 0.54);
  padding: 12px;
  transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.reasoning-step.active {
  border-color: rgba(134, 188, 37, 0.36);
  background: rgba(134, 188, 37, 0.08);
  transform: translateY(-1px);
}

.reasoning-step.pending {
  opacity: 0.48;
}

.reasoning-step span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(134, 188, 37, 0.15);
  color: var(--green-dark);
  font-weight: 800;
}

.reasoning-step.active span {
  box-shadow: 0 0 0 7px rgba(134, 188, 37, 0.12);
}

.reasoning-step small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 12px;
}

.generation-state {
  display: inline-flex;
  align-items: center;
  height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  border: 1px solid rgba(134, 188, 37, 0.28);
  background: rgba(134, 188, 37, 0.12);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

.stream-output {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.reasoning-trace-summary {
  border-radius: 18px;
  border: 1px solid rgba(134, 188, 37, 0.22);
  background:
    linear-gradient(135deg, rgba(134, 188, 37, 0.1), rgba(255, 255, 255, 0.82)),
    rgba(255, 255, 255, 0.7);
  padding: 16px;
}

.trace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.trace-head p {
  max-width: 560px;
  text-align: right;
  margin: 0;
}

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

.trace-grid article {
  border-radius: 14px;
  border: 1px solid rgba(17, 24, 39, 0.07);
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
}

.trace-grid p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.output-block {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.025);
  padding: 14px;
  opacity: 0.56;
  transition: opacity 220ms ease, transform 220ms ease, border-color 220ms ease, background 220ms ease;
}

.output-block.visible {
  opacity: 1;
  background: rgba(255, 255, 255, 0.62);
  animation: revealUp 260ms ease both;
}

.output-block.streaming {
  border-color: rgba(134, 188, 37, 0.34);
}

.output-block.streaming p::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 4px;
  vertical-align: -2px;
  border-radius: 999px;
  background: var(--green);
  animation: cursorBlink 900ms steps(2, start) infinite;
}

.output-block small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.wide-send {
  width: auto;
  padding: 0 18px;
}

@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes cursorBlink {
  0%, 45% {
    opacity: 1;
  }
  46%, 100% {
    opacity: 0;
  }
}

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

.answer-grid article {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 39, 0.03);
  padding: 14px;
}

.answer-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.tiny {
  width: 9px;
  height: 9px;
  display: inline-block;
  margin-right: 8px;
  animation: none;
}

@media (max-width: 1280px) {
  .proto-kpi-grid,
  .product-page .proto-kpi-grid:has(.proto-kpi:nth-child(6)) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .penalty-split,
  .gap-layout,
  .delivery-main-grid,
  .interpretation-layout {
    grid-template-columns: 1fr;
  }

  .clause-outline,
  .interpretation-side {
    position: static;
    max-height: none;
  }

  .proto-prompt {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .proto-header,
  .delivery-head {
    flex-direction: column;
    align-items: stretch;
  }

  .proto-title {
    align-items: flex-start;
  }

  .proto-kpi-grid,
  .product-page .proto-kpi-grid:has(.proto-kpi:nth-child(6)),
  .dimension-grid,
  .answer-grid,
  .tool-call-row,
  .reasoning-steps,
  .trace-grid {
    grid-template-columns: 1fr;
  }

  .thinking-line {
    grid-template-columns: 1fr;
  }

  .thinking-line small {
    justify-self: start;
  }

  .trace-head {
    display: block;
  }

  .trace-head p {
    margin-top: 6px;
    text-align: left;
  }

  .chat-row,
  .user-row {
    grid-template-columns: 1fr;
  }

  .chat-avatar {
    display: none;
  }

  .interpretation-title-card,
  .dimension-card dl {
    grid-template-columns: 1fr;
  }

  .proto-composer {
    grid-template-columns: 44px 1fr 48px;
  }

  .proto-composer .model-select {
    grid-column: 1 / -1;
  }

  .prototype-table {
    min-width: 880px;
  }

  .proto-card {
    overflow-x: auto;
  }
}
