/*
CatchOntheWeb's look: design tokens, Bootstrap 5.3 variables, the app shell (sidebar, top bar), and the shared page parts.
Loaded after Bootstrap and fish_counter.css, before a page's own styles.
Design: docs/superpowers/specs/2026-09-26-web-ui-shell-design.md
*/

:root {
    --cotw-deep-water: #0E2A3B;
    --cotw-deep-water-2: #163A4F;
    --cotw-ink: #1B2B34;
    --cotw-muted: #5B6B75;
    --cotw-teal: #0F766E;
    --cotw-teal-dark: #0B5E58;
    --cotw-teal-soft: #E3F2F0;
    --cotw-signal: #E8772E;
    --cotw-mist: #F3F6F8;
    --cotw-rope: #DCE3E8;
    --cotw-panel: #FFFFFF;
    --cotw-sidebar-text: #C9D6DE;
    --cotw-sidebar-width: 15.5rem;
    --cotw-topbar-height: 3.25rem;
    --cotw-radius: 6px;
    --cotw-font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;

    /* Bootstrap 5.3 */
    --bs-body-font-family: var(--cotw-font);
    --bs-body-font-size: 1rem;
    --bs-body-color: var(--cotw-ink);
    --bs-body-bg: var(--cotw-mist);
    --bs-emphasis-color: var(--cotw-ink);
    --bs-secondary-color: var(--cotw-muted);
    --bs-primary: var(--cotw-teal);
    --bs-primary-rgb: 15, 118, 110;
    --bs-link-color: var(--cotw-teal);
    --bs-link-color-rgb: 15, 118, 110;
    --bs-link-hover-color: var(--cotw-teal-dark);
    --bs-link-hover-color-rgb: 11, 94, 88;
    --bs-border-color: var(--cotw-rope);
    --bs-border-radius: var(--cotw-radius);
    --bs-border-radius-sm: 4px;
    --bs-border-radius-lg: 8px;
    --bs-focus-ring-color: rgba(15, 118, 110, 0.35);
    --bs-heading-color: var(--cotw-ink);

    /* Older styles in fish_counter.css use these */
    --primary-color: var(--cotw-teal);
    --secondary-color: var(--cotw-teal-dark);
    --text-secondary: var(--cotw-muted);
}

body.cotw {
    font-family: var(--cotw-font);
    font-size-adjust: from-font;
    background-color: var(--cotw-mist);
    color: var(--cotw-ink);
    min-height: 100vh;
}

.cotw :is(h1, h2, h3, h4, h5, h6) {
    font-weight: 600;
    color: var(--cotw-ink);
    text-align: left;
    letter-spacing: 0;
}
.cotw h1 { font-size: 1.75rem; }
.cotw h2 { font-size: 1.625rem; margin-bottom: 0.75rem; }
.cotw h3 { font-size: 1.25rem; }
.cotw h4 { font-size: 1.125rem; }
.cotw h5, .cotw h6 { font-size: 1rem; }

.cotw a { text-decoration: none; }
.cotw a:not(.btn):not(.nav-link):not(.dropdown-item):not(.sidebar-nav a):hover { text-decoration: underline; }

/* One visible focus ring everywhere, for keyboard users */
.cotw :focus-visible {
    outline: 2px solid var(--cotw-teal);
    outline-offset: 2px;
    box-shadow: none;
}
.cotw .app-sidebar :focus-visible { outline-color: #7FD4CB; }

.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -3rem;
    z-index: 2000;
    padding: 0.5rem 0.75rem;
    background: var(--cotw-panel);
    color: var(--cotw-ink);
    border-radius: var(--cotw-radius);
}
.skip-link:focus { top: 0.5rem; }

/* ---------- Buttons ---------- */
.cotw .btn { font-weight: 600; }
.cotw .btn-primary {
    --bs-btn-bg: var(--cotw-teal);
    --bs-btn-border-color: var(--cotw-teal);
    --bs-btn-hover-bg: var(--cotw-teal-dark);
    --bs-btn-hover-border-color: var(--cotw-teal-dark);
    --bs-btn-active-bg: var(--cotw-teal-dark);
    --bs-btn-active-border-color: var(--cotw-teal-dark);
    --bs-btn-disabled-bg: var(--cotw-teal);
    --bs-btn-disabled-border-color: var(--cotw-teal);
    --bs-btn-focus-shadow-rgb: 15, 118, 110;
}
.cotw .btn-outline-primary {
    --bs-btn-color: var(--cotw-teal);
    --bs-btn-border-color: var(--cotw-teal);
    --bs-btn-hover-bg: var(--cotw-teal);
    --bs-btn-hover-border-color: var(--cotw-teal);
    --bs-btn-active-bg: var(--cotw-teal-dark);
    --bs-btn-active-border-color: var(--cotw-teal-dark);
}

