:root {
  --bg: #f4f7fc;
  --surface: #ffffff;
  --surface-alt: #f8fbff;
  --text: #1f2a44;
  --muted: #6d7a94;
  --accent: #1f5fb9;
  --accent-soft: #e4efff;
  --accent-contrast: #ffffff;
  --border: #d4e0f3;
  --success: #1f9b58;
  --warning: #d94e61;
  --shadow: 0 24px 60px rgba(31, 42, 68, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #f8fbff 0%, #edf3fb 100%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  overflow-x: hidden;
}

body.is-modal-open {
  overflow: hidden;
}

body:not(.is-authenticated) {
  background: linear-gradient(180deg, #f8fbff 0%, #edf3fb 100%);
}

.access-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.access-gate__card {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 32px;
  align-items: center;
  padding: 32px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.access-gate__brand {
  display: grid;
  gap: 12px;
  align-content: start;
}

.access-gate__content {
  display: grid;
  gap: 16px;
}

.access-gate__eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.access-gate__content h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.access-gate__text {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.access-gate__form {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

.access-field {
  display: grid;
  gap: 8px;
}

.access-field span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.access-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
}

.access-field input:focus {
  outline: 3px solid rgba(31, 95, 185, 0.16);
  border-color: var(--accent);
}

.access-gate__button {
  width: fit-content;
  min-width: 168px;
}

.access-gate__note {
  margin: 0;
}

.process-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.process-modal.is-hidden {
  display: none;
}

.process-modal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(31, 42, 68, 0.46);
  backdrop-filter: blur(4px);
}

.process-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(820px, 100%);
  max-height: min(90vh, 920px);
  overflow: auto;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.process-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.process-modal__eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.process-modal__header h2 {
  margin: 0 0 8px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.process-modal__lead {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.4;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
}

.process-form {
  display: grid;
  gap: 18px;
}

.process-form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.process-field {
  display: grid;
  gap: 8px;
}

.process-field span,
.process-checkbox span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.process-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
}

.process-field input:focus,
.process-checkbox input:focus {
  outline: 3px solid rgba(31, 95, 185, 0.16);
  border-color: var(--accent);
}

.process-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-alt);
}

.process-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.process-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 4px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 32px 0 40px;
}

.page-intro {
  margin: 0 0 24px;
  padding: 0 40px;
  max-width: 760px;
}

.page-intro h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.3;
}

.canvas {
  padding: 0 0 24px;
}

.surface {
  margin: 0 0 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.surface.is-hidden {
  display: none;
}

.is-hidden {
  display: none !important;
}

.app-shell.is-hidden {
  display: none;
}

.surface-header,
.workspace-header,
.filters-row,
.status-row,
.summary-row,
.pagination,
.workspace-body,
.stepper {
  padding-inline: 32px;
}

.surface-header {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: grid;
  gap: 8px;
}

.brand-logo {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
}

.brand-logo--gate {
  width: 140px;
}

.brand-logo--header {
  width: 106px;
}

.top-right,
.workspace-meta,
.chat-badges,
.quick-link-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-pill,
.stage-pill,
.badge,
.status-chip,
.step,
.pagination-button,
.link-button,
.secondary-button,
.primary-button,
.text-button,
.back-button,
.avatar {
  border: 0;
  border-radius: 999px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.product-pill,
.agent-pill,
.stage-pill,
.badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 37px;
  padding: 0 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.agent-pill {
  min-height: 40px;
  padding: 0 18px;
  background: linear-gradient(180deg, #2d66c7 0%, #1f5fb9 100%);
  color: var(--accent-contrast);
  box-shadow: 0 10px 20px rgba(31, 95, 185, 0.18);
}

.stage-pill {
  background: var(--accent);
  color: var(--accent-contrast);
}

.avatar {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 800;
}

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

.filter-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 37px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--accent);
  font-weight: 700;
}

.filter-chip span {
  pointer-events: none;
}

.filter-chip select {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  outline: none;
  min-width: 0;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.status-chip {
  border: 1px solid transparent;
  background: var(--accent-soft);
}

.status-chip:not(.is-active) {
  color: var(--accent);
  border-color: var(--border);
}

.status-chip.is-active,
.step.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
}

.summary-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.primary-button,
.secondary-button,
.link-button,
.text-button,
.pagination-button,
.back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: var(--accent-contrast);
}

.secondary-button {
  background: var(--surface-alt);
  color: var(--accent);
  border: 1px solid var(--border);
}

.secondary-button--warning {
  border-color: rgba(217, 78, 97, 0.28);
  color: var(--warning);
  background: #fff6f8;
}

.text-button,
.back-button {
  background: transparent;
  color: var(--accent);
  padding-inline: 10px;
}

