:root {
  --bg: #ffffff;
  --ink: #111318;
  --muted: #626b77;
  --line: #d9dee7;
  --strong-line: #161a21;
  --surface: #f6f8fb;
  --surface-strong: #eef3f7;
  --navy: #0f3557;
  --accent: #14614f;
  --accent-soft: #e9f6f1;
  --amber: #8c5f00;
  --amber-soft: #fff5d8;
  --danger: #9a1a1a;
  --danger-soft: #fff0f0;
  --ok-soft: #eef8f2;
  --shadow: 0 18px 45px rgba(17, 19, 24, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(246, 248, 251, 0.9) 0, rgba(255, 255, 255, 0) 260px),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 650;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--strong-line);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.nav,
.footer-links,
.auth-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav {
  font-size: 14px;
  color: var(--muted);
}

.nav a,
.link-button {
  color: var(--muted);
}

.nav a:hover,
.link-button:hover,
.footer-links a:hover,
.muted-link:hover {
  color: var(--ink);
}

.nav-cta {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--strong-line);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--ink) !important;
  background: #fff;
}

.inline-form {
  display: inline;
}

.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.legal-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 11px 32px;
  font-size: 13px;
  color: #493800;
  background: var(--amber-soft);
}

.legal-notice a {
  font-weight: 650;
  white-space: nowrap;
}

.messages {
  border-bottom: 1px solid var(--line);
}

.message {
  margin: 0;
  padding: 12px 32px;
  border-bottom: 1px solid rgba(17, 19, 24, 0.08);
}

.message-success {
  background: var(--ok-soft);
}

.message-warning {
  background: var(--amber-soft);
}

.message-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.page {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 46px 28px 72px;
  flex: 1;
}

.split,
.dashboard-grid,
.document-workflow,
.detail-grid,
.workbench-shell {
  display: grid;
  gap: 26px;
}

.hero-split {
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 420px);
  align-items: start;
}

.dashboard-grid,
.document-workflow {
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
}

.detail-grid {
  grid-template-columns: 330px minmax(0, 1fr);
  align-items: start;
}

.workbench-shell {
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  align-items: start;
}

.intro h1,
.page-head h1,
.auth-page h1 {
  margin: 0;
  font-size: 64px;
  line-height: 1;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--ink);
}

.page-head h1,
.auth-page h1 {
  max-width: 760px;
  font-size: 48px;
}

.eyebrow {
  margin: 0 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 750;
  color: var(--navy);
  letter-spacing: 0;
}

.lead {
  max-width: 720px;
  margin: 22px 0 0;
  font-size: 20px;
  line-height: 1.5;
  color: var(--muted);
}

.compact-lead {
  max-width: 460px;
  font-size: 16px;
}

.hero-copy .actions {
  margin-top: 28px;
}

.actions,
.form-actions,
.head-actions,
.listen-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--strong-line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 10px 18px;
  cursor: pointer;
  font-weight: 650;
  line-height: 1;
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button.danger {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff;
}

.button.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.button.small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

.button.full {
  width: 100%;
}

.panel,
.notice-block,
.meta-panel,
.output-panel,
.sections-panel,
.empty-state,
.side-panel,
.workspace-preview,
.workspace-card,
.workbench-rail,
.preview-panel,
.metric-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
}

.panel,
.notice-block,
.meta-panel,
.output-panel,
.sections-panel,
.empty-state,
.side-panel,
.workspace-card,
.workbench-rail,
.preview-panel {
  padding: 24px;
}

.panel,
.side-panel,
.workbench-rail,
.preview-panel,
.workspace-preview {
  box-shadow: var(--shadow);
}

.panel h2,
.notice-block h2,
.meta-panel h2,
.output-panel h2,
.sections-panel h2,
.empty-state h2,
.feature-strip h2,
.side-panel h2,
.workspace-card h2,
.preview-panel h2,
.legal-copy h2 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}

.panel-copy,
.feature-strip p,
.notice-block p,
.sections-panel p,
.empty-state p,
.meta-panel p,
.side-panel p,
.workspace-card p,
.preview-panel p,
.legal-copy p {
  color: var(--muted);
  line-height: 1.6;
}

