:root {
  --bg-canvas: #f5f4ef;
  --bg-surface: #ffffff;
  --bg-subtle: #efede6;
  --bg-elevated: #faf9f6;
  --border-soft: #e2dfd5;
  --border-strong: #cbc6b8;
  --ink-primary: #111827;
  --ink-secondary: #374151;
  --ink-muted: #6b7280;
  --accent-indigo: #1e3a8a;
  --accent-indigo-hover: #172d6d;
  --accent-indigo-soft: #e8eefc;
  --accent-gold: #9a5b08;
  --accent-gold-soft: #fef6e6;
  --accent-emerald: #065f46;
  --accent-emerald-soft: #ecfdf5;
  --accent-crimson: #991b1b;
  --accent-crimson-soft: #fef2f2;
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 6px 20px rgba(17, 24, 39, 0.07);
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

html[data-theme="dark"] {
  --bg-canvas: #0b1120;
  --bg-surface: #111827;
  --bg-subtle: #1e293b;
  --bg-elevated: #162033;
  --border-soft: #243247;
  --border-strong: #334155;
  --ink-primary: #f3f4f6;
  --ink-secondary: #cbd5e1;
  --ink-muted: #94a3b8;
  --accent-indigo: #60a5fa;
  --accent-indigo-hover: #93c5fd;
  --accent-indigo-soft: rgba(59, 130, 246, 0.16);
  --accent-gold: #fbbf24;
  --accent-gold-soft: rgba(245, 158, 11, 0.14);
  --accent-emerald: #34d399;
  --accent-emerald-soft: rgba(16, 185, 129, 0.14);
  --accent-crimson: #f87171;
  --accent-crimson-soft: rgba(239, 68, 68, 0.14);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-canvas);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* TOP COMMAND BAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  z-index: 20;
  flex-shrink: 0;
}

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

.brand-emblem {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.05;
}

.edition-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
  border: 1px solid rgba(180, 83, 9, 0.22);
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.main-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--ink-primary);
  background: rgba(255, 255, 255, 0.45);
}

.tab-btn.active {
  background: var(--bg-surface);
  color: var(--accent-indigo);
  box-shadow: var(--shadow-sm);
}

.tab-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--accent-indigo-soft);
  color: var(--accent-indigo);
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.engine-selector-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

#provider-select {
  border: none;
  background: transparent;
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-soft);
  background: var(--bg-elevated);
  color: var(--ink-primary);
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  border-color: var(--border-strong);
}

/* MAIN WORKSPACE SPLIT */
.workspace-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  min-height: 0;
  overflow: hidden;
}

.main-stage {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view-panel {
  display: none;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.view-panel.active {
  display: flex;
  flex-direction: column;
}

.panel-inner {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 40px;
}

/* CHAT WORKSPACE */
.chat-layout {
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.sessions-rail {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border-soft);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.primary-btn {
  border: none;
  background: #1e3a8a;
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12.5px;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
  background: #172d6d;
}

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

.full-width {
  width: 100%;
}

.rail-section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-top: 4px;
}

.session-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  cursor: pointer;
  color: var(--ink-secondary);
  font-size: 12.5px;
  transition: all 0.14s ease;
}

.session-item:hover {
  background: var(--bg-surface);
  border-color: var(--border-soft);
}

.session-item.active {
  background: var(--bg-surface);
  border-color: var(--accent-indigo);
  color: var(--ink-primary);
  font-weight: 600;
}

.session-item-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.session-del-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
}

.session-item:hover .session-del-btn {
  opacity: 1;
}

.session-del-btn:hover {
  color: var(--accent-crimson);
  background: var(--accent-crimson-soft);
}

.rail-footer-card {
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.rail-footer-title {
  font-weight: 700;
  color: var(--ink-primary);
  margin-bottom: 4px;
  font-size: 12px;
}

.rail-footer-card p {
  margin: 0;
  line-height: 1.45;
}

.chat-column {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-canvas);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* WELCOME HERO & STARTER SCENARIOS */
.welcome-hero {
  max-width: 820px;
  margin: 10px auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 26px 28px;
  box-shadow: var(--shadow-sm);
}

.welcome-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-gold);
  letter-spacing: 0.06em;
}

.welcome-title {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  margin: 6px 0 8px;
  color: var(--ink-primary);
}

