:root {
  --bg: #f4f3f8;
  --bg-grad-a: #f7f4fb;
  --bg-grad-b: #eef0fb;
  --bg-grad-c: transparent;
  --surface: #ffffff;
  --surface-2: #fafaff;
  --surface-3: #f3f1fa;
  --border: #e7e5f0;
  --text: #1c1b29;
  --text-dim: #6b6880;
  --text-faint: #a5a2b8;
  --accent: #6c5ce7;
  --accent-soft: #efeaff;
  --accent-2: #7c6ff2;
  --danger: #f0533d;
  --priority-low: #12a594;
  --priority-low-soft: #e3f7f3;
  --priority-medium: #d68a1e;
  --priority-medium-soft: #fbf0dc;
  --priority-high: #e5484d;
  --priority-high-soft: #fce3e3;
  --deadline-green: #17a34a;
  --deadline-green-soft: #e0f6e8;
  --deadline-yellow: #b58a00;
  --deadline-yellow-soft: #fdf3d6;
  --deadline-red: #e5393f;
  --deadline-red-soft: #fce3e3;
  --shadow: 0 1px 2px rgba(30, 20, 60, 0.04), 0 8px 24px -12px rgba(30, 20, 60, 0.12);
  --shadow-hover: 0 4px 12px rgba(30, 20, 60, 0.08), 0 16px 32px -16px rgba(30, 20, 60, 0.18);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131220;
    --bg-grad-a: #4b3aa873;
    --bg-grad-b: #1f6f8b66;
    --bg-grad-c: #8a2f6e59;
    --surface: #1e1b30;
    --surface-2: #241f3b;
    --surface-3: #2b2444;
    --border: #362f54;
    --text: #f3f1fa;
    --text-dim: #a8a3c9;
    --text-faint: #756fa0;
    --accent: #8f7ff5;
    --accent-soft: #322a5c;
    --accent-2: #a897ff;
    --danger: #ff6f61;
    --priority-low: #2dd9c0;
    --priority-low-soft: #113c37;
    --priority-medium: #fbbf3d;
    --priority-medium-soft: #3d2c0d;
    --priority-high: #ff7a86;
    --priority-high-soft: #3f1620;
    --deadline-green: #34d399;
    --deadline-green-soft: #113d2b;
    --deadline-yellow: #fbbf24;
    --deadline-yellow-soft: #3d2f0d;
    --deadline-red: #f87171;
    --deadline-red-soft: #3f1620;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -12px rgba(140, 118, 245, 0.35);
    --shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.35), 0 24px 48px -18px rgba(140, 118, 245, 0.45);
  }
}

:root[data-theme="dark"] {
  --bg: #131220;
  --bg-grad-a: #4b3aa873;
  --bg-grad-b: #1f6f8b66;
  --bg-grad-c: #8a2f6e59;
  --surface: #1e1b30;
  --surface-2: #241f3b;
  --surface-3: #2b2444;
  --border: #362f54;
  --text: #f3f1fa;
  --text-dim: #a8a3c9;
  --text-faint: #756fa0;
  --accent: #8f7ff5;
  --accent-soft: #322a5c;
  --accent-2: #a897ff;
  --danger: #ff6f61;
  --priority-low: #2dd9c0;
  --priority-low-soft: #113c37;
  --priority-medium: #fbbf3d;
  --priority-medium-soft: #3d2c0d;
  --priority-high: #ff7a86;
  --priority-high-soft: #3f1620;
  --deadline-green: #34d399;
  --deadline-green-soft: #113d2b;
  --deadline-yellow: #fbbf24;
  --deadline-yellow-soft: #3d2f0d;
  --deadline-red: #f87171;
  --deadline-red-soft: #3f1620;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -12px rgba(140, 118, 245, 0.35);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, 0.35), 0 24px 48px -18px rgba(140, 118, 245, 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--bg-grad-a), transparent),
    radial-gradient(1000px 500px at 100% 0%, var(--bg-grad-b), transparent),
    radial-gradient(900px 500px at 15% 110%, var(--bg-grad-c), transparent),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 24px 100px;
}

