:root {
  --ink: #17242b;
  --ink-soft: #536168;
  --paper: #f5f2ea;
  --panel: rgba(255, 255, 255, 0.88);
  --line: rgba(23, 36, 43, 0.12);
  --accent: #e7603b;
  --accent-dark: #ba4023;
  --teal: #247c74;
  --green: #31835b;
  --amber: #aa6b11;
  --red: #b83f3f;
  --shadow: 0 22px 55px rgba(40, 45, 43, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); font-weight: 450; }

.ambient {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(8px);
  opacity: 0.42;
  pointer-events: none;
}
.ambient-one {
  width: 420px;
  height: 420px;
  top: -180px;
  right: -100px;
  background: radial-gradient(circle, #ef9b70, rgba(239, 155, 112, 0));
}
.ambient-two {
  width: 520px;
  height: 520px;
  bottom: -260px;
  left: -180px;
  background: radial-gradient(circle, #88beb5, rgba(136, 190, 181, 0));
}

.shell { width: min(1460px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 44px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 62px; }
.brand { display: inline-flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: white;
  background: var(--ink);
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 9px 20px rgba(23, 36, 43, 0.2);
}
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -0.02em; }
.brand small { color: var(--ink-soft); margin-top: 2px; }
.user-area { display: flex; align-items: center; gap: 12px; }
.user-email { color: var(--ink-soft); font-size: 14px; }

.panel, .center-card, .hero {
  border: 1px solid rgba(255, 255, 255, 0.75);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}
.panel { border-radius: 22px; }
.center-card {
  width: min(580px, 100%);
  margin: 12vh auto;
  padding: 58px;
  border-radius: 28px;
  text-align: center;
}
.center-card h1 { margin: 20px 0 8px; letter-spacing: -0.04em; }
.center-card p { color: var(--ink-soft); margin: 0; }
.spinner {
  width: 38px;
  height: 38px;
  margin: auto;
  border: 3px solid rgba(23, 36, 43, 0.13);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero {
  margin-top: 9vh;
  border-radius: 32px;
  padding: clamp(38px, 7vw, 88px);
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 70px;
  align-items: center;
  overflow: hidden;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.hero h1 { max-width: 760px; margin: 0; font-size: clamp(42px, 6vw, 74px); line-height: 0.98; letter-spacing: -0.065em; }
.hero-text { max-width: 670px; color: var(--ink-soft); font-size: 19px; line-height: 1.6; margin: 26px 0 32px; }
.connect-card {
  max-width: 650px;
  margin-top: 28px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}
.connect-card > strong { display: block; margin-bottom: 11px; }
.connect-card small { display: block; margin-top: 10px; color: var(--ink-soft); line-height: 1.45; }
.connection-url { display: flex; gap: 8px; }
.connection-url input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.connection-url .button { flex: 0 0 auto; }
.hero-diagram {
  position: relative;
  min-height: 390px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: 12px 14px;
  padding: 34px;
  border-radius: 26px;
  background: #17242b;
  color: white;
  box-shadow: 0 30px 65px rgba(23, 36, 43, 0.24);
}
.diagram-node { padding: 17px 20px; border: 1px solid rgba(255,255,255,.18); border-radius: 13px; background: rgba(255,255,255,.08); font-weight: 700; }
.hero-diagram > span { align-self: center; color: #ed9a73; font-weight: 900; }
.diagram-branch { grid-column: 1 / -1; margin-top: 12px; padding: 18px; display: flex; justify-content: space-between; gap: 10px; border-radius: 14px; background: rgba(231, 96, 59, .2); color: #f4c6b4; }
.diagram-branch strong { color: white; }

.button {
  border: 0;
  border-radius: 11px;
  padding: 12px 18px;
  font-weight: 750;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--accent); box-shadow: 0 10px 22px rgba(231, 96, 59, .25); }
.button-primary:hover { background: var(--accent-dark); }
.button-quiet { color: var(--ink); background: rgba(23,36,43,.065); }
.button-quiet:hover { background: rgba(23,36,43,.11); }
.button-small { padding: 8px 12px; font-size: 13px; }
.button-row { display: flex; gap: 8px; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: var(--ink); color: white; font-size: 23px; line-height: 1; }

.app-grid { margin-top: 24px; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.sidebar { position: sticky; top: 20px; min-height: calc(100vh - 70px); padding: 22px; display: flex; flex-direction: column; }
.main-column { display: grid; gap: 18px; }
.workspace-header { padding: 25px 28px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.workspace-header h1 { margin: 0; font-size: 30px; letter-spacing: -0.045em; }
.workspace-header p:last-child { margin: 6px 0 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 21px; letter-spacing: -0.035em; }

.stack { display: grid; gap: 13px; }
.compact { padding: 16px; margin: 4px 0 14px; border-radius: 15px; background: rgba(23, 36, 43, .045); }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 720; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,.8);
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(36, 124, 116, .12); }
textarea { resize: vertical; line-height: 1.5; }

.project-list { display: grid; gap: 7px; }
.project-button { width: 100%; padding: 12px 13px; text-align: left; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--ink); }
.project-button strong, .project-button span { display: block; }
.project-button span { margin-top: 4px; color: var(--ink-soft); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-button:hover { background: rgba(23,36,43,.045); }
.project-button.active { border-color: rgba(231,96,59,.25); background: rgba(231,96,59,.09); }
.sidebar-footer { margin-top: auto; display: flex; gap: 9px; align-items: flex-start; padding-top: 25px; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.status-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(49,131,91,.12); }

.segmented { display: inline-flex; gap: 5px; padding: 5px; border-radius: 13px; background: rgba(23,36,43,.055); }
.segment { border: 0; border-radius: 9px; padding: 9px 13px; color: var(--ink-soft); background: transparent; font-weight: 700; }
.segment.active { color: var(--ink); background: white; box-shadow: 0 4px 13px rgba(23,36,43,.09); }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 5px; padding: 0 5px; border-radius: 999px; color: white; background: var(--accent); font-size: 11px; }
.tab-panel { display: grid; gap: 18px; }
.upload-panel, .tab-panel > .panel { padding: 26px 28px; }
.limit-note { color: var(--ink-soft); font-size: 12px; }
.drop-zone { min-height: 185px; place-items: center; align-content: center; gap: 8px; border: 1.5px dashed rgba(36,124,116,.42); border-radius: 17px; color: var(--ink-soft); background: rgba(36,124,116,.045); text-align: center; transition: .15s ease; }
.drop-zone strong { color: var(--ink); font-size: 17px; }
.drop-zone.dragging, .drop-zone:hover { border-color: var(--teal); background: rgba(36,124,116,.09); transform: translateY(-1px); }
.upload-icon { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 4px; border-radius: 13px; color: white; background: var(--teal); font-size: 25px; box-shadow: 0 9px 18px rgba(36,124,116,.23); }
.progress-wrap { margin-top: 17px; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--ink-soft); font-size: 12px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(23,36,43,.09); }
.progress-bar { height: 100%; width: 0; border-radius: inherit; background: var(--teal); transition: width .18s ease; }

.document-list { display: grid; gap: 9px; }
.document-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.63); }
.document-main { min-width: 0; display: flex; gap: 13px; align-items: center; }
.file-icon { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 42px; border-radius: 9px; color: var(--teal); background: rgba(36,124,116,.1); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.document-copy { min-width: 0; }
.document-copy strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.document-copy span { display: block; margin-top: 4px; color: var(--ink-soft); font-size: 12px; }
.status-pill { padding: 6px 9px; border-radius: 999px; font-size: 11px; font-weight: 830; letter-spacing: .035em; }
.status-ready { color: var(--green); background: rgba(49,131,91,.11); }
.status-failed { color: var(--red); background: rgba(184,63,63,.11); }
.status-working { color: var(--amber); background: rgba(170,107,17,.12); }
.empty-state { min-height: 130px; display: grid; place-items: center; color: var(--ink-soft); text-align: center; }

.question-layout { padding: 0 !important; display: grid; grid-template-columns: minmax(330px, .85fr) minmax(420px, 1.15fr); min-height: 610px; overflow: hidden; }
.question-list-column { padding: 27px; border-right: 1px solid var(--line); }
.question-list { display: grid; gap: 8px; align-content: start; }
.question-button { width: 100%; padding: 14px; text-align: left; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); background: rgba(255,255,255,.58); }
.question-button:hover, .question-button.active { border-color: rgba(231,96,59,.32); background: rgba(231,96,59,.075); }
.question-button strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.38; }
.question-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 9px; color: var(--ink-soft); font-size: 11px; }
.answer-pane { padding: 35px; }
.empty-answer { display: grid; place-items: center; text-align: center; color: var(--ink-soft); }
.empty-answer > div { max-width: 310px; }
.answer-glyph { display: grid; place-items: center; width: 55px; height: 55px; margin: 0 auto 15px; border-radius: 18px; color: white; background: var(--ink); font-family: Georgia, serif; font-size: 31px; }
.answer-pane h3 { margin: 0; color: var(--ink); font-size: 25px; letter-spacing: -.04em; }
.answer-pane p { line-height: 1.6; }
.answer-form { display: grid; gap: 19px; }
.question-context, .review-feedback { padding: 17px; border-radius: 14px; background: rgba(23,36,43,.045); }
.review-feedback { border: 1px solid rgba(170,107,17,.18); background: rgba(170,107,17,.08); }
.question-context h4, .review-feedback h4 { margin: 0 0 8px; }
.question-context p, .review-feedback p { margin: 0; white-space: pre-wrap; }
.answer-form textarea { min-height: 240px; }
.review-note { color: var(--ink-soft); font-size: 12px; line-height: 1.5; }

