/* Planner styles: supplied Codex palette, 4/8/12/16/24/32px spacing scale. */
:root {
  --bg: #f7f7f5;
  --ink: #232b28;
  --accent: #31634e;
  --muted: #5b6561;
  --line: #d9dcd8;
  --card: #ffffff;
  --danger: #a32d24;
  --overdue: #a32d24;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--s3); }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
a { color: var(--accent); }
label, .hint, .who { font-size: 14px; }
label { display: block; margin: var(--s3) 0 var(--s1); font-weight: 600; }
.hint { color: var(--muted); margin: 0 0 var(--s3); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

input, button { font: inherit; color: inherit; }
input:not([type="checkbox"]):not([type="file"]) {
  width: 100%; min-height: 40px; padding: var(--s2) var(--s3);
  border: 1px solid var(--line); border-radius: 6px; background: var(--card);
}
input[type="file"] { max-width: 100%; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
button {
  min-height: 40px; padding: var(--s2) var(--s4);
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); border-color: currentColor; }
button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input:focus-visible { outline-offset: 0; }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s2); padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.topbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.topbar-actions button { min-height: 36px; padding: var(--s1) var(--s3); }
.who { color: var(--muted); }

main { max-width: 960px; margin: 0 auto; padding: var(--s4); }
.status:empty { display: none; }
.status { margin: 0 0 var(--s3); padding: var(--s2) var(--s3); border-radius: 6px; background: #e6efe9; }
.status.is-error { background: #f7e3e1; color: var(--danger); }
.error { color: var(--danger); font-size: 14px; margin: var(--s2) 0; min-height: 0; }
.error:empty { display: none; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: var(--s5); }
.auth { max-width: 420px; margin: var(--s5) auto; }
.auth form button[type="submit"] { width: 100%; margin-top: var(--s4); }
.choice { display: flex; flex-wrap: wrap; gap: var(--s2); }

.projects { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-bottom: var(--s4); }
.project-list { display: flex; flex-wrap: wrap; gap: var(--s2); }
.project-list button { max-width: 100%; }
.project-head { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; justify-content: space-between; margin-bottom: var(--s2); }
.project-head h2 { margin: 0; min-width: 0; }

.add-task, .toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin-bottom: var(--s4); }
.add-task .field.grow { flex: 1 1 240px; min-width: 0; }
.add-task .field { flex: 0 1 180px; min-width: 0; }
.add-task label, .toolbar label { margin-top: 0; }
.toolbar .search { flex: 1 1 200px; min-width: 0; }

.empty { color: var(--muted); padding: var(--s4) 0; }
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.task {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: var(--s3) var(--s4);
}
.task.is-overdue { border-left: 4px solid var(--overdue); }
.task-row { display: flex; gap: var(--s3); align-items: flex-start; }
.task-main { flex: 1; min-width: 0; }
.task-title { margin: 0; font-weight: 600; }
.task.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.due { font-size: 14px; color: var(--muted); margin: var(--s1) 0 0; }
.due.overdue { color: var(--overdue); font-weight: 600; }
.menu { position: relative; flex: none; }
.menu > summary {
  list-style: none; cursor: pointer; min-height: 36px; padding: var(--s1) var(--s3);
  border: 1px solid var(--line); border-radius: 6px; font-size: 14px;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu-items {
  position: absolute; right: 0; z-index: 2; display: grid; gap: var(--s1);
  margin-top: var(--s1); padding: var(--s2); min-width: 170px;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.menu-items button { text-align: left; }
.checklist { margin-top: var(--s2); font-size: 14px; }
.checklist summary { cursor: pointer; color: var(--muted); }
.checklist ul { list-style: none; margin: var(--s2) 0; padding: 0; display: grid; gap: var(--s2); }
.check-item { display: flex; gap: var(--s2); align-items: flex-start; }
.check-item label { flex: 1; min-width: 0; margin: 0; font-weight: 400; }
.check-item.is-done label { text-decoration: line-through; color: var(--muted); }
.check-item button { min-height: 32px; padding: 0 var(--s2); font-size: 14px; }
.check-add { display: flex; gap: var(--s2); flex-wrap: wrap; }
.check-add input { flex: 1 1 160px; min-width: 0; width: auto; }

.guides { max-width: 68ch; margin: var(--s6) auto 0; padding-top: var(--s5); border-top: 1px solid var(--line); }

dialog {
  width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  border: 1px solid var(--line); border-radius: 8px; padding: var(--s5);
  color: var(--ink); background: var(--card);
}
dialog::backdrop { background: rgba(35,43,40,.4); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.preview { font-size: 14px; margin-top: var(--s3); }
.preview ul { padding-left: var(--s5); margin: var(--s2) 0; }

@media (max-width: 480px) {
  main { padding: var(--s3); }
  .panel { padding: var(--s4); }
  .add-task .field, .add-task button { flex: 1 1 100%; }
}
