/*
 * The look of the web interface on top of Bootstrap 5: a sidebar, a bar on
 * top, cards on a grey ground, light or dark as the system is set.
 */
:root, [data-bs-theme="light"] {
    --tc-bg: #f6f7f9;
    --tc-sidebar: #ffffff;
    --tc-line: #e3e6ec;
    --tc-accent: #2f6fdf;
    --tc-soft: #eef3fd;
    --tc-passed: #1f8a4c;
    --tc-failed: #c9372c;
    --tc-blocked: #b26b00;
    --tc-untested: #b8c0cc;
    --bs-primary: #2f6fdf;
    --bs-primary-rgb: 47, 111, 223;
    --bs-link-color: #2f6fdf;
    --bs-link-color-rgb: 47, 111, 223;
    --bs-body-font-size: .9375rem;
}

[data-bs-theme="dark"] {
    --tc-bg: #12151b;
    --tc-sidebar: #1a1f27;
    --tc-line: #2b323d;
    --tc-accent: #5b8ff0;
    --tc-soft: #1f2a3d;
    --tc-passed: #3fb977;
    --tc-failed: #f0645a;
    --tc-blocked: #e0a030;
    --tc-untested: #4a5361;
    --bs-body-bg: #12151b;
    --bs-link-color: #5b8ff0;
    --bs-link-color-rgb: 91, 143, 240;
}

body.tc-app { background: var(--tc-bg); }

.btn-primary {
    --bs-btn-bg: var(--tc-accent);
    --bs-btn-border-color: var(--tc-accent);
    --bs-btn-hover-bg: #275fc2;
    --bs-btn-hover-border-color: #275fc2;
}

a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- layout ------------------------------------------------------------ */

.tc-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 240px;
    display: flex;
    flex-direction: column;
    background: var(--tc-sidebar);
    border-right: 1px solid var(--tc-line);
    padding: .9rem .75rem;
    z-index: 1030;
    overflow-y: auto;
}

.tc-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-weight: 650;
    font-size: 1.05rem;
    color: var(--bs-body-color);
    padding: .2rem .5rem 1rem;
}
.tc-brand:hover { text-decoration: none; }

.tc-logo {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: var(--tc-accent);
    color: #fff;
}

.tc-nav { display: flex; flex-direction: column; gap: 2px; }

.tc-nav__group {
    margin: 1rem .5rem .3rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tc-nav__item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .45rem .6rem;
    border-radius: 7px;
    color: var(--bs-body-color);
    font-size: .9rem;
}
.tc-nav__item:hover { background: var(--tc-soft); text-decoration: none; }
.tc-nav__item.active { background: var(--tc-soft); color: var(--tc-accent); font-weight: 600; }
.tc-nav__item .bi { font-size: 1rem; opacity: .85; }
.tc-nav__ext { margin-left: auto; font-size: .7rem !important; opacity: .5 !important; }

.tc-sidebar__foot { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--tc-line); display: flex; flex-direction: column; gap: 2px; }

.tc-main { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }

.tc-top {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .65rem 1.5rem;
    background: var(--tc-sidebar);
    border-bottom: 1px solid var(--tc-line);
}
.tc-crumbs { flex: 1; min-width: 0; font-size: .875rem; }
.tc-top__actions { display: flex; gap: .5rem; }

.tc-content { padding: 1.5rem; max-width: 1500px; width: 100%; }

.tc-head { margin-bottom: 1.25rem; }
.tc-head h1 { font-size: 1.45rem; font-weight: 650; margin: 0 0 .2rem; }
.tc-head p { margin: 0; }

@media (max-width: 991.98px) {
    .tc-sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 24px rgba(0, 0, 0, .15); }
    .tc-sidebar.open { transform: none; }
    .tc-main { margin-left: 0; }
    .tc-content { padding: 1rem; }
    .tc-top { padding: .6rem 1rem; }
}

/* --- cards and tiles --------------------------------------------------- */

.tc-card {
    border-color: var(--tc-line);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
    overflow: hidden;
}
.tc-card > .card-header {
    background: transparent;
    font-weight: 600;
    border-bottom-color: var(--tc-line);
    padding: .75rem 1rem;
}
.tc-card .table { --bs-table-bg: transparent; }
.tc-card .table > :not(caption) > * > * { padding: .6rem 1rem; }