.expert-landing {
  width: min(820px, 100%);
  margin: clamp(34px, 7vh, 84px) auto 40px;
}
.expert-card {
  padding: clamp(28px, 6vw, 58px);
  overflow: hidden;
}
.expert-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.expert-intro .eyebrow { margin: 0; }
.expert-priority {
  flex: 0 0 auto;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(23, 36, 43, .065);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: .035em;
  text-transform: uppercase;
}
.expert-priority-high { color: var(--accent-dark); background: rgba(231, 96, 59, .11); }
.expert-priority-low { color: var(--teal); background: rgba(36, 124, 116, .1); }
.expert-project {
  margin: 0 0 11px;
  color: var(--teal);
  font-size: 14px;
  font-weight: 780;
}
.expert-card h1 {
  max-width: 680px;
  margin: 0;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.03;
  letter-spacing: -.055em;
}
.expert-lead {
  max-width: 660px;
  margin: 21px 0 30px;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.6;
}
.expert-question-card {
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 255, 255, .68);
}
.expert-question-card span {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.expert-question-card p {
  margin: 10px 0 0;
  font-size: clamp(20px, 3vw, 25px);
  font-weight: 740;
  line-height: 1.42;
  letter-spacing: -.025em;
  white-space: pre-wrap;
}
.expert-support-card, .expert-review-card {
  margin-top: 15px;
  padding: 18px 20px;
  border-radius: 14px;
  color: var(--ink-soft);
  background: rgba(36, 124, 116, .075);
}
.expert-review-card {
  border: 1px solid rgba(170, 107, 17, .18);
  background: rgba(170, 107, 17, .085);
}
.expert-support-card h2, .expert-review-card h2 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 14px;
}
.expert-support-card p, .expert-review-card p {
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
}
.expert-answer-form { display: grid; gap: 12px; margin-top: 28px; }
.expert-answer-form label { font-size: 14px; }
.expert-answer-form textarea { min-height: 210px; padding: 15px; font-size: 16px; }
.expert-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.expert-actions p {
  max-width: 430px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
}
.expert-actions .button { flex: 0 0 auto; }
.expert-result {
  margin-top: 30px;
  padding: 24px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 17px;
  border-radius: 17px;
}
.expert-result > span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: white;
  background: var(--green);
  font-size: 21px;
  font-weight: 850;
}
.expert-result h2, .expert-result h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -.035em;
}
.expert-result p { margin: 8px 0 17px; color: var(--ink-soft); line-height: 1.55; }
.expert-result .button { display: inline-block; color: var(--ink); text-decoration: none; }
.expert-success { border: 1px solid rgba(49, 131, 91, .18); background: rgba(49, 131, 91, .075); }
.expert-resolved { border: 1px solid var(--line); background: rgba(23, 36, 43, .045); }
.expert-error { margin: 0; border: 1px solid rgba(184, 63, 63, .2); background: rgba(184, 63, 63, .065); }
.expert-error > span { background: var(--red); }
.expert-error h1 { font-size: 27px; letter-spacing: -.04em; }
.expert-privacy {
  margin: 17px auto 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 420px; padding: 14px 17px; border-radius: 13px; color: white; background: var(--ink); box-shadow: 0 18px 35px rgba(23,36,43,.25); }