.trust-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.trust-rail span,
.status-list span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.workspace-preview {
  margin-top: 30px;
  max-width: 640px;
  overflow: hidden;
}

.preview-header,
.preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.preview-header {
  background: var(--navy);
  color: #fff;
}

.preview-header span,
.preview-header strong {
  font-size: 14px;
}

.preview-row:last-child {
  border-bottom: 0;
}

.preview-row span,
.preview-row small {
  display: block;
}

.preview-row span {
  font-weight: 700;
}

.preview-row small {
  color: var(--muted);
  font-size: 13px;
}

.muted-preview {
  background: var(--surface);
}

.feature-strip {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.feature-strip article {
  padding: 24px;
  border-right: 1px solid var(--line);
}

.feature-strip article:last-child {
  border-right: 0;
}

.form {
  display: grid;
  gap: 13px;
}

.form label {
  font-weight: 700;
  font-size: 14px;
}

.form input,
.form textarea,
.form select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 12px;
  min-height: 44px;
  border-radius: var(--radius);
  outline: none;
}

.form input:focus,
.form textarea:focus,
.form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 97, 79, 0.12);
}

.form textarea {
  resize: vertical;
  line-height: 1.5;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
  align-items: end;
}

.help,
.muted-link {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--danger);
  font-size: 13px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 14px;
}

.checkline {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--amber-soft);
}

.checkline input {
  min-height: auto;
  width: auto;
  margin-top: 3px;
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.credit-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid #b9c2cf;
  border-radius: var(--radius);
  font-weight: 750;
  color: var(--navy);
  background: var(--surface-strong);
}

.workspace-main {
  min-width: 0;
}

