/* ЛОГИ → ГРАФ (29.09.2026, graph.js): холст графа, окно лет с таймлапсом, панель заметки.
   Холст — непрозрачный экран в цвет фона темы, всё остальное — токены темы. */

#graph-root { display: flex; flex-direction: column; gap: 10px; }
.gr-bar { display: flex; gap: 10px; align-items: stretch; }
.gr-modes { flex: 0 0 auto; }
.gr-modes > button { padding: 0 14px; letter-spacing: .6px; font-size: 11px; }
.gr-find { position: relative; flex: 1; min-width: 0; }
.gr-find input {
    width: 100%; height: 100%; min-height: 34px; box-sizing: border-box; padding: 0 12px;
    background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border-color);
    border-radius: 10px; font: inherit; font-size: 12px; outline: none;
}
.gr-find input:focus { border-color: var(--accent); }
.gr-sugg {
    position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 10px;
    box-shadow: 0 8px 24px var(--shadow-color); overflow: hidden;
}
.gr-sugg button {
    display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; padding: 7px 12px;
    background: none; border: none; border-bottom: 1px solid var(--border-color); color: var(--text-primary); font: inherit; cursor: pointer;
}
.gr-sugg button:last-child { border-bottom: none; }
.gr-sugg button:hover { background: var(--bg-card-hover); }
.gr-sugg b { font-size: 12px; font-weight: 500; }
.gr-sugg span { font-size: 10px; color: var(--text-muted); }

.gr-stage {
    position: relative; height: max(360px, 62vh); border-radius: 14px; overflow: hidden;
    border: 1px solid var(--border-color); background: var(--bg-dark); touch-action: none; user-select: none;
}
html[data-theme="light"] .gr-stage { background: var(--bg-card); }
.gr-stage canvas.gr-gl, .gr-stage canvas.gr-lab { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gr-stage.grabbing { cursor: grabbing !important; }
.gr-stage.is-people { height: auto; min-height: 120px; overflow: visible; touch-action: auto; background: none; border: none; }
.gr-stage.is-people canvas.gr-gl, .gr-stage.is-people canvas.gr-lab, .gr-stage.is-people .gr-zoom { display: none; }
.gr-people { position: relative; }
.gr-people canvas { display: block; width: 100%; cursor: pointer; }
.gr-more { padding: 6px 0 2px; font-size: 11px; color: var(--text-muted); }
.gr-tip {
    position: absolute; z-index: 5; pointer-events: none; max-width: 240px;
    display: flex; flex-direction: column; gap: 2px; padding: 7px 10px; border-radius: 8px;
    background: var(--bg-card); border: 1px solid var(--border-light); box-shadow: 0 6px 18px var(--shadow-color);
}
.gr-tip b { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.gr-tip span { font-size: 10.5px; color: var(--text-secondary); }
.gr-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 4; }
.gr-zoom button {
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-light);
    background: var(--bg-card); color: var(--text-secondary); font: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 0;
}
.gr-zoom button:hover { color: var(--text-primary); border-color: var(--accent); }
.gr-selbar {
    position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 4; display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border-light);
}
.gr-selbar span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-primary); }
.gr-selbar button { flex: none; background: none; border: none; color: var(--accent); font: inherit; font-size: 11px; cursor: pointer; padding: 0; }
.gr-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; text-align: center; color: var(--text-muted); font-size: 12px; }

/* окно лет: гистограмма записей по месяцам + два края + таймлапс */
.gr-time { display: flex; align-items: center; gap: 10px; }
.gr-play, .gr-speed {
    flex: none; height: 34px; min-width: 34px; border-radius: 10px; border: 1px solid var(--border-light);
    background: var(--bg-card); color: var(--text-primary); font: inherit; font-size: 12px; cursor: pointer; padding: 0 8px;
}
.gr-play { color: var(--accent); }
.gr-speed { color: var(--text-secondary); font-size: 11px; }
.gr-track { position: relative; flex: 1; height: 34px; cursor: pointer; touch-action: none; }
.gr-hist { position: absolute; inset: 4px 0 4px; width: 100%; height: calc(100% - 8px); }
.gr-win {
    position: absolute; top: 0; bottom: 0; border-radius: 6px; pointer-events: none;
    background: rgba(var(--accent-rgb), .14); border: 1px solid rgba(var(--accent-rgb), .55);
}
.gr-th {
    position: absolute; top: -3px; bottom: -3px; width: 14px; margin-left: -7px; cursor: ew-resize; z-index: 2;
}
.gr-th::after { content: ''; position: absolute; left: 5px; top: 6px; bottom: 6px; width: 4px; border-radius: 2px; background: var(--accent); }
.gr-timelbl { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11px; color: var(--text-secondary); min-height: 18px; margin-top: -4px; }
.gr-hint { color: var(--text-muted); }
.gr-reset { background: none; border: none; color: var(--accent); font: inherit; font-size: 11px; cursor: pointer; padding: 0; }

