:root {
  --bg: #121214;
  --card: #1a1a1d;
  --card2: #232327;
  --text: #e9e9ec;
  --muted: #8b8b93;
  --accent: #d4af37;
  --ok: #8fbf5a;
  --bad: #d95f43;
  --border: #2c2c31;
  --code-bg: #0d0d0f;
  --code-fg: #e9e9ec;
  --tok-kw: #e0a458;
  --tok-str: #9caf88;
  --tok-num: #d4af37;
  --tok-com: #6b6b74;
  --tok-fn: #c2a878;
  --tok-boo: #d4af37;
  --tok-key: #e0a458;
  --tok-tag: #e0a458;
  --tok-attr: #c2a878;
}
[data-theme="light"] {
  --bg: #f2f2f3;
  --card: #ffffff;
  --card2: #e9e9eb;
  --text: #1c1c1f;
  --muted: #6c6c74;
  --accent: #a9803a;
  --ok: #4e7d22;
  --bad: #b04a25;
  --border: #dcdce0;
  --code-bg: #1d1d21;
  --code-fg: #ececed;
  --tok-kw: #e0a458;
  --tok-str: #9caf88;
  --tok-num: #d4af37;
  --tok-com: #8b8b93;
  --tok-fn: #c2a878;
  --tok-boo: #d4af37;
  --tok-key: #e0a458;
  --tok-tag: #e0a458;
  --tok-attr: #c2a878;
}
html { accent-color: var(--accent); }
::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus { border-color: var(--accent); }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: calc(100vh + 1px);
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 "Clash Grotesk", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
.top { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top)) 16px 4px; max-width: 640px; margin: 0 auto; }
.logo { width: 32px; height: 32px; border-radius: 9px; display: block; flex: none; }
h1 { font-size: 20px; margin: 0; font-weight: 600; letter-spacing: .01em; }
main { padding: 8px 12px; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
h3 { margin: 0 0 8px; font-size: 15px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; }
button {
  font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
button:disabled { opacity: .4; }
button.primary { background: var(--accent); border-color: var(--accent); color: #1a1407; }
button.ghost { background: transparent; }
button.ok { color: var(--ok); border-color: var(--ok); }
button.bad { color: var(--bad); border-color: var(--bad); }
button.icon-btn { padding: 6px; }
.ic { width: 20px; height: 20px; flex: none; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; min-width: 0; width: 100%;
}
.form { display: flex; flex-direction: column; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; color: var(--text); }
label.check input { width: auto; }
.btn-like {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px;
  background: var(--card2); border: 1px solid var(--border); color: var(--text); cursor: pointer;
}
.daybar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.daylabel { display: flex; flex-direction: column; text-align: center; }
.daylabel small { color: var(--muted); }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.toolbar label { flex-direction: row; align-items: center; gap: 6px; }
.toolbar select { width: auto; }
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task {
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--c, var(--accent));
  border-radius: 12px; padding: 10px;
}
.task-head { display: flex; align-items: center; gap: 10px; }
.cat-ico { color: var(--c, var(--accent)); display: flex; }
.task-title { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ttl { overflow-wrap: anywhere; }
.task-title small { color: var(--muted); }
.task.done { border-left-color: var(--ok); }
.task.failed { border-left-color: var(--bad); }
.task.done .ttl { text-decoration: line-through; color: var(--ok); }
.task.failed .ttl { text-decoration: line-through; color: var(--bad); }
.mark { display: flex; }
.mark.ok { color: var(--ok); }
.mark.bad { color: var(--bad); }
.mark .ic { width: 24px; height: 24px; }
.acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.acts.center { justify-content: center; }
.clock { display: block; font-size: 34px; font-variant-numeric: tabular-nums; text-align: center; margin-top: 8px; color: var(--text); }
.verdict { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.verdict span { width: 100%; color: var(--muted); }
.move { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 8px; }
.mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mini li { display: flex; align-items: center; gap: 8px; }
.mini li span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mini li small { color: var(--muted); white-space: nowrap; }
.mini li b { white-space: nowrap; }
.empty, .muted { color: var(--muted); text-align: center; margin: 8px 0; }
.muted { text-align: left; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { background: var(--card2); border-radius: 12px; padding: 10px; }
.tile small { color: var(--muted); display: block; }
.tile b { font-size: 18px; }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.tile .pos, .tile .neg { font-weight: 600; }
.periods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.periods button { justify-content: center; padding: 8px 4px; }
.periods button.on { background: var(--accent); color: #1a1407; border-color: var(--accent); }
.bar-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.bar-l { display: flex; align-items: center; gap: 6px; }
.bar-l span { flex: 1; }
.bar-l small { color: var(--muted); }
.bar { height: 8px; background: var(--card2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.icon-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.ico {
  position: relative; align-items: center; justify-content: center; background: var(--card2);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px; color: var(--text);
}
.ico input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ico:has(input:checked) { border-color: var(--accent); color: var(--accent); }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--border);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  transform: translateZ(0);
}
.tabbar button {
  flex-direction: column; background: none; border: 0; color: var(--muted); font-size: 11px;
  justify-content: center; gap: 2px; padding: 6px 2px;
}
.tabbar button.on { color: var(--accent); }
.daybar button.icon-btn { padding: 6px 10px; }
.ic.rot-up { transform: rotate(-90deg); }
.ic.rot-down { transform: rotate(90deg); }
/* Приветствие в стиле сторисов */
.intro {
  position: fixed; inset: 0; z-index: 200;
  background: #0b0b0d;
  display: flex; flex-direction: column;
  padding: calc(8px + env(safe-area-inset-top)) 0 calc(14px + env(safe-area-inset-bottom));
}
.intro[hidden] { display: none; }
.intro-bars { display: flex; gap: 4px; padding: 8px 12px 12px; }
.intro-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .22); overflow: hidden; display: block; }
.intro-bars b { display: block; height: 100%; width: 0; background: var(--accent); }
.intro-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 12px; }
.intro-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 14px; display: block; }
.intro-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 12px 0; }
.intro-foot button { min-width: 112px; justify-content: center; }
body.intro-open { overflow: hidden; }
/* Предупреждение о входе */
.warn { padding: 8px 12px 0; max-width: 640px; margin: 0 auto; width: 100%; }
.warn[hidden] { display: none; }
.warn-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--accent); border-left-width: 4px;
  border-radius: 12px; padding: 10px 12px;
}
.warn-txt { flex: 1 1 180px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.warn-txt b { color: var(--accent); font-weight: 600; }
.warn-txt span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.warn-box button { flex: none; }
.note-card { cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.note-head { display: flex; align-items: center; gap: 10px; }
.note-ico { color: var(--accent); display: flex; }
.note-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.note-meta b { overflow-wrap: anywhere; }
.note-meta small { color: var(--muted); }
.note-title-row { display: flex; align-items: center; gap: 8px; }
.note-ico-btn { color: var(--accent); padding: 8px; }
.ico.on { border-color: var(--accent); color: var(--accent); }
.note-blocks { display: flex; flex-direction: column; gap: 10px; }
.note-block { display: flex; flex-direction: column; gap: 8px; }
.note-block-head { display: flex; align-items: center; gap: 4px; }
.note-block-head .muted { flex: 1; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.note-block textarea { width: 100%; resize: vertical; font: inherit; line-height: 1.45; }
.code-wrap { position: relative; font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; font-size: 13.5px; line-height: 1.55; }
.code-wrap .code-view, .code-wrap textarea.code {
  font-family: inherit; font-size: inherit; line-height: inherit; letter-spacing: 0;
  margin: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word; tab-size: 2;
}
.code-wrap .code-view {
  position: absolute; inset: 0; background: var(--code-bg); color: var(--code-fg);
  overflow: hidden; pointer-events: none; min-height: 100%;
}
.code-wrap textarea.code {
  position: relative; display: block; width: 100%; min-height: 92px; resize: vertical;
  background: transparent; color: transparent; caret-color: var(--code-fg); overflow: auto;
}
.code-wrap textarea.code::selection { background: rgba(212,175,55,.35); }
.code-wrap textarea.code::-webkit-input-placeholder { color: var(--muted); }
.tok-kw { color: var(--tok-kw); }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-com { color: var(--tok-com); font-style: italic; }
.tok-fn { color: var(--tok-fn); }
.tok-boo { color: var(--tok-boo); }
.tok-key { color: var(--tok-key); }
.tok-tag { color: var(--tok-tag); }
.tok-attr { color: var(--tok-attr); }
.note-photo { width: 100%; border-radius: 10px; display: block; }
.toolbar .muted { font-size: 12px; }
.hint { font-size: 12px; margin: 0; }
.move button { justify-content: center; }
/* Кнопки входа: фирменная Google-кнопка и тихая текстовая ссылка */
.auth-alt { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.btn-google {
  background: #fff; border: 1px solid #dadce0; color: #1f1f1f;
  justify-content: center; font-weight: 500; width: 100%;
}
.btn-google:active { background: #f1f3f4; }
.g-logo { width: 18px; height: 18px; display: inline-flex; flex: none; }
.g-logo svg { width: 100%; height: 100%; display: block; }
.btn-link {
  background: none; border: 0; color: var(--muted);
  justify-content: center; font-size: 13px; padding: 8px 6px; width: 100%;
}
.btn-link:active { color: var(--text); }
.mini li.pays-row { display: grid; grid-template-columns: 72px 1fr auto; gap: 6px; align-items: center; }
.mini li.pays-row input { width: 100%; }
