/* ===== единый скин Vivid (тот же, что Life и Встречи) — светлая база ===== */
:root {
  --bg: #eceef3;
  --bg-glow: rgba(109, 94, 252, .12);
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --surface-3: #e4e7ef;
  --text: #131722;
  --muted: #6f7686;
  --line: rgba(20, 24, 33, .08);
  --accent: #6d5efc;
  --accent-soft: rgba(109, 94, 252, .12);
  --accent-2: #1eb968;
  --danger: #f2456b;
  --amber: #e0930c;
  --grad: linear-gradient(135deg, #6d5efc 0%, #8b7bff 100%);
  --grad-warm: linear-gradient(135deg, #f2456b 0%, #f59e0b 100%);
  --grad-mint: linear-gradient(135deg, #1eb968 0%, #56d0a0 100%);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(70, 80, 130, .10);
  --shadow-accent: 0 6px 18px rgba(109, 94, 252, .28);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(120% 75% at 12% -5%, rgba(124, 140, 255, .20), transparent 52%),
    radial-gradient(110% 70% at 100% 8%, rgba(255, 120, 180, .14), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.45 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
.hidden { display: none !important; }
::selection { background: var(--accent-soft); }

/* ---- Вход ---- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; }
.gate-card {
  background: var(--surface); border-radius: 26px; padding: 34px 26px;
  width: 100%; max-width: 360px; text-align: center; box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.gate-logo {
  width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 22px;
  background: var(--grad); display: grid; place-items: center; font-size: 38px;
  box-shadow: var(--shadow-accent);
}
.gate-card h1 { font-size: 22px; margin: 6px 0 6px; letter-spacing: -.3px; }
.gate-card p { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
.gate-card input, #token-input {
  width: 100%; padding: 14px 16px; border-radius: 14px;
  border: 1px solid var(--surface-3); background: var(--surface-2);
  color: var(--text); font-size: 16px; margin-bottom: 12px; transition: border-color .2s;
}
#token-input:focus { outline: none; border-color: var(--accent); }
.gate-card button {
  width: 100%; padding: 14px; border: 0; border-radius: 14px; background: var(--grad);
  color: #fff; font-size: 16px; font-weight: 700; box-shadow: var(--shadow-accent);
}
.gate-card button:active { transform: scale(.98); }
.gate-err { color: var(--danger); font-size: 14px; margin-top: 10px; min-height: 18px; }

/* ---- Каркас ---- */
.app { display: flex; flex-direction: column; height: 100%; max-width: 660px; margin: 0 auto; }

/* навигация между приложениями — единый первый ряд, как в Life и Встречах */
.hubnav { display: flex; gap: 8px; align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 12px;
  overflow-x: auto; scrollbar-width: none; }
.hubnav::-webkit-scrollbar { display: none; }
.hubnav a, .hubnav span {
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  border-radius: 13px; padding: 9px 16px; font-size: 14px; font-weight: 650;
  text-decoration: none; white-space: nowrap; box-shadow: 0 4px 14px rgba(70, 80, 130, .07);
}
.hubnav .on { background: var(--accent); color: #fff; border-color: transparent; }

.top {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 0 18px 8px;
}
.hello { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
#hello-name {
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.chips { display: flex; gap: 7px; margin-top: 9px; flex-wrap: wrap; }
.chip {
  font-size: 12px; font-weight: 700; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: 20px;
}
.chip.warn { color: var(--danger); background: rgba(242, 69, 107, .10); border-color: transparent; }
.top-actions { display: flex; gap: 4px; }
.icon-btn {
  background: var(--surface); border: 1px solid var(--line);
  color: var(--muted); font-size: 18px; width: 40px; height: 40px; border-radius: 12px;
  box-shadow: 0 4px 14px rgba(70, 80, 130, .06);
}
.icon-btn:active { transform: scale(.94); }

/* ---- Вкладки ---- */
.tabs { display: flex; gap: 8px; padding: 4px 14px 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  white-space: nowrap; font-size: 14px; font-weight: 700; color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 22px; transition: all .18s;
  box-shadow: 0 4px 14px rgba(70, 80, 130, .05);
}
.tab.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: var(--shadow-accent); }

/* ---- Список ---- */
.list { flex: 1; overflow-y: auto; padding: 4px 14px 14px; -webkit-overflow-scrolling: touch; }
.list-head { font-size: 13px; color: var(--muted); margin: 14px 6px 10px; font-weight: 700; letter-spacing: .2px; }
.empty { text-align: center; color: var(--muted); padding: 56px 24px; font-size: 15px; line-height: 1.6; }

.card {
  display: flex; align-items: flex-start; gap: 12px; position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 14px 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow); transition: transform .14s ease, box-shadow .14s ease;
  animation: cardIn .22s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } }
.card:active { transform: scale(.992); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: transparent; }
.card.prio-high::before { background: var(--grad-warm); }
.card.overdue::before { background: var(--danger); }
.card.st-doing::before { background: var(--accent); }
.card.st-done::before { background: var(--accent-2); }

.check {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--surface-3); background: none; margin-top: 1px;
  display: grid; place-items: center; color: #fff; font-size: 14px; transition: all .18s;
}
.check.done { background: var(--grad-mint); border-color: transparent; box-shadow: 0 3px 10px rgba(30, 185, 104, .35); }
.body { flex: 1; min-width: 0; }
.title { font-size: 15.5px; font-weight: 650; letter-spacing: -.2px; }
.title.done { text-decoration: line-through; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.badge {
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--surface-2); padding: 3px 9px; border-radius: 9px;
}
.badge.date { color: var(--accent); background: var(--accent-soft); }
.badge.over { color: #fff; background: var(--danger); }
.badge.high { color: #fff; background: var(--grad-warm); }
.badge.doing { color: #fff; background: var(--accent); }
.badge.tag { color: var(--accent-2); background: rgba(30, 185, 104, .12); }
.del { background: none; border: 0; color: var(--muted); font-size: 16px; padding: 4px; opacity: .6; }
.del:active { opacity: 1; }

/* ---- Ассистент ---- */
.assistant {
  margin: 0 14px 10px; padding: 14px 16px; font-size: 14px; line-height: 1.55;
  white-space: pre-wrap; border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(109, 94, 252, .10), rgba(91, 141, 239, .05)), var(--surface);
  border: 1px solid rgba(109, 94, 252, .22);
}

/* ---- Композер ---- */
.composer {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.composer input {
  flex: 1; padding: 13px 16px; border-radius: 24px; border: 1px solid var(--surface-3);
  background: var(--surface); color: var(--text); font-size: 16px; transition: border-color .2s;
}
.composer input:focus { outline: none; border-color: var(--accent); }
.mic, .send {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 50%; border: 0;
  font-size: 18px; color: #fff; transition: transform .12s;
}
.mic { background: var(--surface-2); color: var(--muted); }
.send { background: var(--grad); box-shadow: var(--shadow-accent); }
.mic:active, .send:active { transform: scale(.92); }
.mic.rec { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---- Доска (канбан) ---- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.board::-webkit-scrollbar { display: none; }
.col {
  flex: 0 0 84%; background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.col-head { font-size: 13px; font-weight: 800; color: var(--text); margin: 4px 6px 12px; display: flex; align-items: center; }
.col-n { background: var(--accent-soft); color: var(--accent); border-radius: 20px; padding: 1px 9px; font-size: 11px; margin-left: 8px; }
.col .card { box-shadow: none; }
.col-empty { color: var(--muted); text-align: center; padding: 22px; font-size: 13px; }

/* ---- Карточка задачи (sheet) ---- */
.sheet { position: fixed; inset: 0; background: rgba(30, 34, 50, .45); display: flex; align-items: flex-end; z-index: 60; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet-card {
  background: var(--surface); width: 100%; max-height: 88vh; overflow-y: auto;
  border-radius: 26px 26px 0 0; padding: 10px 18px calc(22px + var(--safe-b));
  max-width: 660px; margin: 0 auto; box-shadow: 0 -10px 40px rgba(30, 34, 50, .25);
  animation: slideUp .26s cubic-bezier(.22, 1, .36, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } }
.sheet-grip { width: 42px; height: 4px; background: var(--surface-3); border-radius: 2px; margin: 4px auto 14px; }
.sheet-title { font-size: 20px; font-weight: 800; margin-bottom: 10px; letter-spacing: -.3px; }
.seg-row { display: flex; gap: 7px; margin: 16px 0; background: var(--surface-2); padding: 4px; border-radius: 14px; }
.seg { flex: 1; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; transition: all .18s; }
.seg.on { background: var(--grad); color: #fff; box-shadow: var(--shadow-accent); }
.sub-head { font-size: 13px; color: var(--muted); font-weight: 800; margin: 14px 2px 8px; }
.sub { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--surface-2); }
.sub input { width: 22px; height: 22px; accent-color: var(--accent-2); flex: 0 0 auto; }
.sub .sdone { color: var(--muted); text-decoration: line-through; }
.sub-add { display: flex; gap: 9px; margin-top: 12px; }
.sub-add input { flex: 1; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--surface-3); background: var(--surface-2); color: var(--text); font-size: 15px; }
.sub-add input:focus { outline: none; border-color: var(--accent); }
.sub-add button { width: 48px; border: 0; border-radius: 12px; background: var(--grad); color: #fff; font-size: 22px; box-shadow: var(--shadow-accent); }
.sheet-del { width: 100%; margin-top: 20px; padding: 13px; border: 0; border-radius: 12px; background: rgba(242, 69, 107, .10); color: var(--danger); font-size: 14px; font-weight: 600; }

/* ---- Тост ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%);
  background: rgba(30, 34, 50, .95); color: #fff; padding: 12px 18px; border-radius: 14px;
  font-size: 14px; max-width: 90%; text-align: center; z-index: 70; box-shadow: var(--shadow);
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }
.dots { animation: pulse 1.1s ease-in-out infinite; }
.card.pending { opacity: .72; }
.card.pending .check { border-style: dashed; border-color: var(--accent); }
.spinner { opacity: .6; }

/* ---- Доска на широких экранах ---- */
@media (min-width: 900px) {
  .app { max-width: 1480px; }
  .sheet-card { max-width: 720px; border-radius: 26px; margin: auto; }
  .list { columns: 2; column-gap: 12px; }
  .list > * { break-inside: avoid; }
  .list-head { column-span: all; }
  .assistant, .board { column-span: all; }
  .board { display: flex; }
  .col { flex: 1 1 0; }
}
@media (min-width: 1280px) { .list { columns: 3; } }
