:root {
  --bg: #14171c;
  --panel: #1c2028;
  --panel-2: #21262f;
  --card: #262c37;
  --border: #2e333d;
  --border-2: #3a414d;
  --text: #e6e8eb;
  --text-2: #9aa1ac;
  --text-3: #6b717c;
  --accent: #4a86c4;
  --accent-bg: #1f3a52;
  --danger: #d9603d;
  --danger-bg: #3a2018;
  --ok: #3fa088;
  --radius: 10px;
  --panel-alpha: rgba(28, 32, 40, 0.82);
  --sidebar-alpha: rgba(20, 23, 28, 0.82);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  overflow: hidden;
}

#bg-layer {
  position: fixed;
  inset: -40px;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  pointer-events: none;
}
#bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
#root { position: relative; z-index: 1; height: 100vh; display: flex; flex-direction: column; }

button {
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s;
}
button:hover { background: #2b313b; }
button:active { transform: scale(0.98); }
button.primary { background: var(--accent); border-color: var(--accent); }
button.primary:hover { background: #5a93cd; }
button.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: var(--danger-bg); }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--panel-2); }
button.small { padding: 3px 7px; font-size: 12px; }
button.icon { padding: 4px 7px; font-size: 14px; line-height: 1; }

input[type="text"], input[type="password"], input[type="date"], textarea, select {
  background: var(--panel);
  border: 1px solid var(--border-2);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 60px; line-height: 1.4; }
label.field { display: block; font-size: 12px; color: var(--text-2); margin: 12px 0 5px; }
input[type="range"] { accent-color: var(--accent); }

/* ===== header ===== */
#header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  -webkit-app-region: drag;
}
#header .title { font-size: 14px; font-weight: 600; letter-spacing: .01em; padding-left: 60px; }
#header .actions { display: flex; gap: 8px; -webkit-app-region: no-drag; }

/* ===== main layout ===== */
#body { flex: 1; display: flex; min-height: 0; }
#sidebar {
  width: 232px;
  border-right: 1px solid var(--border);
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#main { flex: 1; overflow-y: auto; padding: 16px 20px 28px; }

.side-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.side-item:hover { background: var(--panel); }
.side-item.active { background: var(--accent-bg); }
.side-item .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.side-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .count { color: var(--text-3); font-size: 12px; }
.side-item .hover-actions { display: none; gap: 2px; }
.side-item:hover .hover-actions { display: flex; }
.side-item:hover .count { display: none; }
.side-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 14px 0 4px 9px; }

/* ===== motivation banner ===== */
#motivation-banner {
  font-style: italic;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
  padding: 2px 8px 14px;
}

/* ===== focus strip ===== */
#focus-strip {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}
#focus-strip .fs-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
#focus-strip .fs-empty { color: var(--text-3); font-size: 13px; }
.focus-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 6px 8px 6px 10px;
  margin: 3px 6px 3px 0;
  font-size: 13px;
}
.focus-chip .fc-proj { font-size: 11px; color: var(--text-3); }

/* ===== strategy banner ===== */
#strategy {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
#strategy .st-row { display: flex; gap: 10px; margin: 3px 0; }
#strategy .st-key { color: var(--text-2); min-width: 130px; }
#strategy .st-val { flex: 1; }

/* ===== board controls ===== */
.board-controls { display: flex; justify-content: flex-end; margin-bottom: 10px; }

/* ===== per-project stacked board ===== */
.proj-board {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 10px 12px 12px;
  margin-bottom: 12px;
}
.pb-head { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.pb-chevron { color: var(--text-3); width: 12px; font-size: 12px; }
.pb-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pb-name { font-size: 14px; font-weight: 600; }
.pb-count { font-size: 12px; color: var(--text-3); }
.pb-head { flex-wrap: wrap; row-gap: 6px; }
.pb-head button { opacity: .9; }
.pb-head button:hover { opacity: 1; }
.pb-focus { font-size: 12px; color: var(--text-2); margin: 8px 0 4px; padding-left: 21px; }
.pb-summary { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0 2px 21px; }
.pb-badge { font-size: 11px; color: var(--text-2); background: var(--panel-2); border-radius: 5px; padding: 2px 8px; }
.pb-badge.warn { color: var(--danger); background: var(--danger-bg); }
.pb-add { display: flex; gap: 8px; margin: 10px 0 4px; padding-left: 21px; }
.pb-add input { flex: 1; }

.pb-board { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.pb-col {
  background: var(--bg);
  border-radius: 8px;
  padding: 8px;
  min-height: 66px;
  transition: background .12s, box-shadow .12s;
}
.pb-col.drop-hover { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--accent); }
.pb-col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 12px; font-weight: 600; }
.col-count { font-size: 11px; color: var(--text-3); font-weight: 400; }
.col-count.over { color: var(--danger); font-weight: 600; }
.gauge { height: 3px; background: var(--card); border-radius: 2px; margin-bottom: 8px; overflow: hidden; }
.gauge-fill { height: 100%; background: var(--accent); }
.gauge-fill.over { background: var(--danger); }

