:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1d212a;
  --line: #262b36;
  --text: #e8ecf4;
  --muted: #8b93a7;
  --accent: #7c9cff;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom));
}

.hidden { display: none !important; }

.login {
  margin-top: 18vh;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
}
.login h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: 0.5px; }
.login form { display: flex; gap: 10px; margin-top: 18px; }
.login input { flex: 1; }
.muted { color: var(--muted); font-size: 14px; }
.error { color: var(--red); font-size: 13px; min-height: 18px; }

input, select, button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
button { cursor: pointer; }
button:active { transform: translateY(1px); }
button.primary, .login button, #add-form button[type="submit"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #0b1020;
  font-weight: 700;
}
button.ghost { background: transparent; color: var(--muted); border-color: transparent; }
button.ghost:hover { color: var(--text); }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.eyebrow { color: var(--muted); font-size: 12px; letter-spacing: 2px; }
.date { font-size: 22px; font-weight: 700; margin-top: 4px; }
.top-actions { display: flex; gap: 4px; }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 18px 2px 10px;
}
.count { letter-spacing: 1px; }

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

.card {
  background: linear-gradient(180deg, #1a1e27, #151820);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 12px;
}
.card.empty-card {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.slot {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(124, 156, 255, 0.16);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 1px;
}
.card-title { flex: 1; font-size: 17px; line-height: 1.45; word-break: break-word; }
.meta { color: var(--muted); font-size: 12px; margin: 8px 0 0 36px; display: flex; gap: 10px; flex-wrap: wrap; }
.tag { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.tag.w3 { color: var(--amber); border-color: rgba(251, 191, 36, 0.4); }
.tag.due { color: var(--accent); border-color: rgba(124, 156, 255, 0.35); }
.card-actions { display: flex; gap: 8px; margin: 12px 0 0 36px; }
.card-actions button { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-done { color: var(--green); border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.08); }
.btn-demote { color: var(--muted); }

.pool-list { display: grid; gap: 8px; }
.pool-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.pool-main { flex: 1; min-width: 0; }
.pool-title { font-size: 15px; line-height: 1.4; word-break: break-word; }
.pool-meta { color: var(--muted); font-size: 12px; margin-top: 3px; }
.pool-actions { display: flex; gap: 4px; flex: none; }
.pool-actions button { padding: 7px 9px; font-size: 12px; border-radius: 9px; }
.promote { color: var(--accent); border-color: rgba(124, 156, 255, 0.35); background: rgba(124, 156, 255, 0.08); }
.drop { color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 18px 4px; text-align: center; }

.add-fab {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--accent);
  color: #0b1020;
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(124, 156, 255, 0.3);
}

.add-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -20px 50px rgba(0, 0, 0, 0.4);
  z-index: 20;
}
.add-panel .row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.add-panel .row label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.add-panel input[type="text"] { flex: 1; width: 100%; }
.add-panel .check { color: var(--text); }
.add-panel .actions { justify-content: flex-end; margin-bottom: 0; }
.add-panel .actions button { padding: 10px 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #2a3040;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 30;
  max-width: 86vw;
  text-align: center;
}

@media (max-width: 380px) {
  .card-title { font-size: 16px; }
  .meta, .card-actions { margin-left: 0; }
}
