:root {
  --paper: #eef4ff;
  --paper-strong: #f8fbff;
  --paper-ink: #13233f;
  --paper-muted: #5f7394;
  --paper-line: rgba(46, 83, 143, 0.14);
  --terracotta: #2e6fd0;
  --terracotta-soft: rgba(46, 111, 208, 0.12);
  --sage: #5b8def;
  --sage-soft: rgba(91, 141, 239, 0.12);
  --olive: #1f5fc4;
  --card: rgba(248, 251, 255, 0.9);
  --card-strong: #ffffff;
  --shadow: 0 20px 60px rgba(24, 56, 112, 0.12);
  --shadow-soft: 0 8px 24px rgba(24, 56, 112, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: linear-gradient(180deg, #f4f8ff 0%, #e8f0ff 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper-ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(46, 111, 208, 0.1), transparent 25%),
    radial-gradient(circle at 100% 0%, rgba(91, 141, 239, 0.1), transparent 24%),
    linear-gradient(180deg, #f4f8ff 0%, #e8f0ff 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(46, 83, 143, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 83, 143, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.28;
}

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

h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.03em;
}

p {
  margin: 0;
  line-height: 1.7;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  width: 36rem;
  height: 36rem;
  border-radius: 999px;
  filter: blur(28px);
  opacity: 0.2;
}

.orb-left {
  top: -10rem;
  left: -10rem;
  background: rgba(46, 111, 208, 0.3);
}

.orb-right {
  right: -12rem;
  bottom: -12rem;
  background: rgba(91, 141, 239, 0.26);
}

.grid-wash {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 38%);
}

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px 20px;
  border-right: 1px solid var(--paper-line);
  background: rgba(241, 247, 255, 0.82);
  backdrop-filter: blur(10px);
}

.brand-subtitle,
.hint,
.metric-hint,
.eyebrow,
.empty,
.sidebar-kicker,
.panel-kicker,
.footer-copy,
.pill.subtle,
.metric-label {
  color: var(--paper-muted);
}

.sidebar-note,
.sidebar-footer {
  padding: 18px;
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
}

.sidebar-kicker,
.panel-kicker,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.nav {
  display: grid;
  gap: 10px;
}

.sidebar-section {
  display: grid;
  gap: 12px;
}

.sidebar-menu {
  display: grid;
  gap: 10px;
}

.sidebar-menu-link {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.84);
  color: inherit;
  text-decoration: none;
}

.sidebar-menu-link.active {
  border-color: rgba(46, 111, 208, 0.24);
  background: rgba(46, 111, 208, 0.1);
}

.sidebar-menu-link span {
  color: var(--paper-muted);
  font-size: 13px;
}

.sidebar-menu-link.static {
  cursor: default;
}

.logout-form button {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--paper-line);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.72);
  color: var(--paper-muted);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.logout-form button:hover {
  color: var(--paper-ink);
  background: rgba(255, 252, 247, 0.94);
}

.nav-link {
  position: relative;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid transparent;
  color: var(--paper-muted);
  background: transparent;
  transition: 160ms ease;
}

.nav-link::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(185, 95, 58, 0.08), transparent 72%);
  opacity: 0;
  transition: 160ms ease;
}

.nav-link.active,
.nav-link:hover {
  color: var(--paper-ink);
  border-color: var(--paper-line);
  background: rgba(255, 252, 247, 0.8);
}

.nav-link.active::before,
.nav-link:hover::before {
  opacity: 1;
}

.sidebar-footer {
  margin-top: auto;
}

.footer-tag,
.meta-badge,
.crumb-pill,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(46, 111, 208, 0.16);
  background: rgba(255, 255, 255, 0.94);
}

.footer-tag,
.crumb-pill,
.pill {
  color: var(--terracotta);
}

.content {
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  padding: 12px 6px;
}

.topbar-lead {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.crumb-sep,
.crumb-current {
  color: var(--paper-muted);
}

.global-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.global-nav .nav-link {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
}

.global-nav .nav-link::before {
  display: none;
}

.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--paper-line);
  background: rgba(255, 255, 255, 0.82);
  color: var(--paper-ink);
  font: inherit;
  text-decoration: none;
}

