* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: var(--tg-theme-bg-color, #fff);
  --text: var(--tg-theme-text-color, #000);
  --hint: var(--tg-theme-hint-color, #999);
  --link: var(--tg-theme-link-color, #2678b6);
  --btn: var(--tg-theme-button-color, #2678b6);
  --btn-text: var(--tg-theme-button-text-color, #fff);
  --secondary-bg: var(--tg-theme-secondary-bg-color, #f0f0f0);
  --section-bg: var(--tg-theme-section-bg-color, var(--secondary-bg));
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  padding: 0 0 80px 0;
  -webkit-text-size-adjust: 100%;
}

/* Header */
.header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  padding: 12px 16px;
  border-bottom: 1px solid var(--secondary-bg);
  display: flex; justify-content: space-between; align-items: center;
}
.header h1 { font-size: 18px; font-weight: 600; }
.header .sync-info { font-size: 12px; color: var(--hint); }

/* Filters */
.filters {
  display: flex; gap: 8px; padding: 8px 16px; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.filter-btn {
  padding: 6px 14px; border-radius: 16px; border: none;
  background: var(--secondary-bg); color: var(--text);
  font-size: 13px; white-space: nowrap; cursor: pointer;
}
.filter-btn.active { background: var(--btn); color: var(--btn-text); }

/* Plan Cards */
.plans { padding: 8px 16px; }
.plan-card {
  background: var(--section-bg);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.1s;
}
.plan-card:active { transform: scale(0.98); }
.plan-card .title { font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.plan-card .meta { font-size: 12px; color: var(--hint); display: flex; gap: 12px; }
.plan-card .progress-bar {
  height: 4px; border-radius: 2px; background: var(--secondary-bg);
  margin-top: 8px; overflow: hidden;
}
.plan-card .progress-fill {
  height: 100%; border-radius: 2px; background: #4caf50;
  transition: width 0.3s;
}
.plan-card.completed .title { text-decoration: line-through; opacity: 0.6; }
.plan-card.has-blocked { border-left: 3px solid #f44336; }

/* Detail View */
.detail-view {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 20; overflow-y: auto;
  padding: 0 0 100px 0;
}
.detail-view.open { display: block; }
.detail-header {
  position: sticky; top: 0; z-index: 21;
  background: var(--bg); padding: 12px 16px;
  border-bottom: 1px solid var(--secondary-bg);
  display: flex; align-items: center; gap: 12px;
}
.back-btn {
  background: none; border: none; font-size: 20px;
  color: var(--link); cursor: pointer; padding: 4px;
}
.detail-title { font-weight: 600; font-size: 16px; flex: 1; }
.detail-content { padding: 16px; }

/* Steps */
.step {
  padding: 12px; margin-bottom: 6px;
  background: var(--section-bg); border-radius: 8px;
}
.step-header { display: flex; align-items: center; gap: 8px; }
.step-icon { font-size: 16px; flex-shrink: 0; }
.step-title { font-size: 14px; flex: 1; }
.step-num { font-size: 11px; color: var(--hint); }
.step-details { font-size: 13px; color: var(--hint); margin-top: 6px; }
.step-result { font-size: 13px; color: #4caf50; margin-top: 4px; font-style: italic; }
.step-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.action-btn {
  padding: 8px 16px; border-radius: 8px; border: none;
  font-size: 13px; cursor: pointer; font-weight: 500;
}
.btn-skip { background: var(--secondary-bg); color: var(--text); }
.btn-answer { background: var(--btn); color: var(--btn-text); }
.btn-delete { background: #f44336; color: #fff; }
.btn-approve { background: #4caf50; color: #fff; }

/* Answer form */
.answer-form {
  margin-top: 8px; display: none;
}
.answer-form.open { display: block; }
.answer-input {
  width: 100%; padding: 10px; border-radius: 8px;
  border: 1px solid var(--secondary-bg); background: var(--bg);
  color: var(--text); font-size: 14px; resize: vertical;
  min-height: 60px;
}
.answer-submit {
  margin-top: 8px; padding: 10px 20px; border-radius: 8px;
  background: var(--btn); color: var(--btn-text); border: none;
  font-size: 14px; cursor: pointer; width: 100%;
}

/* Questions section */
.questions {
  background: var(--secondary-bg); border-radius: 8px; padding: 12px;
  margin: 12px 0; border-left: 3px solid #ff9800;
  color: var(--text);
}
.questions h3 { font-size: 14px; margin-bottom: 8px; color: var(--text); }
.questions pre { white-space: pre-wrap; font-size: 13px; font-family: inherit; color: var(--text); }

/* Workspace files */
.workspace { margin-top: 16px; }
.workspace-file {
  margin-bottom: 8px; border-radius: 8px;
  background: var(--section-bg); overflow: hidden;
}
.workspace-file summary {
  padding: 10px 12px; cursor: pointer;
  font-size: 13px; font-weight: 500;
}
.workspace-file pre {
  padding: 12px; font-size: 12px; white-space: pre-wrap;
  font-family: monospace; max-height: 300px; overflow-y: auto;
}

/* Task actions bar */
.task-actions {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg); padding: 12px 16px;
  border-top: 1px solid var(--secondary-bg);
  display: flex; gap: 8px;
}
.task-actions .action-btn { flex: 1; padding: 12px; font-size: 14px; }

/* Empty state */
.empty { text-align: center; padding: 40px 20px; color: var(--hint); }
.empty .icon { font-size: 48px; margin-bottom: 12px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--hint); }
