/* «Хронология» во вкладке GitHub (public/github-timeline.js). */

:root,
[data-theme] {
    --gt-repo-0: #2563eb;
    --gt-repo-1: #d97706;
    --gt-repo-2: #7c3aed;
    --gt-repo-3: #0d9488;
    --gt-heat-0: 37, 99, 235;
    --gt-heat-1: 217, 119, 6;
    --gt-heat-2: 124, 58, 237;
    --gt-heat-3: 13, 148, 136;
    --gt-star: #d97706;
}

[data-theme="dark"],
[data-theme="weather"][data-weather-daynight="night"] {
    --gt-repo-0: #3b82f6;
    --gt-repo-1: #d97706;
    --gt-repo-2: #8b5cf6;
    --gt-repo-3: #14b8a6;
    --gt-heat-0: 59, 130, 246;
    --gt-heat-1: 217, 119, 6;
    --gt-heat-2: 139, 92, 246;
    --gt-heat-3: 20, 184, 166;
    --gt-star: #f59e0b;
}

.gt-root {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.gt-swatch {
    display: inline-block;
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--c, var(--gt-repo-0));
}

.gt-filter-row,
.gt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gt-filter-row button,
.gt-chips button,
.gt-star-filter,
.gt-reset {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    border: 1px solid var(--color-border-light);
    border-radius: 999px;
    padding: 0 13px;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.gt-filter-row button.active,
.gt-chips button.active,
.gt-star-filter.active {
    border-color: var(--color-primary);
    color: var(--color-text-primary);
    background: rgba(59, 130, 246, 0.14);
}

.gt-chips b,
.gt-star-filter b {
    color: var(--color-text-muted);
    font-weight: 600;
}

.gt-section,
.gt-hero {
    border: 1px solid var(--color-border-light);
    border-radius: 12px;
    padding: 16px;
    background: var(--color-bg-secondary);
    min-width: 0;
}

.gt-section-head h3,
.gt-hero h3 {
    margin: 0 0 4px;
    color: var(--color-text-primary);
    font-size: 18px;
}

.gt-section-head p,
.gt-hero-copy p {
    margin: 0 0 12px;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.gt-hero {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
    gap: 16px;
    align-items: start;
}

.gt-hero-copy h3 {
    margin-top: 4px;
    font-size: 22px;
}

.gt-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gt-repo-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
}

.gt-repo-card {
    border: 1px solid var(--color-border-light);
    border-top: 3px solid var(--c);
    border-radius: 10px;
    padding: 12px;
    background: var(--color-bg-card);
}

.gt-repo-card header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-primary);
    font-size: 15px;
}

.gt-repo-age {
    display: block;
    margin: 3px 0 10px;
    color: var(--color-text-muted);
    font-size: 12px;
}

.gt-repo-card dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin: 0;
}

.gt-repo-card dt {
    color: var(--color-text-muted);
    font-size: 12px;
}

