:root {
  --navy: #1a2744;
  --navy-soft: #243456;
  --gold: #c9a04e;
  --bg: #0f1626;
  --panel: #18233b;
  --text: #eef2f8;
  --muted: #9aa7bd;
  --danger: #d9534f;
  --high: #d9534f;
  --mid: #c9a04e;
  --low: #5a8fb0;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1 {
  font-size: 20px;
  margin: 0;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 5;
}
header .actions button {
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  margin-left: 12px;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--navy-soft);
}
.controls select,
.controls .chk {
  background: var(--panel);
  color: var(--text);
  border: 1px solid #2c3a57;
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
}
.controls .chk {
  display: flex;
  align-items: center;
  gap: 6px;
}
.status {
  color: var(--muted);
  font-size: 13px;
  padding: 6px 16px 0;
  min-height: 18px;
}
ul#task-list {
  list-style: none;
  margin: 0;
  padding: 8px 12px 96px;
}
.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.task.done {
  opacity: 0.5;
}
.task .check {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: none;
}
.task.done .check {
  background: var(--gold);
}
.task .body {
  flex: 1;
  min-width: 0;
}
.task .title {
  font-size: 16px;
}
.task.done .title {
  text-decoration: line-through;
}
.task .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #2c3a57;
  color: var(--muted);
}
.badge.cat {
  background: var(--navy);
  color: var(--gold);
}
.badge.p-high {
  background: rgba(217, 83, 79, 0.2);
  color: var(--high);
}
.badge.p-mid {
  background: rgba(201, 160, 78, 0.2);
  color: var(--mid);
}
.badge.p-low {
  background: rgba(90, 143, 176, 0.2);
  color: var(--low);
}
.badge.due.over {
  color: var(--danger);
}
.badge.claude {
  background: rgba(201, 160, 78, 0.25);
  color: var(--gold);
}
.claude-result {
  margin-top: 8px;
  font-size: 13px;
  background: var(--navy);
  border-left: 3px solid var(--gold);
  padding: 8px;
  border-radius: 6px;
  white-space: pre-wrap;
}
.empty {
  text-align: center;
  color: var(--muted);
  margin-top: 40px;
}
#fab {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: var(--navy);
  font-size: 32px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
#setup {
  max-width: 420px;
  margin: 40px auto;
  padding: 0 20px;
}
#setup label,
#editor label {
  display: block;
  margin: 14px 0;
  font-size: 14px;
  color: var(--muted);
}
#setup input,
#editor input,
#editor select {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #2c3a57;
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
}
#setup .chk,
#editor .chk {
  display: flex;
  align-items: center;
  gap: 8px;
}
#setup .chk input,
#editor .chk input {
  width: auto;
}
#setup button {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--gold);
  color: var(--navy);
  font-size: 16px;
}
dialog#editor {
  width: min(92vw, 440px);
  border: none;
  border-radius: 16px;
  background: var(--navy-soft);
  color: var(--text);
  padding: 20px;
}
dialog#editor::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
dialog#editor menu {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 0;
  margin: 18px 0 0;
}
dialog#editor menu button {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
}
dialog#editor menu button.primary {
  background: var(--gold);
  color: var(--navy);
}
dialog#editor menu button.danger {
  background: var(--danger);
  color: #fff;
  margin-right: auto;
}
#cat-manager {
  margin-top: 28px;
  border-top: 1px solid #2c3a57;
  padding-top: 16px;
}
#cat-manager h2 {
  font-size: 16px;
}
#cat-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
#cat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 6px;
}
#cat-list button {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 14px;
}
.cat-add {
  display: flex;
  gap: 8px;
}
.cat-add input {
  flex: 1;
  margin-top: 0;
}
.cat-add button {
  width: auto;
  margin-top: 0;
  padding: 0 16px;
  background: var(--gold);
  color: var(--navy);
  border: none;
  border-radius: 10px;
}
