/* Дела на двоих. Спокойный светлый фон, у каждого человека свой цвет —
   по нему с одного взгляда видно, чья задача. Цветом тревоги — только срок. */
:root {
  --bg: #f7f5f1;
  --paper: #ffffff;
  --ink: #1d1b19;
  --ink-soft: #6c6762;
  --ink-faint: #a39d96;
  --line: #e5e0d9;
  --line-strong: #cfc8bf;
  --hover: #f1ede7;

  --p1: #3f6fd8;  --p1-bg: #e9effc;   /* первый пользователь (Артём) */
  --p2: #d2477a;  --p2-bg: #fbe9f0;   /* второй (Лера) */
  --both: #7a5bd0; --both-bg: #efeafb; /* общие */

  --warn: #b7770a; --warn-bg: #fdf3e1;
  --bad: #c4392b;  --bad-bg: #fbeae8;
  --ok: #3e8a5a;

  --radius: 14px;
  --tap: 44px;
  --shadow: 0 1px 2px rgba(30, 25, 20, .04), 0 4px 16px rgba(30, 25, 20, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a; --paper: #1f1e24; --ink: #ecebef; --ink-soft: #a6a3ad; --ink-faint: #6e6b75;
    --line: #2e2c34; --line-strong: #403d47; --hover: #27262d;
    --p1: #7ea2f2; --p1-bg: #1f2a44;
    --p2: #f07ba5; --p2-bg: #3d2130;
    --both: #a990f0; --both-bg: #2c2645;
    --warn: #e2a640; --warn-bg: #3a2e17;
    --bad: #f07a6c; --bad-bg: #3d2120;
    --ok: #6cc08a;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.app { max-width: 620px; margin: 0 auto; padding: 22px 16px 120px; min-height: 100dvh; }

/* ── шапка ─────────────────────────────────────────────────────────────── */
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.head h1 { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.head .who { margin-left: auto; font-size: 13px; color: var(--ink-faint); background: none; border: 0; padding: 8px 0; }
.head .who b { color: var(--ink-soft); font-weight: 600; }

/* ── фильтр ────────────────────────────────────────────────────────────── */
.filters { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink-soft); font-size: 14px;
}
.filters button.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filters .n { font-size: 12px; opacity: .6; font-variant-numeric: tabular-nums; }

/* ── группы и карточки ─────────────────────────────────────────────────── */
.group { margin-bottom: 22px; }
.group h2 {
  margin: 0 0 8px 4px; font-size: 12px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-faint);
}
.group.bad h2 { color: var(--bad); }
.group.warn h2 { color: var(--warn); }

.list { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.task { display: flex; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line); position: relative; }
.task:first-child { border-top: 0; }
.task::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); }
.task .body { flex: 1; min-width: 0; cursor: pointer; }
.task .title { font-weight: 500; word-wrap: break-word; }
.task .note { font-size: 14px; color: var(--ink-soft); margin-top: 2px; white-space: pre-wrap; word-wrap: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 7px; font-size: 13px; color: var(--ink-faint); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12.5px; font-weight: 600; background: var(--cb); color: var(--c); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }
.due { font-weight: 500; color: var(--ink-soft); }
.due.warn { color: var(--warn); }
.due.bad { color: var(--bad); }

.p1 { --c: var(--p1); --cb: var(--p1-bg); }
.p2 { --c: var(--p2); --cb: var(--p2-bg); }
.both { --c: var(--both); --cb: var(--both-bg); }

/* кружок-галочка */
.check {
  flex: 0 0 auto; width: 26px; height: 26px; margin-top: -1px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: none; padding: 0; display: grid; place-items: center;
  transition: border-color .15s, background .15s;
}
.check:hover { border-color: var(--c); }
.check svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; opacity: 0; }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task.done .check svg { opacity: 1; }
.task.done .title { color: var(--ink-faint); text-decoration: line-through; }
.task.done::before { opacity: .35; }

.empty { text-align: center; color: var(--ink-faint); padding: 48px 20px; }
.empty .big { font-size: 34px; margin-bottom: 8px; }

.more { width: 100%; background: none; border: 0; color: var(--ink-soft); font-size: 14px; padding: 12px; min-height: var(--tap); }

/* ── кнопка «новая задача» ─────────────────────────────────────────────── */
.fab {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom));
  height: 52px; padding: 0 24px; border-radius: 999px; border: 0;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 16px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18); display: flex; align-items: center; gap: 8px;
}
.fab span { font-size: 22px; line-height: 1; margin-top: -2px; }

/* ── нижний лист с формой ──────────────────────────────────────────────── */
.veil { position: fixed; inset: 0; background: rgba(15, 12, 10, .35); z-index: 10; animation: fade .15s; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; margin: 0 auto; max-width: 620px;
  background: var(--paper); border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 92dvh; overflow-y: auto; animation: up .2s ease-out;
}
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 8vh; border-radius: 20px; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }

.sheet h3 { margin: 0 0 14px; font-size: 18px; }
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 7px; }
.input, .textarea {
  width: 100%; border: 1px solid var(--line-strong); background: var(--bg); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; outline: none;
}
.input:focus, .textarea:focus { border-color: var(--ink-soft); }
.textarea { min-height: 76px; resize: vertical; }
input[type="date"].input { min-height: 46px; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg button {
  height: var(--tap); border-radius: 10px; border: 1px solid var(--line-strong); background: var(--paper);
  display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 15px;
}
.seg button.on { background: var(--cb); border-color: var(--c); color: var(--c); font-weight: 600; }

.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick button { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper); font-size: 13.5px; color: var(--ink-soft); }
.quick button.on { border-color: var(--ink-soft); color: var(--ink); }

.actions { display: flex; gap: 8px; margin-top: 20px; }
.btn { height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--paper); font-weight: 500; }
.btn.primary { flex: 1; background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; }
.stamp { font-size: 13px; color: var(--ink-faint); margin-top: 14px; line-height: 1.6; }

/* ── вход ──────────────────────────────────────────────────────────────── */
.login { max-width: 340px; margin: 14vh auto 0; }
.login h1 { font-size: 30px; margin: 0 0 6px; letter-spacing: -0.02em; }
.login p { color: var(--ink-soft); margin: 0 0 24px; }
.login .btn { width: 100%; margin-top: 4px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20;
  display: flex; gap: 14px; align-items: center;
}
.toast button { background: none; border: 0; color: inherit; font-weight: 700; padding: 0; text-decoration: underline; }
