:root {
  --navy: #172033;
  --navy-soft: #26334c;
  --teal: #0f766e;
  --teal-bright: #14b8a6;
  --mint: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --stone: #f7f6f2;
  --white: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --danger: #b42318;
  --shadow: 0 12px 40px rgba(23, 32, 51, .09);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--stone); color: var(--ink); font-family: "DM Sans", system-ui, sans-serif; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2 { font-family: "Newsreader", Georgia, serif; letter-spacing: -.025em; }

.brand { align-items: center; display: inline-flex; font-size: 20px; font-weight: 700; gap: 2px; text-decoration: none; }
.brand-mark { align-items: center; background: var(--navy); border-radius: 9px; color: #5eead4; display: inline-flex; height: 32px; justify-content: center; margin-right: 7px; width: 32px; }
.brand-fast { color: var(--navy); }
.brand-accent { color: var(--teal); }
.button { align-items: center; background: var(--teal); border: 1px solid var(--teal); border-radius: 9px; color: white; cursor: pointer; display: inline-flex; font-weight: 600; justify-content: center; min-height: 42px; padding: 10px 18px; text-decoration: none; }
.button:hover { background: #0b625c; }
.button.secondary { background: white; border-color: #ccd3d9; color: var(--navy); }
.button.small { min-height: 34px; padding: 6px 12px; }
.button.full { width: 100%; }
.button.danger { background: white; border-color: #fda29b; color: var(--danger); }
.button.confirmed { background: var(--navy); border-color: var(--navy); }
.button:disabled { cursor: wait; opacity: .65; }
.quiet-link { color: var(--teal); font-weight: 600; text-decoration: none; }
.muted { color: var(--muted); }
.eyebrow { color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .14em; margin-bottom: 10px; }
.status { background: #eef2f6; border-radius: 999px; color: #475467; display: inline-flex; font-size: 11px; font-weight: 700; padding: 4px 8px; text-transform: capitalize; white-space: nowrap; }
.status.published, .status.admitted, .status.approved, .status.completed, .status.required { background: var(--mint); color: #067647; }
.status.draft, .status.pending, .status.submitted, .status.amber { background: var(--amber-soft); color: #b54708; }
.status.rejected, .status.failed, .status.cancelled { background: #fef3f2; color: var(--danger); }
.status.under-review, .status.evaluation { background: #eff8ff; color: #175cd3; }

.public-nav { align-items: center; display: flex; justify-content: space-between; margin: auto; max-width: 1240px; padding: 24px 30px; }
.public-nav nav { align-items: center; display: flex; gap: 20px; }
.public-main { margin: auto; max-width: 1240px; padding: 40px 30px 80px; }
.hero { align-items: center; display: grid; gap: 70px; grid-template-columns: 1.05fr .95fr; min-height: 610px; }
.hero h1 { font-size: clamp(48px, 6vw, 76px); line-height: .98; margin-bottom: 28px; max-width: 820px; }
.hero-copy { color: #475467; font-size: 19px; line-height: 1.65; max-width: 700px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 18px; }
.proof { color: var(--muted); font-size: 13px; }
.hero-demo { background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 28px; transform: rotate(1deg); }
.landing-message { border-radius: 13px; margin-bottom: 14px; padding: 16px 18px; }
.landing-message.user { background: var(--navy); color: white; margin-left: 45px; }
.landing-message.assistant { background: var(--stone); margin-right: 20px; }
.landing-message p { line-height: 1.55; margin-bottom: 0; }
.chat-label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em; margin-bottom: 6px; text-transform: uppercase; }
.landing-artifact { align-items: center; border: 1px solid #b7e4db; border-left: 4px solid var(--teal); border-radius: 10px; display: grid; gap: 5px; padding: 16px; }
.landing-artifact p, .landing-artifact strong { margin: 0; }
.feature-grid { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); padding: 50px 0; }
.feature-grid > div { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.feature-grid h2 { font-size: 25px; margin-bottom: 10px; }
.feature-grid p { color: var(--muted); line-height: 1.6; margin: 0; }
.open-source-block { background: var(--navy); border-radius: 20px; color: white; margin-top: 40px; padding: 54px; }
.open-source-block h2 { font-size: 40px; margin-bottom: 14px; }
.open-source-block p:last-child { color: #cbd5e1; font-size: 17px; line-height: 1.7; max-width: 760px; }
.public-footer { color: var(--muted); margin: auto; max-width: 1240px; padding: 30px; }

.auth-page { align-items: center; display: flex; justify-content: center; min-height: 100vh; padding: 40px 20px; position: relative; }
.back-link { color: var(--muted); left: 28px; position: absolute; text-decoration: none; top: 28px; }
.auth-card { background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); max-width: 460px; padding: 38px; width: 100%; }
.auth-card h1 { font-size: 38px; margin: 28px 0 10px; }
.auth-form, .form-stack { display: flex; flex-direction: column; gap: 16px; margin: 26px 0 14px; }
label { color: #344054; display: flex; flex-direction: column; font-size: 13px; font-weight: 600; gap: 7px; }
input, textarea, select { background: white; border: 1px solid #cfd4dc; border-radius: 8px; color: var(--ink); min-height: 42px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); outline: none; }
.auth-switch { font-size: 13px; margin: 20px 0 0; text-align: center; }
.alert { border-radius: 8px; margin-top: 15px; padding: 10px 12px; }
.alert.error { background: #fef3f2; color: var(--danger); }
.alert.success { background: var(--mint); color: #067647; margin-bottom: 18px; }

.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { background: var(--navy); color: white; display: flex; flex: 0 0 256px; flex-direction: column; height: 100vh; min-width: 0; z-index: 50; }
.sidebar-head { align-items: center; display: flex; justify-content: space-between; padding: 20px; }
.sidebar .brand-fast { color: white; }
.sidebar .brand-mark { background: white; color: var(--teal); }
.drawer-close { background: none; border: 0; color: white; display: none; font-size: 24px; }
.new-chat { border: 1px solid #526078; border-radius: 8px; color: white; font-size: 13px; font-weight: 600; margin: 6px 14px 16px; padding: 10px 12px; text-decoration: none; }
.new-chat:hover { background: var(--navy-soft); }
.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.nav-item { border-radius: 7px; color: #cbd5e1; font-size: 13px; padding: 9px 12px; text-decoration: none; }
.nav-item:hover, .nav-item.active { background: var(--navy-soft); color: white; }
.nav-item.active { box-shadow: inset 3px 0 0 #5eead4; }
.history { border-top: 1px solid #38455c; margin: 16px 14px 0; overflow: auto; padding-top: 14px; }
.nav-section-label { color: #94a3b8; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.history-item { color: #cbd5e1; display: block; font-size: 12px; overflow: hidden; padding: 7px 3px; text-overflow: ellipsis; text-decoration: none; white-space: nowrap; }
.sidebar-foot { border-top: 1px solid #38455c; margin-top: auto; padding: 16px; }
.identity { align-items: center; display: flex; gap: 10px; }
.identity > div { display: flex; flex-direction: column; min-width: 0; }
.identity small { color: #94a3b8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { align-items: center; background: var(--teal); border-radius: 50%; display: flex; flex: 0 0 34px; height: 34px; justify-content: center; }
.signout { color: #94a3b8; display: block; font-size: 11px; margin: 12px 0 0 44px; }
.workspace-main { background: var(--stone); display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.workspace-head { align-items: center; background: white; border-bottom: 1px solid var(--line); display: flex; flex: 0 0 66px; justify-content: space-between; padding: 0 24px; }
.workspace-head h1 { font-family: "DM Sans", sans-serif; font-size: 16px; margin: 0; }
.workspace-head small { color: var(--muted); }
.workspace-head > div:first-of-type { display: flex; flex-direction: column; }
.top-user { color: var(--muted); font-size: 13px; }
.mobile-nav { background: none; border: 0; display: none; font-size: 22px; }
.drawer-overlay { display: none; }
.page-scroll { flex: 1; overflow: auto; padding: 30px; }
.page-scroll.narrow { margin: auto; max-width: 920px; width: 100%; }
.page-intro { align-items: flex-start; display: flex; gap: 30px; justify-content: space-between; margin: 0 auto 26px; max-width: 1200px; }
.page-intro h2 { font-size: 35px; margin-bottom: 8px; }
.page-intro .muted { line-height: 1.6; margin-bottom: 0; max-width: 700px; }
.panel { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.panel.compact { max-width: 740px; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.inline-form { border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; margin-top: 18px; padding-top: 18px; }
.inline-actions, .row-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; }
.record-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); margin: auto; max-width: 1200px; }
.record-card { background: white; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 10px; padding: 20px; text-decoration: none; }
.record-card:hover { border-color: #98a2b3; box-shadow: 0 8px 28px rgba(23,32,51,.06); }
.record-card > div:first-child { align-items: center; display: flex; justify-content: space-between; }
.record-card > div:last-child { color: var(--muted); display: flex; font-size: 12px; gap: 16px; justify-content: space-between; margin-top: auto; }
.record-card h3, .record-card p { margin-bottom: 0; }
.record-card p { color: var(--muted); line-height: 1.5; }
.stats-grid, .chat-stats { display: grid; gap: 12px; grid-template-columns: repeat(4, 1fr); margin: 0 auto 20px; max-width: 1200px; }
.stat-card { background: white; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; padding: 15px; }
.stat-card strong { font-size: 22px; }
.stat-card span { color: var(--muted); font-size: 11px; }
.two-column { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; margin: auto; max-width: 1200px; }
.list-row { border-bottom: 1px solid var(--line); display: grid; gap: 5px; padding: 14px 0; }
.list-row:last-of-type { border-bottom: 0; }
.list-row h4, .list-row p { margin-bottom: 0; }
.list-row p { color: var(--muted); font-size: 13px; }
.table-card { background: white; border: 1px solid var(--line); border-radius: 12px; margin: auto; max-width: 1200px; overflow: hidden; }
.table-row { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 18px; justify-content: space-between; padding: 16px 18px; text-decoration: none; }
.table-row:last-child { border-bottom: 0; }
.table-row > div:first-child { display: flex; flex-direction: column; gap: 3px; }
.table-row h3, .table-row p { margin-bottom: 0; }
.table-row h3 { font-size: 15px; }
.table-row small, .table-row > span { color: var(--muted); }
.empty-state { color: var(--muted); padding: 34px; text-align: center; }
.empty-state h3 { color: var(--ink); margin-bottom: 6px; }
.role-card { align-items: center; border-bottom: 1px solid var(--line); display: grid; gap: 12px; grid-template-columns: 1fr auto auto; padding: 13px 0; }
.role-card h3, .role-card p { margin-bottom: 2px; }
.role-card span { color: var(--muted); font-size: 12px; }
.role-form { margin-top: 0; }
fieldset { border: 1px solid var(--line); border-radius: 9px; display: grid; gap: 8px; margin: 0; padding: 14px; }
legend { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; padding: 0 5px; text-transform: uppercase; }
.permission-option { display: grid; font-weight: 500; gap: 2px; grid-template-columns: 20px 1fr; }
.permission-option input { grid-row: 1 / span 2; min-height: auto; width: auto; }
.permission-option small { color: var(--muted); font-weight: 400; }
.role-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.role-chip { background: #eef2f6; border: 0; border-radius: 999px; color: #475467; cursor: pointer; font-size: 10px; padding: 4px 8px; }
.assign-role { align-items: center; display: flex; gap: 7px; }
.assign-role select { min-width: 170px; }
.supplier-invitations { margin: 18px auto 0; max-width: 1200px; }
.submission-row { border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; padding: 16px 0; }
.submission-row > div:first-child { display: flex; flex-direction: column; }
.score-form { align-items: end; display: grid; gap: 8px; grid-template-columns: 1fr auto; }

.chat-column { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.chat-stats { flex: 0 0 auto; margin: 18px auto 0; padding: 0 22px; width: 100%; }
.messages { flex: 1; margin: auto; max-width: 820px; overflow: auto; padding: 28px 24px 120px; width: 100%; }
.message { margin-bottom: 24px; max-width: 90%; }
.message.user { margin-left: auto; }
.message-author { color: var(--muted); display: block; font-size: 10px; font-weight: 700; letter-spacing: .09em; margin: 0 5px 6px; text-transform: uppercase; }
.message-copy { background: white; border: 1px solid var(--line); border-radius: 14px; line-height: 1.65; margin: 0; padding: 15px 17px; white-space: pre-wrap; }
.message.user .message-copy { background: var(--navy); border-color: var(--navy); color: white; }
.chat-welcome { padding: 70px 0; text-align: center; }
.chat-welcome h2 { font-size: 37px; margin-bottom: 10px; }
.suggestions { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-top: 28px; }
.suggestion { background: white; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); cursor: pointer; padding: 13px; text-align: left; }
.suggestion:hover { border-color: var(--teal); color: var(--teal); }
.chat-composer { align-items: flex-end; background: rgba(247,246,242,.95); border-top: 1px solid var(--line); bottom: 0; display: flex; gap: 10px; padding: 14px max(24px, calc((100% - 820px)/2)); position: sticky; }
.chat-composer textarea { max-height: 140px; min-height: 48px; resize: none; }
.send-button { background: var(--teal); border: 0; border-radius: 9px; color: white; cursor: pointer; flex: 0 0 72px; height: 48px; }
.artifact-pane { background: white; border-left: 1px solid var(--line); flex: 0 0 0; min-width: 0; overflow: auto; padding: 0; position: relative; transition: flex-basis .2s ease, padding .2s ease; }
.artifact-open .artifact-pane { flex-basis: 380px; padding: 24px; }
.artifact-close { background: white; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 18px; padding: 3px 8px; position: absolute; right: 14px; top: 14px; }
.artifact-empty { padding-top: 30px; }
.artifact-summary { background: var(--mint); border: 1px solid #b7e4db; border-radius: 9px; line-height: 1.55; padding: 14px; }
.artifact-list { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }
.artifact-card { border: 1px solid var(--line); border-radius: 9px; display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.artifact-card .status { align-self: flex-start; }
.artifact-toggle { background: var(--navy); border: 0; border-radius: 20px; bottom: 78px; color: white; cursor: pointer; display: none; padding: 9px 14px; position: fixed; right: 18px; z-index: 45; }

@media (max-width: 1100px) {
  .artifact-pane { bottom: 0; box-shadow: -10px 0 35px rgba(23,32,51,.14); max-width: 430px; position: fixed; right: -440px; top: 0; transition: right .2s ease; width: min(92vw, 430px); z-index: 70; }
  .artifact-open .artifact-pane { padding: 24px; right: 0; width: min(92vw, 430px); }
  .artifact-toggle.has-results { display: block; }
  .artifact-open .artifact-toggle { display: none; }
}

@media (max-width: 760px) {
  .public-nav { padding: 18px; }
  .public-nav .quiet-link { display: none; }
  .public-main { padding: 20px 18px 60px; }
  .hero { gap: 30px; grid-template-columns: 1fr; min-height: auto; padding: 55px 0; }
  .hero h1 { font-size: 47px; }
  .hero-demo { transform: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .open-source-block { padding: 30px; }
  .sidebar { bottom: 0; box-shadow: 12px 0 35px rgba(0,0,0,.22); left: -280px; position: fixed; top: 0; transition: left .2s ease; width: 270px; }
  .nav-open .sidebar { left: 0; }
  .nav-open .drawer-overlay { background: rgba(23,32,51,.55); bottom: 0; display: block; left: 0; position: fixed; right: 0; top: 0; z-index: 40; }
  .drawer-close, .mobile-nav { display: block; }
  .workspace-head { padding: 0 14px; }
  .workspace-head > div:first-of-type { margin-right: auto; padding-left: 8px; }
  .top-user { display: none; }
  .page-scroll { padding: 20px 14px; }
  .page-intro, .two-column { grid-template-columns: 1fr; }
  .page-intro { flex-direction: column; }
  .stats-grid, .chat-stats { grid-template-columns: 1fr 1fr; }
  .chat-stats { padding: 0 12px; }
  .stat-card strong { font-size: 18px; }
  .messages { padding: 22px 14px 110px; }
  .chat-welcome { padding: 36px 0; }
  .suggestions { grid-template-columns: 1fr; }
  .chat-composer { padding: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px; }
  .role-card { grid-template-columns: 1fr auto; }
}
