:root {
  color-scheme: light;
  --ink: #17243b;
  --muted: #748198;
  --line: #e6eaf0;
  --paper: #ffffff;
  --canvas: #f5f7fb;
  --blue: #4267e8;
  --blue-dark: #3154ce;
  --teal: #167f78;
  --mint: #e8f5f2;
  --shadow: 0 22px 65px rgba(29, 48, 81, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.page-bg {
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 86% 9%, rgba(196, 224, 246, 0.56), transparent 34%),
    radial-gradient(ellipse at 10% 40%, rgba(222, 241, 238, 0.66), transparent 32%);
}

.ambient {
  position: absolute;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.32;
}

.ambient-one {
  top: 16%;
  right: -210px;
  background: #9db8ff;
}

.ambient-two {
  top: 54%;
  left: -250px;
  background: #8bd1c4;
}

.app-container {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin-bottom: 48px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 850;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #5178f0, #3154ce);
  box-shadow: 0 7px 16px rgba(66, 103, 232, 0.24);
  color: #fff;
  font-size: 1rem;
}

.brand-light {
  color: var(--blue);
  font-weight: 650;
}

.topbar-actions,
.workspace-label {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 18px;
}

.workspace-label {
  gap: 8px;
  color: #66748a;
  font-size: 0.82rem;
  font-weight: 650;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #25a579;
  box-shadow: 0 0 0 4px rgba(37, 165, 121, 0.12);
}

.new-trip-btn {
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid #dfe5ef;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.78);
  color: #42516a;
  font-size: 0.84rem;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.new-trip-btn:hover {
  transform: translateY(-1px);
  border-color: #b9c9f8;
  background: #fff;
}

.hero-section {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 38px;
  margin-bottom: 34px;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.14em;
}

.hero-section h1 {
  margin: 13px 0 14px;
  color: var(--ink);
  font-size: clamp(2.7rem, 6vw, 4.65rem);
  font-weight: 790;
  letter-spacing: -0.075em;
  line-height: 0.99;
}

.hero-section h1 span {
  color: var(--blue);
}

.hero-section p {
  max-width: 620px;
  margin: 0;
  color: #68768b;
  font-size: 1rem;
  line-height: 1.7;
}

.hero-note {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  width: min(310px, 32%);
  margin-bottom: 5px;
  padding: 17px 18px;
  border: 1px solid rgba(219, 228, 239, 0.9);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.7);
}

.hero-note-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: #edf2ff;
  color: var(--blue);
  font-size: 1.15rem;
}

.hero-note strong {
  display: block;
  margin: 1px 0 5px;
  font-size: 0.84rem;
}

.hero-note p {
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.5;
}

.planner-card,
.workflow-section,
.result-section,
.approval-section {
  border: 1px solid rgba(226, 232, 241, 0.96);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.planner-card,
.workflow-section,
.result-section,
.approval-section {
  padding: 29px;
}

.workflow-section,
.result-section,
.approval-section {
  margin-top: 21px;
}

.card-header,
.result-header,
.workflow-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 23px;
}

.section-kicker {
  margin-bottom: 8px;
  color: #8a96aa;
}

.section-kicker span {
  color: var(--blue);
}

.card-header h2,
.result-header h2,
.workflow-header h2,
.approval-content h2 {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 1.42rem;
  font-weight: 760;
  letter-spacing: -0.04em;
}

.card-header p,
.result-header p,
.approval-content > p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.planner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.78fr);
  gap: 29px;
  align-items: stretch;
}

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

.field-label {
  display: block;
  margin: 1px 0 9px;
  color: #394860;
  font-size: 0.84rem;
  font-weight: 760;
}

