:root {
  --bg: #0b1020; --panel: #141a2e; --panel2: #1c2440; --line: #2a3352;
  --text: #e8ecf7; --muted: #8b95b3; --accent: #4f8cff; --danger: #ef4444; --ok: #22c55e;
  --r: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); min-height: 100vh; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.sr { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }

/* горна лента */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: rgba(11,16,32,.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 20px; margin: 0; }
.top h1 small { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }
.actions { display: flex; gap: 4px; align-items: center; }
.actions form { margin: 0; }

.btn { border: 0; background: var(--panel2); padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.ghost { background: transparent; font-size: 20px; padding: 6px 10px; color: var(--text); }
.btn.primary { background: var(--accent); color: #fff; font-weight: 600; }
#bellBtn.on { filter: drop-shadow(0 0 6px #ffd54a88); }

.hint { margin: 10px 14px 0; padding: 12px 36px 12px 14px; background: #1e2a52; border: 1px solid #34478a; border-radius: var(--r);
  font-size: 14px; position: relative; }
.hint .x { position: absolute; right: 6px; top: 6px; background: none; border: 0; font-size: 20px; color: var(--muted); }
.share { display: inline-block; border: 1px solid var(--muted); border-radius: 4px; padding: 0 4px; font-size: 12px; }

/* дата */
.datebar { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 12px 8px 4px; }
.datelabel { background: none; border: 0; font-size: 18px; font-weight: 600; min-width: 190px; cursor: pointer; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; padding: 4px 10px 8px; max-width: 640px; margin: 0 auto; }
.day { background: var(--panel); border: 1px solid transparent; border-radius: 12px; padding: 6px 0 2px; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.day span { font-size: 11px; color: var(--muted); }
.day b { font-size: 17px; }
.day i { font-style: normal; color: var(--accent); height: 14px; line-height: 10px; font-size: 20px; }
.day.today b { color: var(--accent); }
.day.sel { background: var(--accent); }
.day.sel span, .day.sel b, .day.sel i { color: #fff; }

/* задачи */
.wrap { max-width: 640px; margin: 0 auto; padding: 0 12px; }
.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 4px 8px; }
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task { --c: var(--accent); display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; border-radius: var(--r);
  background: linear-gradient(90deg, color-mix(in srgb, var(--c) 22%, var(--panel)) 0%, var(--panel) 70%);
  border-left: 5px solid var(--c); }
.task .time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 48px; color: var(--c); filter: brightness(1.3); }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 600; word-wrap: break-word; }
.task .note { font-size: 13px; color: var(--muted); white-space: pre-wrap; margin-top: 2px; }
.task .check { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--c); background: transparent; color: #fff; font-weight: 700; cursor: pointer; padding: 0; }
.task.done .check { background: var(--c); }
.task.done .title { text-decoration: line-through; opacity: .55; }
.task.past:not(.done) { opacity: .7; }
.task.next { box-shadow: 0 0 0 2px var(--c); }
.task .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 2px solid #fff3; cursor: pointer; padding: 0; flex: none; }
.task .del { background: none; border: 0; font-size: 17px; cursor: pointer; opacity: .6; padding: 4px; }
.task .del:hover { opacity: 1; }
.empty { color: var(--muted); text-align: center; padding: 16px; background: var(--panel); border-radius: var(--r); margin: 0; font-size: 14px; }

.fab { position: fixed; right: 20px; bottom: calc(22px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; font-size: 32px; box-shadow: 0 8px 24px #0008; cursor: pointer; z-index: 6; }

/* добавяне */
.sheet { position: fixed; inset: 0; background: #000a; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet-body { width: 100%; max-width: 640px; background: var(--panel); border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 10px; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-body h2 { margin: 0 0 4px; font-size: 18px; }
input:not([type=checkbox]):not([type=radio]):not([type=color]), textarea {
  width: 100%; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 16px; }
textarea { resize: vertical; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }
.seg { display: flex; background: var(--panel2); border-radius: 10px; padding: 3px; }
.seg label { flex: 1; }
.seg input { display: none; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 8px; cursor: pointer; }
.seg input:checked + span { background: var(--accent); color: #fff; font-weight: 600; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 4px 0; }
.colors button, .palette button { width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; padding: 0; }
.colors button.sel { border-color: #fff; }
.colors input[type=color] { width: 32px; height: 32px; border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; overflow: hidden; }
.colors input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.colors input[type=color]::-webkit-color-swatch { border: 2px dashed #fff8; border-radius: 50%; }

.palette { position: absolute; z-index: 20; display: grid; grid-template-columns: repeat(4, 32px); gap: 8px; padding: 10px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px #000a; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 30;
  background: #222b4a; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; max-width: 92vw; box-shadow: 0 8px 24px #0008; font-size: 14px; }

/* вход / админ */
.auth { display: flex; align-items: center; justify-content: center; padding: 20px; }
.card { width: 100%; max-width: 360px; background: var(--panel); padding: 26px 22px; border-radius: 20px; display: flex; flex-direction: column; gap: 12px; }
.card h1 { margin: 0 0 6px; text-align: center; }
.card button, .stack button { background: var(--accent); color: #fff; border: 0; padding: 12px; border-radius: 10px; font-weight: 600; cursor: pointer; }
.logo { width: 72px; height: 72px; border-radius: 18px; align-self: center; }
.error { color: #fff; background: #7f1d1d; padding: 10px 12px; border-radius: 10px; margin: 8px 0; }
.ok { color: #bbf7d0; }
.checks { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.checks .bad { color: #fca5a5; }
.panel { background: var(--panel); border-radius: var(--r); padding: 16px; margin: 14px 0; }
.panel h2 { margin: 0 0 12px; font-size: 17px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.chk { display: flex; gap: 8px; align-items: center; }
.user-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.user-row > div { flex: 1 1 100%; }
.user-row small { display: block; color: var(--muted); }
.inline { display: flex; gap: 6px; margin: 0; flex: 1; }
.inline input { padding: 8px !important; }
.small { border: 0; border-radius: 8px; padding: 8px 12px; background: var(--panel2); cursor: pointer; white-space: nowrap; }
.danger { background: var(--danger); color: #fff; }
.badge { background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 11px; vertical-align: middle; }
code { background: var(--panel2); padding: 1px 5px; border-radius: 4px; }

.tsel { display: flex; align-items: center; gap: 4px; }
.tsel b { font-size: 20px; }
.tsel select { flex: 1; appearance: none; -webkit-appearance: none; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 8px; font-size: 18px; text-align: center; text-align-last: center; color: var(--text); font-variant-numeric: tabular-nums; }

.task .author { font-size: 12px; color: var(--muted); margin-top: 3px; }
.task .del-sp { width: 29px; flex: none; }
.user-row .chk { font-size: 14px; color: var(--muted); }
