/* ============================================================
   Superbit Tasks — clean, minimal, mobile-first
   ============================================================ */
:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --line: #e8ebef;
  --line-soft: #f1f3f6;
  --ink: #1a202c;
  --ink-2: #5a6474;
  --ink-3: #9aa3b2;
  --accent: #2563eb;
  --accent-soft: #eaf1fe;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.05), 0 4px 16px -4px rgb(16 24 40 / 0.07);
  --shadow-lg: 0 8px 32px -4px rgb(16 24 40 / 0.14), 0 2px 8px rgb(16 24 40 / 0.06);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #191d23;
    --line: #262b33;
    --line-soft: #1f242b;
    --ink: #e8eaee;
    --ink-2: #9aa3b2;
    --ink-3: #626b7a;
    --accent: #5b8af5;
    --accent-soft: #1d2635;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 12px 40px rgb(0 0 0 / 0.5);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
}
[hidden] { display: none !important; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: var(--shadow);
}
.brand { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; margin-bottom: 28px; }
.brand-dot { color: var(--accent); margin: 0 6px; }
.brand-sub { font-weight: 550; font-size: 15px; color: var(--ink-2); }
.login-card h1 { font-size: 22px; margin: 0 0 20px; letter-spacing: -0.02em; }

input {
  font-family: var(--font);
  font-size: 15px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  margin-bottom: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }

.btn {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 550;
  border: none; border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform .1s, opacity .15s;
  letter-spacing: -0.005em;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.block { width: 100%; margin-top: 6px; }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.danger-ghost { background: transparent; color: var(--danger); }
.btn.small { font-size: 13px; padding: 7px 12px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ---------- main layout ---------- */
#main-view { padding-bottom: 76px; } /* tabbar space */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  cursor: pointer; user-select: none;
}

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  flex: 1;
  font-family: var(--font);
  font-size: 13px; font-weight: 550;
  color: var(--ink-3);
  background: none; border: none;
  padding: 9px 0;
  border-radius: 10px;
  cursor: pointer;
  transition: color .15s;
}
.tab.active { color: var(--accent); font-weight: 650; }

main { padding: 8px 20px 24px; }

/* ---------- lists view ---------- */
.list-group { margin-bottom: 28px; }
.list-group h2 {
  font-size: 12px; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3);
  margin: 0 0 8px 2px;
}
.list-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform .1s;
}
.list-row:active { transform: scale(0.99); }
.list-row .swatch { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.list-row .name { font-weight: 550; flex: 1; }
.list-row .count { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.list-row .chev { color: var(--ink-3); font-size: 15px; }

/* ---------- task list ---------- */
.addbar {
  position: sticky; top: 58px; z-index: 5;
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 12px;
}
.addbar input {
  margin: 0; background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.addbar .btn.primary { padding: 11px 16px; }

.tasklist { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.taskrow {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .12s;
}
.taskrow:last-child { border-bottom: none; }
.taskrow:active { background: var(--line-soft); }

.check {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 1.5px solid var(--ink-3);
  border-radius: 6px;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: transparent;
  cursor: pointer;
  transition: all .15s;
}
.check.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.taskrow .t-body { flex: 1; min-width: 0; }
.taskrow .t-title { font-weight: 480; }
.taskrow.done .t-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 60%, transparent); }
.taskrow .t-meta { display: flex; gap: 6px; margin-top: 3px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; font-weight: 500;
  padding: 1px 8px; border-radius: 999px;
  background: var(--line-soft); color: var(--ink-2);
}
.chip.due-soon { background: #fef3c7; color: #92400e; }
.chip.due-over { background: #fee2e2; color: #991b1b; }
.chip.p1 { background: #fee2e2; color: #991b1b; }
.chip.p2 { background: #ffedd5; color: #9a3412; }
.chip.p3 { background: #dbeafe; color: #1e40af; }
.pri-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.sub-ind { color: var(--ink-3); font-size: 12px; margin-right: -4px; margin-left: -8px; }
.subtask-row { padding-left: 44px; }
.fav { color: #f59e0b; font-size: 13px; }

/* section headings inside lists */
.sect {
  font-size: 12px; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3);
  margin: 18px 2px 8px;
}

.empty { text-align: center; color: var(--ink-3); padding: 48px 20px; }
.empty .ring {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border: 3px solid var(--accent-soft); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 20px;
}

/* ---------- sheet (task detail) ---------- */
#sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgb(10 14 20 / 0.4);
  opacity: 0; transition: opacity .2s;
}
#sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; z-index: 50;
  left: 0; right: 0; bottom: 0;
  max-height: 88dvh;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform .25s cubic-bezier(.32,.72,.32,1);
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.sheet.open { transform: translateY(0); }
.sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 10px auto 4px; flex-shrink: 0; }
.sheet-body { padding: 8px 22px 28px; overflow-y: auto; }
.sheet input.big {
  font-size: 18px; font-weight: 600; letter-spacing: -0.02em;
  border: none; background: transparent; padding: 6px 0; margin: 0 0 4px;
  border-radius: 6px;
}
.sheet input.big:focus { box-shadow: none; border: none; background: var(--line-soft); }
.sheet .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.sheet .sect {
  margin: 20px 0 8px; display: flex; justify-content: space-between; align-items: center;
}
.sheet textarea {
  font-family: var(--font);
  font-size: 14.5px;
  width: 100%; min-height: 84px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
  padding: 12px; resize: vertical; outline: none;
}
.sheet .desc {
  font-size: 14.5px; color: var(--ink-2); line-height: 1.6;
}
.sheet .sub { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.sheet .sub:last-child { border-bottom: none; }
.sheet .sub .check { width: 17px; height: 17px; border-radius: 5px; }
.sheet .addrow { display: flex; gap: 8px; margin-top: 8px; }
.sheet .addrow input { margin: 0; }
.pri-pick { display: flex; gap: 10px; }
.pri-pick button {
  width: 30px; height: 30px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 12px; font-weight: 600;
  background: var(--line-soft); color: transparent;
  transition: transform .1s;
}
.pri-pick button:active { transform: scale(0.9); }
.pri-pick button.sel { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.pri-pick .pv1 { background: #fecaca; }
.pri-pick .pv2 { background: #fed7aa; }
.pri-pick .pv3 { background: #bfdbfe; }
.pri-pick .pv4 { background: #a7f3d0; }
.pri-pick .pv5 { background: #818cf8; }
.assignee { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.assignee .avatar { width: 24px; height: 24px; font-size: 10px; cursor: default; }
.assignees-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.delete-row { margin-top: 24px; width: 100%; }
.due-strip { display: flex; gap: 8px; margin: 8px 0 4px; flex-wrap: wrap; }

/* ---------- toast ---------- */
#toast {
  position: fixed; bottom: 92px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg);
  font-size: 13.5px; font-weight: 500;
  padding: 10px 18px; border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  animation: pop .2s ease;
}
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ---------- desktop nicety ---------- */
@media (min-width: 700px) {
  #main-view { max-width: 560px; margin: 0 auto; }
  .tabbar { max-width: 560px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; border: 1px solid var(--line-soft); border-bottom: none; }
  .sheet { max-width: 560px; left: 50%; transform: translate(-50%, 100%); }
  .sheet.open { transform: translate(-50%, 0); }
  .login-card { box-shadow: var(--shadow-lg); }
}