.gt-repo-card dd {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.gt-repo-deploy {
    margin: 10px 0 0;
    color: var(--color-text-secondary);
    font-size: 12px;
    line-height: 1.45;
}

.gt-repo-deploy b {
    color: var(--color-text-primary);
}

.gt-deploy-tick {
    stroke-width: 1.5;
    opacity: 0.55;
}

.gt-month-fix {
    font-size: 10px !important;
}

.gt-hotfix {
    border: 1px dashed var(--color-border-light);
    border-radius: 6px;
    padding: 0 6px;
    color: var(--color-text-secondary);
    font-size: 11px;
}

.gt-pending {
    color: var(--color-text-primary);
    font-weight: 600;
}

.gt-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.gt-tags span,
.gt-domain {
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    padding: 2px 7px;
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 12px;
}

.gt-domain {
    cursor: pointer;
}

.gt-domain:hover {
    border-color: var(--color-primary);
    color: var(--color-text-primary);
}

/* Рост кода */

.gt-chart-wrap {
    position: relative;
    min-width: 0;
}

.gt-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    margin-bottom: 8px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.gt-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gt-legend-note {
    color: var(--color-text-muted);
    font-size: 12px;
}

.gt-growth {
    display: block;
    max-width: 100%;
    height: auto;
    overflow: visible;
}

.gt-grid {
    stroke: var(--color-border-light);
    stroke-width: 1;
}

.gt-axis {
    fill: var(--color-text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.gt-line {
    fill: none;
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.gt-mk {
    stroke: var(--color-bg-secondary);
    stroke-width: 2;
}

.gt-mk-ring {
    fill: var(--color-bg-secondary);
    stroke-width: 2;
}

.gt-mk-star {
    fill: var(--gt-star);
    font-size: 15px;
    paint-order: stroke;
    stroke: var(--color-bg-secondary);
    stroke-width: 3px;
}

.gt-crosshair {
    stroke: var(--color-text-muted);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    pointer-events: none;
}

.gt-hit {
    fill: transparent;
    cursor: crosshair;
}

.gt-tooltip {
    position: absolute;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 250px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    padding: 9px 11px;
    background: var(--color-bg-card);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
    color: var(--color-text-secondary);
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
}

.gt-tooltip[hidden] {
    display: none;
}

.gt-tooltip strong {
    color: var(--color-text-primary);
    font-size: 13px;
}

.gt-tooltip span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}

.gt-tooltip em {
    margin-top: 3px;
    color: var(--color-text-primary);
    font-style: normal;
    font-weight: 600;
}

.gt-tooltip small {
    color: var(--color-text-muted);
}

/* Темп по месяцам */

.gt-months {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(46px, 1fr);
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.gt-month {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 6px 2px;
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    cursor: pointer;
}

.gt-month:hover {
    border-color: var(--color-border-light);
}

.gt-month-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: 90px;
}

.gt-month-bars i {
    width: 10px;
    border-radius: 4px 4px 0 0;
    background: var(--c);
}

.gt-month strong {
    color: var(--color-text-primary);
    font-size: 12px;
    font-weight: 600;
}

.gt-month small {
    color: var(--color-text-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

/* Ритм работы */

.gt-rhythm-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 8px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.gt-rhythm-facts b {
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
}

.gt-rhythm-signal {
    color: var(--color-text-primary);
    font-weight: 600;
}

.gt-rhythm-ok {
    color: var(--color-text-muted);
}

.gt-rhythm-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.gt-rhythm-grid {
    display: grid;
    grid-template-columns: 28px repeat(24, minmax(10px, 1fr));
    gap: 2px;
    overflow-x: auto;
}

.gt-rhythm-hour,
.gt-rhythm-day {
    color: var(--color-text-muted);
    font-size: 10px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.gt-rhythm-day {
    text-align: left;
    line-height: 16px;
}

.gt-rhythm-cell {
    height: 16px;
    border-radius: 3px;
    background: rgba(var(--gt-heat-0), var(--a));
    box-shadow: inset 0 0 0 1px var(--color-border-light);
}

.gt-rhythm-cell.is-night {
    box-shadow: inset 0 0 0 1px var(--color-border);
}

/* Направления */

.gt-heatmap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-x: auto;
}

.gt-heat-head,
.gt-heat-row {
    display: grid;
    grid-template-columns: minmax(170px, 1.6fr) repeat(var(--cols), minmax(34px, 1fr)) 52px;
    gap: 2px;
    align-items: center;
    min-width: calc(230px + var(--cols) * 36px);
}

.gt-heat-head span {
    color: var(--color-text-muted);
    font-size: 11px;
    text-align: center;
}

.gt-heat-row {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 1px 2px;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.gt-heat-row:hover,
.gt-heat-row.active {
    border-color: var(--color-border-light);
}

.gt-heat-row.active {
    border-color: var(--color-primary);
}

.gt-heat-name {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    color: var(--color-text-primary);
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gt-heat-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: calc(230px + var(--cols) * 36px);
}

.gt-heat-block + .gt-heat-block {
    margin-top: 12px;
}

.gt-heat-project {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 6px 0 4px;
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 700;
}

.gt-heat-project .gt-swatch {
    align-self: center;
}

.gt-heat-project small {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 400;
}

.gt-chevron {
    display: inline-block;
    width: 14px;
    flex-shrink: 0;
    color: var(--color-text-muted);
    font-size: 11px;
}

.gt-heat-name small {
    margin-left: 6px;
    color: var(--color-text-muted);
    font-size: 11px;
}

.gt-heat-row.is-group .gt-heat-name {
    font-weight: 600;
}

.gt-heat-row.is-direction .gt-heat-name {
    padding-left: 22px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

.gt-heat-row.is-direction .gt-heat-cell {
    height: 20px;
    line-height: 20px;
}

.gt-heat-cell {
    height: 24px;
    border-radius: 4px;
    background: rgba(var(--h, var(--gt-heat-0)), var(--a));
    color: var(--color-text-primary);
    font-size: 11px;
    line-height: 24px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.gt-heat-total {
    color: var(--color-text-secondary);
    font-size: 12px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Ключевые события */

.gt-chips {
    margin-bottom: 12px;
}

.gt-milestones {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 8px;
}

.gt-milestone {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--color-border-light);
    border-left: 3px solid var(--c);
    border-radius: 8px;
    padding: 10px 11px;
    background: var(--color-bg-card);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.gt-milestone:hover {
    border-color: var(--color-primary);
    border-left-color: var(--c);
}

.gt-milestone-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-text-muted);
    font-size: 12px;
}

.gt-milestone-meta .gt-swatch {
    background: var(--c);
}

.gt-milestone-type {
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.gt-milestone.is-star .gt-milestone-type {
    color: var(--gt-star);
}

.gt-milestone strong {
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.35;
}

.gt-milestone small {
    display: -webkit-box;
    overflow: hidden;
    color: var(--color-text-muted);
    font-size: 12px;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.gt-more {
    margin-top: 10px;
}

.gt-empty {
    padding: 14px;
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
}

/* Хронология */

.gt-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.gt-controls input,
.gt-controls select {
    min-height: 34px;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    padding: 0 10px;
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    font: inherit;
    font-size: 13px;
}

.gt-controls input {
    flex: 1 1 220px;
    width: auto;
    min-width: 0;
    margin: 0;
}

.gt-controls select {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
    margin: 0;
}

.gt-star-filter b {
    margin-left: 2px;
}

.gt-reset {
    border-style: dashed;
}

.gt-list {
    display: flex;
    flex-direction: column;
}

.gt-list-month {
    position: sticky;
    top: 0;
    z-index: 1;
    margin: 12px 0 4px;
    padding: 6px 0;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
    font-size: 14px;
}

.gt-list-month:first-child {
    margin-top: 0;
}

.gt-item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 12px;
    border-bottom: 1px solid var(--color-border-light);
    border-left: 3px solid var(--c);
    padding: 10px 6px 10px 10px;
    transition: background-color 0.3s;
}

.gt-item.is-starred {
    background: rgba(217, 119, 6, 0.06);
}

.gt-item.is-flash {
    background: rgba(59, 130, 246, 0.16);
}

.gt-item-date {
    color: var(--color-text-secondary);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.gt-item-date small {
    display: block;
    color: var(--color-text-muted);
    font-size: 11px;
}

.gt-item-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 8px;
}

.gt-repo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.gt-repo .gt-swatch {
    background: var(--c);
}

.gt-kind {
    border-radius: 6px;
    padding: 1px 7px;
    background: rgba(100, 116, 139, 0.14);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.gt-kind.is-feat {
    background: rgba(34, 197, 94, 0.16);
    color: var(--color-text-primary);
}

.gt-item-title {
    margin: 5px 0 4px;
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.gt-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    color: var(--color-text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.gt-item-meta a {
    color: var(--color-text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.gt-plus,
.gt-minus {
    color: var(--color-text-secondary);
}

.gt-dots {
    color: var(--color-text-secondary);
    font-size: 9px;
    letter-spacing: 1px;
}

.gt-dots span {
    opacity: 0.25;
}

.gt-note {
    margin: 8px 0 0;
    border-left: 2px solid var(--gt-star);
    padding: 4px 0 4px 9px;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.gt-note-edit {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.gt-note-edit textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    padding: 8px 10px;
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    font: inherit;
    font-size: 13px;
    resize: vertical;
}

.gt-note-edit div {
    display: flex;
    gap: 6px;
}

.gt-item-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gt-star,
.gt-note-btn {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 16px;
    cursor: pointer;
}

.gt-star:hover,
.gt-note-btn:hover {
    border-color: var(--color-border-light);
    color: var(--color-text-primary);
}

.gt-star.active {
    color: var(--gt-star);
}

@media (max-width: 760px) {
    .gt-hero {
        grid-template-columns: 1fr;
    }

    .gt-section,
    .gt-hero {
        padding: 12px;
    }

    .gt-item {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 4px 8px;
        padding-left: 8px;
    }

    .gt-item-date {
        grid-column: 1 / -1;
        display: flex;
        gap: 6px;
    }

    .gt-item-date small {
        display: inline;
    }

    .gt-controls select,
    .gt-star-filter {
        flex: 1 1 45%;
    }
}

/* Сверка коммитов с задачами */

.gt-task-link {
    display: inline-block;
    margin: 0 6px 4px 0;
    border-radius: 6px;
    padding: 1px 7px;
    background: rgba(34, 197, 94, 0.12);
    color: var(--color-text-secondary);
    font-size: 12px;
}

.gt-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--color-bg-modal-overlay, rgba(15, 23, 42, 0.5));
}

.gt-modal-card {
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: min(86vh, 900px);
    overflow: auto;
    border-radius: 14px;
    padding: 16px;
    background: var(--color-bg-card);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.gt-modal-card header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.gt-modal-card h3 {
    margin: 0;
    color: var(--color-text-primary);
    font-size: 18px;
}

.gt-modal-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 22px;
    cursor: pointer;
}

.gt-matches-cycle,
.gt-matches-hint {
    margin: 0 0 10px;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.gt-matches-hint {
    color: var(--color-text-muted);
    font-size: 12px;
}

.gt-matches-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gt-match {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--color-border-light);
    border-radius: 10px;
    padding: 9px 10px;
    transition: opacity 0.2s;
}

.gt-match.is-done {
    opacity: 0.35;
    pointer-events: none;
}

.gt-match-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    font-size: 13px;
}

.gt-match-commit {
    color: var(--color-text-secondary);
    overflow-wrap: anywhere;
}

.gt-match-task {
    color: var(--color-text-primary);
    overflow-wrap: anywhere;
}

.gt-match-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

@media (max-width: 560px) {
    .gt-match {
        flex-direction: column;
        align-items: stretch;
    }
}