/* ---------- The shell ---------- */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar-col {
    flex: 0 0 var(--cotw-sidebar-width);
    background-color: var(--cotw-deep-water);
}
@media (max-width: 991.98px) {
    .app-sidebar-col { flex-basis: 0; }
}

.app-sidebar {
    --bs-offcanvas-width: min(18rem, 85vw);
    --bs-offcanvas-bg: var(--cotw-deep-water);
    --bs-offcanvas-color: var(--cotw-sidebar-text);
    color: var(--cotw-sidebar-text);
    display: flex;
    flex-direction: column;
}
@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
        scrollbar-width: thin;
    }
}

.sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem 0.75rem;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1.0625rem;
}
.sidebar-brand:hover { color: #FFFFFF; text-decoration: none; }
.sidebar-brand-mark { width: 1.75rem; height: 1.1rem; color: #7FD4CB; }

.sidebar-body { flex: 1 1 auto; padding: 0.25rem 0.625rem; }

.sidebar-nav { list-style: none; margin: 0 0 1rem; padding: 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.4rem 0.625rem;
    border-radius: var(--cotw-radius);
    color: var(--cotw-sidebar-text);
}
.sidebar-nav a:hover { background-color: rgba(255, 255, 255, 0.06); color: #FFFFFF; text-decoration: none; }
.sidebar-nav a.current { background-color: rgba(127, 212, 203, 0.14); color: #FFFFFF; }

/* The project's steps: the one bold element of the shell */
.sidebar-project {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 0.875rem;
}
.sidebar-project-name {
    display: block;
    padding: 0 0.625rem 0.5rem;
    color: #FFFFFF;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-project-name:hover { color: #FFFFFF; }
.sidebar-project-name.current { color: #7FD4CB; }

.sidebar-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    position: relative;
}
/* The line joining the steps */
.sidebar-steps::before {
    content: "";
    position: absolute;
    left: calc(0.625rem + 0.6875rem - 1px);
    top: 0.875rem;
    bottom: 0.875rem;
    width: 2px;
    background: rgba(255, 255, 255, 0.12);
}
.sidebar-step a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.3rem 0.625rem;
    border-radius: var(--cotw-radius);
    color: var(--cotw-sidebar-text);
}
.sidebar-step a:hover { background-color: rgba(255, 255, 255, 0.06); color: #FFFFFF; text-decoration: none; }
.sidebar-step-marker {
    flex: 0 0 1.375rem;
    height: 1.375rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.28);
    background: var(--cotw-deep-water);
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.sidebar-step-marker svg { width: 0.8rem; height: 0.8rem; }
.sidebar-step.done .sidebar-step-marker {
    background: var(--cotw-teal);
    border-color: var(--cotw-teal);
    color: #FFFFFF;
}
.sidebar-step.next .sidebar-step-marker {
    border-color: var(--cotw-signal);
    color: var(--cotw-signal);
}
.sidebar-step.next .sidebar-step-label::after {
    content: "next";
    margin-left: 0.375rem;
    padding: 0 0.375rem;
    border-radius: 999px;
    background: rgba(232, 119, 46, 0.18);
    color: #F6B386;
    font-size: 0.75rem;
}
.sidebar-step.current a { background-color: rgba(127, 212, 203, 0.14); color: #FFFFFF; font-weight: 600; }
.sidebar-step.current .sidebar-step-marker { box-shadow: 0 0 0 3px rgba(127, 212, 203, 0.35); }

.sidebar-foot {
    padding: 0.75rem 0.625rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
}
.sidebar-gpus .gpu-status { color: var(--cotw-sidebar-text); padding: 0 0.625rem 0.5rem; }
.sidebar-gpus .gpu-status-label { color: var(--cotw-sidebar-text); }
.sidebar-account {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.4rem 0.625rem;
    border: 0;
    border-radius: var(--cotw-radius);
    background: transparent;
    color: #FFFFFF;
    text-align: left;
}
.sidebar-account:hover { background-color: rgba(255, 255, 255, 0.06); }
.sidebar-account-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-credit { margin: 0.5rem 0.625rem 0; color: rgba(201, 214, 222, 0.6); font-size: 0.75rem; line-height: 1.35; }

.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--cotw-topbar-height);
    padding: 0 1.5rem;
    background: var(--cotw-panel);
    border-bottom: 1px solid var(--cotw-rope);
}
.app-menu-button {
    border: 0;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--cotw-ink);
    padding: 0.25rem;
}
.app-topbar-brand { font-weight: 700; color: var(--cotw-ink); }
.app-topbar-links, .app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.app-topbar-links { flex: 1 1 auto; min-width: 0; overflow-x: auto; }
.app-topbar .nav-link { color: var(--cotw-ink); padding: 0.375rem 0.625rem; border-radius: var(--cotw-radius); }
.app-topbar .nav-link:hover { background: var(--cotw-mist); }

/* The page's side margin is this padding plus the page column's gutter (below): 2rem, and 1rem on phones */
.app-content {
    flex: 1 0 auto;
    padding: 1.75rem 1.25rem 3rem;
}
@media (max-width: 767.98px) {
    .app-topbar { padding: 0 0.75rem; }
    .app-content { padding: 1rem 0.25rem 2rem; }
}

/* Pages: a readable width, centred in the space beside the sidebar */
.cotw .page-container {
    max-width: 75rem;
    margin: 0 auto;
    /* Bootstrap's gutter, so that .row's negative margins stay inside the column */
    padding: 0 calc(var(--bs-gutter-x, 1.5rem) * 0.5) !important;
    background: transparent;
    border-radius: 0 !important;
}
.cotw .page-container.narrow { max-width: 58rem; }

/* ---------- Shared page parts ---------- */
.cotw .breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0.5rem;
    border: 0;
    font-size: 0.875rem;
}
.cotw .breadcrumb-item a { color: var(--cotw-muted); }
.cotw .breadcrumb-item a:hover { color: var(--cotw-teal); }
.cotw .breadcrumb-item.active { color: var(--cotw-muted); }

/* The page header: the title, and the page's actions on the right */
.cotw .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0;
    border-bottom: 0;
}
.cotw .section-header h2 { margin: 0; flex: 1 1 auto; }
.cotw .section-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* Panels */
.cotw .card {
    border: 1px solid var(--cotw-rope);
    border-radius: var(--cotw-radius);
    box-shadow: none;
    background: var(--cotw-panel);
}
.cotw .card-header {
    background: var(--cotw-panel);
    border-bottom: 1px solid var(--cotw-rope);
    font-weight: 600;
}

/* Tables */
.cotw .table { --bs-table-bg: var(--cotw-panel); font-variant-numeric: tabular-nums; }
.cotw .table > thead th {
    font-weight: 600;
    color: var(--cotw-muted);
    background: #F8FAFB;
    border-bottom: 1px solid var(--cotw-rope);
}

/* Form fields stand out from the page: white, with the border colour */
.cotw .form-control, .cotw .form-select {
    background-color: var(--cotw-panel);
    border-color: #C5D0D7;
}
.cotw .form-control:focus, .cotw .form-select:focus { border-color: var(--cotw-teal); }

/* Messages */
.cotw .alert { border-radius: var(--cotw-radius); }

/* Menus and dialogs keep their shadow; everything else is flat */
.cotw .dropdown-menu { border-color: var(--cotw-rope); box-shadow: 0 6px 24px rgba(14, 42, 59, 0.14); }
.cotw .modal-content { border: 0; box-shadow: 0 12px 40px rgba(14, 42, 59, 0.25); }

@media (prefers-reduced-motion: reduce) {
    .cotw *, .cotw *::before, .cotw *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Home dashboard (cow_home.html) ---------- */
.dash-section { margin-bottom: 2rem; }
.dash-section h3 { font-size: 1.25rem; margin-bottom: 0.75rem; }
.dash-columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.5rem; }
@media (max-width: 991.98px) { .dash-columns { grid-template-columns: 1fr; } }

.dash-projects, .dash-jobs, .dash-notices {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--cotw-panel);
    border: 1px solid var(--cotw-rope);
    border-radius: var(--cotw-radius);
}
.dash-project, .dash-job, .dash-notice { padding: 0.875rem 1rem; }
.dash-project + .dash-project, .dash-job + .dash-job, .dash-notice + .dash-notice { border-top: 1px solid var(--cotw-rope); }