.welcome-lead {
  margin: 0 0 18px;
  color: var(--ink-secondary);
  font-size: 13.5px;
}

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

.starter-card {
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.starter-card:hover {
  border-color: var(--accent-indigo);
  background: var(--bg-surface);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.starter-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-indigo);
}

.starter-question {
  font-size: 12.5px;
  color: var(--ink-primary);
  font-weight: 500;
  line-height: 1.42;
}

/* CHAT BUBBLES */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 850px;
  width: 100%;
  margin: 0 auto;
}

.msg-row.user {
  align-items: flex-end;
}

.msg-user-bubble {
  background: #1e3a8a;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 12px 12px 2px 12px;
  max-width: 78%;
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
  white-space: pre-wrap;
}

.msg-assistant-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.msg-meta-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.msg-author-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--ink-primary);
}

.msg-model-pill {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-subtle);
  color: var(--ink-secondary);
}

/* RENDERED LEGAL PROSE & CLICKABLE CITATIONS */
.legal-prose h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 16px 0 7px;
  color: var(--ink-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.legal-prose h3:first-child {
  margin-top: 0;
}

.legal-prose p {
  margin: 0 0 10px;
  color: var(--ink-secondary);
  line-height: 1.65;
}

.legal-prose ul,
.legal-prose ol {
  margin: 4px 0 12px;
  padding-left: 20px;
  color: var(--ink-secondary);
}

.legal-prose li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.legal-prose strong {
  color: var(--ink-primary);
  font-weight: 600;
}

.legal-prose code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-subtle);
  padding: 1px 5px;
  border-radius: 4px;
}

.inline-ref-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  margin: 0 2px;
  border-radius: 5px;
  background: var(--accent-indigo-soft);
  color: var(--accent-indigo);
  border: 1px solid rgba(30, 58, 138, 0.24);
  cursor: pointer;
  vertical-align: baseline;
  transition: all 0.14s ease;
}

.inline-ref-pill:hover,
.inline-ref-pill.selected {
  background: #1e3a8a;
  color: #ffffff;
  border-color: #1e3a8a;
}

/* VERIFIED CITATION STRIP UNDER EACH AI MESSAGE */
.citations-strip {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px dashed var(--border-strong);
}

.citations-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.citations-strip-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--accent-emerald);
}

.msg-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  border: 1px solid var(--border-soft);
  background: var(--bg-elevated);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
}

.mini-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}

.citation-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.citation-mini-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 7px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 260px;
  text-align: left;
  transition: all 0.14s ease;
}

.citation-mini-card:hover,
.citation-mini-card.selected {
  border-color: var(--accent-indigo);
  background: var(--accent-indigo-soft);
}

.citation-mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent-indigo);
}

.citation-mini-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* COMPOSER */
.chat-composer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-soft);
  padding: 14px 28px 12px;
}

.composer-input-wrap {
  max-width: 850px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 10px;
}

#chat-input {
  flex: 1;
  resize: none;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.45;
  outline: none;
}

#chat-input:focus {
  border-color: var(--accent-indigo);
  background: var(--bg-surface);
}

.send-btn {
  border: none;
  border-radius: 10px;
  background: #1e3a8a;
  color: #ffffff;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  padding: 0 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.send-btn:hover:not(:disabled) {
  background: #172d6d;
}

.send-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.composer-hint-row {
  max-width: 850px;
  margin: 6px auto 0;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-muted);
}

kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
  background: var(--bg-elevated);
}

/* RIGHT INSPECTOR DRAWER */
.inspector-drawer {
  background: var(--bg-surface);
  border-left: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.inspector-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elevated);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.inspector-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent-gold);
}

.inspector-title {
  margin: 3px 0 0;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink-primary);
}

.ref-code-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-indigo-soft);
  color: var(--accent-indigo);
  flex-shrink: 0;
}

.inspector-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ins-law-code {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-indigo);
}

.ins-doc-title {
  margin: 4px 0 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.22;
  color: var(--ink-primary);
}

.ins-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  padding: 11px 12px;
  border-radius: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  font-size: 12px;
}

.ins-meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.ins-meta-key {
  color: var(--ink-muted);
  flex-shrink: 0;
}

.ins-meta-val {
  font-weight: 600;
  color: var(--ink-primary);
  text-align: right;
}

.ins-block {
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
}

