:root {
  --bg: #121214;
  --panel: #1b1b1e;
  --panel-2: #232327;
  --text: #f2f2f2;
  --muted: #a8a8ad;
  --accent: #ff8c00;
  --accent-dim: rgba(255, 140, 0, 0.15);
  --danger: #e5484d;
  --border: #2e2e33;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  height: 100vh;
  overflow: hidden;
}

.hidden { display: none !important; }

.center {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 48px;
  text-align: center;
  max-width: 420px;
}
.card h1 { margin: 0 0 8px; font-size: 32px; }
.card h1 .accent { color: var(--accent); }
.card p { color: var(--muted); margin: 0 0 24px; }
.card code {
  display: block;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 12px 0;
  font-size: 13px;
  word-break: break-all;
  user-select: all;
}
.card .field { text-align: left; margin: 12px 0; }
.card .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.card .field input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
}
.card .error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.card ol { text-align: left; color: var(--muted); font-size: 14px; line-height: 1.7; }

#app { display: flex; height: 100vh; }

/* Sidebar */
#sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
}
.brand {
  font-size: 22px;
  font-weight: 700;
  padding: 4px 12px 16px;
}
.brand::after { content: ""; }
#lists { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.list-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item:hover { background: var(--panel-2); color: var(--text); }
.list-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.spacer { flex: 1; }

/* Buttons */
.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #141414; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--border); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.danger:hover { color: var(--danger); border-color: var(--danger); }
#add-list { margin-top: 8px; text-align: left; }
#logout { align-self: flex-start; }

/* Main pane */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}
#list-header h2 { margin: 0; font-size: 22px; }
.header-actions { display: flex; gap: 6px; }

#quick-add { display: flex; gap: 8px; padding: 16px 28px 8px; }
#quick-add-input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 11px 14px;
  font-size: 15px;
}
#quick-add-input:focus { outline: none; border-color: var(--accent); }

#tasks { flex: 1; overflow-y: auto; padding: 8px 28px 40px; }
.task {
  border-bottom: 1px solid var(--border);
  padding: 2px 0;
}
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 6px;
  border-radius: 8px;
  cursor: pointer;
}
.task-row:hover { background: var(--panel); }
.task-row .check {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--muted);
  border-radius: 50%;
  cursor: pointer;
  background: transparent;
  padding: 0;
}
.task-row .check.done {
  background: var(--accent);
  border-color: var(--accent);
}
.task-row .title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row .title.completed { text-decoration: line-through; color: var(--muted); }
.task-row .due {
  font-size: 13px;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 6px;
  padding: 3px 9px;
  white-space: nowrap;
}
.task-row .due.overdue { color: #ffb3b3; background: rgba(229, 72, 77, 0.15); }
.task-row .due.today { color: var(--accent); background: var(--accent-dim); }

.task-editor {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 4px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-editor input[type="text"],
.task-editor textarea,
.task-editor input[type="date"] {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.task-editor textarea { min-height: 64px; resize: vertical; }
.task-editor input:focus, .task-editor textarea:focus { outline: none; border-color: var(--accent); }
.task-editor label { font-size: 12px; color: var(--muted); }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty { color: var(--muted); text-align: center; padding: 48px 0; }

@media (max-width: 700px) {
  #sidebar { width: 200px; min-width: 200px; }
  #list-header, #quick-add, #tasks { padding-left: 16px; padding-right: 16px; }
}