#userInput,
.feedback-input {
  display: block;
  width: 100%;
  min-height: 157px;
  resize: vertical;
  border: 1px solid #dfe5ee;
  border-radius: 15px;
  outline: none;
  background: #fbfcfe;
  color: var(--ink);
  padding: 16px 17px;
  font-size: 0.94rem;
  line-height: 1.65;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

#userInput:focus,
.feedback-input:focus {
  border-color: #8da6f5;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(66, 103, 232, 0.1);
}

#userInput::placeholder,
.feedback-input::placeholder {
  color: #9ba6b7;
}

.prompt-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  color: #8a95a6;
  font-size: 0.73rem;
  line-height: 1.45;
}

#promptCount {
  flex: 0 0 auto;
  color: #97a1b0;
}

.quick-prompt-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  margin: 22px 0 11px;
  color: #919bad;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.quick-prompt-heading span + span {
  color: #8a95a6;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0;
}

.quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.quick-prompts button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 37px;
  padding: 0 12px;
  border: 1px solid #e4e9f1;
  border-radius: 10px;
  background: #fff;
  color: #536179;
  font-size: 0.78rem;
  font-weight: 680;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.quick-prompts button:hover {
  transform: translateY(-1px);
  border-color: #bdcbf8;
  background: #f5f7ff;
  color: var(--blue-dark);
}

.submit-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.keyboard-hint {
  color: #8a95a6;
  font-size: 0.75rem;
}

kbd {
  padding: 2px 6px;
  border: 1px solid #dce2eb;
  border-radius: 5px;
  background: #f7f8fb;
  color: #55637a;
  font-family: inherit;
  font-size: 0.7rem;
  box-shadow: 0 1px 0 #dce2eb;
}

#sendBtn,
.approve-btn,
.revise-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 47px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  font-weight: 780;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

#sendBtn {
  min-width: 190px;
  background: var(--blue);
  box-shadow: 0 9px 20px rgba(66, 103, 232, 0.2);
  color: #fff;
  font-size: 0.88rem;
}

#sendBtn:hover {
  transform: translateY(-1px);
  background: var(--blue-dark);
  box-shadow: 0 12px 24px rgba(66, 103, 232, 0.25);
}

#sendBtn:disabled,
.approve-btn:disabled,
.revise-btn:disabled,
.download-btn:disabled {
  transform: none;
  opacity: 0.56;
  cursor: not-allowed;
}

.planner-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 15px;
  min-width: 0;
  padding: 18px;
  border: 1px solid #e4eaf3;
  border-radius: 16px;
  background: linear-gradient(155deg, #f8faff, #f2f7f8);
}

.aside-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: #e9efff;
  color: var(--blue);
  font-size: 1.25rem;
}

.aside-card h3 {
  margin: 15px 0 14px;
  font-size: 0.94rem;
  letter-spacing: -0.02em;
}

.aside-card ul {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.aside-card li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: #66748a;
  font-size: 0.78rem;
  line-height: 1.4;
}

.aside-card li span {
  color: #94a1b4;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.aside-footnote {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding-top: 14px;
  border-top: 1px solid #e1e8ee;
}

.aside-footnote > span {
  color: var(--teal);
  font-weight: 900;
}

.aside-footnote p {
  margin: 0;
  color: #637287;
  font-size: 0.74rem;
  line-height: 1.5;
}

.workflow-header {
  align-items: center;
  margin-bottom: 18px;
}

.workflow-header h2 {
  margin-bottom: 0;
}

.guardrail-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid #cce9dd;
  border-radius: 999px;
  background: #f0faf5;
  color: #287c5b;
  font-size: 0.76rem;
  font-weight: 760;
  white-space: nowrap;
}

.guardrail-badge.blocked {
  border-color: #f0caca;
  background: #fff4f3;
  color: #b54d48;
}

.guardrail-badge.fallback {
  border-color: #edd9ac;
  background: #fff9eb;
  color: #8a6723;
}

.workflow-stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.workflow-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #e6eaf0;
  border-radius: 11px;
  background: #fafbfd;
  color: #8a95a6;
  font-size: 0.78rem;
}