.top-logout-form {
  display: inline-flex;
}

.compact-selector {
  display: flex;
  gap: 10px;
  align-items: center;
}

.page-canvas {
  padding: 30px;
  border: 1px solid var(--paper-line);
  border-radius: 36px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.64), transparent 18%),
    rgba(248, 251, 255, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.page-header,
.panel-header,
.list-card,
.score-line,
.idea-card,
.evidence-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.page-header {
  align-items: flex-start;
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  margin: 10px 0 14px;
}

.page-header p {
  max-width: 64ch;
  color: var(--paper-muted);
}

.section-heading {
  display: grid;
  gap: 8px;
  margin: 28px 0 16px;
}

.section-kicker {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 2rem);
}

.section-heading p {
  margin: 0;
  color: var(--paper-muted);
  max-width: 70ch;
}

.project-top-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.project-top-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--paper-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--paper-ink);
  text-decoration: none;
  font-weight: 700;
}

.project-top-link.active {
  border-color: rgba(46, 111, 208, 0.24);
  background: rgba(46, 111, 208, 0.1);
  color: var(--terracotta);
}

.project-top-link.disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.project-top-link em {
  font-style: normal;
  font-size: 12px;
  font-weight: 500;
  color: var(--paper-muted);
}

.step-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(71, 53, 38, 0.08);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.62);
}

a.step-item {
  text-decoration: none;
  color: inherit;
}

.step-item.is-current {
  border-color: rgba(185, 95, 58, 0.22);
  background: rgba(185, 95, 58, 0.08);
}

.step-item.is-done {
  background: rgba(109, 128, 104, 0.08);
}

.step-dot {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(71, 53, 38, 0.08);
  color: var(--paper-ink);
  font-size: 13px;
  font-weight: 700;
}

.step-item.is-current .step-dot {
  background: var(--terracotta);
  color: #fff;
}

.step-item.is-done .step-dot {
  background: var(--sage);
  color: #fff;
}

.step-label {
  font-size: 14px;
  font-weight: 600;
}

.metric-grid,
.two-column,
.three-column {
  display: grid;
  gap: 18px;
  margin-bottom: 22px;
}

.focus-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid rgba(71, 53, 38, 0.09);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(185, 95, 58, 0.12), rgba(109, 128, 104, 0.08)),
    rgba(255, 252, 247, 0.86);
  box-shadow: var(--shadow-soft);
}

.focus-main {
  display: grid;
  gap: 12px;
}

.focus-main h2 {
  font-size: clamp(1.6rem, 3vw, 2.7rem);
}

.focus-side {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 252, 247, 0.72);
  border: 1px solid var(--paper-line);
}

.focus-step {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 2.4rem;
  color: var(--terracotta);
}

.drawer {
  margin-bottom: 18px;
  border: 1px solid rgba(71, 53, 38, 0.09);
  border-radius: var(--radius-xl);
  background: rgba(255, 252, 247, 0.62);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.drawer summary {
  cursor: pointer;
  padding: 18px 22px;
  font-weight: 700;
  color: var(--paper-ink);
}

.drawer-body {
  padding: 0 18px 18px;
}

.metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-stack {
  display: grid;
  gap: 18px;
}

.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.panel,
.list-card,
.stage-card,
.idea-card,
.evidence-card {
  border: 1px solid rgba(71, 53, 38, 0.09);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto -12% -35% auto;
  width: 9rem;
  height: 9rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(185, 95, 58, 0.16), transparent 68%);
}

.metric-value {
  position: relative;
  z-index: 1;
  margin: 10px 0 8px;
  font-size: clamp(1.4rem, 2vw, 2.3rem);
  line-height: 1.15;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  word-break: break-word;
}

.panel {
  padding: 22px;
}

.panel-header {
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin-top: 6px;
  font-size: 1.4rem;
}

.panel-action {
  color: var(--paper-muted);
}

.panel-body {
  min-width: 0;
}

.hero-note {
  padding: 16px 18px;
  margin-bottom: 14px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(185, 95, 58, 0.1), rgba(185, 95, 58, 0.04));
}