.dash-project {
    display: grid;
    grid-template-columns: minmax(12rem, 1fr) auto minmax(11rem, auto);
    align-items: center;
    gap: 1.25rem;
}
@media (max-width: 767.98px) {
    .dash-project { grid-template-columns: 1fr; gap: 0.625rem; }
}
.dash-project-name { font-weight: 600; font-size: 1.0625rem; color: var(--cotw-ink); }
.dash-project-facts { margin: 0.125rem 0 0; color: var(--cotw-muted); font-size: 0.875rem; }
.dash-project-desc { margin: 0.125rem 0 0; font-size: 0.9375rem; max-width: 40rem; }
.dash-project-next { justify-self: end; }
@media (max-width: 767.98px) { .dash-project-next { justify-self: start; } }

/* The project's steps, as in the sidebar */
.dash-steps { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; }
.dash-step { display: flex; align-items: center; }
.dash-step + .dash-step::before { content: ""; width: 0.75rem; height: 2px; background: var(--cotw-rope); }
.dash-step.done + .dash-step::before { background: var(--cotw-teal); }
.dash-step a {
    width: 1.625rem;
    height: 1.625rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--cotw-rope);
    background: var(--cotw-panel);
    color: var(--cotw-muted);
    font-size: 0.8125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.dash-step a:hover { text-decoration: none; border-color: var(--cotw-teal); }