.workflow-step > span {
  display: grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #edf0f5;
  color: #78869c;
  font-size: 0.69rem;
  font-weight: 800;
}

.workflow-step.is-complete {
  border-color: #cfe7df;
  background: #f3faf7;
  color: #427666;
}

.workflow-step.is-complete > span {
  background: #d7eee5;
  color: #267c5c;
}

.workflow-step.is-current {
  border-color: #c7d2fb;
  background: #f5f7ff;
  color: var(--blue-dark);
}

.workflow-step.is-current > span {
  background: var(--blue);
  color: #fff;
}

.workflow-step.is-blocked {
  border-color: #f0d7d4;
  background: #fff8f7;
  color: #aa5a55;
}

.workflow-detail {
  padding: 16px 17px;
  border: 1px solid #edf0f5;
  border-radius: 13px;
  background: #fcfdff;
}

.supervisor-reasoning {
  margin: 0 0 13px;
  color: #65738a;
  font-size: 0.86rem;
  line-height: 1.65;
}

.agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid #e2e8f5;
  border-radius: 9px;
  background: #f5f7fc;
  color: #596781;
  font-size: 0.75rem;
  font-weight: 690;
}

.result-header {
  align-items: center;
}

.result-header h2 {
  margin-bottom: 6px;
}

.result-header p {
  overflow-wrap: anywhere;
  font-size: 0.75rem;
}

.result-actions,
.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.copy-btn,
.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 39px;
  padding: 0 13px;
  border: 1px solid #dfe5ee;
  border-radius: 10px;
  background: #fff;
  color: #4e5d75;
  font-size: 0.78rem;
  font-weight: 740;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.copy-btn:hover {
  border-color: #bac9f5;
  background: #f5f7ff;
  color: var(--blue-dark);
}

.download-btn {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.download-btn:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

.pdf-content {
  padding: 28px;
  border: 1px solid #edf0f5;
  border-radius: 15px;
  background: #fff;
}

.pdf-title {
  display: none;
  margin: 0 0 20px;
  color: var(--ink);
}

.result-box {
  overflow-x: auto;
  color: #354156;
  font-size: 0.92rem;
  line-height: 1.72;
}

.result-box h1,
.result-box h2,
.result-box h3 {
  color: var(--ink);
  line-height: 1.3;
}

.result-box h1 {
  margin: 0 0 19px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 1.65rem;
  letter-spacing: -0.045em;
}

.result-box h2 {
  margin: 25px 0 11px;
  font-size: 1.17rem;
  letter-spacing: -0.025em;
}

.result-box h3 {
  margin: 19px 0 8px;
  font-size: 1rem;
}

.result-box p {
  margin: 0 0 13px;
}

.result-box ul,
.result-box ol {
  margin: 8px 0 16px;
  padding-left: 23px;
}

.result-box li {
  margin-bottom: 6px;
}

.result-box strong {
  color: #1d2b42;
}

.result-box hr {
  height: 1px;
  margin: 22px 0;
  border: 0;
  background: var(--line);
}

.result-box table {
  width: 100%;
  margin: 15px 0;
  border-collapse: collapse;
  color: #4e5b70;
  font-size: 0.84rem;
}

.result-box th,
.result-box td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.result-box th {
  background: #f5f7fb;
  color: var(--ink);
  font-weight: 760;
}

.approval-section {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 19px;
  border-color: #f0e2c6;
  background: linear-gradient(130deg, #fffdf7, #fff);
}

.approval-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid #f1dfb8;
  border-radius: 13px;
  background: #fff4d9;
  color: #a9791e;
  font-size: 1.25rem;
}

.approval-content h2 {
  margin-bottom: 7px;
}

.approval-content > p {
  margin-bottom: 19px;
}

.feedback-input {
  min-height: 95px;
  margin-bottom: 14px;
  background: #fff;
}

.approve-btn,
.revise-btn {
  min-height: 42px;
  padding: 0 15px;
  font-size: 0.8rem;
}

.approve-btn {
  background: #238363;
  color: #fff;
}

.approve-btn:hover {
  transform: translateY(-1px);
  background: #176d51;
}

.revise-btn {
  border: 1px solid #e4d7b8;
  background: #fff;
  color: #755e30;
}

.revise-btn:hover {
  border-color: #d3b86e;
  background: #fffaf0;
}

.error-box {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #f0c9c6;
  border-radius: 12px;
  background: #fff5f4;
  color: #9e3f3a;
  font-size: 0.86rem;
  line-height: 1.55;
}

.loader {
  display: inline-block;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: 18px 0 30px;
  color: #8792a3;
  font-size: 0.74rem;
}

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

button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(66, 103, 232, 0.48);
  outline-offset: 3px;
}