.process-list {
  padding: 22px 32px 4px;
  display: grid;
  gap: 16px;
}

.process-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(31, 42, 68, 0.03);
  padding: 18px 20px 16px;
}

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

.status-tag {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #ffe5ef;
  color: #ff3d76;
  font-size: 14px;
  font-weight: 700;
}

.status-tag.status--in-progress {
  background: #e8f1ff;
  color: #2d67c9;
}

.status-tag.status--draft-ready {
  background: #e2f7e9;
  color: #1f9b58;
}

.status-tag.status--blocked {
  background: #fff0f0;
  color: #ef4a4a;
}

.process-card__arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f3f8ff;
  color: var(--accent);
  font-size: 26px;
  line-height: 1;
  font-weight: 700;
}

.process-title {
  margin: 0 0 12px;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.process-meta,
.stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.process-meta {
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: #4d628f;
  font-size: 14px;
}

.process-meta span + span::before {
  content: "|";
  margin: 0 10px;
  color: #c0cee2;
}

.stage-row {
  margin-bottom: 10px;
  color: var(--accent);
  font-weight: 700;
}

.stage-row span:last-child {
  color: #5879b0;
}

.progress-track {
  height: 6px;
  border-radius: 999px;
  background: #e9f0fa;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 24px;
}

.pagination-label {
  font-weight: 700;
  color: #5879b0;
}

.pagination-button {
  width: 32px;
  min-width: 32px;
  padding: 0;
  background: #f3f8ff;
  color: var(--accent);
  font-size: 22px;
}

.workspace-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding-top: 24px;
  padding-bottom: 8px;
}

.workspace-title h2,
.chat-panel h3,
.quick-links h3,
.panel h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

.workspace-kicker {
  color: #5475ad;
  font-size: 14px;
  margin-bottom: 2px;
}

.workspace-meta {
  justify-content: flex-end;
}

.stepper {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 8px;
  padding-bottom: 18px;
  scrollbar-width: none;
}

.stepper::-webkit-scrollbar {
  display: none;
}

.step {
  min-height: 36px;
  padding: 0 14px;
  background: #e7faf0;
  color: #0d9e56;
  border: 1px solid rgba(13, 158, 86, 0.18);
  flex: 0 0 auto;
  font-weight: 700;
}

.step.is-locked {
  background: #f2f4f9;
  color: #9aa7bd;
  border-color: #dbe2ee;
}

.step.is-viewing {
  box-shadow: inset 0 0 0 1px rgba(31, 95, 185, 0.26);
}

.workspace-body {
  display: grid;
  grid-template-columns: minmax(0, 1.95fr) minmax(300px, 1fr);
  gap: 18px;
  padding-bottom: 24px;
}

.chat-column,
.panels-column {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.chat-panel,
.panel,
.quick-links {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  padding: 18px;
}

.chat-panel {
  min-height: 760px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
}

.chat-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.chat-panel__header p,
.quick-links p,
.panel p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.35;
}

.badge {
  min-height: 31px;
  padding-inline: 12px;
  background: #eff5ff;
}

.badge-muted {
  background: #f3f5f9;
  color: #7f8da8;
}

.messages {
  display: grid;
  gap: 12px;
  align-content: start;
}

.message {
  width: fit-content;
  max-width: min(700px, 100%);
  padding: 14px 16px 16px;
  border-radius: 20px;
  background: #f6f8fc;
  border: 1px solid #e3eaf5;
}

.message-agent {
  background: #f8fbff;
}

.message-user {
  margin-left: auto;
  background: #eef6ff;
}

.message-author {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.message p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.workflow-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  background: #f3f8ff;
  color: #355f9f;
  font-size: 14px;
  font-weight: 700;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
}

.composer input {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0 16px;
  background: #fbfdff;
  color: var(--text);
}

.composer input::placeholder {
  color: #92a2be;
}

.quick-links {
  display: grid;
  gap: 14px;
}

.voice-client-panel,
.draft-panel {
  display: grid;
  gap: 14px;
}

.voice-client-panel h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
}

.voice-client-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 16px;
}

.voice-client-column {
  display: grid;
  gap: 12px;
}

.question-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.question-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #dbe6f5;
  border-radius: 14px;
  padding: 10px 12px;
  background: #f8fbff;
}

.question-item--soft {
  background: #fbfdff;
}

.question-item p {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.question-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(29, 95, 185, 0.12);
  color: var(--primary);
  font-weight: 700;
  font-size: 12px;
}

.question-number--soft {
  background: rgba(59, 156, 120, 0.12);
  color: var(--success);
}

.question-list--secondary .question-item {
  background: #fbfdfd;
}

