:root {
  color-scheme: light;
  --ink: #15201b;
  --muted: #66736d;
  --paper: #f4f1e9;
  --card: #fffdf7;
  --line: #d9d4c8;
  --green: #1e654d;
  --green-deep: #10231d;
  --sand: #e9dfc8;
  --danger: #9c342b;
  --shadow: 0 16px 50px rgb(21 32 27 / 10%);
}

* { box-sizing: border-box; }

html { background: var(--paper); }

body {
  margin: 0 auto;
  max-width: 760px;
  min-height: 100vh;
  padding:
    max(18px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(36px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  color: var(--ink);
  background:
    radial-gradient(circle at 85% -5%, rgb(204 222 201 / 65%), transparent 34rem),
    linear-gradient(180deg, #f8f5ec 0%, var(--paper) 45%);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

button, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

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

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 700 28px/1.15 Georgia, "Songti SC", serif; }
h2 { margin-bottom: 0; font-size: 18px; }

.eyebrow {
  margin-bottom: 3px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: #c48e39;
}

.dot.online { background: #2d9b69; box-shadow: 0 0 0 4px rgb(45 155 105 / 12%); }
.dot.offline { background: var(--danger); }

.composer, .task-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgb(255 253 247 / 92%);
  box-shadow: var(--shadow);
}

.composer { padding: 16px; margin-bottom: 26px; }

textarea {
  width: 100%;
  min-height: 126px;
  resize: vertical;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 17px;
}

textarea::placeholder { color: #98a19c; }

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

.primary-button, .secondary-button, .icon-button, .text-button,
.remove-image, .artifact-button {
  min-height: 44px;
  border-radius: 12px;
  cursor: pointer;
}

.primary-button {
  margin-left: auto;
  border: 0;
  padding: 0 22px;
  color: white;
  background: var(--green);
  font-weight: 750;
}

.primary-button:disabled { opacity: .5; cursor: wait; }

.secondary-button, .icon-button {
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink);
  background: #f8f4ea;
}

.icon-button { min-height: 38px; font-size: 13px; font-weight: 700; }

.text-button {
  border: 0;
  padding: 0 5px;
  color: var(--green);
  background: transparent;
  font-weight: 700;
}

.privacy-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.attachment-preview {
  position: relative;
  width: min(180px, 60%);
  margin: 4px 0 12px;
}

.attachment-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 13px;
  border: 1px solid var(--line);
}

.remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 34px;
  min-height: 34px;
  border: 0;
  border-radius: 99px;
  color: white;
  background: rgb(21 32 27 / 78%);
  font-size: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 3px 10px;
}

.task-list { display: grid; gap: 12px; }
.task-card { padding: 15px 16px; box-shadow: 0 8px 28px rgb(21 32 27 / 6%); }

.task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.task-time { color: var(--muted); font-size: 12px; }

.badge {
  border-radius: 99px;
  padding: 3px 9px;
  color: var(--green-deep);
  background: var(--sand);
  font-size: 12px;
  font-weight: 750;
}

.badge.running { color: #714b0d; background: #f4dfb4; }
.badge.completed { color: #14523c; background: #d8eadf; }
.badge.failed, .badge.outcome_unknown { color: #7c241e; background: #f1d7d4; }

.question {
  margin-bottom: 8px;
  white-space: pre-wrap;
  font-weight: 650;
}

.answer, .progress-text, .error-text {
  margin-bottom: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.progress-text { color: var(--muted); font-size: 14px; }
.error-text { color: var(--danger); font-size: 14px; }

.artifact-button {
  width: 100%;
  margin-top: 8px;
  border: 1px solid #b9cdc1;
  padding: 9px 12px;
  color: var(--green);
  background: #f1f7f2;
  text-align: left;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 28px 16px;
  color: var(--muted);
  text-align: center;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(12 22 17 / 64%);
  backdrop-filter: blur(8px);
}

.dialog-backdrop[hidden], [hidden] { display: none !important; }

.dialog {
  width: min(100%, 440px);
  border-radius: 22px;
  padding: 24px;
  background: var(--card);
  box-shadow: 0 30px 80px rgb(0 0 0 / 30%);
}

.dialog p { color: var(--muted); }
.dialog label { display: block; margin: 18px 0 7px; font-weight: 700; }

.dialog input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: white;
}

.dialog-error { min-height: 24px; color: var(--danger) !important; }
.dialog-actions { justify-content: flex-end; }
.dialog .primary-button { margin-left: 0; }

.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: 480px) {
  h1 { font-size: 24px; }
  .composer-actions .primary-button { flex: 1; }
  .secondary-button { padding: 0 11px; font-size: 14px; }
}

