/*
 * DevOps console theme.
 *
 * Bootstrap 5 supplies the components; this file supplies the shell (sidebar,
 * topbar, metric tiles) and the status colour language used across the
 * platform: green healthy, yellow warning, red critical, grey unknown.
 */

:root {
    --wm-sidebar-width: 256px;
    --wm-status-healthy: #2f9e63;
    --wm-status-warning: #d99e2b;
    --wm-status-critical: #d9534f;
    --wm-status-unknown: #6c757d;
}

body {
    min-height: 100vh;
    background: var(--bs-body-bg);
}

.layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
    width: var(--wm-sidebar-width);
    flex: 0 0 var(--wm-sidebar-width);
    flex-direction: column;
    background: var(--bs-tertiary-bg);
    border-right: 1px solid var(--bs-border-color);
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-offcanvas {
    width: var(--wm-sidebar-width);
}

.sidebar-offcanvas .sidebar {
    width: 100%;
    flex: 1 1 auto;
    height: auto;
    position: static;
    border-right: 0;
    padding: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1rem 1.15rem;
    font-weight: 600;
    letter-spacing: .01em;
    border-bottom: 1px solid var(--bs-border-color);
}

.brand i {
    color: var(--bs-primary);
    font-size: 1.15rem;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: .5rem 0 1.5rem;
}

.nav-heading {
    padding: 1rem 1.15rem .35rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--bs-secondary-color);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem 1.15rem;
    font-size: .875rem;
    color: var(--bs-body-color);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--bs-secondary-bg);
    color: var(--bs-emphasis-color);
}

.nav-item.active {
    background: var(--bs-secondary-bg);
    border-left-color: var(--bs-primary);
    color: var(--bs-emphasis-color);
    font-weight: 600;
}

.nav-item i {
    width: 1.1rem;
    text-align: center;
    flex: 0 0 auto;
}

.nav-label {
    flex: 1 1 auto;
}

/* ---------- Main column ---------- */

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

.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar-title {
    flex: 1 1 auto;
    min-width: 0;
}

.topbar-title h1 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-title p {
    margin: 0;
    font-size: .8rem;
    color: var(--bs-secondary-color);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: .6rem;
    flex: 0 0 auto;
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    margin-right: .35rem;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
}

.content {
    flex: 1 1 auto;
    padding: 1.25rem;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .75rem 1.25rem;
    font-size: .75rem;
    color: var(--bs-secondary-color);
    border-top: 1px solid var(--bs-border-color);
}

/* ---------- Metric tiles ---------- */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: .75rem;
}

.tile {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: .8rem .9rem;
    border-left: 3px solid var(--wm-status-unknown);
}

.tile-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bs-secondary-color);
    margin-bottom: .3rem;
}

.tile-value {
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.tile-value.pending {
    font-size: 1.1rem;
    color: var(--bs-secondary-color);
}

.tile-note {
    font-size: .68rem;
    color: var(--bs-secondary-color);
    margin-top: .25rem;
}

.tile-success { border-left-color: var(--wm-status-healthy); }
.tile-warning { border-left-color: var(--wm-status-warning); }
.tile-danger  { border-left-color: var(--wm-status-critical); }
.tile-info    { border-left-color: var(--bs-info); }
.tile-primary { border-left-color: var(--bs-primary); }
.tile-secondary { border-left-color: var(--wm-status-unknown); }

/* ---------- Status dots ---------- */

.status-dot {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    margin-right: .35rem;
    background: var(--wm-status-unknown);
}

.status-dot.healthy  { background: var(--wm-status-healthy); }
.status-dot.warning  { background: var(--wm-status-warning); }
.status-dot.critical { background: var(--wm-status-critical); }

/* ---------- Misc ---------- */

.table-compact td,
.table-compact th {
    padding: .45rem .6rem;
    font-size: .84rem;
    vertical-align: middle;
}

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: end;
    margin-bottom: 1rem;
}

.filter-bar .form-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bs-secondary-color);
    margin-bottom: .15rem;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .75rem;
}

.json-diff {
    font-family: var(--bs-font-monospace);
    font-size: .78rem;
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .4rem;
    padding: .6rem .75rem;
    margin: 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 25rem;
}

@media (max-width: 575.98px) {
    .content { padding: .9rem; }
    .tile-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ---------- Operations timeline ---------- */

.timeline {
    position: relative;
    padding-left: 1rem;
    border-left: 2px solid var(--bs-border-color);
}

.timeline-entry {
    position: relative;
    padding: 0 0 1rem .4rem;
}

.timeline-entry::before {
    content: "";
    position: absolute;
    left: -1.42rem;
    top: .42rem;
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--bs-secondary-color);
    border: 2px solid var(--bs-body-bg);
}

.timeline-entry.timeline-status::before {
    background: var(--bs-primary);
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    font-size: .78rem;
    margin-bottom: .15rem;
}

.timeline-body {
    font-size: .875rem;
    white-space: pre-wrap;
}

.checklist-form {
    display: inline;
    line-height: 1;
}

.workflow {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    align-items: center;
}

.workflow-step {
    font-size: .72rem;
    padding: .15rem .5rem;
    border-radius: 1rem;
    border: 1px solid var(--bs-border-color);
    color: var(--bs-secondary-color);
    white-space: nowrap;
}

