:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --text: #16161d;
  --muted: #6b6b7b;
  --border: #e4e4ec;
  --primary: #5b5bf0;
  --primary-hover: #4646d8;
  --danger: #e5484d;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f14; --surface: #1a1a22; --text: #ececf1; --muted: #9a9aab;
    --border: #2a2a36; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* nav */
.nav { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; }
.logo { font-weight: 700; font-size: 1.15rem; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: .9rem; }
.nav-links { display: flex; gap: 10px; align-items: center; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; transition: .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface); }
.btn-lg { padding: 14px 26px; font-size: 1.05rem; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* landing */
.hero { text-align: center; padding: 80px 0 60px; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: .85rem; margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.8rem); line-height: 1.1; letter-spacing: -.02em; margin-bottom: 18px; }
.hero h1 span { color: var(--primary); }
.hero p { color: var(--muted); font-size: 1.15rem; max-width: 560px; margin: 0 auto 32px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.preview { margin: 60px auto 0; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 20px; text-align: left; }
.preview-item { display: flex; align-items: center; gap: 12px; padding: 12px 6px; border-bottom: 1px solid var(--border); }
.preview-item:last-child { border-bottom: none; }
.preview-item .check { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--border); flex-shrink: 0; }
.preview-item.done .check { background: var(--primary); border-color: var(--primary); }
.preview-item.done span { text-decoration: line-through; color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; padding: 60px 0; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.feature-icon { font-size: 1.6rem; margin-bottom: 10px; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); }
.cta { text-align: center; padding: 60px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; margin-bottom: 60px; }
.cta h2 { font-size: 2rem; margin-bottom: 10px; }
.cta p { color: var(--muted); margin-bottom: 24px; }
footer { text-align: center; color: var(--muted); padding: 30px 0; font-size: .9rem; border-top: 1px solid var(--border); }

/* auth */
.auth-wrap { min-height: calc(100vh - 80px); display: grid; place-items: center; padding: 20px; }
.card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; }
.card h1 { font-size: 1.6rem; margin-bottom: 6px; }
.card .sub { color: var(--muted); margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password] {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit; outline: none; transition: .15s;
}
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,91,240,.2); }
.card .btn { width: 100%; margin-top: 6px; }
.error { background: rgba(229,72,77,.1); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: .9rem; margin-bottom: 16px; display: none; }
.error.show { display: block; }
.switch { text-align: center; margin-top: 20px; color: var(--muted); font-size: .92rem; }

/* app */
.app { max-width: 640px; margin: 0 auto; padding: 20px 20px 60px; }
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.user { display: flex; align-items: center; gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.greeting h1 { font-size: 1.8rem; }
.greeting p { color: var(--muted); margin-bottom: 20px; }
.add-form { display: flex; gap: 10px; margin-bottom: 20px; }
.add-form input { flex: 1; }
.filters { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 10px; }
.tab { padding: 6px 12px; border-radius: 7px; border: none; background: none; color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer; }
.tab.active { background: var(--primary); color: #fff; }
.link-btn { background: none; border: none; color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer; }
.link-btn:hover { color: var(--danger); }
.todo-list { list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.todo { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.todo:last-child { border-bottom: none; }
.todo input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.todo .title { flex: 1; word-break: break-word; cursor: text; }
.todo.done .title { text-decoration: line-through; color: var(--muted); }
.todo .edit-input { flex: 1; }
.todo .delete { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; opacity: 0; transition: .15s; padding: 4px 8px; border-radius: 6px; }
.todo:hover .delete, .todo .delete:focus { opacity: 1; }
.todo .delete:hover { color: var(--danger); background: rgba(229,72,77,.1); }
@media (hover: none) { .todo .delete { opacity: 1; } }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.count { color: var(--muted); font-size: .9rem; margin-top: 12px; text-align: center; }
