:root {
  --bg: #f4f5f7; --panel: #ffffff; --panel2: #eceef2; --text: #171a1f; --muted: #737b8a; --line: #dfe2e8;
  --accent: #2f6fdb; --accent-text: #ffffff; --ok: #2e9a5b; --del: #c93b3b;
  --mic-a: #ff7a45; --mic-b: #e8336b; --mic-glow: rgba(232, 51, 107, .38);
  --plus-bg: #e6edfa; --plus-fg: #3b5f9e;
  --bar-h: 64px; --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --panel: #1a1e24; --panel2: #232831; --text: #e7e9ee; --muted: #8e96a5; --line: #2c323c;
    --accent: #5b92f0; --plus-bg: #243044; --plus-fg: #9db8e6; --mic-glow: rgba(232, 51, 107, .45); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
input, textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 16px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* вход */
.login-page { display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; }
.logo { font-size: 30px; font-weight: 800; text-align: center; letter-spacing: -0.5px; }
.sub { text-align: center; color: var(--muted); margin: -8px 0 12px; }
.error { background: rgba(201, 59, 59, .12); color: var(--del); padding: 10px 12px; border-radius: 10px; }
.primary { background: var(--accent); color: var(--accent-text); padding: 13px; border-radius: 10px; font-weight: 600; }

/* общий каркас */
.app, .add-page { display: flex; flex-direction: column; height: 100dvh; }
.bar-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.logo-sm { font-weight: 800; }
.ghost { color: var(--muted); font-size: 13px; padding: 4px; }

/* три колонки */
.cols { --div-w: 10px; flex: 1; min-height: 0; display: grid;
  grid-template-columns: minmax(0, 22fr) var(--div-w) minmax(0, 24fr) var(--div-w) minmax(0, 54fr); }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.divider { position: relative; cursor: col-resize; touch-action: none; background: var(--panel); user-select: none; }
.divider::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: var(--line); }
.divider::after { content: ""; position: absolute; top: 50%; left: 50%; width: 4px; height: 28px; margin: -14px 0 0 -2px;
  border-radius: 2px; background: var(--muted); opacity: .45; }
.divider.drag::before, .divider:hover::before { background: var(--accent); width: 2px; }
.item.placeholder .name { color: var(--muted); font-style: italic; }
.item.active.placeholder .name { color: var(--accent-text); }
#col-dir { background: var(--panel2); }
#col-proj { background: var(--panel); }
.col-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 4px;
  padding: 8px 8px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.plus-sm { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-text);
  font-size: 18px; line-height: 26px; padding: 0; flex: none; }
.col-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 6px 12px; -webkit-overflow-scrolling: touch; }
.item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 4px; text-align: left;
  padding: 10px 8px; margin-bottom: 4px; border-radius: 8px; overflow-wrap: anywhere; }
.item.active { background: var(--accent); color: var(--accent-text); }
.item .count { font-size: 12px; opacity: .7; flex: none; }
.empty { color: var(--muted); font-size: 13px; padding: 10px 6px; }
.inline { margin-bottom: 6px; padding: 9px 8px; font-size: 16px; }

/* задачи */
.task { display: flex; align-items: flex-start; gap: 6px; padding: 8px 6px 8px 10px; margin-bottom: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.task .title { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 5px; }
.task.is-done .title { color: var(--muted); text-decoration: line-through; }
.acts { display: flex; gap: 2px; flex: none; }
.act { width: 32px; height: 32px; border-radius: 8px; font-size: 16px; color: var(--muted); }
.act.ok { color: var(--ok); }
.act.del { color: var(--del); }
.act:active { background: var(--panel2); }
.done-toggle { color: var(--muted); font-size: 13px; padding: 10px 4px; }
@media (max-width: 520px) {
  .task { flex-direction: column; gap: 2px; padding: 8px; }
  .task .title { padding-top: 0; }
  .acts { align-self: flex-end; }
  .item { padding: 9px 6px; font-size: 14px; }
}

/* нижняя плашка */
.bar-bottom { flex: none; height: calc(var(--bar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; align-items: center; justify-content: space-around; background: var(--panel); border-top: 1px solid var(--line);
  position: relative; z-index: 5; /* иначе разделители колонок рисуются поверх приподнятого микрофона */ }
.nav-btn { width: 72px; height: 48px; color: var(--muted); border-radius: 10px; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.nav-btn .ico { font-size: 20px; line-height: 1; }
.nav-btn .cap { font-size: 11px; }
.nav-center { display: flex; align-items: center; gap: 12px; }
.nav-plus, .nav-mic { border-radius: 50%; text-align: center; text-decoration: none; flex: none; }
/* «+» — второстепенная: мягкая, поменьше */
.nav-plus { width: 46px; height: 46px; margin-top: -8px; background: var(--plus-bg); color: var(--plus-fg);
  border: 1px solid var(--line); font-size: 28px; line-height: 43px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
/* микрофон — главная кнопка: крупная, цветная */
.nav-mic { width: 64px; height: 64px; margin-top: -24px; border: 3px solid var(--panel); color: #fff;
  background: linear-gradient(145deg, var(--mic-a), var(--mic-b)); box-shadow: 0 6px 18px var(--mic-glow);
  display: flex; align-items: center; justify-content: center; transition: transform .12s ease; }
.nav-mic svg { width: 28px; height: 28px; }
.nav-mic:active { transform: scale(.93); }

/* окна поверх экрана */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center; }
.overlay[hidden] { display: none; }
.sheet { width: 100%; max-width: 520px; max-height: 85dvh; overflow-y: auto; background: var(--panel);
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(14px + var(--safe-b)); }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 16px; } }
.sheet-actions { display: flex; gap: 10px; margin-top: 14px; }
.sheet-actions [hidden] { display: none; }
.rec-sheet { text-align: center; }
.rec-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--muted); margin: 6px auto 10px; }
.rec-dot.on { background: var(--del); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.rec-state { font-size: 18px; font-weight: 600; }
.rec-time { color: var(--muted); margin: 4px 0 10px; font-variant-numeric: tabular-nums; }
.rec-hint { color: var(--muted); font-size: 13px; }
.pick-heard { color: var(--muted); font-size: 13px; margin-bottom: 6px; overflow-wrap: anywhere; }
.pick-q { font-weight: 600; margin-bottom: 12px; overflow-wrap: anywhere; }
.pick-opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left;
  padding: 12px 14px; border-radius: 10px; background: var(--panel2); }