/* панель: на ноутбуке — правая колонка ЛОГОВ, на телефоне — под окном лет */
.gr-panel:empty { display: none; }
.gr-panel { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 20px; }
.lg-side-body .gr-sum, .gr-panel .gr-sum { display: flex; flex-direction: column; gap: 14px; }
.gr-cards { margin: 0 !important; grid-template-columns: 1fr 1fr !important; }
.gr-leg { display: flex; flex-direction: column; gap: 5px; font-size: 10.5px; color: var(--text-muted); }
.gr-leg-h { letter-spacing: .5px; }
.gr-leg-r { display: flex; justify-content: space-between; }
.gr-grad {
    display: block; height: 8px; border-radius: 4px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--bg-dark) 70%, var(--accent)), color-mix(in srgb, var(--accent) 75%, #fff));
}
html[data-theme="light"] .gr-grad { background: linear-gradient(90deg, color-mix(in srgb, var(--bg-card) 65%, var(--acc2, var(--accent))), var(--acc2, var(--accent))); }
.gr-grad-p { background: linear-gradient(90deg, color-mix(in srgb, var(--bg-dark) 75%, var(--accent)), var(--accent)); }
.gr-dots { flex-direction: row; flex-wrap: wrap; gap: 12px; }
.gr-dots span { display: inline-flex; align-items: center; gap: 5px; }
.gr-dots i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.gr-dots .d-p { background: var(--text-primary); width: 10px; height: 10px; }
.gr-dots .d-l { background: var(--text-muted); }
.gr-dots .d-d { background: var(--accent); }
html[data-theme="light"] .gr-dots .d-d { background: var(--acc2, var(--accent)); }
.gr-sec-h { font-size: 10px; letter-spacing: .8px; color: var(--text-muted); text-transform: uppercase; margin-bottom: -4px; }
.gr-list { display: flex; flex-direction: column; }
.gr-list button {
    position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    padding: 6px 2px; background: none; border: none; border-bottom: 1px solid var(--border-color);
    color: var(--text-primary); font: inherit; font-size: 12px; text-align: left; cursor: pointer;
}
.gr-list button:hover span { color: var(--accent); }
.gr-list button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; z-index: 1; }
.gr-list button em { font-style: normal; font-size: 10.5px; color: var(--text-muted); flex: none; z-index: 1; font-variant-numeric: tabular-nums; }
.gr-bars button i { position: absolute; left: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 1px; }
.gr-nhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 11px; color: var(--text-muted); }
.gr-x { background: none; border: none; color: var(--text-muted); font: inherit; font-size: 11px; cursor: pointer; padding: 0; flex: none; }
.gr-x:hover { color: var(--text-primary); }
.gr-btn {
    padding: 5px 11px; border-radius: 8px; border: 1px solid var(--border-light); background: var(--bg-card);
    color: var(--accent); font: inherit; font-size: 11px; cursor: pointer;
}
.gr-btn:hover { border-color: var(--accent); }
.gr-ntitle { font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.35; }
.gr-nmeta { font-size: 11px; color: var(--text-secondary); margin-top: -6px; }
.gr-nact { display: flex; gap: 8px; }
.gr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gr-chips button {
    padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border-light); background: var(--bg-card);
    color: var(--text-primary); font: inherit; font-size: 11px; cursor: pointer;
}
.gr-chips button:hover { border-color: var(--accent); }
.gr-ntext { white-space: pre-wrap; font-size: 12.5px; line-height: 1.55; color: var(--text-secondary); overflow-wrap: anywhere; }
.gr-foot { font-size: 10px; color: var(--text-muted); }

/* ноутбук: холст на высоту окна, панель справа */
@media (min-width: 1100px), (orientation: landscape) and (min-width: 700px) and (max-height: 520px) {
    #view-stats.lg-wide .gr-stage:not(.is-people) { height: calc(100vh - var(--desk-top, 10px) - 196px); min-height: 400px; }
    #view-stats.lg-wide .gr-panel { display: none; }
}
@media (max-width: 520px) {
    .gr-bar { flex-direction: column; }
    .gr-modes { display: flex; }
    .gr-modes > button { flex: 1; }
}

