/* Finsketch — «План-график» (web/modules/gantt.js). Все цвета — переменные темы: работает в светлой и тёмной. */
.gt { --gt-lw: 300px; --rh: 30px; }
.gt-c1 { --c: var(--series-1); } .gt-c2 { --c: var(--series-2); } .gt-c3 { --c: var(--series-3); } .gt-c4 { --c: var(--series-4); }
.gt-c5 { --c: var(--series-5); } .gt-c6 { --c: var(--series-6); } .gt-c7 { --c: var(--series-7); } .gt-c8 { --c: var(--series-8); }
.gt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- сводка */
.gt-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gt-kpis:empty { display: none; }
.gt-kpis .kpi.gt-kneg .k-val { color: var(--neg); }
.gt-kpis .kpi.gt-knext .k-val { font-size: 18px; line-height: 1.3; margin: 8px 0 4px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gt-kpis .kpi.hero .k-val { font-size: 22px; }
.gt-none .gt-kpis { display: none; }

/* ---------- заголовок и панели инструментов */
.gt-title h3 { margin: 0 0 2px; }
.gt-title .cap { margin-bottom: 12px; }
.gt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.gt-toolbar .view-sw button { font-size: 12.5px; padding: 5px 10px; }
.gt-sp { flex: 1; }
.gt-tgl[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.gt-edit-bar { padding-top: 10px; border-top: 1px dashed var(--line); }
.gt-pstart { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.gt input[type="date"], .gt-dlg input, .gt-dlg select, .gt-dlg textarea {
  border: 1px solid var(--line); border-radius: 7px; padding: 5px 8px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; min-width: 0;
}
.gt-none .gt-toolbar, .gt-none .gt-legend, .gt-none .gt-msg { display: none; }
.gt-v-table .gt-only-chart { display: none; }
.gt-msg { font-size: 12.5px; color: var(--ink-2); margin: -2px 0 8px; }
.gt-msg:empty { display: none; }

/* ---------- пустое состояние */
.gt-empty { border: 1px dashed var(--line); border-radius: 12px; padding: 28px 24px; background: var(--surface-2); text-align: center; }
.gt-empty h3 { margin: 0 0 8px; font-size: 18px; }
.gt-empty p { margin: 0 auto 16px; max-width: 640px; color: var(--ink-2); font-size: 14px; }
.gt-empty-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: flex-end; }
.gt-empty .gt-f { text-align: left; }
.gt-notasks { margin: 8px 0 0; }

/* ---------- диаграмма */
.gt-chart { position: relative; }
.gt-scroll {
  overflow: auto; max-height: min(72vh, 920px); border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
}
.gt-scroll:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.gt-hrow { display: flex; width: max-content; min-width: 100%; position: sticky; top: 0; z-index: 3; background: var(--surface); }
.gt-corner {
  position: sticky; left: 0; z-index: 4; flex: none; width: var(--gt-lw); height: 44px; box-sizing: border-box; background: var(--surface);
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; align-items: flex-end; padding: 0 10px 7px;
  font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
}
.gt-brow { display: flex; width: max-content; min-width: 100%; }
.gt-left { position: sticky; left: 0; z-index: 2; flex: none; width: var(--gt-lw); box-sizing: border-box; background: var(--surface); border-right: 1px solid var(--line); }
.gt-hsvg, .gt-bsvg { display: block; flex: none; }
.gt-bsvg { user-select: none; -webkit-user-select: none; }

.gt-row { display: flex; align-items: center; gap: 4px; height: var(--rh); box-sizing: border-box; padding: 0 6px; border-bottom: 1px solid var(--line); min-width: 0; }
.gt-rb { background: var(--surface-2); font-weight: 650; }
.gt-rt { padding-left: 22px; }
.gt-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; display: inline-block; }
table .gt-dot { margin-right: 6px; vertical-align: -1px; }
.gt-bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.gt-cnt { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; flex: none; }
.gt-in {
  flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; padding: 3px 6px; border-radius: 6px; font-size: 13.5px;
  color: var(--ink); text-overflow: ellipsis; font-weight: inherit;
}
.gt-in:hover { border-color: var(--line); }
.gt-in:focus { border-color: var(--focus); background: var(--surface); outline: none; }
.gt-tg, .gt-ib, .gt-st {
  flex: none; width: 24px; height: 24px; display: inline-grid; place-items: center; border: 1px solid transparent; border-radius: 6px;
  background: none; color: var(--ink-2); cursor: pointer; padding: 0; font-size: 13px; line-height: 1;
}
.gt-tg:hover, .gt-ib:hover, .gt-st:hover { border-color: var(--line); background: var(--surface); color: var(--ink); }
.gt-tg:focus-visible, .gt-ib:focus-visible, .gt-st:focus-visible, .gt-tlink:focus-visible, .gt-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.gt-st { font-size: 14px; }
span.gt-st { cursor: default; }
.gt-st.s-doing { color: var(--accent); }
.gt-st.s-done { color: var(--good-ink); font-weight: 700; }
.gt-rt.gt-done .gt-in, .gt-rt.gt-done .gt-tlink { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.gt-rt.gt-od .gt-in, .gt-rt.gt-od .gt-tlink { color: var(--neg); }
.gt-tlink {
  flex: 1; min-width: 0; border: 0; background: none; padding: 3px 6px; text-align: left; cursor: pointer; color: var(--ink);
  font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 6px;
}
.gt-tlink:hover { color: var(--accent); text-decoration: underline; }

/* шапка шкалы */
.gt-hbg { fill: var(--surface); }
.gt-ht { fill: var(--ink-2); font-size: 11.5px; font-weight: 650; }
.gt-hd { fill: var(--muted); font-size: 11px; }
.gt-hd.we { fill: color-mix(in srgb, var(--muted) 60%, transparent); }
.gt-hl { stroke: var(--line); fill: none; }
.gt-tdm { fill: var(--warning); }

/* тело */
.gt-we { fill: var(--line); opacity: .4; }
.gt-band { fill: var(--surface-2); }
.gt-gw { stroke: var(--line); stroke-dasharray: 2 3; fill: none; }
.gt-gm { stroke: var(--line); fill: none; }
.gt-rl { stroke: var(--line); fill: none; opacity: .7; }
.gt-today { stroke: var(--warning); stroke-width: 2; stroke-dasharray: 5 3; }
.gt-dep { fill: none; stroke: var(--muted); stroke-width: 1.3; }
.gt-dep.c { stroke: var(--ink); stroke-width: 2; }
.gt-dep.dim { opacity: .3; }
.gt-ah { fill: var(--muted); }
.gt-ah.c { fill: var(--ink); }
.gt-bar { fill: var(--c); fill-opacity: .38; }
.gt-pf { fill: var(--c); pointer-events: none; }
.gt-ms { fill: var(--c); stroke: var(--surface); stroke-width: 1.5; }
.gt-hdl { fill: transparent; cursor: ew-resize; }
.gt-lbl { fill: var(--ink-2); font-size: 11.5px; pointer-events: none; }
.gt-lb { fill: var(--muted); font-size: 11px; }
.gt-bs path { fill: var(--c); opacity: .85; }
.gt-t { cursor: pointer; }
.gt-dr .gt-t .gt-bar, .gt-dr .gt-t .gt-ms { cursor: grab; }
.gt-dr .gt-t:hover .gt-hdl { fill: var(--c); fill-opacity: .55; }
.gt-t:hover .gt-bar { fill-opacity: .55; }
.gt-t.gt-done { opacity: .55; }
.gt-t.gt-done .gt-bar { fill-opacity: .25; }
.gt-t.gt-od .gt-bar, .gt-t.gt-od .gt-ms { stroke: var(--neg); stroke-width: 2; }
.gt-t.gt-od .gt-lbl { fill: var(--neg); }
.gt-t.gt-crit:not(.gt-od) .gt-bar, .gt-t.gt-crit:not(.gt-od) .gt-ms { stroke: var(--ink); stroke-width: 2; }
.gt-t.gt-crit .gt-lbl { fill: var(--ink); font-weight: 650; }
.gt-t.gt-dim { opacity: .3; }
.gt-t.drag .gt-bar, .gt-t.drag .gt-ms { stroke: var(--focus); stroke-width: 2; fill-opacity: .6; }
.gt-dragging, .gt-dragging * { cursor: grabbing !important; }
.gt-dragging .gt-hdl, .gt-dragging .gt-t.drag .gt-hdl { cursor: ew-resize !important; }
.gt-tip { position: absolute; z-index: 6; background: var(--ink); color: var(--surface); font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; box-shadow: var(--shadow); }
.gt-tip[hidden] { display: none; }

/* легенда */
.gt-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.gt-legend:empty { display: none; }
.gt-lg { display: inline-flex; align-items: center; gap: 6px; }
.gt-lg i { display: inline-block; flex: none; }
.lg-today { width: 0; height: 14px; border-left: 2px dashed var(--warning); }
.lg-od { width: 18px; height: 10px; border-radius: 3px; border: 2px solid var(--neg); background: color-mix(in srgb, var(--series-1) 38%, transparent); }
.lg-done { width: 18px; height: 10px; border-radius: 3px; background: var(--series-1); opacity: .5; }
.lg-ms { width: 10px; height: 10px; background: var(--ink-2); transform: rotate(45deg); margin: 0 2px; }
.lg-dep { width: 20px; height: 8px; border-top: 1.5px solid var(--muted); border-right: 1.5px solid var(--muted); }
.lg-crit { width: 18px; height: 10px; border-radius: 3px; border: 2px solid var(--ink); }
.gt-hint { color: var(--muted); flex-basis: 100%; }

/* ---------- таблица */
.gt-tscroll { max-height: min(72vh, 920px); border: 1px solid var(--line); border-radius: 10px; }
.gt-table { font-size: 13px; }
.gt-table th.l, .gt-table td.l { text-align: left; }
.gt-table td.gt-cname { white-space: normal; min-width: 220px; max-width: 420px; }
.gt-table thead th { z-index: 1; }
.gt-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.gt-sort:hover { color: var(--ink); }
.gt-table th[aria-sort] { color: var(--ink); }
.gt-table .gt-tlink { padding: 0; white-space: normal; text-align: left; font-size: inherit; display: inline; }
.gt-tnote { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: pre-line; }
.gt-table tr.gt-done td { color: var(--muted); }
.gt-table tr.gt-od td { color: var(--neg); }
.gt-table tr.gt-od td .gt-tlink { color: var(--neg); }
.gt-table tr.gt-critr td:first-child { box-shadow: inset 3px 0 0 var(--ink); font-weight: 700; }
.gt-odl { font-size: 11.5px; font-weight: 650; }
.gt-msi { color: var(--muted); }

/* ---------- диалоги */
.gt-dlg { width: min(720px, 100%); }
.gt-dlg.gt-dlg-s { width: min(460px, 100%); }
.gt-dlg h2 { font-size: 20px; }
.gt-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.gt-w2 { grid-column: 1 / -1; }
.gt-f { display: grid; gap: 4px; font-size: 12.5px; color: var(--ink-2); font-weight: 500; min-width: 0; }
.gt-f input, .gt-f select, .gt-f textarea { width: 100%; }
.gt-f textarea { resize: vertical; }
.gt-form .hint { margin: -4px 0 0; }
.gt-deps { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 10px; margin: 0; min-width: 0; }
.gt-deps legend { font-size: 12.5px; font-weight: 600; color: var(--ink-2); padding: 0 4px; }
.gt-deps .hint { margin: 0 0 6px; }
.gt-dfilter { width: 100%; margin-bottom: 6px; }
.gt-dlist { max-height: 220px; overflow: auto; display: grid; gap: 2px; padding-right: 4px; }
.gt-dg[hidden], .gt-di[hidden] { display: none; }
.gt-dgh { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 6px 0 2px; }
.gt-di { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 6px; align-items: start; padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--ink); }
.gt-di:hover { background: var(--surface-2); }
.gt-di input { margin: 2px 0 0; width: auto; accent-color: var(--accent); }
.gt-di.dis { cursor: not-allowed; color: var(--muted); }
.gt-dn { color: var(--muted); font-variant-numeric: tabular-nums; }
.gt-dt small { display: block; font-size: 11.5px; color: var(--muted); }
.gt-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gt-colors { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.gt-colors legend { font-size: 12.5px; color: var(--ink-2); font-weight: 500; margin-bottom: 4px; padding: 0; }
.gt-sw { position: relative; cursor: pointer; }
.gt-sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.gt-sw span { display: block; width: 30px; height: 30px; border-radius: 8px; background: var(--c); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.gt-sw input:checked + span { box-shadow: 0 0 0 2px var(--ink); }
.gt-sw input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 3px; }
.gt-note { white-space: pre-line; }

/* ---------- узкие экраны */
@media (max-width: 1100px) {
  .gt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gt-kpis .kpi.hero { grid-column: span 2; }
}
@media (max-width: 860px) {
  .gt { --gt-lw: 220px; }
  .gt-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .gt { --gt-lw: 150px; }
  .gt-kpis { grid-template-columns: minmax(0, 1fr); }
  .gt-kpis .kpi.hero { grid-column: auto; }
  .gt-cnt, .gt-add { display: none; }
  .gt-row { padding: 0 3px; gap: 2px; }
  .gt-rt { padding-left: 8px; }
  .gt-corner { padding: 0 6px 7px; font-size: 11px; }
  .gt-form { grid-template-columns: minmax(0, 1fr); }
  .gt-empty { padding: 20px 14px; }
  .gt-toolbar .btn.sm { padding: 5px 8px; }
}
@media (hover: none) { .gt-dr .gt-t .gt-bar, .gt-dr .gt-t .gt-ms { cursor: pointer; } }

/* ---------- печать: диаграмма целиком в ширину страницы (gtPrint заполняется перед печатью) + таблица */
.gt-print { display: none; }
@media print {
  .gt-box, .gt-none { display: none !important; }
  .gt-print { display: block; }
  .gt * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .gt-ph { margin: 12px 0 8px; font-size: 15px; }
  .gt-psvg { display: block; width: 100%; height: auto; margin-bottom: 8px; }
  .gt-psvg .gt-ht, .gt-psvg .gt-hd { font-size: 8px; }
  .gt-plb { fill: var(--ink); font-size: 9px; font-weight: 700; }
  .gt-plt { fill: var(--ink-2); font-size: 8.5px; }
  .gt-print .gt-tscroll { max-height: none; overflow: visible; border: 0; }
  .gt-print .gt-table { font-size: 10px; }
  .gt-print .gt-table th, .gt-print .gt-table td { padding: 3px 5px; }
  .gt-print .gt-table thead th { position: static; }
  .gt-print .gt-table tr { break-inside: avoid; }
  .gt-print .gt-table td.gt-cname { min-width: 0; }
  .gt-print .gt-legend { margin: 0 0 10px; }
  .gt-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .gt-kpis .kpi.hero { grid-column: auto; }
  .gt-kpis .kpi .k-val { font-size: 16px; }
}