.list-card,
.idea-card,
.evidence-card {
  padding: 18px;
  margin-bottom: 14px;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.note-card {
  padding: 16px 18px;
  margin-bottom: 12px;
  border: 1px solid rgba(71, 53, 38, 0.09);
  border-radius: 20px;
  background: rgba(255, 254, 250, 0.82);
}

.note-card p + p {
  margin-top: 8px;
}

.ai-chat-shell {
  display: grid;
  min-height: 520px;
  border: 1px solid rgba(71, 53, 38, 0.1);
  border-radius: 24px;
  background: rgba(255, 252, 247, 0.7);
  overflow: hidden;
}

.ai-chat-header {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(71, 53, 38, 0.08);
  background: rgba(255, 252, 247, 0.88);
}

.ai-chat-header h3 {
  margin-top: 4px;
  font-size: 1.35rem;
}

.ai-chat-header p {
  margin-top: 6px;
  color: var(--paper-muted);
  font-size: 14px;
}

.ai-chat-thread {
  display: grid;
  align-content: start;
  gap: 18px;
  max-height: 58vh;
  min-height: 280px;
  overflow-y: auto;
  padding: 22px 20px;
}

.ai-message {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.ai-message.user {
  grid-template-columns: minmax(0, 1fr) 38px;
}

.ai-message.user .ai-avatar {
  grid-column: 2;
  background: linear-gradient(145deg, #bc6843, #e5b18b);
}

.ai-message.user .ai-message-body {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  background: #fff7ed;
}

.ai-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--sage), #a9b79f);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.ai-message-body {
  width: min(760px, 100%);
  padding: 14px 16px;
  border: 1px solid rgba(71, 53, 38, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.ai-message-body p {
  white-space: pre-wrap;
}

.ai-message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--paper-muted);
}

.ai-message-meta strong {
  color: var(--paper-ink);
}

.ai-message-note {
  margin-top: 10px;
  color: var(--paper-muted);
  font-size: 13px;
}

.ai-message.is-thinking .ai-message-body {
  background: rgba(246, 241, 231, 0.82);
}

.ai-message.is-thinking .ai-message-body p::after {
  content: '';
  display: inline-block;
  width: 1.4em;
  animation: thinkingDots 1.2s steps(4, end) infinite;
}

.ai-chat-composer {
  padding: 14px;
  border-top: 1px solid rgba(71, 53, 38, 0.08);
  background: rgba(255, 252, 247, 0.92);
}

.chat-form {
  display: grid;
  gap: 10px;
}

.chat-form textarea {
  min-height: 84px;
  resize: vertical;
}

.chat-form button:disabled,
.chat-form textarea:disabled {
  cursor: wait;
  opacity: 0.68;
}

.chat-tools {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.file-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  background: rgba(255, 252, 247, 0.8);
  color: var(--paper-muted);
  cursor: pointer;
  font-size: 14px;
  overflow: hidden;
}

.file-chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.chat-empty {
  padding: 36px 18px;
  text-align: center;
  color: var(--paper-muted);
}

.selection-draft-preview {
  gap: 16px;
}

.selection-draft-preview p {
  margin-top: 6px;
  white-space: pre-wrap;
}

.toast-root {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 40;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(71, 53, 38, 0.09);
  background: rgba(255, 252, 247, 0.96);
  color: var(--paper-ink);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.toast.success {
  border-color: rgba(109, 128, 104, 0.28);
}

.toast.error {
  border-color: rgba(185, 95, 58, 0.28);
  color: var(--terracotta);
}

.process-grid {
  display: grid;
  gap: 12px;
}

.process-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 6px 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid rgba(71, 53, 38, 0.09);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.72);
}

.process-card span {
  grid-row: span 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--sage);
  color: #fff;
  font-weight: 800;
}

.process-card strong {
  color: var(--paper-ink);
}

.process-card p {
  color: var(--paper-muted);
  font-size: 13px;
}

.evidence-board {
  display: grid;
  gap: 12px;
}

.evidence-card {
  padding: 15px;
  border: 1px solid rgba(71, 53, 38, 0.09);
  border-radius: 18px;
  background: rgba(255, 252, 247, 0.8);
}

.evidence-label,
.journey-title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

