@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-cyrillic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Alice";
  src: url("fonts/alice-cyrillic.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Alice";
  src: url("fonts/alice-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #fbf4f7;
  --fg: #3a2430;
  --surface: #fff8fb;
  --surface-2: #f3e4ec;
  --muted: #8a6574;
  --subtle: #c09aaa;
  --border: color-mix(in oklab, #3a2430 10%, transparent);
  --accent: #e25d8a;
  --accent-fg: #fff8fb;
  --ok: #3d9a78;
  --warn: #d4893a;
  --danger: #d4566a;
  --shadow: 0 0 0 1px rgba(58, 36, 48, 0.05), 0 10px 28px -14px rgba(226, 93, 138, 0.28);
  --font: "Nunito", "Segoe UI", "PT Sans", system-ui, sans-serif;
  --display: "Alice", "Nunito", "Segoe UI", serif;
  --coral: #f08a7a; --sky: #7bb8e8; --teal: #5cb8a8; --amber: #e8b04a;
  --rose: #e57a9a; --violet: #b08ad4; --lime: #8bc46a; --navy: #7a8ec8;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
.dark {
  --bg: #1a1216; --fg: #f8eef2; --surface: #261c22; --surface-2: #32262c;
  --muted: #c4a3b0; --subtle: #8a6a76;
  --border: color-mix(in oklab, #f8eef2 12%, transparent);
  --accent: #f0789c; --accent-fg: #2a1520;
  --ok: #6ecb97; --warn: #e0b05a; --danger: #ef7a8a;
  --shadow: 0 0 0 1px rgba(248, 238, 242, 0.08);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background-color: var(--bg); background-image: radial-gradient(900px 420px at 8% -8%, color-mix(in oklab, var(--accent) 16%, transparent), transparent 70%), radial-gradient(720px 380px at 100% 0%, color-mix(in oklab, var(--sky) 14%, transparent), transparent 65%), radial-gradient(640px 280px at 70% 100%, color-mix(in oklab, var(--violet) 10%, transparent), transparent 70%); background-attachment: fixed; color: var(--fg); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, [role="button"] { cursor: pointer; font-family: inherit; }
button:disabled { opacity: 0.4; cursor: default; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; font-weight: 500; }
input, textarea, select { font-family: inherit; color: inherit; }
.app { min-height: 100dvh; }

.pin { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 40px 20px 80px; }
.pin-box { width: 100%; max-width: 360px; text-align: center; }
.logo { width: 56px; height: 56px; border-radius: 18px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; margin: 0 auto 20px; font-family: var(--display); font-size: 24px; }
.dots { display: flex; justify-content: center; gap: 10px; margin: 32px 0; }
.dot { width: 12px; height: 12px; border-radius: 99px; background: var(--surface-2); }
.dot.on { background: var(--accent); }
.dot.err { background: var(--danger); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.keys button { height: 64px; border: 0; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); font-size: 20px; font-weight: 500; color: var(--fg); }
.keys button.ok { background: var(--accent); color: var(--accent-fg); }
.shake { animation: shake 420ms cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.shell { display: flex; min-height: 100dvh; max-width: 1400px; margin: 0 auto; }
.rail { width: 248px; border-right: 1px solid var(--border); padding: 20px 12px; display: none; flex-direction: column; }
@media (min-width: 1024px) { .rail { display: flex; } .rail-hide { display: none !important; } .only-phone { display: none !important; } }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 24px; }
.brand b { font-family: var(--display); font-weight: 500; }
.rail button.item { display: flex; align-items: center; gap: 8px; min-height: 44px; border: 0; background: transparent; color: var(--fg); border-radius: 10px; padding: 0 8px; text-align: left; font-size: 14px; font-weight: 500; width: 100%; }
.rail button.item.active, .rail button.item:hover { background: var(--surface-2); }
.rail .count { margin-left: auto; font-size: 11px; color: var(--subtle); font-variant-numeric: tabular-nums; }
.glyph { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.glyph svg { width: 14px; height: 14px; }
.rail-foot { margin-top: auto; padding: 12px 8px 4px; }
.rail-foot a { color: var(--muted); font-size: 12px; text-decoration: none; }
.main { flex: 1; min-width: 0; }
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in oklab, var(--bg) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.top-row { display: flex; align-items: center; gap: 8px; }
.top h1 { font-size: 22px; letter-spacing: -0.03em; }
.minw { min-width: 0; }
.minw h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-btn { background: none; border: 0; padding: 0; color: inherit; text-align: left; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--fg); position: relative; display: grid; place-items: center; flex: 0 0 auto; }
.icon-btn:hover { background: var(--surface-2); }
.badge { position: absolute; top: 10px; right: 10px; width: 8px; height: 8px; border-radius: 99px; background: var(--danger); }
.search { flex: 1; max-width: 320px; position: relative; display: none; }
@media (min-width: 768px) { .search { display: block; } }
.search-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--subtle); pointer-events: none; }
.search input, .field, select.field, textarea.field {
  width: 100%; height: 44px; border: 0; border-radius: 10px; background: var(--surface); padding: 0 12px; outline: none;
}
.search input { padding-left: 36px; background: var(--surface); }
.search input:focus, .field:focus, select.field:focus, textarea.field:focus { box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 40%, transparent); }
textarea.field { height: auto; padding: 10px 12px; min-height: 110px; resize: vertical; }
.search-mobile { display: block; margin-top: 10px; }
.search-mobile input { width: 100%; height: 44px; border: 0; border-radius: 10px; background: var(--surface); padding: 0 12px; outline: none; }
@media (min-width: 768px) { .search-mobile { display: none !important; } }

.chips { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; height: 36px; border: 0; border-radius: 999px; padding: 0 12px; background: var(--surface); color: var(--fg); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--fg); color: var(--bg); }
.chip.filter.on { background: var(--accent); color: var(--accent-fg); }
.dotc { width: 8px; height: 8px; border-radius: 99px; }

.content { padding: 16px; padding-bottom: calc(108px + var(--safe-b)); }
.grid { display: grid; gap: 12px; }
@media (min-width: 768px) { .grid { grid-template-columns: 1fr 1fr; } .content { padding: 24px; } }
@media (min-width: 1200px) { .grid { grid-template-columns: 1fr 1fr 1fr; } }

.card { background: var(--surface); box-shadow: var(--shadow); border-radius: 16px; padding: 16px 16px 16px 20px; position: relative; text-align: left; }
.card.done { opacity: 0.6; }
.card.imp { box-shadow: var(--shadow), 0 0 0 1px color-mix(in oklab, var(--accent) 45%, transparent); }
.stripe { position: absolute; left: 6px; top: 12px; bottom: 12px; width: 4px; border-radius: 99px; }
.card h3 { font-family: var(--font); font-size: 15px; font-weight: 650; line-height: 1.35; }
.card.done h3 { text-decoration: line-through; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { font-size: 11px; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 3px 8px; font-weight: 500; }
.tag.over { background: color-mix(in oklab, var(--danger) 12%, transparent); color: var(--danger); }
.tag.today { background: color-mix(in oklab, var(--warn) 12%, transparent); color: var(--warn); }
.star { color: var(--accent); display: inline-flex; vertical-align: middle; }

.fab {
  position: fixed; right: 16px; bottom: calc(20px + var(--safe-b)); z-index: 20;
  height: 56px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-fg);
  padding: 0 22px; font-weight: 600; box-shadow: var(--shadow); font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px;
}
@media (min-width: 768px) { .fab { right: 32px; bottom: 32px; } }
.empty { text-align: center; margin: 64px auto 0; max-width: 280px; color: var(--muted); }
.empty h2 { font-size: 22px; color: var(--fg); margin-bottom: 8px; }

.overlay { position: fixed; inset: 0; z-index: 40; background: color-mix(in oklab, var(--fg) 35%, transparent); display: flex; justify-content: flex-end; }
.panel {
  width: 100%; max-width: 480px; background: var(--surface); height: 100%;
  padding: 16px; padding-top: max(16px, env(safe-area-inset-top));
  overflow: auto; display: flex; flex-direction: column;
}
.modal-bg { position: fixed; inset: 0; z-index: 50; background: color-mix(in oklab, var(--fg) 40%, transparent); display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 420px; background: var(--surface); border-radius: 24px 24px 0 0; padding: 20px; padding-bottom: calc(20px + var(--safe-b)); max-height: 92dvh; overflow: auto; }
@media (min-width: 640px) { .modal { border-radius: 20px; margin-bottom: 24px; } }

.row { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; }
.btn { height: 44px; border: 0; border-radius: 12px; padding: 0 16px; font-weight: 600; background: var(--accent); color: var(--accent-fg); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.sec { background: var(--surface-2); color: var(--fg); }
.btn.ghost { background: transparent; color: var(--fg); }
.btn.danger { color: var(--danger); background: transparent; }
.check {
  width: 44px; height: 44px; border: 0; background: transparent; flex: 0 0 auto;
  display: grid; place-items: center; margin: -10px 0 -10px -10px;
}
.check i { width: 22px; height: 22px; border-radius: 99px; border: 1.5px solid var(--border); display: block; }
.check.on i { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 5px var(--ok), inset 0 0 0 7px var(--accent-fg); }

.colors, .icons { display: flex; flex-wrap: wrap; gap: 8px; }
.colors button { width: 36px; height: 36px; border-radius: 99px; border: 0; }
.colors button.sel, .icons button.sel { outline: 2px solid var(--fg); outline-offset: 2px; }
.icons button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--surface-2); color: var(--fg); display: grid; place-items: center; }
.icons button.sel { background: var(--fg); color: var(--bg); }

.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); font-size: 14px; margin-top: 16px; }
label span, .lbl { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
.hide { display: none !important; }
.done-link { display: block; margin: 24px auto 0; background: none; border: 0; color: var(--muted); font-size: 14px; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.preset { height: 36px; border: 0; border-radius: 999px; padding: 0 12px; background: var(--surface-2); color: var(--fg); font-size: 12px; font-weight: 500; }
.preset.on { background: var(--fg); color: var(--bg); }

.set-row { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.set-ic { width: 36px; height: 36px; border-radius: 8px; background: var(--surface); display: grid; place-items: center; flex: 0 0 auto; }
.set-row p { margin: 0; font-size: 14px; font-weight: 600; }
.set-row small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.howto { font-size: 13px; color: var(--muted); line-height: 1.55; margin-top: 16px; }
.howto ol { padding-left: 18px; margin: 8px 0 0; }

.toast {
  position: fixed; top: max(16px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 80; background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow); max-width: min(90vw, 360px); text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