.opt:active { outline: 2px solid var(--accent); }
.opt-label { font-weight: 600; overflow-wrap: anywhere; }
.opt-sub { color: var(--muted); font-size: 13px; flex: none; max-width: 45%; text-align: right; }
.pick-new { display: flex; gap: 8px; margin-top: 12px; }
.pick-new .btn { flex: none; }

/* история */
.back { text-decoration: none; color: var(--accent); }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.history { flex: 1; overflow-y: auto; padding: 8px 16px 24px; max-width: 760px; width: 100%; margin: 0 auto; }
.day { font-size: 13px; color: var(--muted); margin: 16px 0 6px; font-weight: 600; }
.ev { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ev-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 1px; flex: none; }
.ev-icon { width: 20px; text-align: center; flex: none; color: var(--accent); }
.ev-done .ev-icon { color: var(--ok); }
.ev-delete .ev-icon { color: var(--del); }
.ev-body { min-width: 0; overflow-wrap: anywhere; }
.ev-where { color: var(--muted); font-size: 13px; }
.help-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); color: var(--accent);
  text-align: center; line-height: 28px; font-weight: 700; text-decoration: none; }
.help h2 { font-size: 16px; margin: 18px 0 6px; }
.help ul { margin: 0; padding-left: 20px; }
.help li { margin-bottom: 6px; }
.big { font-size: 20px; font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.btn.danger { background: var(--del); color: #fff; }
.add p { margin: 0 0 8px; }
.chip.placeholder { font-style: italic; color: var(--muted); }
.chip.active.placeholder { color: var(--accent-text); }

/* экран добавления */
.add { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px;
  max-width: 640px; width: 100%; margin: 0 auto; }
.block h2 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.chip { padding: 8px 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.bar-actions { flex: none; display: flex; gap: 10px; padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--panel); border-top: 1px solid var(--line); }
.btn { flex: 1; text-align: center; font-size: 15px; padding: 13px; border-radius: 10px; background: var(--panel2);
  text-decoration: none; color: var(--text); font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn:disabled { opacity: .6; }

.toast { position: fixed; left: 50%; bottom: calc(var(--bar-h) + var(--safe-b) + 16px); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%); }

/* история: выбор дня или периода */
.period { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 12px; }
.period .chip { text-decoration: none; }
.period-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.period-form input[type=date] { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--text); font: inherit; min-width: 0; flex: 1 1 130px; }
.period-form button { padding: 8px 14px; border-radius: 8px; }
.period-title { color: var(--muted); font-size: 13px; width: 100%; }

/* настройки: удаление */
.rm-row { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.rm-row select { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  color: var(--text); font: inherit; font-size: 15px; width: 100%; }
.rm-btns { display: flex; gap: 8px; margin-bottom: 8px; }
.rm-btns .btn { padding: 11px 8px; font-size: 14px; text-decoration: none; color: inherit; }
.rm-btns .btn.danger { color: #fff; }
#rm .btn:disabled { opacity: .4; }

/* перетаскивание блоков */
.item, .task { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.dragging { position: relative; z-index: 3; transform: scale(1.03); box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  outline: 2px solid var(--accent); transition: transform .1s ease; }
.sorting { touch-action: none; }
@media (hover: hover) and (pointer: fine) {
  .item[data-id], .task[data-id] .title { cursor: grab; }
  body.is-sorting, body.is-sorting * { cursor: grabbing !important; }
}

/* очередь расшифровки — значки в шапке */
.jobs { flex: 1; min-width: 0; display: flex; justify-content: flex-end; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.jobs:empty { display: none; }
.jobs::-webkit-scrollbar { display: none; }
.job { flex: none; display: flex; align-items: center; border-radius: 999px; background: var(--panel2);
  border: 1px solid var(--line); font-size: 12px; line-height: 1; }
.job-main { display: flex; align-items: center; gap: 5px; padding: 6px 4px 6px 10px; color: inherit; font: inherit; }
.job-x { width: 26px; height: 26px; padding: 0; color: var(--muted); font-size: 12px; border-radius: 50%; }
.job-x:hover { color: inherit; }
.job-run .job-ico { animation: job-pulse 1.1s ease-in-out infinite; }
.job-choose { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.job-choose .job-x { color: var(--accent-text); opacity: .8; }
@keyframes job-pulse { 50% { opacity: .35; } }
@media (max-width: 420px) { .job-wait .job-text { display: none; } }