.dash-step a svg { width: 0.875rem; height: 0.875rem; }
.dash-step.done a { background: var(--cotw-teal); border-color: var(--cotw-teal); color: #FFFFFF; }
.dash-step.next a { border-color: var(--cotw-signal); color: #B4541A; }

.dash-job, .dash-notice { display: flex; align-items: center; gap: 0.75rem; }
.dash-job-what { flex: 1 1 auto; min-width: 0; }
.dash-job-what a, .dash-notice a { font-weight: 600; }
.dash-job-where { display: block; color: var(--cotw-muted); font-size: 0.875rem; }
.dash-notice.unread a { color: var(--cotw-ink); }
.dash-badge {
    flex: 0 0 auto;
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}
.dash-badge-waiting { background: #FCEBDD; color: #8A3F10; }
.dash-badge-running { background: var(--cotw-teal-soft); color: var(--cotw-teal-dark); }
.dash-more { display: inline-block; margin-top: 0.5rem; font-size: 0.875rem; }

.dash-empty {
    padding: 1.25rem 1rem;
    background: var(--cotw-panel);
    border: 1px dashed #C5D0D7;
    border-radius: var(--cotw-radius);
    color: var(--cotw-muted);
}
.dash-empty p { margin: 0 0 0.75rem; }
.dash-empty p:last-child { margin-bottom: 0; }

/* ---------- Narrow screens: lists of videos wrap instead of pushing the page wider ---------- */
.cotw .video_outline { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 575.98px) {
    .cotw div.inference_video_thumb_and_outline, .cotw div.video_thumb_and_outline { flex-wrap: wrap; }
    .cotw div.inference_video_thumb_and_outline div.video_outline { flex: 1 1 10rem; margin-right: 0; }
    .cotw div.inference_video_thumb_and_outline div.video_results { flex: 1 1 100%; margin-left: 2rem; }
}

/* ---------- Manual (catchmonitor/manual.html): contents beside the steps on wide screens ---------- */
.manual { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 2rem; align-items: start; }
.manual-contents {
    position: sticky;
    top: calc(var(--cotw-topbar-height) + 1rem);
    background: var(--cotw-panel);
    border: 1px solid var(--cotw-rope);
    border-radius: var(--cotw-radius);
    padding: 1rem 1rem 0.75rem;
}
.manual-contents h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.manual-contents ol { margin: 0; padding-left: 1.25rem; font-size: 0.875rem; }
.manual-contents li { margin-bottom: 0.3rem; }
.manual-body { max-width: 52rem; }
.manual-body p, .manual-body li { line-height: 1.6; }
.manual-lead { font-size: 1.125rem; }
.manual-step { padding-top: 1.75rem; margin-top: 1.75rem; border-top: 1px solid var(--cotw-rope); scroll-margin-top: calc(var(--cotw-topbar-height) + 1rem); }
.manual-step h3 { display: flex; align-items: center; gap: 0.625rem; font-size: 1.25rem; margin-bottom: 0.75rem; }
.manual-num {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 1.75rem; height: 1.75rem; border-radius: 50%;
    background: var(--cotw-teal); color: #fff; font-size: 0.875rem; font-weight: 700;
}
.manual-figure { margin: 1rem 0 1.25rem; }
.manual-figure img {
    display: block; width: 100%; height: auto;
    border: 1px solid var(--cotw-rope); border-radius: var(--cotw-radius); background: var(--cotw-panel);
}
.manual-figure figcaption { margin-top: 0.4rem; font-size: 0.875rem; color: var(--cotw-muted); }
.manual-end { margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--cotw-rope); color: var(--cotw-muted); }
@media (max-width: 991.98px) {
    .manual { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .manual-contents { position: static; }
}

/* ---------- A project's overview (catchmonitor/survey_type_home.html): its six steps on one rail ---------- */
.proj-desc { color: var(--cotw-muted); max-width: 44rem; margin-top: -0.5rem; }
.proj-steps { list-style: none; padding: 0; margin: 1.5rem 0 0; position: relative; }
.proj-steps::before {
    content: ""; position: absolute; left: 1.0625rem; top: 1.5rem; bottom: 1.5rem; width: 2px; background: var(--cotw-rope);
}
.proj-step { position: relative; display: grid; grid-template-columns: 2.125rem minmax(0, 1fr); gap: 1rem; margin-bottom: 1rem; scroll-margin-top: 1rem; }
.proj-step:last-child { margin-bottom: 0; }
.proj-step-mark {
    position: relative; z-index: 1; width: 2.125rem; height: 2.125rem; margin-top: 0.875rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9375rem;
    background: var(--cotw-panel); color: var(--cotw-muted); border: 2px solid var(--cotw-rope);
}
.proj-step-mark svg { width: 1rem; height: 1rem; }
.proj-step.done .proj-step-mark { background: var(--cotw-teal); border-color: var(--cotw-teal); color: #fff; }
.proj-step.next .proj-step-mark { border-color: var(--cotw-signal); color: var(--cotw-signal); }
.proj-step-body {
    background: var(--cotw-panel); border: 1px solid var(--cotw-rope); border-radius: var(--cotw-radius);
    padding: 0.875rem 1.125rem 1rem; min-width: 0;
}
.proj-step.next .proj-step-body { border-color: var(--cotw-signal); box-shadow: inset 3px 0 0 var(--cotw-signal); }
.proj-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; margin-bottom: 0.25rem; }
.proj-step-head h3 { font-size: 1.125rem; margin: 0; }
.proj-step-more { margin-left: auto; font-size: 0.875rem; }
.proj-badge { font-size: 0.75rem; font-weight: 600; border-radius: 999px; padding: 0.05rem 0.55rem; border: 1px solid currentColor; }
.proj-badge.next { color: #B4531A; }
.proj-badge.done { color: var(--cotw-teal); }
.proj-step-what { color: var(--cotw-muted); margin: 0 0 0.5rem; max-width: 44rem; }
.proj-step-facts { margin: 0 0 0.5rem; font-size: 0.9375rem; }
.proj-step-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.625rem; }
.proj-bar { height: 0.5rem; max-width: 22rem; border-radius: 0.25rem; background: var(--cotw-rope); overflow: hidden; }
.proj-bar span { display: block; height: 100%; background: var(--cotw-teal); }
.proj-list { list-style: none; padding: 0; margin: 0.25rem 0 0; }
.proj-list li { padding: 0.375rem 0; border-top: 1px solid var(--cotw-rope); }
.proj-list li:first-child { border-top: 0; }
.proj-list-meta { display: block; color: var(--cotw-muted); font-size: 0.8125rem; }
.proj-table { margin: 0.25rem 0 0; font-size: 0.9375rem; }
.proj-table td, .proj-table th { vertical-align: top; }
@media (max-width: 575.98px) {
    .proj-steps::before { display: none; }
    .proj-step { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .proj-step-mark { position: absolute; top: 0.875rem; right: 1rem; margin: 0; width: 1.75rem; height: 1.75rem; font-size: 0.8125rem; }
    .proj-step-head { padding-right: 2.25rem; }
    .proj-step-more { margin-left: 0; }
}

/* ---------- Simple forms (project, camera): one column, a panel ---------- */
.form-panel { max-width: 40rem; background: var(--cotw-panel); border: 1px solid var(--cotw-rope); border-radius: var(--cotw-radius); padding: 1.25rem 1.25rem 1rem; }
.form-panel .form-text { margin-top: 0.25rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.danger-zone { max-width: 40rem; margin-top: 1.5rem; padding: 1rem 1.25rem; border: 1px solid #F1C4BE; border-radius: var(--cotw-radius); background: #FDF6F5; }
.danger-zone h3 { font-size: 1rem; margin-bottom: 0.25rem; }

/* ---------- Uploads (training_videos, video_upload, video_frame_chooser, upload_dataset_zip) ---------- */
/* Page buttons some pages put in the top bar were light-on-dark; the top bar is white now */
.app-topbar .btn-outline-light { color: var(--cotw-ink); border-color: var(--cotw-rope); background: var(--cotw-panel); }
.app-topbar .btn-outline-light:hover { color: var(--cotw-ink); background: var(--cotw-mist); border-color: #C3CED6; }

/* Cameras: white panels with a quiet header, like the project's steps */
.cotw .cam { border-color: var(--cotw-rope); border-radius: var(--cotw-radius); }
.cotw .cam-head { background: var(--cotw-panel); color: var(--cotw-ink); border-radius: var(--cotw-radius); }
.cotw .cam:has(.collapse.show) .cam-head, .cotw .cam:has(.collapsing) .cam-head {
    border-radius: var(--cotw-radius) var(--cotw-radius) 0 0; border-bottom: 1px solid var(--cotw-rope);
}
.cotw .cam-name { font-size: 1.125rem; }
.cotw .cam-counts, .cotw .cam-desc { color: var(--cotw-muted); }
.cotw .cam-chevron { color: var(--cotw-muted); }
.cotw .cam-head .cam-btn-primary, .cotw .cam-empty .cam-btn-primary { background: var(--cotw-teal); color: #fff; border: 1px solid var(--cotw-teal); }
.cotw .cam-head .cam-btn-primary:hover, .cotw .cam-empty .cam-btn-primary:hover { background: var(--cotw-teal-dark); color: #fff; }
.cotw .cam-btn-ghost { color: var(--cotw-ink); border: 1px solid var(--cotw-rope); background: var(--cotw-panel); }
.cotw .cam-btn-ghost:hover, .cotw .cam-btn-ghost:focus-visible { color: var(--cotw-ink); background: var(--cotw-mist); border-color: #C3CED6; }
.cotw .cam-body { background: var(--cotw-panel); border-radius: 0 0 var(--cotw-radius) var(--cotw-radius); }

/* The frame chooser's save bar stays beside the sidebar, not under it */
@media (min-width: 992px) {
    .cotw .fc-savebar { left: var(--cotw-sidebar-width); }
}

/* The upload page (video_upload.html): Fine Uploader's gallery, as one drop area with a real button */
.up-page { max-width: 58rem; }
.cotw .qq-gallery.qq-uploader.up-drop {
    min-height: 13rem; max-height: none; padding: 1.75rem 1.25rem 1.25rem; text-align: center;
    border: 2px dashed #B7C4CD; border-radius: var(--cotw-radius); background: var(--cotw-panel);
}
.cotw .qq-gallery.qq-uploader.up-drop::before { content: none; }
.cotw .up-drop .qq-upload-drop-area {
    border-radius: var(--cotw-radius); border: 2px solid var(--cotw-teal); background: rgba(227, 242, 240, 0.92);
}
.cotw .up-drop .qq-upload-drop-area-active { background: rgba(227, 242, 240, 0.97); }
.up-drop-hint { color: var(--cotw-muted); }
.up-drop-hint .bi { font-size: 2.25rem; color: var(--cotw-teal); display: block; line-height: 1; margin-bottom: 0.5rem; }
.up-drop-hint p { margin: 0 0 0.75rem; font-size: 1.0625rem; }
.cotw .qq-gallery .qq-upload-button.btn {
    display: inline-block; float: none; width: auto; padding: 0.5rem 1.25rem; margin: 0 auto;
    background: var(--cotw-teal); border: 1px solid var(--cotw-teal); border-radius: var(--cotw-radius);
    color: #fff; font-weight: 600; box-shadow: none; text-shadow: none;
}
.cotw .qq-gallery .qq-upload-button.btn:hover, .cotw .qq-gallery .qq-upload-button-hover { background: var(--cotw-teal-dark); }
.cotw .qq-gallery .qq-upload-button-focus { outline: 3px solid var(--cotw-signal); outline-offset: 2px; }
.cotw .qq-gallery .qq-upload-list { text-align: left; margin-top: 1rem; }
.cotw .qq-gallery .qq-total-progress-bar-container { margin: 0 0 1rem; }
.cotw .qq-gallery .qq-total-progress-bar, .cotw .qq-gallery .qq-progress-bar { background: var(--cotw-teal); }
.up-rules { margin: 0.875rem 0 0; padding-left: 1.125rem; color: var(--cotw-muted); font-size: 0.9375rem; }
.up-rules li + li { margin-top: 0.25rem; }
.up-rules strong { color: var(--cotw-ink); }
.up-previous { margin-top: 1.75rem; }
.up-previous h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.up-fallback { margin-top: 1.5rem; color: var(--cotw-muted); font-size: 0.9375rem; }
.up-fallback summary { cursor: pointer; color: var(--cotw-teal); }
.up-fallback p { margin: 0.5rem 0; }
/* The ZIP page's Dropzone, like the upload page's drop area */
.cotw .dropzone {
    min-height: 11rem; border: 2px dashed #B7C4CD; border-radius: var(--cotw-radius); background: var(--cotw-panel);
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 1rem;
}
.cotw .dropzone.dz-drag-hover { border-color: var(--cotw-teal); border-style: solid; background: var(--cotw-teal-soft); }
.cotw .dropzone .dz-message { margin: 0; color: var(--cotw-muted); font-size: 1.0625rem; }
.cotw .dropzone .dz-message .dz-button { color: var(--cotw-teal); font-weight: 600; text-decoration: underline; }

/* ---------- Label images (labelling_home.html) ---------- */
.lab-start { background: var(--cotw-panel); border: 1px solid var(--cotw-rope); border-radius: var(--cotw-radius); padding: 1rem 1.25rem 1.125rem; max-width: 44rem; }
.lab-progress-text { margin: 0 0 0.375rem; }
.lab-h { font-size: 1rem; margin: 1.75rem 0 0.375rem; }
.lab-table { max-width: 44rem; background: var(--cotw-panel); }
.lab-table td a { font-weight: 600; }
.lab-cameras { max-width: 44rem; }
#label_stats_container .table { max-width: 30rem; margin-top: 0.75rem; background: var(--cotw-panel); }

/* ---------- The schema editor (static/schema_editor/schema_editor.css), in the site's look ---------- */
.cotw div.classes_panel, .cotw div.colour_scheme_panel { border: 1px solid var(--cotw-rope); border-radius: var(--cotw-radius); background: var(--cotw-panel); box-shadow: none; }
.cotw div.classes_panel_header, .cotw div.colour_scheme_panel_header {
    background: var(--cotw-mist); border-bottom: 1px solid var(--cotw-rope); color: var(--cotw-ink); font-weight: 600;
    border-radius: var(--cotw-radius) var(--cotw-radius) 0 0;
}
.cotw div.group_panel { border-color: var(--cotw-rope); border-radius: var(--cotw-radius); }
.cotw div.group_panel_header { background: var(--cotw-panel); border-bottom-color: var(--cotw-rope); }
.cotw .editor_card_toolbar { top: var(--cotw-topbar-height); border-bottom-color: var(--cotw-rope); }
.cotw table.class_labels_table, .cotw table.colour_scheme_table { border-color: var(--cotw-rope); border-radius: var(--cotw-radius); }
.cotw table.class_labels_table thead tr, .cotw table.colour_scheme_table thead tr { background: var(--cotw-mist); color: var(--cotw-muted); }
.cotw table.class_labels_table tbody tr:nth-child(even), .cotw table.colour_scheme_table tbody tr:nth-child(even) { background: #F8FAFB; }
.cotw table.class_labels_table tbody td, .cotw table.colour_scheme_table tbody td { color: var(--cotw-ink); }
.cotw table.class_labels_table td, .cotw table.colour_scheme_table td { padding: 0.3rem 0.5rem; }
.lab-filename { overflow-wrap: anywhere; }
/* On a phone the species table scrolls inside its panel rather than widening the page */
@media (max-width: 575.98px) {
    .cotw table.class_labels_table { display: block; max-width: 100%; overflow-x: auto; }
}
.cotw table.class_labels_table.shadow { box-shadow: none !important; }
#cr-video { max-width: 100%; }