.evidence-card strong {
  display: block;
  margin-top: 6px;
  color: var(--paper-ink);
  font-size: 16px;
}

.evidence-card p {
  margin-top: 6px;
  color: var(--paper-muted);
  font-size: 13px;
}

.journey-board {
  display: grid;
  gap: 10px;
}

.journey-step {
  padding: 14px;
  border-radius: 16px;
  border: 1px dashed rgba(71, 53, 38, 0.14);
  background: rgba(252, 248, 242, 0.9);
}

.journey-step p {
  margin-top: 6px;
  color: var(--paper-ink);
  line-height: 1.6;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.pagination-meta {
  color: var(--paper-muted);
  font-size: 13px;
}

@keyframes thinkingDots {
  0% {
    content: '';
  }
  25% {
    content: '.';
  }
  50% {
    content: '..';
  }
  75%,
  100% {
    content: '...';
  }
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.material-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(71, 53, 38, 0.1);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.72);
}

.material-card img,
.file-icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
}

.material-card img {
  object-fit: cover;
  border: 1px solid rgba(71, 53, 38, 0.08);
}

.file-icon {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(185, 95, 58, 0.15), rgba(109, 128, 104, 0.13));
  color: var(--terracotta);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.material-card div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.material-card strong,
.material-card span {
  overflow-wrap: anywhere;
}

.material-card span {
  color: var(--paper-muted);
  font-size: 12px;
}

.idea-card,
.evidence-card {
  display: grid;
  justify-content: stretch;
}

.list-card:hover,
.idea-card:hover,
.evidence-card:hover,
.stage-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(185, 95, 58, 0.2);
}

.list-card-main,
.list-card-side {
  display: grid;
  align-content: start;
  gap: 10px;
}

.idea-card h3,
.evidence-card h3 {
  font-size: 1.2rem;
  line-height: 1.3;
}

.idea-card form {
  margin-top: 6px;
}

.idea-card .button,
.evidence-card .button {
  width: 100%;
}

.list-card-main p,
.stage-card p,
.idea-card p,
.evidence-card p {
  color: var(--paper-muted);
}

.list-card-side {
  justify-items: end;
  min-width: 132px;
}

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

.stage-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: start;
  column-gap: 16px;
  padding: 18px;
  margin-bottom: 14px;
}

.stage-order {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(185, 95, 58, 0.12), rgba(185, 95, 58, 0.04));
  color: var(--terracotta);
  font-weight: 700;
}

.stage-card > div:last-child {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.stage-card h3 {
  font-size: 1.16rem;
  line-height: 1.25;
}

.stage-focus-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage);
  font-size: 12px;
  font-weight: 600;
}

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