/* Header */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.brand h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.date {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.tab {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: var(--accent);
  color: white;
}

/* Page toolbar */

.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.new-category {
  position: relative;
}

.add-category-btn {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.add-category-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.add-category-form {
  display: flex;
  gap: 6px;
  position: absolute;
  right: 0;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px;
  box-shadow: var(--shadow-hover);
}

.add-category-form.hidden { display: none; }

.add-category-form input {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  width: 170px;
}

.add-category-form input:focus {
  border-color: var(--accent);
}

.add-category-form button[type="submit"] {
  border: none;
  background: var(--accent);
  color: white;
  padding: 0 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.add-category-form button.cancel {
  border: none;
  background: transparent;
  color: var(--text-faint);
  padding: 0 8px;
  font-size: 13px;
  cursor: pointer;
}

.add-category-form button.cancel:hover { color: var(--text); }

/* Categories */

.categories {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px;
}

.collapse-toggle {
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 6px;
  transition: transform 0.15s ease, color 0.15s ease;
}

.collapse-toggle:hover { color: var(--text); }

.category.collapsed .collapse-toggle { transform: rotate(-90deg); }

.category-name {
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
  outline: none;
  border-radius: 4px;
  padding: 2px 5px;
  margin-left: -5px;
  flex: 1;
  min-width: 0;
}

.category-name:focus {
  background: var(--accent-soft);
}

.category-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dim);
  background: var(--surface-3);
  padding: 2px 9px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.category-delete {
  border: none;
  background: transparent;
  color: var(--text-faint);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
  flex: none;
}

.category-header:hover .category-delete { opacity: 1; }

.category-delete:hover {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.category.collapsed .task-list,
.category.collapsed .quick-add-toggle,
.category.collapsed .quick-add-form,
.category.collapsed .category-empty {
  display: none;
}

.category-empty {
  padding: 0 16px 14px;
  color: var(--text-faint);
  font-size: 13px;
}

/* Task list */

.task-list {
  list-style: none;
  margin: 0;
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  transition: background 0.15s ease;
  animation: rise 0.18s ease both;
}

@keyframes rise {
  from { opacity: 0; }
  to { opacity: 1; }
}

.task:hover { background: var(--surface-2); }

.task[data-priority="low"] { border-left-color: var(--priority-low); }
.task[data-priority="medium"] { border-left-color: var(--priority-medium); }
.task[data-priority="high"] { border-left-color: var(--priority-high); }

.task[data-deadline="green"] { background: var(--deadline-green-soft); }
.task[data-deadline="yellow"] { background: var(--deadline-yellow-soft); }
.task[data-deadline="red"] { background: var(--deadline-red-soft); }
.task[data-deadline]:hover { filter: brightness(1.04); }

.task .checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 2px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.task .checkbox:hover { border-color: var(--accent); }

.task .checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task .checkbox:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.priority-pill {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: none;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, filter 0.15s ease;
}

.priority-pill:hover { filter: brightness(1.08); }
.priority-pill:active { transform: scale(0.92); }

.priority-pill[data-priority="low"] {
  background: var(--priority-low-soft);
  color: var(--priority-low);
}
.priority-pill[data-priority="medium"] {
  background: var(--priority-medium-soft);
  color: var(--priority-medium);
}
.priority-pill[data-priority="high"] {
  background: var(--priority-high-soft);
  color: var(--priority-high);
}

.task-main {
  flex: 1;
  min-width: 0;
}

.task .label {
  font-size: 14.5px;
  line-height: 1.4;
  word-break: break-word;
  outline: none;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.task .label:focus {
  background: var(--accent-soft);
}

.task.done .label {
  color: var(--text-faint);
  text-decoration: line-through;
}

.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  margin-top: 1px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  width: fit-content;
}

.deadline-badge svg { width: 12px; height: 12px; flex: none; }

.deadline-badge[data-deadline="green"] {
  background: var(--deadline-green-soft);
  color: var(--deadline-green);
}
.deadline-badge[data-deadline="yellow"] {
  background: var(--deadline-yellow-soft);
  color: var(--deadline-yellow);
}
.deadline-badge[data-deadline="red"] {
  background: var(--deadline-red-soft);
  color: var(--deadline-red);
}

.deadline-edit-wrap {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.task.deadline-open .deadline-edit-wrap { display: flex; }
.task.deadline-open .deadline-badge { display: none; }

.deadline-input {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 6px 8px;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}

.deadline-input:focus { border-color: var(--accent); }

.deadline-delete {
  width: 26px;
  height: 26px;
  flex: none;
  border: none;
  background: var(--surface-3);
  color: var(--text-faint);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.deadline-delete:hover {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.note-preview {
  font-size: 12.5px;
  color: var(--text-faint);
  font-style: italic;
  margin-top: 3px;
  padding: 0 4px;
  cursor: pointer;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-edit-wrap {
  display: none;
  position: relative;
  margin-top: 6px;
}

.note-edit {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 8px 34px 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 54px;
  outline: none;
}

.note-edit:focus { border-color: var(--accent); }

.note-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  background: var(--surface-3);
  color: var(--text-faint);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.note-delete:hover {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

.task.note-open .note-edit-wrap { display: block; }
.task.note-open .note-preview { display: none; }

.task-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s ease;
  flex: none;
  margin-top: 1px;
}

.task:hover .task-actions,
.task:focus-within .task-actions,
.task.note-open .task-actions {
  opacity: 1;
}

.task-actions button {
  border: none;
  background: transparent;
  color: var(--text-faint);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.task-actions button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.task-actions button.note-btn.has-note {
  color: var(--accent);
}

.task-actions button.deadline-btn.has-deadline {
  color: var(--accent);
}

.task-actions button.delete-btn:hover {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger);
}

/* Quick add */

.quick-add-toggle {
  display: block;
  width: calc(100% - 20px);
  margin: 6px 10px 12px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 8px 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.quick-add-toggle:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.quick-add-form {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin: 4px 10px 16px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.quick-add-form.open { display: flex; }

.quick-add-form input[type="text"] {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
}

.quick-add-form input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.quick-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.priority-picker {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.priority-picker button {
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-dim);
  transition: background 0.15s ease, color 0.15s ease;
}

.priority-picker button[data-priority="low"].selected {
  background: var(--priority-low-soft);
  color: var(--priority-low);
}
.priority-picker button[data-priority="medium"].selected {
  background: var(--priority-medium-soft);
  color: var(--priority-medium);
}
.priority-picker button[data-priority="high"].selected {
  background: var(--priority-high-soft);
  color: var(--priority-high);
}

.quick-add-toggle-group {
  display: flex;
  gap: 6px;
}

.note-toggle-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.note-toggle-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.quick-add-form textarea {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 54px;
  outline: none;
}

.quick-add-form textarea.open { display: block; }

.quick-add-deadline {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  width: fit-content;
}

.quick-add-deadline.open { display: block; }
.quick-add-deadline:focus { border-color: var(--accent); }

.quick-add-form textarea:focus { border-color: var(--accent); }

.quick-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.quick-add-actions button {
  border: none;
  border-radius: var(--radius-xs);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.quick-add-actions button[type="submit"] {
  background: var(--accent);
  color: white;
}

.quick-add-actions button[type="submit"]:hover { background: var(--accent-2); }

.quick-add-actions button.cancel {
  background: transparent;
  color: var(--text-faint);
}

.quick-add-actions button.cancel:hover { color: var(--text); }

.hidden { display: none !important; }

/* Settings button */

.icon-btn {
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.icon-btn:active { transform: scale(0.94); }

.icon-btn svg { width: 18px; height: 18px; }

/* Settings modal */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 20, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  width: 100%;
  max-width: 460px;
  max-height: min(640px, 90vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-in 0.16s ease both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-faint);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.modal-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin: 0 0 10px;
}

.modal-section p.hint {
  font-size: 12.5px;
  color: var(--text-faint);
  margin: 6px 0 0;
}

.segmented {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.segmented button.selected {
  background: var(--accent);
  color: white;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sync-signout-row {
  margin-top: 14px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

.log-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.log-count {
  font-size: 12px;
  color: var(--text-faint);
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 200px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
}

.log-entry {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  color: var(--text-dim);
}

.log-entry:last-child { border-bottom: none; }

.log-entry .log-time { color: var(--text-faint); flex: none; }
.log-entry .log-type { color: var(--accent); flex: none; font-weight: 700; }
.log-entry .log-detail { color: var(--text-dim); word-break: break-word; }
.log-entry.log-error .log-type { color: var(--danger); }

.log-empty {
  padding: 16px 10px;
  text-align: center;
  color: var(--text-faint);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

#import-file-input { display: none; }

.sync-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-form input {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
}

.sync-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Auth gate */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--bg-grad-a), transparent),
    radial-gradient(1000px 500px at 100% 0%, var(--bg-grad-b), transparent),
    radial-gradient(900px 500px at 15% 110%, var(--bg-grad-c), transparent),
    var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  padding: 32px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px;
}

.auth-card .hint {
  margin: 0 0 20px;
}

.auth-card .sync-form {
  margin-bottom: 14px;
  text-align: left;
}

.btn-primary-block {
  width: 100%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 700;
  padding: 11px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary-block:hover { background: var(--accent-2); }

.auth-gate-links {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}

.link-btn:hover { color: var(--accent); }

#gate-signup-row {
  margin-top: 12px;
}

/* Board layout */

:root[data-layout="board"] .app {
  max-width: 1400px;
}

:root[data-layout="board"] .categories {
  flex-direction: row;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 10px;
}

:root[data-layout="board"] .category {
  flex: 0 0 320px;
  width: 320px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}

:root[data-layout="board"] .task-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px;
  gap: 10px;
}

/* Cards: title gets its own full-width row so text has room to breathe,
   with checkbox/priority/actions on a second row underneath instead of
   competing with the title for horizontal space. */
:root[data-layout="board"] .task {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  grid-template-areas:
    "main main main main main"
    "check pill deadline spacer actions";
  align-items: center;
  column-gap: 10px;
  row-gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

:root[data-layout="board"] .task .checkbox {
  grid-area: check;
  margin-top: 0;
}

:root[data-layout="board"] .priority-pill {
  grid-area: pill;
  margin-top: 0;
}

:root[data-layout="board"] .deadline-badge {
  grid-area: deadline;
  margin-top: 0;
}

:root[data-layout="board"] .task-main {
  grid-area: main;
}

:root[data-layout="board"] .task .label {
  font-size: 15px;
  line-height: 1.5;
}

:root[data-layout="board"] .task-actions {
  grid-area: actions;
  margin-top: 0;
}

:root[data-layout="board"] .task:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

:root[data-layout="board"] .task[data-deadline="green"] { background: var(--deadline-green-soft); }
:root[data-layout="board"] .task[data-deadline="yellow"] { background: var(--deadline-yellow-soft); }
:root[data-layout="board"] .task[data-deadline="red"] { background: var(--deadline-red-soft); }

/* Touch devices: hover never fires reliably, so reveal on-tap controls and
   grow hit targets instead of hiding functionality behind :hover. */

@media (pointer: coarse) {
  .task-actions,
  .category-delete {
    opacity: 1;
  }

  .checkbox {
    width: 24px;
    height: 24px;
  }

  .priority-pill {
    width: 26px;
    height: 26px;
  }

  .task-actions button,
  .category-delete,
  .collapse-toggle {
    width: 34px;
    height: 34px;
  }

  .icon-btn {
    width: 44px;
    height: 44px;
  }
}