.voice-client-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.draft-preview {
  border: 1px solid #dbe6f5;
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.draft-summary {
  display: grid;
  gap: 8px;
}

.draft-summary p {
  margin: 0;
  line-height: 1.5;
}

.helper-note {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.quick-link-row {
  flex-wrap: wrap;
}

.link-button {
  min-height: 40px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.panel {
  display: grid;
  gap: 14px;
}

.approval-actions {
  display: grid;
  gap: 12px;
}

.comment-field {
  display: grid;
  gap: 8px;
  color: var(--accent);
  font-weight: 700;
}

.comment-field span {
  font-size: 14px;
}

.comment-field textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
  background: #fbfdff;
  color: var(--text);
}

.approval-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.field-error {
  margin: 0;
  color: var(--warning);
  font-size: 14px;
  font-weight: 700;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.materials-list,
.approval-list,
.history-list {
  display: grid;
  gap: 10px;
}

.material,
.approval-item,
.history-item,
.conflict-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 16px;
  padding: 12px 14px;
  background: #fbfdff;
  border: 1px solid #e3eaf5;
}

.material div,
.history-item p {
  display: grid;
  gap: 3px;
}

.material strong,
.approval-item strong,
.conflict-card strong {
  font-size: 15px;
}

.material span,
.approval-item span,
.approval-item time {
  color: var(--muted);
  font-size: 13px;
}

.material-source {
  font-size: 12px;
  color: #6780ae;
}

.material-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 800;
}

.material-state.is-ok {
  color: var(--success);
}

.material-state.is-warning {
  color: var(--warning);
}

.panel-warning {
  border-color: rgba(217, 78, 97, 0.26);
  background: #fffdfd;
}

.panel-warning h3,
.panel-warning p {
  color: #d94e61;
}

.panel-warning .conflict-card {
  background: #f9fbff;
  color: #4c5d7d;
}

.conflict-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.source-choice {
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid #dbe6f5;
  border-radius: 14px;
  padding: 12px 14px;
  background: #ffffff;
  color: var(--text);
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.source-choice span {
  font-weight: 700;
  font-size: 14px;
}

.source-choice small {
  color: var(--muted);
  font-size: 12px;
}

.source-choice.is-active {
  border-color: var(--primary);
  background: rgba(29, 95, 185, 0.08);
}

.source-choice:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.helper-note.is-error {
  color: var(--warning);
}

.panel-history {
  min-height: 260px;
}

.history-item {
  align-items: flex-start;
}

.history-item time {
  min-width: 54px;
  color: #5772a6;
  font-weight: 700;
}

.history-item p {
  margin: 0;
}

:focus-visible {
  outline: 3px solid rgba(31, 95, 185, 0.28);
  outline-offset: 3px;
}

button:hover,
.link-button:hover,
.primary-button:hover,
.secondary-button:hover,
.pagination-button:hover,
.step:hover,
.status-chip:hover,
.filter-chip:hover {
  transform: translateY(-1px);
}

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

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

  .panel-history {
    grid-column: 1 / -1;
  }
}

@media (max-width: 920px) {
  .access-gate__card {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .access-gate__brand {
    justify-items: start;
  }

  .page-intro,
  .surface-header,
  .filters-row,
  .status-row,
  .summary-row,
  .process-list,
  .pagination,
  .workspace-header,
  .stepper,
  .workspace-body {
    padding-inline: 20px;
  }

  .surface-header,
  .workspace-header {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .workspace-meta {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .filters-row {
    grid-template-columns: 1fr;
  }

  .summary-row,
  .chat-panel__header,
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .voice-client-grid {
    grid-template-columns: 1fr;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .panels-column {
    grid-template-columns: 1fr;
  }

  .process-modal {
    padding: 18px;
  }

  .process-modal__dialog {
    padding: 22px;
  }

  .process-form__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding-top: 20px;
  }

  .page-intro h1 {
    font-size: 32px;
  }

  .page-intro p {
    font-size: 16px;
  }

  .surface {
    border-radius: 24px;
  }

  .surface-header {
    min-height: auto;
    padding-top: 20px;
    padding-bottom: 12px;
  }

  .process-card__top {
    align-items: flex-start;
  }

  .process-meta,
  .stage-row {
    display: grid;
    gap: 6px;
  }

  .process-meta span + span::before {
    content: none;
  }

  .workspace-body {
    padding-bottom: 20px;
  }

  .conflict-options {
    grid-template-columns: 1fr;
  }

  .voice-client-actions {
    flex-direction: column;
  }

  .process-modal {
    padding: 12px;
  }

  .process-modal__dialog {
    padding: 18px;
    border-radius: 22px;
  }

  .process-modal__header {
    flex-direction: column;
  }

  .process-form__actions {
    flex-direction: column-reverse;
  }

  .process-form__actions .primary-button,
  .process-form__actions .secondary-button {
    width: 100%;
    justify-content: center;
  }
}