.tc-tile { padding: 1rem 1.1rem; height: 100%; color: inherit; display: flex; flex-direction: column; gap: .25rem; }
a.tc-tile:hover { text-decoration: none; border-color: var(--tc-accent); }
.tc-tile__label { font-size: .8rem; color: var(--bs-secondary-color); font-weight: 500; }
.tc-tile__value { font-size: 1.75rem; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tc-tile__note { font-size: .8rem; color: var(--bs-secondary-color); margin-top: auto; }
.tc-tile .stat { font-size: 1.75rem; }

.tc-subhead { font-size: .8rem; color: var(--bs-secondary-color); font-weight: 500; }

/* --- results of a run -------------------------------------------------- */

.tc-results { min-width: 8rem; }
.tc-results__bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--tc-untested); }
.tc-results__part--passed { background: var(--tc-passed); }
.tc-results__part--failed { background: var(--tc-failed); }
.tc-results__part--blocked { background: var(--tc-blocked); }
.tc-results__part--untested { background: var(--tc-untested); }
.tc-results__figures { font-size: .75rem; color: var(--bs-secondary-color); margin-top: .2rem; }

.chart__series--passed { --chart-series: var(--tc-passed); }
.chart__series--failed { --chart-series: var(--tc-failed); }
.chart__series--blocked { --chart-series: var(--tc-blocked); }
.chart__series--untested { --chart-series: var(--tc-untested); }

/* --- login ------------------------------------------------------------- */

body.tc-login { min-height: 100vh; display: grid; place-items: center; background: var(--tc-bg); padding: 1rem; }
.tc-login__box { width: 100%; max-width: 400px; border-color: var(--tc-line); }

/* --- tables: a light head and foot in every card ------------------------ */

.tc-card .table-dark {
    --bs-table-bg: var(--bs-tertiary-bg);
    --bs-table-color: var(--bs-body-color);
    --bs-table-border-color: var(--tc-line);
}
.tc-card thead th { font-weight: 600; font-size: .8rem; color: var(--bs-secondary-color) !important; white-space: nowrap; }
.tc-card tfoot td { font-size: .85rem; color: var(--bs-secondary-color); }
.tc-card .tc-grow { min-width: 14rem; width: 18rem; }
/* A table wider than its card scrolls inside it */
.tc-card:has(> .table, > div > .table, .table-component-frame) { overflow-x: auto; }

/* --- the person logged in ---------------------------------------------- */

.tc-avatar {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--tc-accent);
    color: #fff;
    font-size: .7rem;
    font-weight: 600;
}
.tc-me__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- test case: text, steps, review, history --------------------------- */

.tc-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.tc-data { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; background: var(--bs-tertiary-bg); border-radius: 4px; padding: .15rem .4rem; display: inline-block; }
.tc-steps td:first-child { font-variant-numeric: tabular-nums; }

.tc-review--draft { border-left: 4px solid var(--bs-warning); }
.tc-review--review { border-left: 4px solid var(--bs-info); }
.tc-review--approved { border-left: 4px solid var(--tc-passed); }
.tc-review--deprecated { border-left: 4px solid var(--bs-secondary); }
.tc-quote { border-left: 3px solid var(--tc-line); padding: .25rem .75rem; margin: 0 0 .75rem; color: var(--bs-secondary-color); }

.tc-timeline { list-style: none; padding: 0; margin: 0; }
.tc-timeline__item { position: relative; padding: 0 0 .9rem 1.1rem; border-left: 2px solid var(--tc-line); margin-left: .3rem; font-size: .875rem; }
.tc-timeline__item::before { content: ''; position: absolute; left: -6px; top: .3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--tc-untested); }
.tc-timeline__item:last-child { border-left-color: transparent; }
.tc-timeline__item--approved::before { background: var(--tc-passed); }
.tc-timeline__item--changes_requested::before { background: var(--tc-blocked); }
.tc-timeline__item--submitted::before { background: var(--bs-info); }
.tc-timeline__item--comment::before { background: var(--tc-accent); }
.tc-timeline__comment { margin-top: .25rem; background: var(--bs-tertiary-bg); border-radius: 6px; padding: .4rem .6rem; }

