.ai-task-page {
  min-height: 100vh;
  padding: 36px 40px 60px;
  background: #faf6ef;
}

.ai-task-shell { max-width: 1080px; margin: 0 auto; }

.ai-task-mode-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px;
  padding: 5px; border: 1px solid #e7dfd1; border-radius: 12px; background: #f4eee5;
}
.ai-task-mode-tab {
  min-height: 48px; padding: 8px 14px; border: 0; border-radius: 9px; background: transparent;
  color: #6b6554; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.ai-task-mode-tab span { display: block; margin-top: 2px; color: #9a947f; font-size: 10.5px; font-weight: 600; }
.ai-task-mode-tab.is-active { background: #fff; color: #2a2e36; box-shadow: 0 2px 9px rgba(47, 41, 36, .08); }
.ai-task-mode-tab.is-active span { color: #cc785c; }

.ai-task-header,
.ai-task-current-head,
.ai-task-history-head,
.ai-task-form-actions,
.ai-task-approval-actions {
  display: flex;
  align-items: center;
}

.ai-task-header { justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.ai-task-header h2 { color: #2a2e36; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.ai-task-header p { color: #6b6554; font-size: 14px; line-height: 1.65; margin-top: 5px; }
.ai-task-policy-badge {
  flex: 0 0 auto; padding: 6px 12px; border: 1px solid #f1d4c0; border-radius: 999px;
  background: #fff3ea; color: #8a4a20; font-size: 11.5px; font-weight: 700;
}

.ai-task-card {
  border: 1px solid #e7dfd1; border-radius: 14px; background: #fff;
  box-shadow: 0 8px 24px rgba(47, 41, 36, .035);
}
.ai-task-form-card,
.ai-task-current { padding: 22px 24px; }
.ai-task-current,
.ai-task-history-card { margin-top: 16px; }
.ai-task-card-title { color: #5a5748; font-size: 14px; font-weight: 700; }
.ai-task-form-description { margin-top: 7px; color: #8a8672; font-size: 12.5px; line-height: 1.6; }
.ai-task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.ai-task-field { display: block; }
.ai-task-field > span { display: block; margin-bottom: 7px; color: #5a5748; font-size: 12.5px; font-weight: 600; }
.ai-task-field select,
.ai-task-field input,
.ai-task-field textarea {
  width: 100%; border: 1px solid #e7dfd1; border-radius: 10px; background: #fff;
  color: #2a2e36; font: inherit; font-size: 13.5px; outline: none;
}
.ai-task-field select { height: 42px; padding: 0 12px; }
.ai-task-field input { height: 42px; padding: 0 12px; }
.ai-task-field textarea { min-height: 150px; padding: 12px 14px; line-height: 1.65; resize: vertical; }
.ai-task-field select:focus,
.ai-task-field input:focus,
.ai-task-field textarea:focus { border-color: #cc785c; box-shadow: 0 0 0 3px rgba(204, 120, 92, .09); }
.ai-task-scope { display: flex; flex-wrap: wrap; gap: 9px 18px; margin-top: 17px; padding: 14px; border: 1px solid #efe9dc; border-radius: 10px; }
.ai-task-scope legend { padding: 0 5px; color: #5a5748; font-size: 12.5px; font-weight: 700; }
.ai-task-scope label { color: #4a463d; font-size: 12px; }
.ai-task-scope label.is-disabled { color: #aaa493; }
.ai-task-scope label span { margin-left: 3px; font-size: 10px; }
.ai-task-instruction-field { margin-top: 16px; }
.ai-task-path-note { margin-top: 7px; color: #8a8672; font-size: 11.5px; }
.ai-task-billing-note,
.ai-task-approval-note,
.ai-task-warning {
  margin-top: 14px; padding: 11px 13px; border: 1px solid #f0d9a8; border-radius: 9px;
  background: #fff8ec; color: #7b5b17; font-size: 12.5px; line-height: 1.6;
}
.ai-task-form-actions { justify-content: flex-end; gap: 12px; margin-top: 16px; }
.ai-task-error { display: none; flex: 1; color: #b3261e; font-size: 12.5px; line-height: 1.5; }
.ai-task-primary,
.ai-task-secondary {
  min-height: 40px; padding: 0 18px; border-radius: 9px; font: inherit;
  font-size: 13px; font-weight: 700; cursor: pointer;
}
.ai-task-primary { border: 0; background: #f5793b; color: #fff; }
.ai-task-primary:disabled { background: #d7cabb; cursor: not-allowed; }
.ai-task-secondary { border: 1px solid #e7dfd1; background: #fff; color: #5a5748; }
.ai-task-danger { color: #b3261e; border-color: #f0c6c6; }
.ai-task-current-head { justify-content: space-between; gap: 18px; }
.ai-task-eyebrow { color: #8a8672; font-size: 11.5px; font-weight: 600; }
.ai-task-eyebrow span { margin-left: 5px; color: #b4af9c; font-family: monospace; }
.ai-task-current-title { max-width: 740px; margin-top: 6px; color: #2a2e36; font-size: 16px; font-weight: 700; line-height: 1.5; }
.ai-task-status { flex: 0 0 auto; padding: 5px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.ai-task-status.is-waiting { color: #8a4a20; background: #fff3ea; }
.ai-task-status.is-running { color: #875d00; background: #fff3cd; }
.ai-task-status.is-success { color: #1f7a4d; background: #eaf6ee; }
.ai-task-status.is-failed { color: #b3261e; background: #fdecea; }
.ai-task-approval-actions { gap: 8px; margin-top: 12px; }
.ai-task-meta { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 18px; border: 1px solid #efe9dc; border-radius: 10px; overflow: hidden; }
.ai-task-meta > div { min-width: 0; padding: 12px 14px; border-right: 1px solid #efe9dc; background: #fdfbf7; }
.ai-task-meta > div:last-child { border-right: 0; }
.ai-task-meta dt { color: #8a8672; font-size: 10.5px; }
.ai-task-meta dd { margin-top: 5px; color: #5a5748; font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.ai-task-result-block,
.ai-task-failure-block { margin-top: 16px; }
.ai-content-task-block { margin-top: 16px; padding: 13px 14px; border: 1px solid #efe9dc; border-radius: 10px; background: #fdfbf7; color: #4a463d; font-size: 12.5px; line-height: 1.65; }
.ai-content-task-block h4 { margin: 0 0 8px; color: #5a5748; font-size: 12.5px; }
.ai-content-task-block ul { margin: 7px 0 0 18px; padding: 0; }
.ai-content-task-block code { color: #6b6554; font-size: 11px; overflow-wrap: anywhere; }
.ai-content-task-review-pass { border-color: #cde6d5; background: #f3faf5; }
.ai-content-task-review-block { border-color: #f0c6c6; background: #fdf2f1; }
.ai-task-block-title { margin-bottom: 7px; color: #5a5748; font-size: 12.5px; font-weight: 700; }
.ai-task-summary,
.ai-task-failure-block { white-space: pre-wrap; color: #4a463d; font-size: 13px; line-height: 1.7; }
.ai-task-failure-block { padding: 12px 14px; border: 1px solid #f0c6c6; border-radius: 9px; background: #fdf2f1; color: #8e2922; }
.ai-task-log-details { margin-top: 16px; border-top: 1px solid #efe9dc; padding-top: 12px; }
.ai-task-log-details summary { color: #6b6554; font-size: 12px; font-weight: 600; cursor: pointer; }
.ai-task-log-details pre { max-height: 420px; overflow: auto; margin-top: 10px; padding: 14px; border-radius: 9px; background: #20201e; color: #e8e3da; font: 11.5px/1.6 monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-task-history-card { overflow: hidden; }
.ai-task-history-head { justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #efe9dc; background: #fbf7ef; }
.ai-task-text-button { border: 0; background: none; color: #cc785c; font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.ai-task-history-item { display: grid; grid-template-columns: 120px 105px 1fr 120px 95px; gap: 10px; align-items: center; padding: 13px 18px; border-bottom: 1px solid #f3eee5; cursor: pointer; }
.ai-task-history-item:last-child { border-bottom: 0; }
.ai-task-history-item:hover { background: #fdfbf7; }
.ai-task-history-item > div { min-width: 0; color: #6b6554; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-task-history-item .ai-task-history-prompt { color: #2a2e36; font-weight: 600; }
.ai-task-empty { padding: 32px 18px; color: #b4af9c; font-size: 13px; text-align: center; }

@media (max-width: 768px) {
  .ai-task-page { padding: 76px 16px 36px; }
  .ai-task-header { align-items: flex-start; }
  .ai-task-header h2 { font-size: 22px; }
  .ai-task-grid,
  .ai-task-mode-tabs,
  .ai-task-meta { grid-template-columns: 1fr; }
  .ai-task-scope { display: grid; grid-template-columns: 1fr 1fr; }
  .ai-task-meta > div { border-right: 0; border-bottom: 1px solid #efe9dc; }
  .ai-task-meta > div:last-child { border-bottom: 0; }
  .ai-task-form-card,
  .ai-task-current { padding: 18px 16px; }
  .ai-task-current-head { align-items: flex-start; }
  .ai-task-history-item { grid-template-columns: 95px 1fr 78px; }
  .ai-task-history-engine,
  .ai-task-history-duration { display: none; }
}
