:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f5f9ff;
  --line: #b8d3f6;
  --line-strong: #91b9ec;
  --text: #17365f;
  --ink: #17365f;
  --ink-strong: #0d2b50;
  --muted: #5d7795;
  --soft: #7e95b0;
  --blue: #2874f0;
  --blue-strong: #1464dc;
  --green: #0b8a49;
  --purple: #7252c7;
  --amber: #a86900;
  --red: #b42318;
  --shadow: 0 18px 52px rgba(23, 54, 95, .09);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 3px solid rgba(40, 116, 240, .25);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  min-height: 100dvh;
  padding-bottom: 36px;
}

.page-width {
  width: min(1348px, calc(100% - 92px));
  margin-inline: auto;
}

.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 46px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(18px);
  position: relative;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink-strong);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-block;
  border-radius: 999px;
  background: var(--blue);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: inherit;
  background: #ffffff;
}

.brand strong {
  display: block;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.02em;
}

.brand small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.worker-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.status-dot,
.agent-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(11, 138, 73, .11);
}

.status-dot.working {
  background: var(--blue);
  box-shadow: 0 0 0 5px rgba(40, 116, 240, .12);
}

.status-dot.complete {
  background: var(--purple);
  box-shadow: 0 0 0 5px rgba(114, 82, 199, .12);
}

.avatar {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #dceaff;
  color: #174b95;
  font-weight: 800;
}

.worker-sign-out {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.worker-sign-out:hover {
  border-color: #b8c7da;
  color: var(--ink);
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 42px 0 26px;
}

.eyebrow,
.section-kicker {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.eyebrow {
  margin-bottom: 10px;
}

h1 {
  max-width: 850px;
  font-size: clamp(42px, 5vw, 60px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 560;
}

.hero-copy {
  max-width: 780px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.45;
}

.ghost-button,
.primary-button,
.finish-button,
.send-button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
}

.ghost-button {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .82);
  color: var(--blue);
  white-space: nowrap;
}

.ghost-button:hover {
  border-color: #b8cbea;
  background: #f7faff;
}

.ghost-button svg,
.primary-button svg,
.finish-button svg {
  width: 18px;
  height: 18px;
}

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

.assignment-card {
  position: relative;
  min-height: 292px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 15px;
  padding: 25px 27px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .88);
  color: var(--text);
  text-align: left;
  box-shadow: 0 1px 2px rgba(23, 36, 61, .04);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease, background .16s ease;
}

.assignment-card:hover {
  transform: translateY(-2px);
  border-color: #b8cbea;
  box-shadow: var(--shadow);
}

.assignment-card.selected {
  border-color: var(--blue);
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
  box-shadow: 0 0 0 1px rgba(40, 116, 240, .26), var(--shadow);
}

.card-check {
  position: absolute;
  top: 19px;
  right: 19px;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--soft);
}

.assignment-card.selected .card-check {
  background: var(--blue);
  color: white;
}

.assignment-card.custom-choice {
  border-style: dashed;
  background: linear-gradient(155deg, rgba(245, 241, 255, .92), rgba(255, 255, 255, .96));
}

.assignment-card.custom-choice.selected {
  border-style: solid;
}

.card-check svg {
  width: 18px;
  height: 18px;
}

.card-icon,
.soft-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
}

.card-icon {
  width: 60px;
  height: 60px;
  background: #eaf3ff;
  color: var(--blue);
}

.card-icon.easy {
  background: #e7f7ee;
  color: var(--green);
}

.card-icon.custom {
  background: #eee9fb;
  color: var(--purple);
}

.custom-task-builder {
  margin-top: 18px;
  padding: 24px;
  border: 1px solid #d9d0f2;
  border-radius: 15px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 42px rgba(57, 41, 99, .08);
}

.custom-task-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}

.custom-task-heading h2 {
  margin: 2px 0 5px;
  font-size: 24px;
  letter-spacing: -.025em;
}

.custom-task-heading > div > p:last-child {
  color: var(--muted);
  line-height: 1.45;
}

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

.custom-task-form label {
  display: grid;
  align-content: start;
  gap: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.custom-task-form input,
.custom-task-form textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fbfcfe;
  color: var(--text);
  line-height: 1.45;
}