.ins-block.engineering {
  background: var(--accent-emerald-soft);
  border-color: rgba(6, 95, 70, 0.22);
}

.ins-block.penalty {
  background: var(--accent-crimson-soft);
  border-color: rgba(153, 27, 27, 0.22);
}

.ins-block-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  color: var(--ink-muted);
}

.ins-block.engineering .ins-block-label {
  color: var(--accent-emerald);
}

.ins-block.penalty .ins-block-label {
  color: var(--accent-crimson);
}

.ins-block p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.58;
  color: var(--ink-primary);
}

.ins-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.outline-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--ink-primary);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
}

.outline-link-btn:hover {
  border-color: var(--accent-indigo);
  color: var(--accent-indigo);
}

/* CORPUS VIEW */
.editorial-heading {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 400;
  margin: 0 0 6px;
}

.section-desc {
  margin: 0 0 18px;
  color: var(--ink-secondary);
  max-width: 820px;
}

.search-filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  color: var(--ink-muted);
}

#corpus-search-input {
  width: 100%;
  padding: 12px 16px 12px 38px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
}

#corpus-search-input:focus {
  border-color: var(--accent-indigo);
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.cat-pill {
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
  color: var(--ink-secondary);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 99px;
  cursor: pointer;
}

.cat-pill.active {
  background: #1e3a8a;
  color: #ffffff;
  border-color: #1e3a8a;
}

.corpus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.corpus-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.corpus-card:hover {
  border-color: var(--accent-indigo);
  box-shadow: var(--shadow-md);
}

.corpus-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.risk-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.risk-chip.Kritik {
  background: var(--accent-crimson-soft);
  color: var(--accent-crimson);
}

.risk-chip.Yüksek,
.risk-chip.Orta-Yüksek {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
}

.risk-chip.Orta {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.corpus-card-code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-indigo);
  margin-top: 6px;
}

.corpus-card-title {
  margin: 4px 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-primary);
}

.corpus-card-excerpt {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.corpus-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* RISK SIMULATOR */
.risk-simulator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.risk-questions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.risk-q-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.risk-q-card.checked {
  border-color: var(--accent-crimson);
  background: var(--accent-crimson-soft);
}

.risk-q-card input[type="checkbox"] {
  margin-top: 3px;
  width: 17px;
  height: 17px;
  accent-color: #991b1b;
  cursor: pointer;
}

.risk-q-title {
  font-weight: 700;
  color: var(--ink-primary);
  font-size: 13.5px;
}

.risk-q-detail {
  margin: 3px 0 6px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.score-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.score-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
}

.score-Dial-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 6px 0;
}

.score-number {
  font-family: var(--font-serif);
  font-size: 54px;
  line-height: 1;
  color: var(--ink-primary);
}

.score-max {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink-muted);
}

.risk-tier-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 8px;
}

.risk-tier-badge.low {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald);
}

.risk-tier-badge.moderate,
.risk-tier-badge.warning {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
}

.risk-tier-badge.critical {
  background: var(--accent-crimson-soft);
  color: var(--accent-crimson);
}

.score-help {
  font-size: 12px;
  color: var(--ink-muted);
  margin: 0 0 14px;
}

.risk-findings-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.finding-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--accent-crimson);
  border-radius: 9px;
  padding: 12px 14px;
}

.finding-card-title {
  font-weight: 700;
  font-size: 12.5px;
  margin-bottom: 4px;
}

.finding-card-action {
  font-size: 12px;
  color: var(--ink-secondary);
  margin-bottom: 7px;
}

/* CONTRACT TEMPLATES */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.template-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.template-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
}

.template-usecase {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.template-pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--ink-primary);
  margin: 10px 0 12px;
}

.template-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* LOADING STATE */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--ink-secondary);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-indigo);
  animation: pulseAnim 1s infinite ease-in-out;
}

@keyframes pulseAnim {
  0%, 100% { transform: scale(0.8); opacity: 0.4; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 20px;
  right: 24px;
  background: #111827;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.2s ease;
  z-index: 999;
}

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

@media (max-width: 1180px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) 330px;
  }
  .chat-layout {
    grid-template-columns: 205px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
  }
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .inspector-drawer {
    display: none;
  }
  .chat-layout,
  .risk-simulator-layout,
  .starter-grid {
    grid-template-columns: 1fr;
  }
  .sessions-rail {
    display: none;
  }
}
