:root {
  --bg: #f7f7f5;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e3e3e0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --danger: #dc2626;
  --success: #16a34a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg);
}
.view {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1rem;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
h1 { margin: 0; font-size: 1.75rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }

.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.card label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; color: var(--muted); }

input, textarea, select, button {
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { cursor: pointer; background: var(--accent); color: white; border-color: var(--accent); }
button:hover { filter: brightness(0.95); }
button.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
button.danger { background: var(--danger); border-color: var(--danger); }

.filters { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.filters button { background: transparent; color: var(--fg); border-color: var(--line); }
.filters button.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

#todo-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.todo {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.todo.done .title { text-decoration: line-through; color: var(--muted); }
.todo .body { flex: 1; min-width: 0; }
.todo .title { font-weight: 600; word-break: break-word; }
.todo .desc { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }
.todo .meta { color: var(--muted); font-size: 0.8rem; margin-top: 0.5rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.todo .actions { display: flex; gap: 0.25rem; flex-shrink: 0; }
.todo .actions button { padding: 0.25rem 0.5rem; font-size: 0.85rem; }

dialog {
  border: none;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 480px;
  width: 90vw;
}
dialog::backdrop { background: rgba(0,0,0,0.4); }
dialog form { display: flex; flex-direction: column; gap: 0.75rem; }
dialog menu { display: flex; gap: 0.5rem; justify-content: flex-end; padding: 0; margin: 0; }
dialog menu button { background: transparent; color: var(--fg); border-color: var(--line); }
dialog menu button[value=save] { background: var(--accent); color: white; border-color: var(--accent); }

#files-section { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
#files-list { list-style: none; padding: 0; margin: 0 0 0.75rem; display: flex; flex-direction: column; gap: 0.25rem; }
#files-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0.6rem; background: var(--bg); border-radius: 6px; font-size: 0.9rem; }
#files-list a { color: var(--accent); text-decoration: none; word-break: break-all; }
#upload-form { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
#upload-form small { color: var(--muted); font-size: 0.8rem; }

.error { color: var(--danger); margin: 0; font-size: 0.9rem; }