.toast.error { background: var(--red); }

@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; margin-top: 35px; }
  .hero-diagram { min-height: 300px; }
  .app-grid { grid-template-columns: 1fr; }
  .sidebar { position: static; min-height: auto; }
  .sidebar-footer { margin-top: 20px; }
  .project-list { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
  .question-layout { grid-template-columns: 1fr; }
  .question-list-column { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 680px) {
  .shell { width: min(100% - 22px, 1460px); padding-top: 11px; }
  .brand small, .user-email { display: none; }
  .hero { padding: 31px 24px; gap: 36px; }
  .hero h1 { font-size: 45px; }
  .hero-diagram { padding: 22px; }
  .diagram-branch { flex-direction: column; }
  .workspace-header { align-items: stretch; flex-direction: column; }
  .segmented { width: 100%; }
  .segment { flex: 1; }
  .upload-panel, .tab-panel > .panel { padding: 21px; }
  .panel-heading { align-items: flex-start; }
  .limit-note { display: none; }
  .question-list-column, .answer-pane { padding: 22px; }
  .expert-landing { margin-top: 24px; }
  .expert-card { padding: 27px 22px; }
  .expert-intro { align-items: flex-start; }
  .expert-actions { align-items: stretch; flex-direction: column; gap: 13px; }
  .expert-actions .button { width: 100%; }
  .expert-result { padding: 20px; grid-template-columns: 1fr; }
}
