@font-face {
  font-family: Figtree;
  src: url('/assets/fonts/Figtree-Variable.ttf') format('truetype');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --paper: #FFFEFB; --rail: #F5F2EA; --context: #FAF8F1; --wash: #ECEFE5;
  --ink: #28332B; --muted: #596354; --accent: #435B44; --edge: #77816F; --rule: #E0E4DB;
  --bs-body-font-family: Figtree, sans-serif; --bs-body-color: var(--ink);
  --bs-body-bg: var(--rail); --bs-primary: var(--accent); --bs-border-color: var(--rule);
  --bs-link-color: var(--accent); --bs-link-hover-color: #2e432f;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 15px; line-height: 1.55; }
button, select, textarea { font: inherit; }
h1 { font-size: 23px; font-weight: 650; margin: 0; }
h2 { font-size: 27px; font-weight: 550; }
h3 { font-size: 19px; font-weight: 600; line-height: 1.35; }
h4 { font-size: 14px; font-weight: 650; margin: 20px 0 7px; }
a { color: var(--accent); text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow, .rail-caption { font-size: 11px; letter-spacing: .065em; color: var(--muted); }
.line-icon { width: 19px; height: 19px; flex: 0 0 19px; }
.app-shell { --rail-width: 216px; --workspace-margin: 26px; display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 100vh; max-width: 1800px; margin: 0 auto; }
.sidebar { padding: 30px 16px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { display: block; width: 105px; margin: 0 0 40px 20px; }
.brand-logo { width: 85px; height: 85px; }
.rail-caption { margin: 0 14px 17px; }
.mibera-nav { gap: 7px; }
.mibera-nav .nav-link { display: flex; gap: 12px; align-items: center; color: var(--muted); border-radius: 9px; padding: 12px 14px; cursor: pointer; }
.mibera-nav .nav-link.active { background: var(--wash); color: var(--ink); font-weight: 600; }
.mibera-nav .nav-link:hover:not(.disabled) { background: var(--wash); }
.mibera-nav .nav-link.disabled { color: #899084; cursor: default; opacity: .65; }
.rail-footer { margin: auto 14px 8px; font-size: 13px; }
.rail-footer p { margin: 4px 0 0; font-size: 12px; }
.status-dot { display: inline-block; background: var(--accent); width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; }
.workspace { min-width: 0; margin: 24px 26px 24px 0; padding: 32px 40px 50px; background: var(--paper); min-height: calc(100vh - 48px); }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 35px; }
.case-context { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; font-size: 13px; color: var(--muted); }
.demo-badge { background: var(--wash); border-radius: 20px; padding: 1px 10px; white-space: nowrap; }
.btn { --bs-btn-font-size: 14px; --bs-btn-border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; }
.btn-sm { --bs-btn-font-size: 12px; padding: 6px 10px; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: #314632; --bs-btn-hover-border-color: #314632; --bs-btn-active-bg: #314632; --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: var(--edge); --bs-btn-hover-color: var(--ink); --bs-btn-hover-bg: var(--wash); --bs-btn-hover-border-color: var(--edge); --bs-btn-active-color: var(--ink); --bs-btn-active-bg: var(--wash); --bs-btn-active-border-color: var(--edge); }
.btn .line-icon { width: 16px; height: 16px; flex-basis: 16px; }
:focus-visible { outline: 2px solid var(--accent) !important; outline-offset: 3px; }
.form-control, .form-select { background-color: var(--paper); color: var(--ink); border: 1px solid var(--edge); border-radius: 7px; font-size: 14px; line-height: 1.5; padding: 10px 12px; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--wash); background-color: var(--paper); color: var(--ink); }
.form-control:disabled { background: var(--context); }
.form-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.case-intro { display: flex; align-items: center; gap: 26px; min-height: 135px; margin-bottom: 35px; }
.case-intro h2 { margin-bottom: 10px; }
.case-intro p { margin: 0; }
.intro-art { flex: 0 0 220px; height: 120px; }
.intro-art svg { width: 100%; height: 100%; }
.case-list { display: grid; gap: 8px; }
.case-card { border: 1px solid var(--rule); border-radius: 9px; background: var(--paper); }
.case-card .card-body { padding: 12px 18px; }
.case-card.is-selected { border-color: var(--accent); background: var(--context); }
.case-row { display: grid; grid-template-columns: minmax(140px, 1fr) 100px 175px auto; gap: 20px; align-items: center; font-size: 13px; }
.case-id { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.case-title { margin-left: 12px; font-weight: 400; overflow-wrap: anywhere; }
.case-topic-preview { font-size: 14px; margin: 10px 0 18px; }
.case-date { white-space: nowrap; }
.case-error { margin: 8px 0 0; }
.case-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.case-open { --bs-btn-bg: var(--wash); }
.phase-note { margin-top: 25px; font-size: 13px; }
.view-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.view-toolbar p { margin: 0; }
.conversation-layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 36%, 420px); gap: 26px; align-items: start; }
.analysis-column, .draft-column { min-width: 0; }
.conversation-panel { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 16px; min-width: 0; height: min(900px, calc(100dvh - 240px)); padding: 20px; border: 1px solid var(--rule); border-radius: 12px; background: var(--context); }
.chat-title { display: flex; align-items: center; gap: 10px; }
.chat-title h3 { font-size: 16px; margin: 0; }
.chat-history { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.chat-history > div > div { padding: 12px 0; }
.chat-history > div > div + div { border-top: 1px solid var(--rule); }
.chat-composer { display: flex; flex-direction: column; align-items: stretch; flex-shrink: 0; gap: 10px; border-top: 1px solid var(--rule); padding-top: 16px; }
.chat-input { min-width: 0; }
.chat-input textarea { min-height: 140px; max-height: 200px; }
.chat-send { align-self: flex-end; margin: 0; min-width: 120px; height: 42px; }
.chat-collapsed .conversation-layout { grid-template-columns: minmax(0, 1fr); }
.chat-collapsed .conversation-panel { display: none; }
details { margin: 12px 0; }
summary { cursor: pointer; font-weight: 550; padding: 9px 0; }
summary:hover { color: var(--accent); }
details[open] > summary { margin-bottom: 10px; }
.people-panel, .goals-panel { border-bottom: 1px solid var(--rule); padding-bottom: 14px; }
.goals-panel { margin-bottom: 25px; }
.goals-panel ul { padding-left: 20px; }
.goals-panel li { margin: 13px 0; }
.goals-panel .prose p { margin-bottom: 5px; }
.inline-label > .prose, .inline-label > .prose > p { display: inline; margin: 0; }
.inline-label .soft-badge { vertical-align: baseline; }
.thread-card { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; margin-bottom: 20px; }
.thread-card .card-body { padding: 24px; }
.thread-card h3 { margin-top: 13px; }
.thread-card details { border-top: 1px solid var(--rule); }
.badge-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.soft-badge { background: var(--wash) !important; color: var(--muted); font-size: 11px; font-weight: 500; padding: 5px 8px; white-space: normal; text-align: left; line-height: 1.4; }
.priority-high, .priority-urgent { background: #f2e9d7 !important; color: #745528; }
.prose { overflow-wrap: anywhere; }
.prose p { margin-bottom: 10px; }
.prose > :last-child { margin-bottom: 0; }
.text-list { padding-left: 20px; }
.text-list li { padding-left: 3px; margin-bottom: 9px; }
.detail-pair { display: grid; grid-template-columns: 135px minmax(0, 1fr); gap: 18px; margin-bottom: 13px; }
.detail-pair dt { font-weight: 400; font-size: 13px; color: var(--muted); }
.detail-pair dd { margin: 0; overflow-wrap: anywhere; }
.question, .finding-content { padding: 12px 0 16px; }
.question + .question { border-top: 1px solid var(--rule); }
.finding { padding-left: 12px; }
.finding summary { display: list-item; font-weight: 500; }
.evidence-observation { margin: 12px 0; }
.document-reference { padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; overflow-wrap: anywhere; text-align: left; }
.input-note { font-size: 12px; padding: 10px 13px; background: var(--context); border-left: 2px solid var(--edge); color: var(--muted); margin-bottom: 24px; }
.documents-layout { display: grid; grid-template-columns: minmax(240px, .65fr) minmax(350px, 1.35fr); gap: 28px; align-items: start; }
.document-inventory { position: sticky; top: 20px; min-width: 0; max-height: calc(100vh - 60px); overflow-y: auto; scrollbar-gutter: stable; padding-right: 12px; }
.inventory-title { font-size: 16px; margin: 0 0 6px; }
.native-email { white-space: pre-wrap; font-family: inherit; font-size: 14px; overflow-wrap: anywhere; }
.email-preview { padding: 20px 24px; border: 1px solid var(--rule); border-radius: 8px; background: var(--paper); max-height: 65vh; overflow-y: auto; }
.document-row { display: flex; width: 100%; gap: 8px; align-items: start; text-align: left; color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; margin: 0 0 10px; padding: 14px 12px; }
.document-row:hover { background: var(--context); border-color: var(--edge); }
.document-row.is-selected { background: var(--wash); border-color: var(--accent); box-shadow: inset 3px 0 var(--accent); }
.source-id { font-size: 12px; color: var(--muted); margin-right: 7px; flex-shrink: 0; }
.document-label { min-width: 0; }
.document-name { display: block; overflow-wrap: anywhere; font-size: 14px; }
.document-kind { display: block; font-size: 12px; line-height: 1.45; margin-top: 4px; }
.document-kind { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.document-description { padding: 14px 20px; border: 1px solid var(--rule); border-radius: 8px; background: var(--context); margin-bottom: 12px; }
.source-details { font-size: 13px; }
.source-details .detail-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 12px; }
.preview-panel { min-width: 0; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.preview-toolbar h3 { font-size: 14px; margin: 0; overflow-wrap: anywhere; }
.preview-toolbar .btn { flex-shrink: 0; }
.native-pdf { width: 100%; height: calc(100vh - 340px); min-height: 420px; border: 1px solid var(--rule); border-radius: 6px; background: var(--context); }
.pdf-fallback { display: none; padding: 25px; background: var(--context); }
.pdf-unavailable .native-pdf { display: none; }
.pdf-unavailable .pdf-fallback { display: block; }
.image-viewer { border: 1px solid var(--rule); border-radius: 7px; background: var(--context); overflow: hidden; }
.zoom-toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.zoom-label { font-size: 12px; color: var(--muted); min-width: 65px; text-align: center; }
.image-scroll { height: calc(100vh - 390px); min-height: 360px; overflow: auto; padding: 12px; }
.native-image { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; margin: 0 auto; object-fit: contain; }
.original-link { display: inline-block; font-size: 12px; margin-top: 12px; }
.empty-state { padding: 55px 22px; text-align: center; background: var(--context); border-radius: 8px; }
.empty-state .line-icon { width: 28px; height: 28px; margin-bottom: 20px; }
.empty-state h3 { font-size: 17px; }
.empty-state p { font-size: 13px; }
.document-modal .modal-dialog { max-width: calc(100vw - 60px); margin: 20px auto; }
.document-modal .modal-content { background: var(--paper); max-height: calc(100vh - 40px); }
.document-modal .modal-body { padding: 12px 20px; overflow: auto; }
.document-modal .modal-title { font-size: 16px; overflow-wrap: anywhere; }
.document-modal .native-pdf { height: calc(100vh - 185px); min-height: 0; }
.document-modal .image-scroll { height: calc(100vh - 235px); min-height: 0; }
.document-modal .modal-footer { padding: 10px 20px; }
.draft-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.segmented-control { display: flex; }
.segmented-control .form-check { flex: 1; padding: 0; margin: 0; min-width: 0; }
.segmented-control .form-check-label { width: 100%; height: 100%; border-radius: 0; }
.segmented-control .form-check:first-child .form-check-label { border-radius: 7px 0 0 7px; }
.segmented-control .form-check:last-child .form-check-label { border-radius: 0 7px 7px 0; }
.segmented-control .form-check + .form-check .form-check-label { border-left-width: 0; }
.generation-note { display: flex; gap: 14px; align-items: center; margin: 22px 0 25px; }
.email-editor { min-height: 440px; line-height: 1.65; }
.editor-footer { display: flex; flex-wrap: wrap; gap: 15px; align-items: center; margin-top: 17px; }
.report-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.report-section { grid-column: 1 / -1; padding: 22px 26px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); }
.report-section h2 { font-size: 17px; font-weight: 600; margin: 0 0 14px; }
.report-overview { grid-column: auto; background: var(--context); }
.report-text { white-space: pre-line; overflow-wrap: anywhere; line-height: 1.75; }
.report-notes { border: 1px solid var(--rule); border-radius: 10px; padding: 22px 26px; background: var(--context); margin-top: 24px; }
.report-notes .form-label { font-size: 17px; font-weight: 600; color: var(--ink); }
.report-notes > p:last-child { margin-top: 12px; }
.notification-area { position: fixed; bottom: 24px; right: 30px; z-index: 1060; width: max-content; max-width: min(440px, calc(100vw - 40px)); }
.notification-area .alert, .copy-status:not(:empty) { margin: 8px 0 0; padding: 13px 20px; border: 1px solid var(--edge); border-radius: 8px; box-shadow: 0 4px 15px #28332b12; }
.notification-area .alert-success, .copy-status:not(:empty) { background: var(--wash); color: var(--ink); }
.debug-tree { font-family: monospace; font-size: 13px; line-height: 1.7; min-width: 0; }
.debug-tree summary { cursor: pointer; overflow-wrap: anywhere; }
.debug-children { margin-left: 18px; padding-left: 12px; border-left: 1px solid var(--rule); }
.debug-leaf { white-space: pre-wrap; overflow-wrap: anywhere; }
.debug-key { font-weight: 600; }
.notification-area .alert-dismissible { padding-right: 48px; }
@media (max-width: 1250px) {
  .workspace { padding: 30px 28px; }
  .documents-layout { grid-template-columns: minmax(240px, .65fr) minmax(300px, 1.35fr); gap: 20px; }
  .draft-settings { gap: 10px; }
}
@media (max-width: 1050px) {
  .app-shell { --rail-width: 190px; --workspace-margin: 16px; }
  .sidebar { padding-inline: 10px; }
  .workspace { padding: 28px 24px; margin-right: 16px; }
  .case-row { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; }
  .conversation-layout { grid-template-columns: minmax(0, 1fr); }
  .conversation-panel { position: static; height: min(700px, 80dvh); }
  .documents-layout { grid-template-columns: minmax(0, 1fr); }
  .document-inventory { position: static; max-height: 300px; }
  .report-sections { grid-template-columns: 1fr; }
  .case-intro { gap: 10px; }
  .intro-art { flex-basis: 150px; }
  .workspace-header { align-items: start; }
}
@media (max-width: 700px) {
  .app-shell { --rail-width: 10px; --workspace-margin: 10px; display: block; }
  .sidebar { height: auto; position: static; padding: 12px; }
  .brand { margin: 0 0 12px; width: 50px; }
  .brand-logo { width: 50px; height: 50px; }
  .rail-caption, .rail-footer { display: none; }
  .mibera-nav { flex-direction: row !important; flex-wrap: wrap; gap: 2px; }
  .mibera-nav .nav-link { padding: 8px; font-size: 12px; gap: 5px; }
  .workspace { margin: 0 10px 10px; padding: 24px 18px; }
  .workspace-header, .view-toolbar { flex-wrap: wrap; }
  .case-context { justify-content: flex-start; }
  .case-row { grid-template-columns: minmax(0, 1fr); }
  .case-intro { flex-direction: column; align-items: start; }
  .intro-art { flex-basis: auto; width: 180px; height: 100px; }
  .draft-settings { grid-template-columns: 1fr; }
  .detail-pair { grid-template-columns: 1fr; gap: 6px; }
  .conversation-panel { padding: 14px 16px; }
  .chat-composer { gap: 10px; }
  .chat-send { min-width: auto; padding: 9px 10px; }
  .report-section, .report-notes { padding: 20px 18px; }
  .generation-note { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