.tc-step-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.tc-step { display: grid; grid-template-columns: 2rem 1fr auto; gap: .75rem; align-items: start; padding: .75rem; border: 1px solid var(--tc-line); border-radius: 8px; background: var(--bs-body-bg); }
.tc-step__number { font-weight: 600; color: var(--bs-secondary-color); text-align: center; padding-top: .3rem; }
.tc-sticky { position: sticky; top: 4.5rem; }

/* --- testing by hand --------------------------------------------------- */

.tc-play-steps { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .75rem; }
.tc-play-step { border-left: 4px solid var(--tc-line); transition: border-color .15s; }
.tc-play-step[data-status="passed"] { border-left-color: var(--tc-passed); }
.tc-play-step[data-status="failed"] { border-left-color: var(--tc-failed); }
.tc-play-step[data-status="blocked"] { border-left-color: var(--tc-blocked); }
.tc-play-step__grid { display: grid; grid-template-columns: 2rem 1fr 1fr auto; gap: 1rem; align-items: start; }
.tc-play-step__number { font-weight: 650; font-size: 1.1rem; color: var(--bs-secondary-color); }
@media (max-width: 767.98px) {
    .tc-play-step__grid { grid-template-columns: 2rem 1fr; }
    .tc-play-step__buttons { grid-column: 1 / -1; }
}
.tc-verdicts { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.tc-files { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.tc-file { display: flex; align-items: center; gap: .3rem; border: 1px solid var(--tc-line); border-radius: 6px; overflow: hidden; font-size: .75rem; min-height: 3.5rem; padding: .25rem; }
.tc-file img { width: 100%; height: 4rem; object-fit: cover; }
.tc-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- dark mode: light badges and buttons in the colours of the theme ---- */

[data-bs-theme="dark"] .text-bg-light {
    background-color: var(--bs-tertiary-bg) !important;
    color: var(--bs-body-color) !important;
    border: 1px solid var(--tc-line);
}
[data-bs-theme="dark"] .tc-card .table { --bs-table-hover-bg: rgba(255, 255, 255, .04); }
.tc-pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; background: var(--bs-tertiary-bg); border: 1px solid var(--tc-line); border-radius: 6px; padding: .6rem .75rem; max-height: 22rem; overflow: auto; }
.tc-next { border-left: 4px solid var(--bs-warning); }
.tc-matrix th, .tc-matrix td { min-width: 9rem; }
.tc-matrix td:first-child, .tc-matrix th:first-child { min-width: 18rem; }
.tc-script { border: 1px solid var(--tc-line); border-radius: 8px; padding: .6rem .8rem; }
.tc-script > summary { cursor: pointer; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tc-code { max-height: 30rem; font-size: .78rem; }
.tc-entry__icon--bug { color: var(--tc-failed); }
.tc-entry__icon--idea { color: var(--tc-blocked); }
.tc-entry__icon--question { color: var(--bs-info); }
.tc-entry__file { display: flex; align-items: center; gap: .25rem; font-size: .8rem; }
.tc-entry__file img { height: 4rem; border-radius: 4px; border: 1px solid var(--tc-line); }

/* --- the language of the pages (top right) ----------------------------- */

.tc-language__menu { max-height: 70vh; overflow-y: auto; }
.tc-top__actions { align-items: center; }

/* Calendars (kiopstudio/calendar): the entries of a day as small links */
.calendar { --calendar-surface: var(--bs-body-bg); --calendar-muted: var(--bs-secondary-color); --calendar-weekend-color: var(--bs-danger-text-emphasis); --calendar-today-background: var(--bs-warning-bg-subtle); --calendar-today-color: var(--bs-warning-text-emphasis); }
.tc-cal-entries { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tc-cal-entry { display: block; font-size: .72rem; line-height: 1.3; padding: 0 .3rem; border-radius: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }
.tc-cal-entry--danger { background: var(--bs-danger-bg-subtle); color: var(--bs-danger-text-emphasis); }
.tc-cal-entry--success { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.tc-cal-entry--warning { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.tc-cal-entry--secondary { background: var(--bs-secondary-bg-subtle); color: var(--bs-secondary-text-emphasis); }
.tc-cal-entry:hover { text-decoration: underline; }
.tc-cal-more { font-size: .7rem; color: var(--bs-secondary-color); }
/* Narrow calendars: weekdays on one line, cut rather than wrapped */
.calendar__weekday { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .75rem; }

/* Card titles of the bundles (calendar, attachments) the size of a card header, not of a page heading */
.component-card__title { font-size: 1rem; font-weight: 600; margin: 0; }

/* The release report on paper: no menu, no buttons */
@media print {
    .tc-sidebar, .tc-top, .d-print-none { display: none !important; }
    .tc-main { margin: 0 !important; }
    .tc-card { break-inside: avoid; }
}
.tc-shared .tc-brand { font-weight: 650; display: inline-flex; gap: .5rem; align-items: center; }

/* The latest results of a case as a strip of dots (stability, flaky) */
.tc-strip { display: flex; gap: 3px; flex-wrap: wrap; }
.tc-strip__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bs-secondary-bg); }
.tc-strip__dot--passed { background: var(--bs-success); }
.tc-strip__dot--failed { background: var(--bs-danger); }
.tc-strip__dot--blocked { background: var(--bs-warning); }


/* The test report of a task (task_report/_report.html.twig): page, shared page /r/<token> and paper */
.tc-tr-head { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: stretch; justify-content: space-between; margin-bottom: 1.25rem; }
.tc-tr-title h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 .25rem; }
.tc-tr-task { font-size: 1.15rem; margin: 0; }
.tc-tr-key { font-weight: 650; font-variant-numeric: tabular-nums; }
.tc-tr-verdict { display: flex; gap: .9rem; align-items: center; min-width: min(100%, 20rem); padding: 1rem 1.25rem; border-radius: 10px; border: 1px solid; }
.tc-tr-verdict > .bi { font-size: 2.25rem; line-height: 1; }
.tc-tr-verdict .tc-verdict { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.tc-tr-verdict__count { font-size: .9rem; margin: .15rem 0 .45rem; }
.tc-tr-verdict--success { background: var(--bs-success-bg-subtle); border-color: var(--bs-success-border-subtle); color: var(--bs-success-text-emphasis); }
.tc-tr-verdict--danger { background: var(--bs-danger-bg-subtle); border-color: var(--bs-danger-border-subtle); color: var(--bs-danger-text-emphasis); }
.tc-tr-verdict--primary { background: var(--bs-primary-bg-subtle); border-color: var(--bs-primary-border-subtle); color: var(--bs-primary-text-emphasis); }
.tc-tr-verdict--secondary { background: var(--bs-secondary-bg-subtle); border-color: var(--bs-secondary-border-subtle); color: var(--bs-secondary-text-emphasis); }
.tc-tr-bar { display: flex; height: .5rem; border-radius: 99px; overflow: hidden; background: var(--bs-secondary-bg); }
.tc-tr-bar__passed { background: var(--bs-success); }
.tc-tr-bar__failed { background: var(--bs-danger); }
.tc-tr-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; margin: 0 0 1.5rem; }
.tc-tr-facts > div { border: 1px solid var(--tc-line); border-radius: 8px; padding: .65rem .85rem; background: var(--bs-body-bg); }
.tc-tr-facts dt { font-size: .75rem; font-weight: 500; color: var(--bs-secondary-color); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .2rem; }
.tc-tr-facts dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.tc-tr-section { font-size: 1.1rem; font-weight: 650; margin: 0 0 .75rem; }
.tc-tr-none { color: var(--bs-success-text-emphasis); font-weight: 550; margin-bottom: 1.5rem; }
.tc-expected { list-style: none; margin: 0; padding: 0; max-width: 30rem; }
.tc-expected li { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-expected li + li { margin-top: .15rem; }
.tc-thumbs { display: flex; flex-wrap: wrap; gap: .35rem; }
.tc-thumbs img { width: 6rem; height: 4rem; object-fit: cover; border-radius: 4px; border: 1px solid var(--tc-line); display: block; }
.tc-evidence__files { display: flex; flex-wrap: wrap; gap: .75rem; }
.tc-evidence__files img { max-width: 100%; max-height: 18rem; border-radius: 6px; border: 1px solid var(--tc-line); display: block; }
/* The frame repeats head and foot on every printed page; on screen it is not there */
.tc-print-frame, .tc-print-frame > tbody, .tc-print-frame > tbody > tr, .tc-print-frame > tbody > tr > td { display: contents; }
.tc-print-frame > thead, .tc-print-frame > tfoot { display: none; }
.tc-print-head, .tc-print-foot { display: flex; justify-content: space-between; gap: 1rem; font-size: 9pt; color: #555; }
.tc-print-head { border-bottom: 1px solid #ccc; padding-bottom: .3rem; margin-bottom: .6rem; }
.tc-print-foot { border-top: 1px solid #ccc; padding-top: .3rem; margin-top: .6rem; }
@media print {
    .tc-print-frame { display: table; width: 100%; border-collapse: collapse; }
    .tc-print-frame > thead { display: table-header-group; }
    .tc-print-frame > tfoot { display: table-footer-group; }
    .tc-print-frame > tbody { display: table-row-group; }
    .tc-print-frame > tbody > tr { display: table-row; }
    .tc-print-frame > tbody > tr > td { display: table-cell; }
    .tc-task-report, .tc-task-report * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .tc-task-report tr, .tc-tr-facts > div, .tc-evidence, .tc-red li { break-inside: avoid; }
    .tc-tr-section { break-after: avoid; }
    .tc-tr-facts { grid-template-columns: repeat(5, 1fr); }
    .tc-tr-tiles > div { flex: 0 0 25%; max-width: 25%; }
    .tc-task-report .table-responsive { overflow: visible; }
    .tc-shared .tc-content { padding: 0 !important; max-width: none; }
}
.tc-tr-verdict--success > .bi { color: var(--bs-success); }
.tc-tr-verdict--danger > .bi { color: var(--bs-danger); }
.tc-tr-verdict--primary > .bi { color: var(--bs-primary); }
/* Cases of the test report: two lines per case, the result over both */
.tc-report-cases .tc-rc + .tc-rc { border-top: 2px solid var(--tc-line); }
.tc-report-cases .tc-rc-top > td { border-bottom: 0; padding-bottom: .2rem; }
.tc-report-cases .tc-rc-sub > td { padding-top: .1rem; }
.tc-report-cases .tc-rc-case { font-weight: 550; }
.tc-report-cases .tc-rc-tester { width: 15rem; }
.tc-report-cases .tc-rc-result { width: 9rem; text-align: center; vertical-align: middle; border-left: 1px solid var(--tc-line); }
.tc-report-cases .tc-rc-result .badge { font-size: .85rem; padding: .45em .9em; }
@media print { .tc-tr-tiles > div { width: 25%; } }
.tc-tr-about { color: var(--bs-secondary-color); font-size: .875rem; margin: .35rem 0 0; }
.tc-report-cases .tc-rc-one { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.tc-report-cases .tc-rc-one + .tc-rc-one { margin-top: .3rem; }
.tc-report-cases .tc-rc-conf { font-size: .75rem; color: var(--bs-secondary-color); white-space: nowrap; }
.tc-report-cases .tc-rc-result:has(.tc-rc-conf) { width: 15rem; }
.tc-report-cases .tc-rc--red > tr > td:first-child { box-shadow: inset 3px 0 0 var(--bs-danger); }
.tc-tr-key { font-weight: 650; }
.tc-tr-subtask { margin: .2rem 0 0; }

/* Reports of the runner's checks: accessibility and the visual comparison (report/accessibility, report/visual) */
.tc-explain > summary { cursor: pointer; list-style: none; }
.tc-explain > summary::-webkit-details-marker { display: none; }
.tc-explain[open] > summary { border-bottom: 1px solid var(--tc-line); }
.tc-visual-pic { width: 100%; max-height: 28rem; object-fit: contain; object-position: top; border: 1px solid var(--tc-line); border-radius: 6px; background: var(--bs-body-bg); }
.tc-visual-pic--one { max-width: 26rem; }
.tc-visual-thumb { width: 12rem; border: 1px solid var(--tc-line); border-radius: 4px; }
.tc-visual-row--differs { border-color: var(--bs-danger-border-subtle); }
