:root {
  --page-bg: #f6f2ea;
  --shell-bg: rgba(255, 252, 246, 0.95);
  --panel-bg: rgba(255, 255, 255, 0.82);
  --line: rgba(86, 74, 59, 0.14);
  --text: #231f1a;
  --muted: #6d655d;
  --teal: #0f766e;
  --teal-strong: #0a5954;
  --teal-soft: rgba(15, 118, 110, 0.12);
  --orange: #dd7a0a;
  --orange-soft: rgba(221, 122, 10, 0.13);
  --danger: #bf3f35;
  --danger-soft: rgba(191, 63, 53, 0.12);
  --shadow: 0 28px 60px rgba(66, 49, 28, 0.12);
  --radius-shell: 28px;
  --radius-panel: 20px;
  --radius-chip: 999px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 0 0, rgba(15, 118, 110, 0.12), transparent 28%),
    radial-gradient(circle at 100% 0, rgba(221, 122, 10, 0.14), transparent 24%),
    linear-gradient(180deg, #f7f1e8 0%, #f4efe8 100%);
}

body {
  padding: 20px;
}

a {
  color: inherit;
}

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

.page {
  max-width: 1120px;
  margin: 0 auto;
}

.shell {
  background: var(--shell-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-shell);
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.shell-projects {
  padding-bottom: 26px;
}

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

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
}

.shell-header h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.title-wrap {
  display: grid;
  gap: 6px;
}

.header-copy {
  margin: 0;
  max-width: 620px;
  color: var(--muted);
  line-height: 1.45;
}

.header-actions,
.project-bar,
.composer-row,
.tabs {
  display: flex;
  gap: 10px;
}

.mode-switch {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-chip);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 238, 229, 0.85));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.mode-chip,
.tab-button,
.button {
  border: 1px solid transparent;
  border-radius: var(--radius-chip);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.mode-lamp {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.92), rgba(15, 118, 110, 0.86) 55%, rgba(15, 118, 110, 1));
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.18), 0 0 0 4px rgba(15, 118, 110, 0.08);
}

.mode-chip[data-mode="cloud"] .mode-lamp {
  background: radial-gradient(circle at 35% 35%, rgba(255, 249, 230, 0.98), rgba(245, 158, 11, 0.96) 48%, rgba(220, 38, 38, 0.94));
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.18), 0 0 0 4px rgba(217, 119, 6, 0.08);
}

.mode-chip.is-active[data-mode="bridge"],
.mode-chip.is-active:first-child {
  color: var(--teal-strong);
  background: linear-gradient(180deg, rgba(225, 247, 241, 0.98), rgba(217, 242, 234, 0.94));
  border-color: rgba(15, 118, 110, 0.22);
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.08);
}

.mode-chip.is-active[data-mode="cloud"],
.mode-chip.is-active:last-child {
  color: #8e4f03;
  background: linear-gradient(180deg, rgba(255, 241, 214, 0.98), rgba(255, 230, 181, 0.94));
  border-color: rgba(221, 122, 10, 0.22);
  box-shadow: 0 8px 18px rgba(217, 119, 6, 0.14);
}

.button {
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
  font-weight: 700;
}

.button:hover,
.mode-chip:hover,
.tab-button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--teal-strong));
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18);
}

.button-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.75);
  border-color: var(--line);
}

.button-send {
  align-self: stretch;
  min-width: 62px;
  color: white;
  background: linear-gradient(135deg, var(--orange), #c45f0a);
}

.project-bar,
.status-panel,
.projects-card,
.workspace {
  padding: 18px 24px;
}

.project-bar,
.status-panel,
.projects-card {
  border-bottom: 1px solid var(--line);
}

.project-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

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

.field-grow {
  min-width: 0;
}

.field-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select,
input[type="password"],
input[type="file"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
}

select,
input[type="password"],
input[type="file"] {
  min-height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 140px;
  padding: 14px 16px;
  resize: vertical;
}

.status-panel,
.projects-card,
.context-line,
.composer-footer,
.project-card-meta,
.timeline-meta,
.attempt-list,
.project-row,
.projects-grid {
  display: flex;
}

.status-panel,
.projects-card,
.context-line {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-text,
.status-subtext,
.meta-copy,
.card-copy {
  margin: 0;
}

.status-text {
  font-weight: 700;
}

.status-copy {
  display: grid;
  gap: 6px;
}

.status-subtext,
.meta-copy,
.card-copy {
  color: var(--muted);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.composer-panel,
.timeline-panel,
.menu-panel,
.timeline-item,
.project-card {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
}

.composer-panel,
.timeline-panel {
  padding: 18px;
}

.menu-panel {
  margin: 14px 0;
  padding: 14px;
}

.tabs {
  margin-bottom: 14px;
}

.tab-button {
  min-height: 38px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-weight: 700;
}

.tab-button.is-active {
  color: var(--text);
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.18);
}

.timeline,
.project-groups,
.projects-grid {
  flex-direction: column;
  gap: 12px;
}

.timeline-item {
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 247, 241, 0.92));
}

.timeline-head,
.timeline-body,
.timeline-meta {
  display: grid;
  gap: 8px;
}

.timeline-head {
  grid-template-columns: 1fr auto;
  align-items: start;
}

.timeline-title {
  margin: 0;
  font-size: 1rem;
}

.timeline-text {
  margin: 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.timeline-answer {
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(229, 246, 242, 0.9), rgba(240, 250, 247, 0.92));
  border: 1px solid rgba(15, 118, 110, 0.12);
}

.timeline-answer.is-failed {
  background: var(--danger-soft);
  border-color: rgba(191, 63, 53, 0.18);
}

.badge-row,
.attempt-list,
.project-card-meta {
  flex-wrap: wrap;
  gap: 8px;
}

.badge,
.attempt-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-chip);
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.composer-live-status {
  min-height: 20px;
}

.badge-teal {
  background: var(--teal-soft);
  border-color: rgba(15, 118, 110, 0.18);
  color: var(--teal-strong);
}

.badge-orange {
  background: var(--orange-soft);
  border-color: rgba(221, 122, 10, 0.18);
  color: #8e4f03;
}

.badge-danger {
  background: var(--danger-soft);
  border-color: rgba(191, 63, 53, 0.18);
  color: var(--danger);
}

.project-group {
  display: grid;
  gap: 10px;
}

.project-group-title {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.project-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: var(--radius-chip);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.project-pill.is-active {
  border-color: rgba(15, 118, 110, 0.18);
  background: var(--teal-soft);
}

.projects-grid {
  padding: 22px 24px 0;
}

.project-card {
  padding: 18px;
}

.project-card h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.project-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed var(--line);
  color: var(--muted);
}

@media (max-width: 860px) {
  body {
    padding: 12px;
  }

  .shell-header,
  .project-bar,
  .status-panel,
  .projects-card,
  .workspace {
    padding-left: 16px;
    padding-right: 16px;
  }

  .shell-header,
  .status-panel,
  .projects-card {
    align-items: stretch;
    flex-direction: column;
  }

  .project-bar,
  .workspace {
    grid-template-columns: 1fr;
  }

  .composer-row {
    flex-direction: column;
  }

  .button-send {
    min-height: 48px;
  }
}