.workflow-step.done {
    background: var(--wm-status-healthy);
    border-color: var(--wm-status-healthy);
    color: #fff;
}

.workflow-step.current {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
    font-weight: 600;
}

/* ---------- Result sheets ---------- */

/*
 * A task that records a result per website rather than a checklist. The table
 * is wide by nature, so it scrolls sideways inside its card and the first two
 * columns stay put — losing sight of which site a row belongs to is the one
 * thing that makes a sheet unreadable.
 */

.sheet-summary {
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    margin-bottom: 1rem;
}

.sheet-summary .tile { padding: .6rem .7rem; }
.sheet-summary .tile-value { font-size: 1.25rem; }

.sheet-table { min-width: 860px; }

.sheet-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bs-tertiary-bg);
}

.sheet-table td.sn,
.sheet-table th.sn {
    width: 2.5rem;
    color: var(--bs-secondary-color);
    font-variant-numeric: tabular-nums;
}

.sheet-table .domain {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .74rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
    word-break: break-all;
}

.sheet-table .domain:hover { color: var(--bs-primary); }

.sheet-table td.comment {
    min-width: 12rem;
    color: var(--bs-secondary-color);
}

/* A failing row is tinted rather than coloured over, so the text stays legible
   in both themes and the badge is still what carries the verdict. */
.sheet-table tr.table-danger-soft > td {
    background: color-mix(in srgb, var(--wm-status-critical) 9%, transparent);
}

.sheet-input { min-width: 4.5rem; }
.sheet-check { min-width: 5.5rem; }
.sheet-code { max-width: 4.5rem; margin-left: auto; }
.sheet-seconds { max-width: 7rem; margin-left: auto; }

.chk {
    font-size: .8rem;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.chk-ok { color: var(--wm-status-healthy); }
.chk-fail { color: var(--wm-status-critical); }
.chk-na,
.chk-none { color: var(--bs-secondary-color); }

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
    font-size: .8rem;
}

.mono.slow {
    color: var(--wm-status-warning);
    font-weight: 600;
}

/* Section tabs on a result sheet. Pills rather than underlines, so the count
   badge has somewhere to sit without crowding the label. */
.section-tabs .nav-link {
    padding: .3rem .8rem;
    font-size: .85rem;
    color: var(--bs-secondary-color);
}

.section-tabs .nav-link:hover { color: var(--bs-body-color); }
.section-tabs .nav-link.active .badge { background: rgba(255, 255, 255, .25) !important; }

/* ---------- Website form: the three section choices ---------- */

.section-choice {
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: .8rem .9rem;
    margin-bottom: .7rem;
    transition: border-color .12s ease, background-color .12s ease;
}

.section-choice:last-child { margin-bottom: 0; }

/* Ticked sections are tinted rather than outlined in colour, so the three read
   as a set and the one you are filling in is still the loudest thing. */
.section-choice.on {
    border-color: color-mix(in srgb, var(--bs-primary) 45%, var(--bs-border-color));
    background: color-mix(in srgb, var(--bs-primary) 6%, transparent);
}

.section-choice .section-body {
    margin-top: .7rem;
    padding-top: .7rem;
    border-top: 1px dashed var(--bs-border-color);
}

.section-choice .form-check-label { cursor: pointer; }

/* Live monitoring bar above an automated sheet. */
.live-bar {
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    padding: .5rem .8rem;
    background: var(--bs-tertiary-bg);
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: .4rem;
    background: var(--wm-status-healthy);
}

/* Held still for anyone who would rather it did not pulse at them. */
@media (prefers-reduced-motion: no-preference) {
    .live-dot { animation: live-pulse 2.4s ease-in-out infinite; }
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

/* A register groups by day: a hairline above each new date separates them
   without a heading row interrupting the columns. */
.table tr.register-day:not(:first-child) > td {
    border-top: 1px solid var(--bs-border-color);
}

/* ---------- Sheet meter and filter ---------- */

.meter {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bs-tertiary-bg);
    margin-bottom: .6rem;
}

.meter i { display: block; height: 100%; }
.meter-ok { background: var(--wm-status-healthy); }
.meter-warn { background: var(--wm-status-warning); }
.meter-bad { background: var(--wm-status-critical); }
.meter-wait { background: var(--wm-status-unknown); }

.meter-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1.1rem;
    font-size: .76rem;
    color: var(--bs-secondary-color);
    margin-bottom: .9rem;
}

.meter-legend b {
    color: var(--bs-body-color);
    font-variant-numeric: tabular-nums;
    margin-left: .2rem;
}

.meter-legend .dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: .35rem;
}

.dot-ok { background: var(--wm-status-healthy); }
.dot-warn { background: var(--wm-status-warning); }
.dot-bad { background: var(--wm-status-critical); }
.dot-wait { background: var(--wm-status-unknown); }

.sheet-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-bottom: .9rem;
}

.sheet-filter input[type="search"] { max-width: 15rem; }

/* The protocol, set apart from the host so the two do not read as one string. */
.proto-pill {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .7rem;
    letter-spacing: .04em;
    padding: .1rem .4rem;
    border: 1px solid var(--bs-border-color);
    border-radius: .25rem;
}