/* ── пакет 2: фильтры, цвет, окружение ── */
.gr-fbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: -2px; }
.gr-fbtn {
    height: 30px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border-light); background: var(--bg-card);
    color: var(--text-secondary); font: inherit; font-size: 11px; letter-spacing: .3px; cursor: pointer;
}
.gr-fbtn.on { color: var(--text-primary); border-color: var(--accent); }
.gr-fbtn b { display: inline-block; min-width: 16px; padding: 0 4px; margin-left: 3px; border-radius: 8px; background: var(--accent); color: var(--bg-dark); font-weight: 600; font-size: 10px; line-height: 16px; text-align: center; }
.gr-sel { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--text-muted); }
.gr-sel select, .gr-fsec select, .gr-fsec input[type=number] {
    height: 30px; padding: 0 8px; border-radius: 9px; border: 1px solid var(--border-light); background: var(--bg-input);
    color: var(--text-primary); font: inherit; font-size: 11px; outline: none; max-width: 190px;
}
.gr-fsec input[type=number] { width: 90px; }
/* панель фильтров — поверх холста слева: граф за ней меняется вживую */
.gr-fpanel {
    position: absolute; z-index: 6; left: 10px; top: 10px; width: min(620px, calc(100% - 20px)); max-height: calc(100% - 20px);
    overflow: auto; scrollbar-width: thin; box-sizing: border-box;
    display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; border-radius: 12px;
    border: 1px solid var(--border-light); background: color-mix(in srgb, var(--bg-card) 94%, transparent);
    box-shadow: 0 10px 30px var(--shadow-color);
}
.gr-fpanel[hidden] { display: none; }
.gr-stage.is-people .gr-fpanel { position: static; width: auto; max-height: none; margin-bottom: 10px; }
.gr-fsec { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: start; }
.gr-fsec > span { font-size: 10px; letter-spacing: .5px; color: var(--text-muted); padding-top: 7px; }
.gr-fsec > div { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.gr-fend { align-items: center; }
.gr-fend > span { padding-top: 0; grid-column: 1 / -1; display: flex; justify-content: space-between; }
.gr-chip {
    display: inline-flex; align-items: baseline; gap: 5px; padding: 4px 9px; border-radius: 999px;
    border: 1px solid var(--border-light); background: transparent; color: var(--text-secondary);
    font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap;
}
.gr-chip em { font-style: normal; font-size: 9.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.gr-chip:hover { border-color: var(--accent); color: var(--text-primary); }
.gr-chip.on { background: rgba(var(--accent-rgb), .16); border-color: var(--accent); color: var(--text-primary); }
.gr-fwho { position: relative; display: inline-block; }
.gr-fwho input {
    height: 28px; width: 150px; padding: 0 10px; border-radius: 999px; border: 1px dashed var(--border-light);
    background: transparent; color: var(--text-primary); font: inherit; font-size: 11px; outline: none;
}
.gr-fwho .gr-sugg { width: 240px; }
.gr-fge { font-size: 12px; color: var(--text-muted); }
.gr-factive { font-size: 11px; color: var(--text-secondary); }
.gr-leg-note { font-size: 10px; color: var(--text-muted); }
.gr-legc button i { flex: none; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; align-self: center; }
.gr-legc button { justify-content: flex-start; }
.gr-legc button span { flex: 1; }
.gr-legc button:disabled { cursor: default; opacity: .8; }
.gr-legother { background: var(--text-muted); }
.gr-stage canvas.gr-loc { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.gr-stage.is-local canvas.gr-gl, .gr-stage.is-local canvas.gr-lab, .gr-stage.is-local .gr-zoom { display: none; }
.gr-lochead {
    position: absolute; left: 10px; top: 10px; right: 10px; z-index: 4; display: flex; align-items: center; gap: 10px;
    pointer-events: none;
}
.gr-lochead button {
    pointer-events: auto; height: 30px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border-light);
    background: var(--bg-card); color: var(--accent); font: inherit; font-size: 11px; cursor: pointer;
}
.gr-lochead span { font-size: 11px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-selbar button + button { margin-left: 4px; }
@media (max-width: 520px) {
    .gr-fsec { grid-template-columns: 1fr; gap: 4px; }
    .gr-fsec > span { padding-top: 0; }
    .gr-sel select { max-width: 130px; }
}
