@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0b0b10;
  --bg-elev: #13131a;
  --card: #17171f;
  --card-hover: #1c1c26;
  --border: #26262f;
  --text: #f4f4f6;
  --text-muted: #9a9aa6;
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.16);
  --danger: #ef4444;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image: radial-gradient(circle at 20% 0%, rgba(99, 102, 241, 0.12), transparent 45%);
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}

.screen { min-height: 100vh; }

/* ---------- Login ---------- */
#login:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin: 0 auto 16px;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; font-weight: 700; }
.muted { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; }
.login-card input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  font-size: 16px;
  margin-bottom: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.error-text { color: var(--danger); font-size: 13px; margin: 10px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: white; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.4); }
.btn-sm { width: auto; padding: 10px 16px; font-size: 14px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 10px;
  position: sticky;
  top: 0;
  background: linear-gradient(to bottom, var(--bg) 70%, transparent);
  z-index: 10;
}
.brand { font-weight: 800; font-size: 19px; letter-spacing: -0.02em; }
.topbar-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}
.icon-btn:active { background: var(--card-hover); }

/* ---------- Quick add ---------- */
.quick-add {
  display: flex;
  gap: 8px;
  padding: 4px 16px 14px;
}
.quick-add input {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-size: 15px;
  outline: none;
}
.quick-add input:focus { border-color: var(--accent); }

/* ---------- Board ---------- */
.board {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 16px 24px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.column {
  flex: 0 0 82vw;
  max-width: 320px;
  scroll-snap-align: start;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 60vh;
}
.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}
.column-title { font-weight: 700; font-size: 15px; }
.column-count {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--card);
  border-radius: 999px;
  padding: 2px 9px;
}
.column-cards { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.empty-hint {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  padding: 24px 8px;
}

/* ---------- Card ---------- */
.task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.task-card:active { background: var(--card-hover); }
.task-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.task-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
.task-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-meta {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.pr-tag { white-space: nowrap; }
.pr-1 { background: rgba(154,154,166,0.15); color: var(--text-muted); }
.pr-2 { background: rgba(245, 158, 11, 0.16); color: #f59e0b; }
.pr-3 { background: rgba(239, 68, 68, 0.16); color: #ef4444; }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 20;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-elev);
  border-top: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  z-index: 21;
  max-height: 86vh;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
}
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 6px auto 16px;
}
#task-form input[type="text"], #task-form textarea, #task-form select {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  margin-bottom: 12px;
  outline: none;
  resize: vertical;
}
#task-form input:focus, #task-form textarea:focus, #task-form select:focus { border-color: var(--accent); }
.field-label { font-size: 12px; color: var(--text-muted); font-weight: 600; display: block; margin-bottom: 6px; }
.priority-picker { display: flex; gap: 8px; margin-bottom: 14px; }
.pr-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.pr-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sheet-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---------- Manage sheet ---------- */
.manage-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.manage-tab {
  flex: 1;
  padding: 10px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.manage-tab.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.manage-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.manage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.manage-row-left { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.color-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.manage-row button {
  background: none; border: none; color: var(--text-muted);
  font-size: 14px; cursor: pointer; padding: 4px 8px;
}
.manage-row button.delete { color: var(--danger); }
.manage-form { display: flex; gap: 8px; }
.manage-form input[type="text"] {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  outline: none;
}
.manage-form input[type="color"] {
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  padding: 2px;
}

@media (min-width: 720px) {
  .column { flex: 0 0 300px; }
  .quick-add, .topbar { padding-left: 24px; padding-right: 24px; }
  .board { padding-left: 24px; padding-right: 24px; }
  .sheet { max-width: 420px; left: auto; right: 24px; bottom: 24px; border-radius: var(--radius-lg); }
  .sheet-backdrop { backdrop-filter: blur(2px); }
}