@media (max-width: 820px) {
  .app-container {
    width: min(100% - 32px, 680px);
  }

  .hero-section {
    align-items: flex-start;
  }

  .hero-note {
    width: 260px;
  }

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

  .planner-aside {
    gap: 18px;
  }

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

  footer {
    width: min(100% - 32px, 680px);
  }
}

@media (max-width: 600px) {
  .app-container {
    width: calc(100% - 24px);
    padding-top: 12px;
  }

  .topbar {
    margin-bottom: 36px;
  }

  .topbar-actions {
    gap: 10px;
  }

  .workspace-label {
    font-size: 0;
  }

  .workspace-label .status-dot {
    width: 9px;
    height: 9px;
  }

  .new-trip-btn {
    min-height: 35px;
    padding: 0 10px;
    font-size: 0.77rem;
  }

  .hero-section {
    display: block;
    margin-bottom: 24px;
  }

  .hero-section h1 {
    margin-top: 11px;
    font-size: clamp(2.65rem, 13vw, 4rem);
  }

  .hero-section p {
    font-size: 0.92rem;
  }

  .hero-note {
    width: 100%;
    margin-top: 18px;
  }

  .planner-card,
  .workflow-section,
  .result-section,
  .approval-section {
    padding: 19px;
    border-radius: 17px;
  }

  .card-header,
  .result-header,
  .workflow-header {
    flex-direction: column;
    gap: 12px;
  }

  .workflow-header {
    align-items: flex-start;
  }

  .planner-layout {
    gap: 20px;
  }

  #userInput {
    min-height: 145px;
  }

  .prompt-meta {
    align-items: flex-start;
    font-size: 0.69rem;
  }

  .quick-prompts {
    gap: 7px;
  }

  .quick-prompts button {
    min-height: 35px;
    padding: 0 9px;
    font-size: 0.73rem;
  }

  .submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  #sendBtn {
    width: 100%;
    min-height: 47px;
  }

  .workflow-stepper {
    gap: 6px;
  }

  .workflow-step {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
    padding: 9px;
    font-size: 0.68rem;
  }

  .workflow-detail,
  .pdf-content {
    padding: 14px;
  }

  .result-actions,
  .approval-actions {
    width: 100%;
  }

  .copy-btn,
  .download-btn,
  .approve-btn,
  .revise-btn {
    flex: 1;
    min-width: 0;
    padding: 0 10px;
    font-size: 0.74rem;
  }

  .approval-section {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  footer {
    width: calc(100% - 24px);
    flex-direction: column;
    padding-bottom: 22px;
  }
}

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

@media print {
  body {
    background: #fff;
    color: #111827;
  }

  .topbar,
  .planner-card,
  .workflow-section,
  .approval-section,
  .hero-section,
  footer,
  .result-actions,
  #threadInfo {
    display: none !important;
  }

  .app-container {
    width: 100%;
    padding: 0;
  }

  .result-section {
    margin: 0;
    border: 0;
    box-shadow: none;
  }

  .pdf-title {
    display: block;
  }
}