.custom-task-form input:focus,
.custom-task-form textarea:focus {
  border-color: var(--blue);
  background: white;
}

.custom-task-form small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.custom-task-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 2px;
}

.secondary-button {
  flex: 0 0 auto;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: #172033;
  color: white;
  font-weight: 800;
}

.secondary-button:hover:not(:disabled) {
  background: #0b1220;
}

.secondary-button svg {
  width: 18px;
  height: 18px;
}

.human-work-notice {
  width: min(560px, 100%);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #d8e7dc;
  border-radius: 10px;
  background: #f7fbf8;
  color: #365143;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
}

.human-work-notice svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--green);
}

.card-icon.medium {
  background: #fff2d4;
  color: var(--amber);
}

.card-icon.detailed {
  background: #efeaff;
  color: var(--purple);
}

.card-icon svg {
  width: 29px;
  height: 29px;
}

.card-body {
  display: grid;
  gap: 11px;
  width: 100%;
  padding-right: 20px;
}

.card-task {
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: -.025em;
}

.card-role,
.card-outcome {
  color: var(--muted);
  line-height: 1.4;
}

.card-role {
  font-size: 14px;
}

.card-outcome {
  font-size: 15px;
}

.card-role b,
.card-outcome b {
  color: var(--text);
  font-weight: 750;
}

.card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card-meta svg {
  width: 15px;
  height: 15px;
}

.selection-preview {
  margin-top: 22px;
  padding: 25px 28px 26px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 1px 2px rgba(23, 36, 61, .04);
}

.preview-heading,
.brief-topline {
  display: flex;
  align-items: center;
  gap: 14px;
}

.preview-heading h2,
.brief-topline h2,
.chat-header h2 {
  margin-top: 3px;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: -.02em;
}

.soft-icon {
  width: 46px;
  height: 46px;
}

.soft-icon.blue {
  background: #eaf3ff;
  color: var(--blue);
}

.soft-icon.purple {
  background: #efeaff;
  color: var(--purple);
}

.soft-icon svg {
  width: 23px;
  height: 23px;
}

.time-pill {
  margin-left: auto;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.prompt-box {
  margin-top: 18px;
  padding: 22px 25px;
  border: 1px solid #b9d7c4;
  border-radius: 9px;
  background: #f4fbf6;
  color: #155d30;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.52;
}

.finish-preview {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding: 0 2px;
}

.finish-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #fff3dc;
  color: var(--amber);
}

.finish-icon svg {
  width: 17px;
  height: 17px;
}

.finish-preview strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.finish-preview p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.start-area {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 22px;
}

.model-picker {
  width: min(560px, 100%);
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid #cbdcf4;
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 16px 38px rgba(32, 70, 124, .09), 0 1px 2px rgba(23, 36, 61, .04);
  text-align: left;
}

.agent-picker-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding-bottom: 5px;
}

.agent-picker-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 11px;
  background: #eaf3ff;
  color: var(--blue-strong);
}

.agent-picker-icon svg {
  width: 22px;
  height: 22px;
}

.agent-picker-heading .section-kicker {
  margin-bottom: 3px;
  color: var(--blue-strong);
  font-size: 11px;
}

.agent-picker-heading h2 {
  margin-bottom: 4px;
  font-size: 22px;
  letter-spacing: -.02em;
}