.task-card {
  border-radius: 7px;
  padding: 7px 8px;
  margin-bottom: 6px;
  background: var(--card);
  border-left: 3px solid var(--accent);
  cursor: grab;
}
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: .4; }
.task-card .tc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.task-card .tc-star { cursor: pointer; font-size: 13px; color: var(--text-3); line-height: 1; }
.task-card .tc-star.on { color: #e0b341; }
.task-card .tc-text { font-size: 12.5px; line-height: 1.35; word-break: break-word; }
.task-card .tc-foot { margin-top: 5px; }
.due-pill { font-size: 11px; color: var(--text-2); background: var(--panel-2); border-radius: 5px; padding: 1px 6px; }
.due-pill.over { color: var(--danger); background: var(--danger-bg); }
.task-card .tc-del { font-size: 12px; color: var(--text-3); cursor: pointer; opacity: 0; }
.task-card:hover .tc-del { opacity: 1; }

/* ===== notes panel (inside a project) ===== */
.notes-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px 12px;
  margin: 10px 0 0;
}
.notes-add { display: flex; gap: 8px; margin-bottom: 10px; }
.notes-add input { flex: 1; }
.note-item { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.note-item:last-child { border-bottom: none; }
.note-item .n-text { flex: 1; font-size: 13px; line-height: 1.4; word-break: break-word; white-space: pre-wrap; }
.note-item .n-meta { font-size: 11px; color: var(--text-3); white-space: nowrap; margin-top: 1px; }
.note-item .n-actions { display: flex; gap: 6px; opacity: 0; }
.note-item:hover .n-actions { opacity: 1; }
.n-star { cursor: pointer; color: var(--text-3); font-size: 13px; }
.n-star.on { color: #e0b341; }
.n-del { cursor: pointer; color: var(--text-3); font-size: 12px; }
.n-del:hover { color: var(--danger); }
.notes-empty { color: var(--text-3); font-size: 13px; padding: 4px 0; }

/* ===== files panel (inside a project) ===== */
.files-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px 12px;
  margin: 10px 0 0;
  transition: box-shadow .12s, background .12s;
}
.files-panel.drop-hover { background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--accent); }
.files-add { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.files-hint { font-size: 12px; color: var(--text-3); }
.file-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.file-item:last-child { border-bottom: none; }
.file-item .f-icon { font-size: 16px; flex-shrink: 0; }
.file-item .f-body { flex: 1; min-width: 0; cursor: pointer; }
.file-item .f-name { font-size: 13px; word-break: break-word; }
.file-item .f-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.file-item .n-del { opacity: 0; }
.file-item:hover .n-del { opacity: 1; }

/* ===== journal view ===== */
.journal-quick { display: flex; gap: 8px; margin-bottom: 16px; }
.journal-quick input { flex: 1; }
.journal-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.jf-chip { font-size: 12px; padding: 5px 11px; border-radius: 14px; background: var(--panel-2); color: var(--text-2); cursor: pointer; border: 1px solid transparent; }
.jf-chip.active { background: var(--accent-bg); color: var(--text); border-color: var(--accent); }
.jf-chip.drop-hover { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-bg); }
.journal-group { margin-bottom: 18px; }
.journal-group .jg-title { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 8px; }
.journal-entry { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: grab; }
.journal-entry:hover { background: var(--panel); }
.journal-entry.dragging { opacity: .4; }
.journal-entry .je-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.journal-entry .je-body { flex: 1; min-width: 0; }
.journal-entry .je-src { font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
.journal-entry .je-text { font-size: 13px; line-height: 1.4; word-break: break-word; white-space: pre-wrap; }
.journal-entry .je-time { font-size: 11px; color: var(--text-3); white-space: nowrap; margin-top: 1px; }
.journal-entry .je-actions { display: flex; gap: 6px; opacity: 0; }
.journal-entry:hover .je-actions { opacity: 1; }

/* ===== archive view ===== */
.arch-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.arch-item .ai-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.arch-item .ai-name { font-size: 15px; font-weight: 600; }
.arch-item .ai-meta { font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.arch-item .ai-actions { display: flex; gap: 8px; }
.empty-note { color: var(--text-3); font-size: 13px; padding: 20px 0; }

/* ===== modal ===== */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  padding: 20px 22px;
  width: 460px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
}
.modal h3 { margin: 0 0 4px; font-size: 16px; }
.modal .sub { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.modal .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal .err { color: var(--danger); font-size: 12px; margin-top: 8px; min-height: 14px; }
.swatches { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.swatch.sel { border-color: var(--text); }

/* ===== settings sections ===== */
.settings-section { margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.settings-section h4 { margin: 0 0 6px; font-size: 13px; }
.warn-text { color: var(--danger); font-size: 12px; margin: 6px 0; }
.slider-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; }
.slider-row input[type="range"] { flex: 1; }
.slider-row .sv { width: 42px; text-align: right; font-size: 12px; color: var(--text-2); }
.bg-actions { display: flex; gap: 8px; margin: 6px 0; }
.backup-list { max-height: 180px; overflow-y: auto; }
.backup-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.backup-row:last-child { border-bottom: none; }
.backup-row .b-date { color: var(--text-2); }
.mot-list { max-height: 220px; overflow-y: auto; margin-bottom: 10px; }
.mot-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.mot-row .m-text { flex: 1; font-size: 13px; }

/* ===== lock screen ===== */
#lock {
  height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
#lock .lock-box { width: 320px; text-align: center; }
#lock .lock-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
#lock .lock-sub { font-size: 13px; color: var(--text-3); margin-bottom: 18px; }
#lock input { width: 100%; text-align: center; margin-bottom: 10px; }
#lock .lock-err { color: var(--danger); font-size: 12px; min-height: 16px; margin-bottom: 8px; }
#lock .lock-reset { font-size: 12px; color: var(--text-3); margin-top: 16px; cursor: pointer; }
#lock .lock-reset:hover { color: var(--danger); }

/* ===== background mode: translucent panels ===== */
.has-bg #sidebar,
.has-bg #header { background: var(--sidebar-alpha); }
.has-bg #focus-strip,
.has-bg #strategy,
.has-bg .proj-board,
.has-bg .arch-item,
.has-bg .notes-panel,
.has-bg .files-panel,
.has-bg .modal { background: var(--panel-alpha); }
.has-bg .pb-col { background: rgba(20, 23, 28, 0.55); }

@media (max-width: 900px) {
  #board { grid-template-columns: repeat(2, 1fr); }
}

/* ===================== v4: веб-версия ===================== */

#sync-status { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 50; display: none;
  background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text-2); padding: 7px 14px; border-radius: 8px; font-size: 12.5px; }
#sync-status.warn { color: var(--danger); border-color: var(--danger); background: var(--danger-bg); }

.side-item .count.warn { color: var(--danger); font-weight: 600; }
.side-item:hover .count.warn { display: inline; }

/* перетаскивание проектов */
.side-item.dragging, .pb-head.dragging { opacity: .45; }
.side-item.reorder-before, .pb-head.reorder-before { box-shadow: inset 0 2px 0 var(--accent); }
.side-item.reorder-after, .pb-head.reorder-after { box-shadow: inset 0 -2px 0 var(--accent); }

/* приоритеты */
.prio-badge { font-size: 10.5px; font-weight: 700; border-radius: 5px; padding: 1px 5px; letter-spacing: .02em; flex-shrink: 0; }
.prio-badge.p1 { color: #ff8a6b; background: rgba(217, 96, 61, .18); }
.prio-badge.p2 { color: #e0b341; background: rgba(224, 179, 65, .15); }
.prio-badge.p3 { color: var(--text-2); background: var(--panel-2); }
.task-card .tc-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.due-pill.today { color: #e0b341; background: rgba(224, 179, 65, .15); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* редактирование заметок */
.note-item .n-edit { cursor: pointer; color: var(--text-3); font-size: 13px; }
.note-item .n-edit:hover, .je-actions .n-edit:hover { color: var(--text); }
.je-actions .n-edit { cursor: pointer; color: var(--text-3); }
.n-edited { color: var(--text-3); }
.note-item.editing, .journal-entry.editing { display: flex; cursor: default; }
.note-item.editing { display: block; }
.journal-entry.editing .je-body { flex: 1; }
.note-editor { width: 100%; }
.note-editor textarea.note-edit { width: 100%; min-height: 70px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.45;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 10px; }
.note-editor .ne-actions { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.note-editor .ne-actions .sub { font-size: 11px; margin: 0; }

/* копии */
.backup-row .b-kind { color: var(--text-3); font-size: 11.5px; }
.backup-row { gap: 6px; }

/* ===== дашборд ===== */
.dashboard { max-width: 1280px; }
.dash-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-title { font-size: 20px; font-weight: 650; margin-bottom: 2px; }
.dash-top .sub { margin: 0; }
.dash-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-stat { background: var(--panel-alpha); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; min-width: 88px; }
.dash-stat .ds-n { font-size: 20px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-stat .ds-l { font-size: 11.5px; color: var(--text-3); }
.dash-stat.danger .ds-n { color: var(--danger); }
.dash-stat.ok .ds-n { color: var(--ok); }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; margin-top: 14px; }
.dash-capture { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.dash-capture input { flex: 1; min-width: 200px; }
.dash-capture select { max-width: 170px; }

.dash-section { background: var(--panel-alpha); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.dash-section.danger { border-color: rgba(217, 96, 61, .55); }
.dash-section.accent { border-color: rgba(74, 134, 196, .6); }
.dash-section.muted, .dash-section.done { opacity: .9; }
.dsec-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.dash-section.danger .dsec-head { color: var(--danger); }
.dsec-count { color: var(--text-3); font-weight: 500; }
.dsec-hint { color: var(--text-3); font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11.5px; }

.dash-task { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-left: 3px solid var(--accent); border-radius: 6px; cursor: pointer; }
.dash-task + .dash-task { margin-top: 2px; }
.dash-task:hover { background: var(--card); }
.dash-task .dt-text { flex: 1; min-width: 0; font-size: 13px; line-height: 1.35; word-break: break-word; }
.dash-task .dt-proj { font-size: 11.5px; color: var(--text-2); background: var(--panel-2); padding: 1px 7px; border-radius: 5px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.dash-task .dt-proj:hover { color: var(--text); }
.dash-task .dt-col { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.dash-task .tc-star { cursor: pointer; color: var(--text-3); }
.dash-task .tc-star.on { color: #e0b341; }
.dt-check { width: 17px; height: 17px; border-radius: 50%; border: 1.5px solid var(--border-2); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; cursor: pointer; }
.dt-check:hover { border-color: var(--ok); }
.dt-check.on { background: var(--ok); border-color: var(--ok); }
.dash-task.is-done .dt-text { text-decoration: line-through; color: var(--text-3); }

.dash-right { position: sticky; top: 0; }
.pulse { background: var(--panel-alpha); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 9px 11px; margin-bottom: 8px; cursor: pointer; }
.pulse:hover { background: var(--card); }
.pl-head { display: flex; align-items: center; gap: 7px; }
.pl-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-badge { font-size: 10.5px; border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.pl-badge.danger { color: var(--danger); background: var(--danger-bg); }
.pl-badge.warn { color: #e0b341; background: rgba(224, 179, 65, .15); }
.pl-focus { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.pl-meta { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.pl-note { font-size: 11.5px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 980px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-right { position: static; }
}
@media (max-width: 700px) {
  body { overflow: auto; }
  #body { flex-direction: column; }
  #sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 6px 8px; gap: 4px; border-right: none; border-bottom: 1px solid var(--border); }
  #sidebar .side-label, #sidebar > button { display: none; }
  #sidebar .side-item { flex-shrink: 0; margin: 0; }
  #sidebar .side-item .hover-actions { display: none !important; }
  #sidebar .side-item .count { display: inline !important; }
  #main { padding: 12px; }
  .dash-task .dt-col { display: none; }
}

/* вход */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
#header .title { padding-left: 6px; }

/* ===================== v4.1: решение задачи, файлы задачи, поиск ===================== */

.modal.wide { width: 640px; }
.field-row.three { grid-template-columns: 1.4fr 1fr 1fr; }
.task-modal textarea { width: 100%; }
textarea.res-input { min-height: 80px; resize: vertical; font: inherit; font-size: 13px; line-height: 1.45; }
.task-files-box { margin-top: 12px; border: 1px dashed var(--border-2); border-radius: 10px; padding: 8px 10px; }
.task-files-box.drop-hover { border-color: var(--accent); background: var(--accent-bg); }
.task-files-box .tf-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.task-files .file-item { padding: 5px 0; }
.f-task { color: var(--accent); cursor: pointer; }
.f-task:hover { text-decoration: underline; }

.tc-ind { font-size: 11px; color: var(--text-2); background: var(--panel-2); border-radius: 5px; padding: 1px 6px; }
.tc-ind.res { color: var(--ok); background: rgba(63, 160, 136, .15); }
.tc-addres { font-size: 11px; color: var(--text-3); margin-top: 5px; cursor: pointer; opacity: 0; transition: opacity .12s; }
.task-card:hover .tc-addres { opacity: 1; }
.tc-addres:hover { color: var(--accent); }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 12px; box-shadow: 0 8px 30px rgba(0,0,0,.35);
  max-width: calc(100vw - 32px); font-size: 13px; }
#toast .t-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 380px; }
#toast .t-close { color: var(--text-3); cursor: pointer; }

.search-btn { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.search-btn .kbd { font-size: 11px; border: 1px solid var(--border-2); border-radius: 4px; padding: 0 5px; color: var(--text-3); }
.search-overlay { align-items: flex-start !important; padding-top: 10vh; }
.search-modal { width: 680px; padding: 14px; display: flex; flex-direction: column; max-height: 76vh; }
.search-input { width: 100%; font-size: 16px; padding: 11px 12px; }
.search-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 10px 0 6px; }
.search-done { margin-left: auto; font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 4px; cursor: pointer; }
.search-results { overflow-y: auto; flex: 1; min-height: 60px; }
.search-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin: 10px 2px 4px; }
.search-empty { color: var(--text-3); font-size: 13px; padding: 10px 2px; }
.search-item { border-left: 3px solid var(--accent); border-radius: 6px; padding: 7px 10px; cursor: pointer; }
.search-item.active { background: var(--card); }
.search-item.done .si-title { color: var(--text-2); }
.si-title { font-size: 13.5px; line-height: 1.35; word-break: break-word; }
.si-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.si-snippet { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.search-results mark { background: rgba(224, 179, 65, .35); color: inherit; border-radius: 2px; padding: 0 1px; }
.search-hint { font-size: 11px; color: var(--text-3); margin-top: 8px; text-align: right; }

@media (max-width: 700px) {
  .field-row.three { grid-template-columns: 1fr; }
  .search-overlay { padding-top: 12px; }
  .search-btn .kbd, .search-btn .lbl { display: none; }
  .search-hint { display: none; }
}

/* v4.2: дата постановки */
.assigned-pill { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.dash-task .dt-assigned { font-size: 11px; color: var(--text-3); white-space: nowrap; }
@media (max-width: 700px) { .dash-task .dt-assigned { display: none; } }

/* ===================== v4.3: календарь ===================== */
input[type="time"] { background: var(--panel); border: 1px solid var(--border-2); color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 14px; font-family: inherit; outline: none; color-scheme: dark; }
input[type="date"] { color-scheme: dark; }
input:disabled, select:disabled { opacity: .45; }

.plan-pill { font-size: 11px; color: #9cc2ec; background: rgba(74, 134, 196, .18); border-radius: 5px; padding: 1px 6px; white-space: nowrap; cursor: pointer; }
.plan-pill:hover { background: rgba(74, 134, 196, .3); }
.plan-pill.missed { color: #e0b341; background: rgba(224, 179, 65, .15); }
.plan-clear { font-size: 11px; color: var(--text-3); cursor: pointer; margin-left: 4px; text-decoration: underline dotted; }
.plan-clear:hover { color: var(--danger); }
.dsec-act { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }

#main.cal-main { display: flex; flex-direction: column; overflow: hidden; padding: 12px 16px 14px; }
.cal { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; user-select: none; -webkit-user-select: none; }
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-nav .icon { font-size: 18px; padding: 2px 9px; }
.cal-title { font-size: 17px; font-weight: 650; margin-left: 8px; white-space: nowrap; }
.cal-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cal-tools select.cal-proj { padding: 4px 8px; font-size: 12.5px; max-width: 180px; }
.cal-tools .jf-chip { user-select: none; }
.cal-rollover { color: #e0b341; border-color: rgba(224, 179, 65, .45); }
.cal-panel-btn.on { background: var(--accent-bg); border-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; padding: 4px 11px; font-size: 12.5px; }
.seg button + button { border-left: 1px solid var(--border-2); }
.seg button.on { background: var(--accent-bg); color: var(--text); }

.cal-wrap { flex: 1; min-height: 0; display: flex; gap: 12px; position: relative; }

/* сетка часов */
.cal-scroll { --cal-gutter: 54px; --cal-colmin: 104px; flex: 1; min-width: 0; overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); position: relative; overscroll-behavior: contain; }
.cal-scroll.one-day { --cal-colmin: 220px; }
.cal-top { position: sticky; top: 0; z-index: 6; background: var(--panel); border-bottom: 1px solid var(--border-2); box-shadow: 0 2px 6px rgba(0, 0, 0, .18); }
.cal-row { display: grid; }
.cal-corner { position: sticky; left: 0; z-index: 2; background: var(--panel); }
.cal-dayhead { display: flex; align-items: baseline; gap: 6px; padding: 7px 8px 6px; border-left: 1px solid var(--border); min-width: 0; }
.cal-dayhead.clickable { cursor: pointer; }
.cal-dayhead.clickable:hover { background: var(--panel-2); }
.cdh-wd { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.cal-dayhead.weekend .cdh-wd { color: #b9827a; }
.cdh-n { font-size: 18px; font-weight: 600; line-height: 1.2; }
.cal-dayhead.today .cdh-n { background: var(--accent); color: #fff; border-radius: 14px; min-width: 28px; padding: 0 7px; text-align: center; }
.cal-dayhead.today .cdh-wd { color: var(--accent); }
.cdh-load { margin-left: auto; font-size: 11px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cdh-load.over { color: var(--danger); font-weight: 600; }
.cal-allday { border-top: 1px solid var(--border); }
.cal-allday-label { font-size: 10px; color: var(--text-3); padding: 7px 6px 0 0; text-align: right; line-height: 1.1; }
.cal-adcell { border-left: 1px solid var(--border); padding: 3px; min-height: 30px; max-height: 118px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: cell; }
.cal-adcell.drop-hover { background: var(--accent-bg); box-shadow: inset 0 0 0 2px var(--accent); }

.cal-body { display: grid; position: relative; }
.cal-gutter { position: sticky; left: 0; z-index: 4; background: var(--panel); border-right: 1px solid var(--border); }
.cal-hour { position: absolute; right: 7px; font-size: 10.5px; color: var(--text-3); transform: translateY(-50%); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-left: 1px solid var(--border); cursor: cell; touch-action: pan-x pan-y;
  background-image: linear-gradient(to bottom, var(--border) 1px, transparent 1px), linear-gradient(to bottom, rgba(255, 255, 255, .03) 1px, transparent 1px);
  background-size: 100% 48px, 100% 24px; }
.cal-col.today { background-color: rgba(74, 134, 196, .06); }
.cal-col.past { background-color: rgba(0, 0, 0, .1); }
.cal-now { position: absolute; left: -1px; right: 0; height: 2px; background: #e5534b; z-index: 4; pointer-events: none; }
.cal-now::before { content: ''; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e5534b; }

.cal-block { position: absolute; z-index: 1; border-radius: 6px; border-left: 3px solid var(--accent); padding: 3px 6px; overflow: hidden; cursor: grab;
  font-size: 12px; line-height: 1.3; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); backdrop-filter: blur(2px); }
.cal-block:hover { z-index: 3; filter: brightness(1.15); }
.cal-block:active { cursor: grabbing; }
.cal-block.compact { display: flex; align-items: center; gap: 5px; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
.cal-block.compact .cb-text { overflow: hidden; text-overflow: ellipsis; }
.cal-block.missed { box-shadow: inset 0 0 0 1px rgba(224, 179, 65, .55); }
.cal-block.done { opacity: .7; }
.cb-line { display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.cb-time { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cb-star { color: #e0b341; }
.cb-flag { font-size: 10px; }
.cb-text { font-weight: 560; overflow-wrap: normal; word-break: normal; overflow: hidden; }
.cb-proj { font-size: 11px; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.cal-block .prio-badge { padding: 0 4px; font-size: 9.5px; }
.cb-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.cb-resize::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 18px; height: 2px; margin-left: -9px; border-radius: 2px; background: rgba(255, 255, 255, .35); opacity: 0; }
.cal-block:hover .cb-resize::after { opacity: 1; }
.cal-block.done .cb-text, .cal-chip.done .cc-text { text-decoration: line-through; color: var(--text-3); }

.cal-check { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--text-2); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; color: #fff; cursor: pointer; background: rgba(0, 0, 0, .15); }
.cal-check:hover { border-color: var(--ok); background: rgba(63, 160, 136, .25); }
.cal-check.on { background: var(--ok); border-color: var(--ok); }

.cal-ev { position: absolute; z-index: 1; font-size: 11px; line-height: 16px; color: var(--text-2); border: 1px dashed var(--border-2); border-left: 3px solid var(--text-3);
  border-radius: 5px; padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(20, 23, 28, .7); cursor: default; }
.cal-evdot { position: absolute; right: 3px; width: 9px; height: 9px; margin-top: -1px; border-radius: 50%; z-index: 4; box-shadow: 0 0 0 2px var(--panel); cursor: help; }
.cal-evdot:hover { transform: scale(1.4); }
.cal-ghost, .cal-sel { position: absolute; left: 2px; right: 2px; z-index: 5; border-radius: 6px; pointer-events: none; font-size: 11px; padding: 2px 6px; color: var(--text); font-variant-numeric: tabular-nums; }
.cal-ghost { border: 2px dashed var(--accent); background: rgba(74, 134, 196, .18); }
.cal-sel { border: 1px solid var(--accent); background: rgba(74, 134, 196, .38); }
.cal-sel.inline { position: static; flex-shrink: 0; }

/* плашки: весь день, сроки, месяц */
.cal-chip { display: flex; align-items: center; gap: 5px; font-size: 12px; line-height: 1.3; padding: 2px 6px; border-radius: 5px; border-left: 3px solid var(--accent);
  cursor: grab; white-space: nowrap; overflow: hidden; min-width: 0; flex-shrink: 0; }
.cal-chip:hover { filter: brightness(1.15); }
.cal-chip .cc-text { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.cal-chip .cc-time { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.cal-chip .cc-ico { font-size: 10px; flex-shrink: 0; }
.cal-chip.due { background: transparent; border: 1px dashed var(--border-2); border-left: 3px solid var(--accent); color: var(--text-2); }
.cal-chip.due.over { color: #ff8a6b; border-color: rgba(217, 96, 61, .6); }
.cal-chip.missed { box-shadow: inset 0 0 0 1px rgba(224, 179, 65, .5); }
.cal-chip.ev { cursor: default; background: transparent; border-left-style: dotted; color: var(--text-3); }
.cal-block.dragging, .cal-chip.dragging, .cp-item.dragging { opacity: .35; }

/* месяц */
.cal-month { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-mhead { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border-2); }
.cal-mhead div { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 7px 8px; }
.cal-mhead div.weekend { color: #b9827a; }
.cal-mgrid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow-y: auto; }
.cal-mcell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; cursor: cell; }
.cal-mcell:nth-child(7n) { border-right: none; }
.cal-mcell.weekend { background: rgba(255, 255, 255, .012); }
.cal-mcell.out { background: rgba(0, 0, 0, .18); }
.cal-mcell.out .cm-n { color: var(--text-3); }
.cal-mcell.drop-hover { background: var(--accent-bg); box-shadow: inset 0 0 0 2px var(--accent); }
.cm-n { font-size: 12px; font-weight: 600; align-self: flex-start; padding: 1px 7px; border-radius: 10px; cursor: pointer; flex-shrink: 0; }
.cm-n:hover { background: var(--panel-2); }
.cal-mcell.today .cm-n { background: var(--accent); color: #fff; }
.cm-more { font-size: 11px; color: var(--text-2); cursor: pointer; padding: 0 6px; flex-shrink: 0; }
.cm-more:hover { color: var(--text); text-decoration: underline; }

/* панель «Без даты» */
.cal-panel { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 0; transition: box-shadow .12s; }
.cal-panel.drop-hover { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-bg); }
.cp-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.cp-close { cursor: pointer; color: var(--text-3); font-weight: 400; }
.cp-close:hover { color: var(--text); }
input.cp-search { width: 100%; margin-bottom: 8px; padding: 6px 9px; font-size: 13px; }
.cp-list { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; gap: 4px; }
.cp-item { background: var(--card); border-left: 3px solid var(--accent); border-radius: 6px; padding: 6px 8px; cursor: grab; flex-shrink: 0; }
.cp-item:hover { background: #2c3340; }
.cp-text { font-size: 12.5px; line-height: 1.35; word-break: break-word; }
.cp-meta { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 11px; color: var(--text-3); }
.cp-proj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.cp-hint { font-size: 11px; color: var(--text-3); margin-top: 8px; line-height: 1.4; }

/* быстрое создание */
.overlay.cal-pop-overlay { background: transparent; display: block; }
.cal-pop { position: fixed; background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; padding: 12px; box-shadow: 0 14px 44px rgba(0, 0, 0, .55); }
.cq-head { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.cal-pop input.cq-text { width: 100%; font-size: 15px; }
.cq-row { display: flex; gap: 6px; margin-top: 8px; }
.cq-row > * { flex: 1; min-width: 0; padding: 6px 8px; font-size: 13px; }
.cq-row > .cq-prio { flex: 0 0 72px; }
.cq-row > input[type="date"] { flex: 1.5; }
.cq-row > input[type="time"] { flex: 1.1; }
.cq-actions { display: flex; gap: 6px; margin-top: 12px; align-items: center; }

.has-bg .cal-scroll, .has-bg .cal-month, .has-bg .cal-panel { background: var(--panel-alpha); }
.has-bg .cal-top, .has-bg .cal-gutter, .has-bg .cal-corner { background: rgba(28, 32, 40, .96); }

@media (max-width: 900px) {
  .cal-panel { position: absolute; right: 0; top: 0; bottom: 0; z-index: 8; width: min(300px, 86vw); box-shadow: -10px 0 30px rgba(0, 0, 0, .5); }
}
@media (max-width: 700px) {
  #main.cal-main { padding: 8px; }
  .cal-title { font-size: 15px; }
  .cal-scroll { --cal-gutter: 42px; --cal-colmin: 86px; }
  .cal-scroll.one-day { --cal-colmin: 200px; }
  .cdh-load { display: none; }
  .cal-mgrid .cal-chip { font-size: 10.5px; padding: 1px 4px; }
  .cal-mgrid .cal-chip .cc-time, .cal-mgrid .cal-check { display: none; }
  .cal-pop { left: 8px !important; right: 8px; width: auto !important; top: 12% !important; }
}

/* ===================== v4.4: достижения ===================== */
.side-item .count.ok { color: var(--ok); font-weight: 600; }
.dash-stat.clickable { cursor: pointer; }
.dash-stat.clickable:hover { background: var(--card); }

/* галочка «выполнено» на карточке доски */
.task-card .tc-left { display: inline-flex; align-items: center; gap: 6px; }
.tc-check { width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--border-2); display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff; cursor: pointer; flex-shrink: 0; }
.tc-check:hover { border-color: var(--ok); background: rgba(63, 160, 136, .2); }
.tc-check.on { background: var(--ok); border-color: var(--ok); }
.tc-win { font-size: 12px; }
.tc-done-at { font-size: 11px; color: var(--text-3); }
.col-more { font-size: 11.5px; color: var(--text-2); text-align: center; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.col-more:hover { background: var(--panel-2); color: var(--text); }
.win-row { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 13px; color: var(--text-2); cursor: pointer; }

/* календарь: выполнено за день */
.cal-done { font-size: 10.5px; color: var(--ok); background: rgba(63, 160, 136, .14); border-radius: 5px; padding: 0 5px; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cal-done:hover { background: rgba(63, 160, 136, .28); }
.cal-done.goal { font-weight: 650; }
.cm-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; flex-shrink: 0; }

/* экран */
.ach { max-width: 1280px; }
.ach-stat { min-width: 104px; }
.ach-stat .ach-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; white-space: nowrap; }
.dash-stat.streak .ds-n { color: #e0b341; }
.ach-meter { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.ach-meter-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.ach-meter-fill.full { background: var(--ok); }
.ach-capture input[type="checkbox"] { flex: none; min-width: 0; width: auto; margin: 0; }
.ach-left, .ach-right { min-width: 0; }
.ach-heat .dsec-head { flex-wrap: wrap; }
.hm { padding-right: 16px; }
.ach-capture .ach-win-toggle { display: inline-flex; align-items: center; gap: 3px; font-size: 14px; cursor: pointer; padding: 0 4px; }
.ach-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.ach-right { position: sticky; top: 0; }

/* карта активности */
.ach-heat { --hm-cell: 15px; }
.hm-scroll { overflow-x: auto; padding: 4px 0 2px; }
.hm { display: flex; gap: 6px; width: max-content; }
.hm-wd { display: grid; grid-template-rows: 16px repeat(7, var(--hm-cell)); row-gap: 3px; font-size: 10px; color: var(--text-3); line-height: var(--hm-cell); }
.hm-wd span:first-child { margin-top: 0; }
.hm-wd::before { content: ''; }
.hm-months { display: grid; column-gap: 3px; height: 16px; font-size: 10.5px; color: var(--text-3); }
.hm-months span { white-space: nowrap; overflow: visible; }
.hm-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, var(--hm-cell)); grid-auto-columns: var(--hm-cell); gap: 3px; margin-top: 3px; }
.hm-cell { width: var(--hm-cell); height: var(--hm-cell); border-radius: 3px; cursor: pointer; outline: none; display: inline-block; }
.hm-cell.zero { background: var(--panel-2); }
.hm-cell.future { background: transparent; cursor: default; }
.hm-cell.today { box-shadow: inset 0 0 0 1.5px var(--text-2); }
.hm-cell.sel, .hm-cell:focus-visible { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }
.hm-cell:not(.future):hover { filter: brightness(1.25); }
.hm-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.hm-legend { display: inline-flex; align-items: center; gap: 3px; }
.hm-legend .hm-cell { width: 11px; height: 11px; cursor: default; }
.hm-legend .hm-cell:hover { filter: none; }
.ach-set { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); cursor: pointer; }
.ach-set select.ach-goal { padding: 2px 6px; font-size: 12px; }
#viz-tip { position: fixed; z-index: 80; display: none; pointer-events: none; background: #0f1216; color: var(--text); border: 1px solid var(--border-2);
  border-radius: 7px; padding: 5px 9px; font-size: 12px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, .45); }

/* журнал по дням */
.ach-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 4px 0 10px; }
input.ach-search { flex: 1; min-width: 180px; padding: 6px 9px; font-size: 13px; }
.ach-filters select.ach-proj { padding: 5px 8px; font-size: 12.5px; max-width: 200px; }
.log-day + .log-day { margin-top: 14px; }
.log-day-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); padding: 0 2px 5px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ldh-goal { font-size: 11px; font-weight: 500; color: var(--ok); }
.log-entry { display: flex; align-items: flex-start; gap: 9px; padding: 7px 8px; border-left: 3px solid var(--accent); border-radius: 6px; cursor: pointer; }
.log-entry + .log-entry { margin-top: 2px; }
.log-entry:hover { background: var(--card); }
.log-entry .dt-check { margin-top: 1px; }
.log-entry.win { background: rgba(224, 179, 65, .07); }
.le-body { flex: 1; min-width: 0; }
.le-text { font-size: 13px; line-height: 1.35; word-break: break-word; }
.le-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.le-proj { color: var(--text-2); }
.le-res { font-size: 12px; color: var(--text-2); margin-top: 4px; line-height: 1.4; white-space: pre-wrap; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.le-win { font-size: 14px; cursor: pointer; filter: grayscale(1); opacity: .25; flex-shrink: 0; transition: opacity .12s; }
.log-entry:hover .le-win { opacity: .6; }
.le-win.on, .log-entry:hover .le-win.on { filter: none; opacity: 1; }
.ach-more { margin-top: 10px; width: 100%; }

/* по проектам */
.ach-chips { display: flex; gap: 6px; margin: 2px 0 10px; }
.pbar-row { display: grid; grid-template-columns: minmax(0, 120px) 1fr 28px; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; cursor: pointer; }
.pbar-row:hover { background: var(--card); }
.pbar-label { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; }
.pbar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbar-track { height: 10px; }
.pbar-fill { height: 10px; border-radius: 0 4px 4px 0; }
.pbar-val { font-size: 12px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }

/* главные достижения */
.win-item { border-left: 3px solid var(--accent); border-radius: 6px; padding: 6px 9px; cursor: pointer; }
.win-item + .win-item { margin-top: 3px; }
.win-item:hover { background: var(--card); }
.wi-text { font-size: 13px; line-height: 1.35; word-break: break-word; }
.wi-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

@media (max-width: 980px) {
  .ach-grid { grid-template-columns: minmax(0, 1fr); }
  .ach-right { position: static; }
}
@media (max-width: 700px) {
  .ach-heat { --hm-cell: 13px; }
  .ach-stat { min-width: 0; flex: 1 1 30%; }
  .ach-stat .ach-sub { white-space: normal; }
  .ach-capture input[type="text"] { min-width: 100%; }
  .hm-foot .ach-set { width: 100%; }
}

/* ===================== v4.5: офлайн ===================== */
/* Индикатор связи — в шапке по центру (внизу живут всплывающие сообщения) */
#sync-status { top: 9px; bottom: auto; padding: 4px 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: min(460px, calc(100vw - 280px)); box-shadow: 0 4px 14px rgba(0,0,0,.3); cursor: default; }
#sync-status.offline { color: #e8c37a; border-color: #8a6d2f; background: #2b2416; }
#sync-status.ok { color: var(--ok); border-color: var(--ok); }
.offline-first { max-width: 420px; margin: 18vh auto 0; padding: 28px 24px; text-align: center;
  background: var(--panel-alpha); border: 1px solid var(--border); border-radius: var(--radius); }
.offline-first .of-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.offline-first .of-sub { color: var(--text-2); font-size: 14px; line-height: 1.5; }
@media (max-width: 700px) { #sync-status { max-width: calc(100vw - 150px); font-size: 11.5px; padding: 4px 9px; } }
