:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e7e9ee;
  --muted: #8a90a0;
  --accent: #6366f1;
  --danger: #ef4444;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

body {
  padding-bottom: env(safe-area-inset-bottom);
}

a { color: inherit; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 15px;
}

.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px);
}

header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15, 17, 21, 0.92);
  backdrop-filter: blur(10px);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

header.top h1 {
  font-size: 18px;
  margin: 0;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}

.btn.small { padding: 5px 10px; font-size: 13px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  background: var(--panel);
  white-space: nowrap;
}

.chip.active {
  color: white;
  border-color: transparent;
}

.chip .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.section-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 22px 0 8px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.item-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.item-row .kind-dot {
  margin-top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.item-row .body { flex: 1; min-width: 0; }

.item-title {
  font-weight: 600;
  font-size: 15px;
}

.item-title.done {
  text-decoration: line-through;
  color: var(--muted);
}

.item-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag-pill {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.item-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 40px 10px;
  font-size: 14px;
}

.project-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.project-row:last-child { border-bottom: none; }

.project-title { font-weight: 600; font-size: 14.5px; }
.project-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.status-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.fab {
  position: fixed;
  right: 20px;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 28px;
  border: none;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
  cursor: pointer;
  z-index: 20;
}

/* --- Auth / forms --- */
.centered {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  padding-top: max(48px, calc(env(safe-area-inset-top) + 24px));
  overflow-y: auto;
}

.form-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
}

.form-panel h2 { margin-top: 0; }

label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin: 14px 0 6px;
}

input[type="text"],
input[type="email"],
input[type="date"],
select,
textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
}

textarea { resize: vertical; min-height: 60px; }

.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 50;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
}

.modal-sheet {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 18px);
}

.modal-sheet h3 { margin-top: 0; }

.close-x {
  float: right;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
}
