:root {
  --bg: #f4ebd9;          /* sand (brand) — sıcak krem zemin */
  --card: #fffcf5;        /* sıcak beyaz kart */
  --ink: #2a231a;         /* sıcak koyu metin */
  --muted: #6f6552;       /* sıcak ikincil metin */
  --line: #e8dcc6;        /* sıcak kenarlık */
  --accent: #00a896;      /* turkuaz — Lada'nın Feneri aktif aksanı (brand) */
  --accent-deep: #008376; /* turquoiseDeep */
  --on-accent: #1a2639;   /* turkuaz zeminde metin/glyph = koyu lacivert (brand kuralı) */
  --overdue: #b85742;     /* coralDeep (brand error) */
  --soon: #9a6320;        /* koyu amber (warning, metin-güvenli) */
  --shadow: 0 1px 2px rgba(80, 60, 30, 0.06), 0 1px 3px rgba(80, 60, 30, 0.12);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
  touch-action: manipulation;
}

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 14px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
.icon-btn {
  border: none; background: var(--card); color: var(--ink);
  width: 44px; height: 44px; border-radius: 12px; font-size: 20px;
  box-shadow: var(--shadow); cursor: pointer;
}
.icon-btn:active { transform: scale(0.94); }

main { padding: 14px 14px 24px; max-width: 640px; margin: 0 auto; }
.hidden { display: none !important; }

.group { margin-top: 18px; }
.group:first-child { margin-top: 4px; }
.group-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); margin: 0 6px 8px;
}
.group.overdue .group-title { color: var(--overdue); }
.group.today .group-title { color: var(--soon); }

.task {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.task.done-anim { transform: translateX(48px); opacity: 0; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 16px; font-weight: 600; line-height: 1.35; word-break: break-word; }
.task-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.due { font-size: 13px; color: var(--muted); font-weight: 600; }
.due.overdue { color: var(--overdue); }
.due.today { color: var(--soon); }

.prio, .countdown { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.countdown.over { background: #f6e0d8; color: var(--overdue); }
.countdown.soon { background: #f3e6d0; color: var(--soon); }
.countdown.far  { background: #d8efea; color: var(--accent-deep); }
.prio.urgent { background: #f6e0d8; color: var(--overdue); }
.prio.high   { background: #f3e6d0; color: var(--soon); }

.task-desc {
  margin-top: 8px; font-size: 14px; color: var(--muted); line-height: 1.45;
  white-space: pre-wrap; word-break: break-word; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.task-id { font-size: 11px; color: #a89a80; font-weight: 600; }

.done-btn {
  flex-shrink: 0; cursor: pointer;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--card); color: var(--accent-deep);
  font-size: 22px; display: grid; place-items: center;
  border: 2px solid var(--accent);
}
.done-btn:active { transform: scale(0.9); background: var(--accent); color: var(--on-accent); }
.icon-btn, .done-btn, #pin-submit { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

.auth { display: grid; place-items: center; min-height: 50vh; }
.auth-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line);
  padding: 28px 24px; width: 100%; max-width: 320px; text-align: center;
}
.auth-emoji { font-size: 40px; }
.auth-card p { color: var(--muted); margin: 12px 0 16px; }
.auth-card input {
  width: 100%; padding: 14px; font-size: 18px; text-align: center;
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px;
  letter-spacing: 0.2em; background: var(--bg); color: var(--ink);
}
#pin-submit {
  width: 100%; padding: 14px; font-size: 16px; font-weight: 700;
  background: var(--accent); color: var(--on-accent);
  border: none; border-radius: 12px; cursor: pointer;
}
.error { color: var(--overdue); font-size: 13px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-emoji { font-size: 48px; margin-bottom: 8px; }
.loading { display: grid; place-items: center; padding: 60px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.statusbar { text-align: center; color: #a89a80; font-size: 12px; padding: 8px 0 16px; }
.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px);
  transform: translateX(-50%); background: #2a231a; color: #fff;
  padding: 12px 18px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow); z-index: 50; max-width: 90%;
}
