:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #68758a;
  --line: #dce3ee;
  --accent: #176b87;
  --accent-2: #2f7d57;
  --warn: #b44d2f;
  --shadow: 0 10px 28px rgba(28, 45, 75, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(720px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  font-size: 22px;
  box-shadow: var(--shadow);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.stat-card,
.composer,
.task,
.report {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat-card {
  min-height: 84px;
  padding: 14px 12px;
  text-align: left;
  color: var(--ink);
}

.stat-card.active {
  border-color: var(--accent);
}

.stats strong {
  display: block;
  font-size: 24px;
}

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

.composer {
  padding: 12px;
  margin-bottom: 14px;
}

.composer input,
.composer select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink);
  padding: 0 12px;
}

#titleInput {
  width: 100%;
  margin-bottom: 8px;
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr 100px 72px;
  gap: 8px;
}

.composer button,
.complete-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.task-tools {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.clear-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--warn);
  font-weight: 700;
}

.clear-button:disabled {
  color: var(--muted);
  opacity: 0.55;
}

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

.swipe-shell {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}

.task,
.report {
  padding: 14px;
}

.swipe-shell .task {
  position: relative;
  z-index: 1;
  background: var(--panel);
  transition: transform 0.18s ease;
}

.swipe-shell .report {
  position: relative;
  z-index: 1;
  background: var(--panel);
  transition: transform 0.18s ease;
}

.swipe-shell.open .task {
  transform: translateX(-86px);
}

.swipe-shell.open .report {
  transform: translateX(-86px);
}

.delete-button {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 0;
  width: 86px;
  height: 100%;
  border: 0;
  background: #b7352d;
  color: #fff;
  font-weight: 800;
}

.task.done {
  border-color: var(--line);
}

.task.confirm-needed {
  border-color: #d89c2b;
}

.report.unread {
  border-color: #d89c2b;
}

.report.viewed {
  border-color: var(--line);
}

.task-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.task h2,
.report h2 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.3;
}

.task p,
.report p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
}

.pill.high {
  background: #fff0e8;
  color: var(--warn);
}

.pill.hermes,
.pill.source-hermes {
  background: #e7f5f0;
  color: var(--accent-2);
}

.pill.source-codex {
  background: #e8f0ff;
  color: #315f9d;
}

.pill.confirm {
  background: #fff5dc;
  color: #96651c;
}

.progress {
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf2;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

.complete-button,
.confirm-button {
  width: 48px;
  flex: 0 0 48px;
  background: var(--accent-2);
}

.confirm-button {
  background: #b97821;
}

.empty {
  margin-top: 40px;
  color: var(--muted);
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 420px) {
  .composer-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 29px;
  }
}
