:root {
  --bg: #f5efe8;
  --panel: #fffaf5;
  --panel-strong: #fff;
  --line: #ddcfbf;
  --text: #2e241b;
  --muted: #75685a;
  --accent: #b95c37;
  --accent-deep: #8b4428;
  --accent-soft: #f4dcc6;
  --ok: #2e7d53;
  --danger: #a43a2a;
  --pending: #7c5f40;
  --shadow: 0 16px 36px rgba(103, 70, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 213, 172, 0.75), transparent 28%),
    linear-gradient(180deg, #fbf7f2 0%, #f2e8dc 100%);
  min-height: 100vh;
}

.shell {
  width: min(1280px, calc(100% - 28px));
  margin: 18px auto 92px;
}

.hero,
.card {
  background: rgba(255, 251, 245, 0.95);
  border: 1px solid rgba(125, 92, 56, 0.12);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 24px 26px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.05;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  max-width: 860px;
}

.hero-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.pill,
.tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(185, 92, 55, 0.14);
  background: rgba(255, 246, 236, 0.92);
  font-size: 12px;
  font-weight: 600;
}

.tag-study {
  background: #f8efe4;
}

.tag-job {
  background: #f4e9da;
}

.tag-output {
  background: #ede8dc;
}

.tag-submitted,
.tag-prompt_ready,
.tag-generated,
.tag-pending {
  border-color: rgba(124, 95, 64, 0.25);
  color: var(--pending);
}

.tag-approved,
.tag-reviewed,
.tag-published {
  border-color: rgba(46, 125, 83, 0.3);
  color: var(--ok);
  background: #eaf5ee;
}

.tag-rejected {
  border-color: rgba(164, 58, 42, 0.3);
  color: var(--danger);
  background: #fbeceb;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar-tight {
  margin-top: 12px;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  margin-top: 18px;
}

.sidebar {
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
  height: fit-content;
}

.mobile-nav {
  display: none;
  margin-top: 14px;
  padding: 10px;
}

.mobile-nav-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.mobile-nav-btn,
.nav-btn,
button {
  appearance: none;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: transform 0.15s ease;
  min-height: 44px;
}

button:hover,
.nav-btn:hover,
.mobile-nav-btn:hover {
  transform: translateY(-1px);
}

.nav-btn {
  width: 100%;
  text-align: left;
  background: #efe3d5;
  color: var(--text);
}

.mobile-nav-btn {
  white-space: nowrap;
  background: #efe3d5;
  color: var(--text);
  flex: 0 0 auto;
}

.nav-btn.active,
.mobile-nav-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
}

.btn-secondary {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.btn-light {
  color: var(--text);
  background: #eee1d3;
}

.main {
  display: grid;
  gap: 18px;
}

.card-head {
  padding: 18px 20px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.card-head h2 {
  margin: 0;
  font-size: 20px;
}

.card-head span {
  color: var(--muted);
  font-size: 13px;
}

.card-body {
  padding: 0 20px 20px;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.list {
  display: grid;
  gap: 10px;
}

.list.compact {
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.item {
  border: 1px solid rgba(126, 89, 55, 0.12);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 253, 248, 0.88);
}

.task-card {
  position: relative;
}

.item strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

.item small,
.muted {
  color: var(--muted);
}

.task-summary {
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-detail {
  margin-top: 8px;
  font-size: 13px;
}

.task-toggle-btn {
  display: none;
}

.item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0 10px;
}

.two-col,
.three-col {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

form {
  display: grid;
  gap: 12px;
}

.create-form {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(126, 89, 55, 0.12);
  border-radius: 16px;
  background: rgba(255, 250, 244, 0.92);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--panel-strong);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  min-height: 44px;
}

.checkbox-inline {
  width: auto;
  min-height: auto;
  margin-right: 8px;
}

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.65;
}

.notice {
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 14px;
  background: #fff7ef;
  border: 1px solid rgba(191, 90, 54, 0.16);
  color: var(--muted);
  font-size: 13px;
}

.success {
  background: #eff9f1;
  border-color: rgba(47, 125, 80, 0.18);
  color: #2e7d53;
}

.stepbar-wrap {
  overflow-x: auto;
  margin-bottom: 18px;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
}

.stepbar {
  display: flex;
  gap: 10px;
  min-width: max-content;
}

.step-pill {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(126, 89, 55, 0.12);
  background: rgba(248, 238, 227, 0.9);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.step-pill.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  border-color: transparent;
}

.step-pane {
  display: none;
}

.step-pane.active {
  display: block;
}

.prompt-box,
.output-box {
  min-height: 200px;
  white-space: pre-wrap;
  line-height: 1.7;
  padding: 16px;
  border-radius: 18px;
  background: #fffdf8;
  border: 1px solid rgba(126, 89, 55, 0.12);
  font-size: 14px;
  margin-top: 14px;
}

.asset-preview {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.asset-link {
  color: var(--accent-deep);
  text-decoration: none;
  word-break: break-all;
}

.hidden {
  display: none !important;
}

.publish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.publish-card {
  border: 1px solid rgba(126, 89, 55, 0.12);
  border-radius: 18px;
  padding: 14px;
  background: rgba(255, 253, 248, 0.88);
}

.empty {
  padding: 24px 18px;
  border: 1px dashed rgba(126, 89, 55, 0.2);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 252, 247, 0.7);
}

.mobile-actionbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: none;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(251, 245, 238, 0.96);
  border-top: 1px solid rgba(126, 89, 55, 0.12);
  backdrop-filter: blur(4px);
}

.mobile-actionbar button {
  width: 100%;
}

@media (max-width: 1080px) {
  .layout,
  .two-col,
  .three-col,
  .publish-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: block;
  }
}

@media (max-width: 760px) {
  .shell {
    width: calc(100% - 14px);
    margin-top: 10px;
    margin-bottom: 108px;
  }

  .hero {
    padding: 18px 14px;
    border-radius: 18px;
  }

  .hero p {
    font-size: 13px;
    line-height: 1.6;
  }

  .card-head,
  .card-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar button {
    width: 100%;
  }

  .task-summary {
    -webkit-line-clamp: 1;
  }

  .task-toggle-btn {
    display: inline-flex;
  }

  .task-card .task-detail {
    display: none;
  }

  .task-card.expanded .task-detail {
    display: block;
  }

  .mobile-actionbar.show {
    display: block;
  }
}