.workbench-main {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.workbench-rail,
.workbench-preview {
  position: sticky;
  top: 102px;
}

.workbench-rail {
  max-height: calc(100vh - 124px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  overflow: hidden;
}

.rail-header,
.rail-footer,
.composer-entry,
.compact-meta {
  display: flex;
  gap: 12px;
}

.rail-header {
  align-items: center;
  justify-content: space-between;
  font-weight: 750;
}

.rail-list {
  min-height: 0;
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.rail-item {
  display: grid;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 12px;
  background: #fff;
}

.rail-item:hover,
.rail-item.active {
  border-color: #bcc8d6;
  background: var(--surface);
}

.rail-item.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.rail-item strong,
.rail-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.rail-item small,
.rail-empty,
.rail-footer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.rail-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
}

.rail-footer {
  flex-direction: column;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.rail-footer a {
  color: var(--accent);
  font-weight: 700;
}

.workbench-preview {
  display: grid;
  gap: 16px;
}

.workspace-card,
.preview-panel {
  min-width: 0;
}

.composer-card {
  display: grid;
  gap: 16px;
}

.continue-card {
  background: linear-gradient(180deg, #fff 0, var(--surface) 100%);
}

.continue-form {
  gap: 12px;
}

.composer-entry {
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  border: 1px solid var(--strong-line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #fff;
}

.composer-entry span {
  color: var(--muted);
}

.composer-entry strong {
  color: var(--accent);
}

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

.mode-grid span {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.panel-kicker {
  margin-bottom: 10px;
  color: var(--navy);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.preview-text {
  max-height: 420px;
  margin: 18px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.latest-instruction {
  margin: 14px 0 0;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--ink) !important;
  font-size: 14px;
}

.compact-meta {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 9px 12px;
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.compact-meta dt {
  font-weight: 750;
}

.compact-meta dd {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.action-stack {
  display: grid;
  gap: 10px;
}

.action-stack form {
  margin: 0;
}

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

.iteration-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: #fff;
}

.iteration-item strong,
.iteration-item small {
  display: block;
}

.iteration-item small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.iteration-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.flush {
  margin: 0;
}

.flush-top {
  margin-top: 0 !important;
}

.caution-preview {
  background: var(--amber-soft);
  border-color: #ead18a;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  margin-bottom: 22px;
}

.metric-strip div {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #fff;
}

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

.metric-strip span {
  font-size: 32px;
  line-height: 1;
  font-weight: 750;
  color: var(--navy);
}

.metric-strip small {
  color: var(--muted);
  font-size: 13px;
}

.document-list {
  border-top: 1px solid var(--line);
}

.document-row {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
}

.document-row strong,
.document-row small {
  display: block;
}

.document-row strong {
  font-weight: 700;
}

.document-row small,
.row-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.document-row:hover strong {
  color: var(--accent);
}

.static-row:hover strong {
  color: var(--ink);
}

.side-panel {
  position: sticky;
  top: 102px;
}

.status-list {
  display: grid;
  gap: 9px;
  margin: 18px 0;
}

.status-list span {
  justify-content: flex-start;
  width: 100%;
}

.notice-block.compact {
  margin-top: 24px;
  padding: 18px 22px;
}

.caution-strip {
  background: var(--amber-soft);
  border-color: #ead18a;
}

.meta-panel dl {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-bottom: 20px;
}

.meta-panel dt {
  font-weight: 700;
}

.meta-panel dd {
  margin: 0;
  color: var(--muted);
}

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

.generated-text {
  margin: 18px 0 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.sections-panel {
  margin-top: 24px;
}

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

.section-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.section-item summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
}

.section-item small {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.section-item .generated-text {
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 16px;
}

.auth-page {
  max-width: 560px;
  margin: 0 auto;
}

.auth-form {
  margin-top: 24px;
}

.auth-links {
  justify-content: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.legal-copy {
  max-width: 820px;
}

.legal-copy h2 {
  margin-top: 30px;
}

.legal-copy h2:first-child {
  margin-top: 0;
}

.data-list {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 10px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: #fff;
}

.data-list dt {
  font-weight: 700;
}

.data-list dd {
  margin: 0;
  color: var(--muted);
}

.danger-zone {
  margin-top: 16px;
  border: 1px solid #efb2b2;
  border-radius: var(--radius);
  padding: 18px;
  background: var(--danger-soft);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  background: var(--surface);
}

.footer div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

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

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }

  .button:hover {
    transform: none;
  }
}

@media (max-width: 900px) {
  .hero-split,
  .dashboard-grid,
  .document-workflow,
  .detail-grid,
  .workbench-shell {
    grid-template-columns: 1fr;
  }

  .side-panel,
  .workbench-rail,
  .workbench-preview {
    position: static;
  }

  .workbench-rail {
    max-height: none;
  }

  .intro h1 {
    font-size: 52px;
  }
}

@media (max-width: 760px) {
  .topbar,
  .footer,
  .page-head,
  .document-row,
  .output-toolbar,
  .section-item summary,
  .legal-notice,
  .preview-header,
  .preview-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
    padding: 16px 18px;
  }

  .brand {
    width: 100%;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
  }

  .legal-notice,
  .message {
    padding-left: 18px;
    padding-right: 18px;
  }

  .legal-notice a {
    white-space: normal;
  }

  .page {
    padding: 30px 18px 48px;
  }

  .feature-strip,
  .field-grid,
  .mode-grid,
  .metric-strip,
  .upload-row {
    grid-template-columns: 1fr;
  }

  .feature-strip article,
  .metric-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .feature-strip article:last-child,
  .metric-strip div:last-child {
    border-bottom: 0;
  }

  .intro h1,
  .page-head h1,
  .auth-page h1 {
    font-size: 38px;
  }

  .lead {
    font-size: 17px;
  }

  .head-actions,
  .actions,
  .listen-controls,
  .form-actions {
    width: 100%;
  }

  .button,
  .head-actions form,
  .head-actions .button {
    width: 100%;
  }

  .meta-panel dl {
    grid-template-columns: 1fr;
  }

  .data-list {
    grid-template-columns: 1fr;
  }

  .compact-meta {
    grid-template-columns: 1fr;
  }

  .section-item small {
    text-align: left;
  }

  .footer-links,
  .auth-links {
    flex-wrap: wrap;
  }
}