.pill {
  background: var(--terracotta-soft);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: linear-gradient(180deg, #3b82f6 0%, #2e6fd0 100%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(46, 111, 208, 0.18);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--paper-ink);
  border-color: var(--paper-line);
  box-shadow: none;
}

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

.button.back {
  background: transparent;
  color: var(--paper-muted);
  border-color: var(--paper-line);
  box-shadow: none;
}

.button.back:hover {
  color: var(--paper-ink);
  background: rgba(255, 255, 255, 0.74);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.inline-password-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.inline-password-form input {
  min-width: 180px;
}

.project-switcher label,
.account-card {
  display: grid;
  gap: 8px;
}

.project-switcher span,
.account-card span {
  color: var(--paper-muted);
  font-size: 13px;
}

.project-switcher select {
  min-width: 280px;
}

.stage-locked-hint {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 16px;
  color: var(--paper-muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed var(--paper-line);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  box-shadow: none;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  align-items: center;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.inline-form-top {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(71, 53, 38, 0.12);
}

.stack-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--paper-muted);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(71, 53, 38, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  padding: 12px 14px;
  color: var(--paper-ink);
  font: inherit;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(185, 95, 58, 0.45);
  box-shadow: 0 0 0 4px rgba(185, 95, 58, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(71, 53, 38, 0.08);
}

th {
  color: var(--paper-muted);
  font-size: 13px;
  font-weight: 600;
}

.table-link {
  color: var(--terracotta);
}

.metric-link {
  color: inherit;
  text-decoration: none;
  display: block;
}

.metric-link .metric-card {
  height: 100%;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.metric-link:hover .metric-card {
  transform: translateY(-2px);
  border-color: rgba(185, 95, 58, 0.2);
  box-shadow: 0 18px 36px rgba(71, 53, 38, 0.08);
}

.stack-block {
  display: grid;
  gap: 16px;
}

.stack-block p {
  margin: 8px 0 0;
}

.simple-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.timeline-list {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(71, 53, 38, 0.08);
}

.timeline-item h3 {
  margin: 0;
}

.timeline-item p {
  margin: 6px 0 10px;
}

.timeline-order {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(109, 128, 104, 0.16);
  color: var(--olive);
  font-weight: 700;
}

.chat-thread {
  display: grid;
  gap: 14px;
}

.chat-bubble {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(71, 53, 38, 0.08);
}

.chat-bubble.user {
  background: rgba(185, 95, 58, 0.08);
}

.chat-bubble.assistant {
  background: rgba(109, 128, 104, 0.08);
}

.chat-bubble-meta {
  color: var(--paper-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.chat-bubble-content {
  white-space: pre-wrap;
}

.chat-bubble-note {
  margin-top: 8px;
  color: var(--paper-muted);
  font-size: 14px;
}

.feedback-box,
.comment-block {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(109, 128, 104, 0.09), rgba(109, 128, 104, 0.05));
  color: var(--paper-ink);
}

.auth-wrap {
  min-height: calc(100vh - 140px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(560px, 100%);
  padding: 34px;
  border: 1px solid rgba(71, 53, 38, 0.09);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 8px 0 10px;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.auth-error {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(185, 95, 58, 0.12);
  color: var(--terracotta);
  font-weight: 600;
}

.inline-banner {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: 16px;
  font-weight: 600;
}

.inline-banner.success {
  background: rgba(77, 122, 77, 0.12);
  color: var(--olive);
}

.inline-banner.error {
  background: rgba(185, 95, 58, 0.12);
  color: var(--terracotta);
}

.demo-account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.demo-account-grid div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.72);
  border: 1px solid var(--paper-line);
}

.demo-account-grid span {
  color: var(--paper-muted);
  font-size: 13px;
}

.score-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.score-line {
  display: grid;
  grid-template-columns: 96px 56px minmax(0, 1fr);
  align-items: start;
  column-gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(71, 53, 38, 0.08);
}

.score-line strong {
  color: var(--terracotta);
  font-size: 1.1rem;
  line-height: 1.3;
}

.score-line span:first-child {
  color: var(--paper-ink);
  font-weight: 600;
}

.score-line span:last-child {
  color: var(--paper-muted);
  line-height: 1.6;
}

.bullet-list {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
  color: var(--paper-muted);
}

.compact-list {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.7;
}

.empty {
  padding: 10px 0;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--paper-line);
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .metric-grid,
  .two-column,
  .three-column,
  .focus-board {
    grid-template-columns: 1fr;
  }

  .step-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-top-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .content {
    padding: 14px;
  }

  .page-canvas {
    padding: 20px;
    border-radius: 26px;
  }

  .topbar,
  .page-header,
  .panel-header,
  .list-card,
  .score-line,
  .evidence-card {
    flex-direction: column;
  }

  .step-rail {
    grid-template-columns: 1fr;
  }

  .project-top-nav {
    grid-template-columns: 1fr;
  }

  .score-line {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }

  .ai-chat-thread {
    max-height: none;
    padding: 16px 14px;
  }

  .ai-message,
  .ai-message.user {
    grid-template-columns: 1fr;
  }

  .ai-message.user .ai-avatar,
  .ai-message.user .ai-message-body {
    grid-column: auto;
    grid-row: auto;
    justify-self: stretch;
  }

  .ai-avatar {
    display: none;
  }

  .chat-tools {
    grid-template-columns: 1fr;
  }

  .focus-board {
    padding: 18px;
  }

  .drawer-body {
    padding: 0 12px 12px;
  }

  .stage-card {
    grid-template-columns: 1fr;
    row-gap: 12px;
  }

  .list-card-side {
    justify-items: stretch;
    min-width: 0;
  }
}