.agent-picker-heading > div > p:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.model-picker > label,
.model-tier-picker legend {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.model-tier-picker {
  min-width: 0;
  display: grid;
  gap: 7px;
  margin: 0 0 5px;
  padding: 0;
  border: 0;
}

.model-tier-picker legend {
  margin-bottom: 7px;
  padding: 0;
}

.model-tier-tabs {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.model-tier-option {
  min-width: 0;
  cursor: pointer;
}

.model-tier-card {
  min-height: 52px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: center;
}

.model-tier-card strong,
.model-tier-card small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.model-tier-card strong {
  color: inherit;
  font-size: 14px;
  line-height: 1.2;
}

.model-tier-card small {
  color: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.model-tier-option input:checked + .model-tier-card {
  border-width: 2px;
  border-color: #76a8e9;
  padding: 6px 9px;
  background: var(--surface);
  color: var(--blue-strong);
  box-shadow: 0 1px 3px rgba(23, 36, 61, .08);
}

.model-tier-option input:focus-visible + .model-tier-card {
  outline: 3px solid rgba(40, 116, 240, .25);
  outline-offset: 3px;
}

.model-tier-option input:disabled + .model-tier-card {
  cursor: not-allowed;
  opacity: .58;
}

.model-picker select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}

.model-picker select:hover:not(:disabled) {
  border-color: #9db9df;
}

.model-picker select:disabled {
  background: var(--surface-soft);
  color: var(--muted);
}

.model-picker p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.agent-selection-lock {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  padding: 9px 11px;
  border: 1px solid #bddfc9;
  border-radius: 9px;
  background: #f4fbf6;
  color: #17623a;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.agent-selection-lock svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.data-notice {
  width: min(560px, 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid #ead7a7;
  border-radius: 10px;
  background: #fffbef;
  color: #6c5526;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
}

.data-notice input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--blue);
}

.data-notice strong {
  display: block;
  margin-bottom: 2px;
  color: #533f18;
  font-size: 13px;
}

.primary-button {
  min-width: min(390px, 100%);
  min-height: 58px;
  padding: 0 24px;
  border-radius: 9px;
  background: linear-gradient(180deg, #1677ff 0%, var(--blue-strong) 100%);
  color: white;
  font-size: 21px;
  box-shadow: 0 15px 30px rgba(40, 116, 240, .2);
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.035);
}

.primary-button.compact {
  min-width: 0;
  min-height: 46px;
  font-size: 15px;
  box-shadow: none;
}

.quiet-copy {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

.loading-card {
  min-height: 232px;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .75);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.load-error {
  grid-column: 1 / -1;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px;
  border: 1px solid #efc4c0;
  border-radius: 11px;
  background: #fff8f7;
  color: var(--red);
  text-align: center;
}

.load-error span {
  color: var(--muted);
}

.load-error .ghost-button {
  margin-top: 6px;
}

.workspace-view {
  height: calc(100dvh - 78px);
  min-height: 650px;
  display: flex;
  flex-direction: column;
  padding-top: 25px;
}

.workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
}

.workspace-heading h1 {
  font-size: clamp(32px, 3vw, 44px);
}

.agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid #bddfc9;
  border-radius: 999px;
  background: #f4fbf6;
  color: #17623a;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.picker-qa-badge {
  max-width: max-content;
  margin-top: 14px;
  padding: 8px 11px;
  font-size: 12px;
  white-space: normal;
}

.picker-qa-badge svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.agent-dot {
  width: 8px;
  height: 8px;
  box-shadow: none;
}

.locked-agent-badge svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

@media (max-width: 560px) {
  .model-picker {
    padding: 16px;
  }

  .agent-picker-heading {
    grid-template-columns: 1fr;
  }

  .agent-picker-icon {
    width: 38px;
    height: 38px;
  }
}

.workspace-layout {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 18px;
}

.task-brief,
.chat-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 1px 2px rgba(23, 36, 61, .04);
  overflow: hidden;
}

.task-brief {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.brief-scroll {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 23px;
  padding: 23px;
  overflow-y: auto;
}

.protected-brief {
  -webkit-user-select: none;
  user-select: none;
}

.brief-section {
  display: grid;
  gap: 8px;
}

.brief-section h3,
.end-result-card h3 {
  font-size: 14px;
  letter-spacing: .01em;
}

.brief-section p,
.end-result-card p {
  font-size: 15px;
  line-height: 1.48;
}

.muted-copy {
  color: var(--muted);
}

.end-result-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 1px solid #b9d7c4;
  border-radius: 9px;
  background: #f4fbf6;
  color: #155d30;
}

.end-result-card > span {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #dff2e5;
}

.end-result-card svg {
  width: 16px;
  height: 16px;
}

.end-result-card h3 {
  margin-bottom: 5px;
}

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

.fact-list,
.readiness-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  list-style: none;
}

.fact-list li {
  position: relative;
  padding-left: 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.fact-list li::before {
  content: "";
  position: absolute;
  top: .63em;
  left: 1px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.done-list li {
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: start;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}

.done-list li svg {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: var(--blue);
}

.first-message-guide {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 11px;
  padding: 15px;
  border: 1px solid #c8d8ef;
  border-radius: 9px;
  background: #f5f9ff;
}

.first-message-guide > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e4efff;
  color: var(--blue);
}

.first-message-guide svg {
  width: 17px;
  height: 17px;
}

.first-message-guide h3,
.readiness-panel h3 {
  margin-bottom: 5px;
  font-size: 14px;
}

.first-message-guide p,
.readiness-panel > p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.readiness-panel {
  display: grid;
  gap: 11px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.readiness-item {
  display: grid;
  grid-template-columns: 19px 1fr;
  align-items: start;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.readiness-item svg {
  width: 17px;
  height: 17px;
  margin-top: 1px;
}

.readiness-item[data-status="passed"] {
  color: var(--green);
}

.readiness-item[data-status="failed"] {
  color: var(--red);
}

.finish-button {
  min-height: 48px;
  flex: 0 0 auto;
  margin: 0 23px 23px;
  padding: 0 16px;
  border-radius: 9px;
  background: var(--text);
  color: white;
}

.finish-button:hover:not(:disabled) {
  background: #263245;
}

.chat-panel {
  display: flex;
  flex-direction: column;
}

.chat-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.chat-header h2 {
  font-size: 19px;
}

.chat-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.turn-count {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.chat-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 15px;
  border-bottom: 1px solid #efc4c0;
  background: #fff4f2;
  color: var(--red);
  font-size: 13px;
  font-weight: 650;
}

.chat-error button {
  border: 0;
  background: transparent;
  color: var(--red);
  font-weight: 800;
  text-decoration: underline;
}

.message-list {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px clamp(18px, 4vw, 54px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f7f8fb;
}

.message {
  min-width: 0;
  width: fit-content;
  max-width: min(82%, 780px);
  display: grid;
  gap: 7px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  box-shadow: 0 2px 8px rgba(23, 36, 61, .04);
}

.user-message {
  align-self: flex-end;
  border-color: #126cda;
  background: var(--blue);
  color: white;
}

.failed-message {
  border-color: #d96d63;
  background: #fff2f0;
  color: var(--red);
}

.message-meta {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.user-message:not(.failed-message) .message-meta {
  color: rgba(255, 255, 255, .78);
}

.message-content {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  line-height: 1.55;
}

.assistant-message .message-content {
  white-space: normal;
}

.tool-activity-list {
  display: grid;
  gap: 6px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.tool-activity {
  min-width: 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f4f8fd;
  color: #31516f;
}

.tool-activity svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.tool-activity span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tool-activity strong {
  font-size: 12px;
  line-height: 1.35;
}

.tool-activity small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-activity.tool-error {
  background: #fff4f2;
  color: var(--red);
}

.assistant-message .message-content > *:first-child {
  margin-top: 0;
}

.assistant-message .message-content > *:last-child {
  margin-bottom: 0;
}

.assistant-message .message-content h3,
.assistant-message .message-content h4,
.assistant-message .message-content h5 {
  margin: 20px 0 8px;
  color: var(--text);
  line-height: 1.25;
}

.assistant-message .message-content h3 {
  font-size: 18px;
}

.assistant-message .message-content h4 {
  font-size: 15px;
}

.assistant-message .message-content h5 {
  font-size: 13px;
  letter-spacing: .01em;
}

.assistant-message .message-content p,
.assistant-message .message-content ul,
.assistant-message .message-content ol,
.assistant-message .message-content blockquote,
.assistant-message .message-content pre,
.assistant-message .message-content .markdown-table-wrap {
  margin: 0 0 13px;
}

.assistant-message .message-content ul,
.assistant-message .message-content ol {
  padding-left: 22px;
}

.assistant-message .message-content li > ul,
.assistant-message .message-content li > ol {
  margin: 6px 0 2px;
  padding-left: 21px;
}

.assistant-message .message-content li + li {
  margin-top: 5px;
}

.assistant-message .message-content blockquote {
  padding: 2px 0 2px 14px;
  border-left: 3px solid #b9cbe2;
  color: #42566c;
}

.assistant-message .message-content blockquote blockquote {
  margin-top: 9px;
}

.assistant-message .message-content hr {
  height: 1px;
  margin: 18px 0;
  border: 0;
  background: var(--line);
}

.assistant-message .message-content code {
  overflow-wrap: anywhere;
  padding: 2px 5px;
  border-radius: 5px;
  background: #edf1f7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .9em;
}

.assistant-message .message-content pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 13px 14px;
  border-radius: 8px;
  background: #172033;
  color: #f5f7fb;
}

.assistant-message .message-content pre code {
  overflow-wrap: normal;
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  overscroll-behavior-inline: contain;
}

.markdown-table-wrap:focus-visible {
  outline: 3px solid rgba(18, 108, 218, .22);
  outline-offset: 2px;
}

.markdown-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.markdown-table-wrap th,
.markdown-table-wrap td {
  padding: 8px 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.markdown-table-wrap tr:last-child td {
  border-bottom: 0;
}

.markdown-table-wrap th:last-child,
.markdown-table-wrap td:last-child {
  border-right: 0;
}

.markdown-table-wrap th {
  background: var(--surface-soft);
  font-weight: 800;
}

.markdown-table-wrap .markdown-align-center {
  text-align: center;
}

.markdown-table-wrap .markdown-align-right,
.markdown-table-wrap .markdown-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.message small {
  font-weight: 700;
}

.chat-empty {
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.chat-empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 4px;
  color: var(--soft);
}

.chat-empty strong {
  color: var(--text);
}

.chat-empty span {
  font-size: 13px;
}

.typing-message {
  min-width: 118px;
}

.typing-dots {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--soft);
  animation: typing 1.1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: .15s;
}

.typing-dots span:nth-child(3) {
  animation-delay: .3s;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.composer-form {
  position: relative;
  padding: 12px 16px 13px;
  border-top: 1px solid var(--line);
  background: white;
}

.composer-input-shell {
  position: relative;
}

.composer-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 2px 8px;
  font-size: 12px;
  font-weight: 800;
}

.composer-label-row span {
  color: var(--blue);
}

.composer-form textarea {
  width: 100%;
  min-height: 54px;
  max-height: 160px;
  resize: none;
  padding: 15px 58px 15px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fbfcfe;
  color: var(--text);
  line-height: 1.45;
}

.composer-form textarea::placeholder {
  color: var(--soft);
}

.send-button {
  position: absolute;
  top: 50%;
  right: 9px;
  width: 37px;
  height: 37px;
  transform: translateY(-50%);
  border-radius: 9px;
  background: var(--blue);
  color: white;
}

.composer-file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 9px;
}

.attach-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid #bed3ef;
  border-radius: 9px;
  background: #f4f8fe;
  color: #28557f;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.attach-button:hover:not(:disabled) {
  background: #edf3fb;
  color: var(--blue);
}

.attach-button svg {
  width: 18px;
  height: 18px;
}

.composer-file-hint {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 2px 9px;
}

.attachment-tray-heading {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.attachment-tray-heading strong {
  color: var(--text);
  font-size: 11px;
}

.attachment-chip {
  max-width: 100%;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 4px 4px 9px;
  border: 1px solid #bed3ef;
  border-radius: 9px;
  background: #f4f8fe;
  color: #28557f;
  font-size: 12px;
  font-weight: 750;
}

.attachment-chip-copy {
  max-width: 240px;
  min-width: 0;
  display: grid;
  gap: 1px;
}

.attachment-chip-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.attachment-chip > svg,
.attachment-chip button svg {
  width: 14px;
  height: 14px;
}

.attachment-chip button {
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
}

.attachment-chip button:hover {
  background: #dfeaf8;
}

.attachment-chip.discarding {
  opacity: .62;
}

.upload-status {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.send-button svg {
  width: 19px;
  height: 19px;
}

.composer-hint {
  margin: 6px 2px 0;
  padding-right: 48px;
  color: var(--soft);
  font-size: 11px;
}

.composer-error {
  margin: 7px 2px 0;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.complete-view {
  min-height: calc(100dvh - 114px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.complete-mark {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  border-radius: 50%;
  background: #e3f6eb;
  color: var(--green);
}

.complete-mark svg {
  width: 38px;
  height: 38px;
}

.complete-view h1 {
  font-size: 54px;
}

.complete-view > p:not(.eyebrow) {
  margin-top: 13px;
  color: var(--muted);
  font-size: 18px;
}

.complete-view .primary-button {
  margin-top: 30px;
}

.completed-resources-button {
  margin-top: 22px;
}

.finish-dialog {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  color: var(--text);
  box-shadow: 0 28px 80px rgba(15, 23, 42, .24);
}

.finish-dialog::backdrop {
  background: rgba(16, 24, 39, .46);
  backdrop-filter: blur(3px);
}

.finish-dialog form {
  padding: 30px;
  text-align: center;
}

.dialog-icon {
  width: 52px;
  height: 52px;
  display: inline-grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  background: #fff3dc;
  color: var(--amber);
}

.dialog-icon svg {
  width: 25px;
  height: 25px;
}

.finish-dialog h2 {
  font-size: 24px;
  letter-spacing: -.025em;
}

.finish-dialog p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.button-spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.resources-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: white;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.resources-button:hover {
  border-color: #9db9df;
  background: #f7faff;
}

.resources-button svg {
  width: 16px;
  height: 16px;
  color: var(--blue);
}

.resource-count {
  min-width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  background: #e9f2ff;
  color: var(--blue-strong);
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 3px;
}

.message-attachment {
  min-height: 34px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  color: inherit;
  font-size: 11px;
  font-weight: 750;
}

.message-attachment svg {
  width: 15px;
  height: 15px;
}

.assistant-message .message-content a,
.inline-resource-link {
  max-width: 100%;
  color: var(--blue-strong);
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-decoration: underline;
  text-decoration-color: rgba(40, 116, 240, .35);
  text-underline-offset: 2px;
}

.unverified-link-text {
  color: inherit;
}

.unverified-link-text::after {
  content: " · unverified link";
  color: var(--soft);
  font-size: .82em;
}

.inline-resource-link {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.inline-resource-link[data-file-kind="PDF"]::after {
  content: " PDF";
  display: inline-block;
  margin-left: 5px;
  padding: 1px 4px;
  border-radius: 4px;
  background: #fce8e6;
  color: #a7352b;
  font-size: .68em;
  font-weight: 850;
  line-height: 1.35;
  text-decoration: none;
  vertical-align: .1em;
}

button.tool-activity,
a.tool-activity {
  width: 100%;
  border: 0;
  grid-template-columns: 18px minmax(0, 1fr) 16px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

button.tool-activity:hover,
a.tool-activity:hover {
  background: #eaf2fc;
}

.tool-affordance {
  align-self: center;
  color: #6d88a4;
}

.resource-dialog {
  width: min(1080px, calc(100% - 34px));
  height: min(780px, calc(100dvh - 34px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  color: var(--text);
  box-shadow: 0 30px 100px rgba(15, 23, 42, .28);
  overflow: hidden;
}

.resource-dialog::backdrop {
  background: rgba(16, 24, 39, .48);
  backdrop-filter: blur(4px);
}

.resource-sheet {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.resource-sheet-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 21px;
  border-bottom: 1px solid var(--line);
}

.resource-sheet-header h2 {
  margin-top: 2px;
  font-size: 24px;
  letter-spacing: -.025em;
}

.resource-sheet-header > div > p:last-child {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--text);
}

.icon-button svg {
  width: 19px;
  height: 19px;
}

.resource-capabilities {
  min-height: 52px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 9px 21px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.resource-capabilities > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf7f1;
  color: #1d6740;
  font-size: 11px;
  font-weight: 750;
}

.resource-capabilities svg {
  width: 13px;
  height: 13px;
}

.resource-sheet-body {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
}

.resource-browser {
  min-height: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #f8f9fc;
  overflow-y: auto;
}

.resource-browser > section + section {
  margin-top: 25px;
}

.resource-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 9px;
}

.resource-group-heading h3 {
  font-size: 13px;
  letter-spacing: .02em;
}

.resource-group-heading span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.resource-list {
  display: grid;
  gap: 7px;
}

.resource-row {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--text);
  text-align: left;
  text-decoration: none;
}

.resource-row:hover,
.resource-row.selected {
  border-color: #9db9df;
  background: #f4f8fe;
}

.resource-row-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eaf2fd;
  color: var(--blue);
}

.source-row .resource-row-icon {
  background: #eef7f1;
  color: var(--green);
}

.resource-row-icon svg,
.resource-row > svg {
  width: 16px;
  height: 16px;
}

.resource-row-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.resource-row-copy strong,
.resource-row-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-row-copy strong {
  font-size: 12px;
}

.resource-row-copy small {
  color: var(--muted);
  font-size: 10px;
}

.resource-empty {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.activity-row {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, .72);
  color: #31516f;
  text-align: left;
  text-decoration: none;
}

button.activity-row,
a.activity-row {
  cursor: pointer;
}

button.activity-row:hover,
a.activity-row:hover {
  border-color: #9db9df;
  background: white;
}

.activity-row > svg {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.activity-row > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.activity-row strong,
.activity-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-row strong {
  font-size: 11px;
}

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

.activity-row.activity-error {
  border-color: #efc4c0;
  background: #fff4f2;
  color: var(--red);
}

.file-viewer {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: white;
}

.file-viewer-empty {
  margin: auto;
  max-width: 320px;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.file-viewer-empty svg {
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
  color: #9cb1ca;
}

.file-viewer-empty strong {
  color: var(--text);
}

.file-viewer-empty span {
  font-size: 12px;
  line-height: 1.45;
}

#fileViewerContent {
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.file-viewer-header {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 19px;
  border-bottom: 1px solid var(--line);
}

.file-viewer-header p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.file-viewer-header h3 {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.download-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.download-button svg {
  width: 16px;
  height: 16px;
}

.file-preview-notice {
  padding: 9px 18px;
  border-bottom: 1px solid #f0d7a4;
  background: #fff8e9;
  color: #805b10;
  font-size: 12px;
}

.file-preview {
  min-height: 0;
  flex: 1;
  margin: 0;
  padding: 21px;
  overflow: auto;
  background: #172033;
  color: #f4f7fb;
  font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.pdf-preview-shell {
  min-width: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #dfe5ec;
}

.pdf-preview-toolbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.pdf-preview-toolbar button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.pdf-preview-toolbar button:disabled {
  opacity: .42;
  cursor: default;
}

.pdf-preview-toolbar button svg {
  width: 14px;
  height: 14px;
}

.pdf-preview-toolbar span {
  min-width: 92px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.pdf-preview-scroll {
  min-height: 0;
  flex: 1;
  overflow: auto;
  display: grid;
  justify-items: center;
  align-items: start;
  padding: 24px;
}

.pdf-preview {
  display: block;
  width: min(100%, 900px);
  height: auto;
  border: 1px solid #c9d2de;
  background: white;
  box-shadow: 0 12px 30px rgba(24, 39, 61, .16);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1020px) {
  .page-width {
    width: min(100% - 32px, 780px);
  }

  .topbar {
    padding-inline: 22px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 34px;
  }

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

  .assignment-card {
    min-height: 220px;
  }

  .workspace-view {
    height: auto;
    min-height: calc(100dvh - 78px);
    padding-bottom: 18px;
  }

  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .task-brief {
    overflow: visible;
  }

  .brief-scroll {
    overflow: visible;
  }

  .chat-panel {
    height: 72dvh;
    min-height: 560px;
  }

  .resource-sheet-body {
    grid-template-columns: 300px minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-bottom: 22px;
  }

  .topbar {
    height: 68px;
    padding: 10px 16px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 21px;
    height: 21px;
    flex-basis: 21px;
  }

  .brand-mark::after {
    inset: 7px;
  }

  .brand strong {
    font-size: 18px;
  }

  .brand small,
  .worker-menu > span:not(.status-dot):not(.avatar),
  .worker-sign-out {
    display: none;
  }

  .worker-menu {
    gap: 8px;
  }

  .avatar {
    width: 38px;
    height: 38px;
  }

  .page-width {
    width: calc(100% - 24px);
  }

  .hero {
    gap: 20px;
    padding: 28px 0 20px;
  }

  h1 {
    font-size: 40px;
  }

  .hero-copy {
    font-size: 16px;
  }

  .ghost-button {
    min-height: 42px;
  }

  .assignment-card {
    min-height: 0;
    padding: 20px;
    gap: 13px;
  }

  .assignment-grid,
  .custom-task-form {
    grid-template-columns: 1fr;
  }

  .custom-task-builder {
    padding: 20px;
  }

  .custom-task-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-button {
    width: 100%;
  }

  .card-icon {
    width: 48px;
    height: 48px;
  }

  .card-icon svg {
    width: 24px;
    height: 24px;
  }

  .card-task {
    font-size: 21px;
  }

  .card-role {
    font-size: 13px;
  }

  .card-outcome {
    font-size: 14px;
  }

  .selection-preview {
    padding: 20px;
  }

  .preview-heading {
    align-items: flex-start;
  }

  .preview-heading h2 {
    font-size: 20px;
  }

  .soft-icon {
    width: 40px;
    height: 40px;
  }

  .time-pill {
    padding: 6px 8px;
  }

  .prompt-box {
    padding: 18px;
    font-size: 16px;
  }

  .primary-button {
    min-height: 54px;
    font-size: 18px;
  }

  .workspace-view {
    min-height: calc(100dvh - 68px);
    padding-top: 18px;
  }

  .workspace-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
    padding-bottom: 16px;
  }

  .workspace-heading h1 {
    font-size: 34px;
  }

  .agent-badge {
    max-width: 100%;
    white-space: normal;
  }

  .task-brief {
    padding: 0;
  }

  .brief-scroll {
    padding: 20px;
  }

  .finish-button {
    margin: 0 20px 20px;
  }

  .chat-panel {
    height: calc(100dvh - 24px);
    min-height: 0;
    max-height: none;
  }

  .chat-header {
    align-items: flex-start;
    padding: 14px;
  }

  .chat-header p {
    max-width: 240px;
  }

  .chat-header-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
  }

  .resources-button {
    min-height: 36px;
  }

  .resources-button > svg {
    display: none;
  }

  .message-list {
    padding: 16px 12px;
  }

  .message {
    max-width: 92%;
  }

  .message-content {
    font-size: 14px;
  }

  .composer-form {
    position: sticky;
    bottom: 0;
    padding: 12px 12px calc(13px + env(safe-area-inset-bottom));
  }

  .composer-file-row {
    align-items: stretch;
  }

  .attach-button {
    min-height: 44px;
  }

  .composer-file-hint {
    display: flex;
    align-items: center;
  }

  .attachment-chip {
    width: 100%;
    min-height: 48px;
  }

  .attachment-chip-copy {
    max-width: none;
    flex: 1;
  }

  .attachment-chip button {
    width: 44px;
    height: 44px;
  }

  .attachment-tray {
    max-height: 170px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .send-button {
    right: 6px;
    width: 44px;
    height: 44px;
  }

  .composer-hint {
    display: none;
  }

  .resource-dialog {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .resource-sheet-header {
    min-height: 83px;
    padding: 14px 16px;
  }

  .resource-sheet-header > div > p:last-child {
    display: none;
  }

  .resource-capabilities {
    padding-inline: 14px;
  }

  .resource-sheet-body {
    display: flex;
    flex-direction: column;
  }

  .resource-browser {
    max-height: 42%;
    padding: 13px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .file-viewer {
    min-height: 0;
    flex: 1;
  }

  .file-viewer-header {
    min-height: 68px;
    padding: 11px 13px;
  }

  .file-preview {
    padding: 15px;
  }

  .pdf-preview-scroll {
    padding: 12px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions .ghost-button,
  .dialog-actions .primary-button {
    width: 100%;
  }

  .complete-view h1 {
    font-size: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
