/* Radio Monitor theme — Bootstrap 5.3 */

:root {
    --rm-ink: #15233d;
    --rm-ink-2: #1e3152;
    --rm-ink-line: #2a3f63;
    --rm-paper: #f4f6f9;
    --rm-surface: #ffffff;
    --rm-line: #dde3eb;
    --rm-text: #1b2635;
    --rm-muted: #5f6b7a;
    --rm-blue: #1f4e8c;
    --rm-blue-rgb: 31, 78, 140;
    --rm-signal: #e9a31b;
    --rm-signal-soft: #fdf3dc;
    --rm-ok: #1e8a7a;
    --rm-ok-soft: #e1f3f0;
    --rm-bad: #c8463d;
    --rm-bad-soft: #fbe7e5;
    --rm-sidebar-w: 248px;
    --rm-radius: 10px;

    --bs-body-font-family: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-body-bg: var(--rm-paper);
    --bs-body-color: var(--rm-text);
    --bs-secondary-color: var(--rm-muted);
    --bs-border-color: var(--rm-line);
    --bs-primary: var(--rm-blue);
    --bs-primary-rgb: var(--rm-blue-rgb);
    --bs-link-color: var(--rm-blue);
    --bs-link-color-rgb: var(--rm-blue-rgb);
    --bs-link-hover-color: #163b6b;
    --bs-link-hover-color-rgb: 22, 59, 107;
    --bs-focus-ring-color: rgba(var(--rm-blue-rgb), .3);
    --bs-border-radius: 8px;
}

body {
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand-name {
    font-stretch: 87.5%;
    letter-spacing: -.01em;
}

a { text-underline-offset: .18em; }

.btn-primary {
    --bs-btn-bg: var(--rm-blue);
    --bs-btn-border-color: var(--rm-blue);
    --bs-btn-hover-bg: #193f72;
    --bs-btn-hover-border-color: #193f72;
    --bs-btn-active-bg: #153560;
    --bs-btn-active-border-color: #153560;
    --bs-btn-disabled-bg: var(--rm-blue);
    --bs-btn-disabled-border-color: var(--rm-blue);
}
.btn-outline-primary {
    --bs-btn-color: var(--rm-blue);
    --bs-btn-border-color: var(--rm-blue);
    --bs-btn-hover-bg: var(--rm-blue);
    --bs-btn-hover-border-color: var(--rm-blue);
    --bs-btn-active-bg: var(--rm-blue);
}
.btn { display: inline-flex; align-items: center; gap: .4rem; }
.btn .bi { font-size: 1.05em; }

.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: rgba(var(--rm-blue-rgb), .6);
    box-shadow: 0 0 0 .2rem rgba(var(--rm-blue-rgb), .15);
}
.form-check-input:checked { background-color: var(--rm-blue); border-color: var(--rm-blue); }
.form-label, .control-label { font-weight: 600; font-size: .875rem; }
.form-text, .hint-block { color: var(--rm-muted); font-size: .8125rem; }

/* ---------- shell ---------------------------------------------------- */

.app { min-height: 100vh; }

.sidebar {
    background: var(--rm-ink);
    color: #c9d3e3;
    --bs-offcanvas-width: var(--rm-sidebar-w);
    --bs-offcanvas-bg: var(--rm-ink);
}
@media (min-width: 992px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--rm-sidebar-w);
        display: flex;
        flex-direction: column;
    }
    .app-main { margin-left: var(--rm-sidebar-w); }
    /* Bootstrap's .offcanvas-lg makes the panel transparent at this size */
    .sidebar.offcanvas-lg, .sidebar.offcanvas-lg .offcanvas-body { background-color: var(--rm-ink) !important; }
    .sidebar .offcanvas-body { flex-direction: column; flex-grow: 1; overflow-y: auto; }
}
.sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; height: 100%; }

.brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.35rem 1.25rem 1.1rem;
    color: #fff;
    text-decoration: none;
}
.brand:hover { color: #fff; }
.brand-mark { flex: none; width: 30px; height: 30px; }
.brand-name { font-size: 1.15rem; font-weight: 700; line-height: 1.1; }

.nav-section { padding: .35rem .75rem 1rem; }
.nav-section + .nav-section { border-top: 1px solid var(--rm-ink-line); padding-top: 1rem; }
.nav-heading {
    font-size: .75rem;
    font-weight: 600;
    color: #8293ad;
    padding: 0 .6rem .4rem;
}
.side-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .5rem .6rem;
    border-radius: 7px;
    color: #c9d3e3;
    text-decoration: none;
    font-size: .9375rem;
}
.side-link .bi { font-size: 1.05rem; opacity: .8; }
.side-link:hover { background: var(--rm-ink-2); color: #fff; }
.side-link.active { background: var(--rm-ink-2); color: #fff; box-shadow: inset 3px 0 0 var(--rm-signal); }
.side-link.active .bi { opacity: 1; color: var(--rm-signal); }
.side-link .count {
    margin-left: auto;
    background: var(--rm-signal);
    color: var(--rm-ink);
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    padding: .05rem .5rem;
}
.side-link:focus-visible { outline: 2px solid var(--rm-signal); outline-offset: 1px; }

.sidebar-user {
    margin-top: auto;
    border-top: 1px solid var(--rm-ink-line);
    padding: 1rem 1.25rem 1.25rem;
    font-size: .875rem;
}
.sidebar-user .who { color: #fff; font-weight: 600; }
.sidebar-user .role { color: #8293ad; font-size: .8125rem; }
.sidebar-user .btn-link { color: #c9d3e3; padding: 0; font-size: .875rem; text-decoration: none; }
.sidebar-user .btn-link:hover { color: #fff; }

.topbar {
    background: var(--rm-ink);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.topbar .brand { padding: 0; }
.topbar .btn { color: #fff; font-size: 1.4rem; padding: .1rem .4rem; }

.app-content { padding: 1.75rem 2rem 3rem; max-width: 1440px; }
@media (max-width: 575.98px) { .app-content { padding: 1.25rem 1rem 2.5rem; } }

.app-foot { color: var(--rm-muted); font-size: .8125rem; padding: 0 2rem 1.5rem; }

/* ---------- page header ---------------------------------------------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: .75rem 1.5rem;
    margin-bottom: 1.5rem;
}
.page-head h1 { font-size: 1.75rem; font-weight: 700; margin: 0; }
.page-head .lede { color: var(--rm-muted); margin: .35rem 0 0; max-width: 68ch; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.breadcrumb { --bs-breadcrumb-margin-bottom: .4rem; font-size: .8125rem; }
.breadcrumb a { text-decoration: none; }

/* ---------- surfaces -------------------------------------------------- */

.panel {
    background: var(--rm-surface);
    border: 1px solid var(--rm-line);
    border-radius: var(--rm-radius);
    margin-bottom: 1.5rem;
}
.panel-pad { padding: 1.5rem; }
.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem .75rem;
    border-bottom: 1px solid var(--rm-line);
}
.panel-head h2 { font-size: 1.125rem; font-weight: 700; margin: 0; }
.panel-head .note { color: var(--rm-muted); font-size: .8125rem; }
.panel-body { padding: 1.25rem; }
.panel > .table-responsive:first-child .table thead th:first-child,
.panel > .table-responsive:first-child { border-top-left-radius: var(--rm-radius); }

.form-panel { max-width: 760px; }
.form-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    border-top: 1px solid var(--rm-line);
    margin: 1.25rem -1.5rem -1.5rem;
    padding: 1rem 1.5rem;
    background: #fafbfd;
    border-radius: 0 0 var(--rm-radius) var(--rm-radius);
}
.form-actions .ms-auto { margin-left: auto; }
.form-actions.standalone { margin: 1.5rem 0 0; border: 1px solid var(--rm-line); border-radius: var(--rm-radius); background: var(--rm-surface); }
fieldset legend { font-size: 1rem; font-weight: 700; margin-bottom: .75rem; }

/* ---------- tables ---------------------------------------------------- */

.table { --bs-table-hover-bg: #f6f8fb; margin-bottom: 0; }
.table > thead th {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--rm-muted);
    background: #fafbfd;
    border-bottom-color: var(--rm-line);
    white-space: nowrap;
}
.table > thead th a { color: inherit; text-decoration: none; }
.table > thead th a:hover { color: var(--rm-text); }
.table > :not(caption) > * > * { padding: .65rem .9rem; }
.table td.num, .table th.num { text-align: right; }
.table .muted { color: var(--rm-muted); }
.table a.text-reset { text-decoration: none; }
.table a.text-reset:hover { text-decoration: underline; }
.panel .table > tbody > tr:last-child > * { border-bottom: 0; }

.grid-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
    padding: .75rem 1rem;
    border-top: 1px solid var(--rm-line);
}
.grid-foot:empty, .grid-foot:not(:has(*)) { display: none; }
.grid-summary { color: var(--rm-muted); font-size: .8125rem; }
.pagination { --bs-pagination-active-bg: var(--rm-blue); --bs-pagination-active-border-color: var(--rm-blue); }
.empty-state { color: var(--rm-muted); padding: 2rem 1rem; text-align: center; }

code { color: var(--rm-ink); background: #eef2f7; padding: .1em .35em; border-radius: 4px; font-size: .875em; }

/* ---------- chips ----------------------------------------------------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 999px;
    padding: .15rem .6rem;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    background: #eef1f5;
    color: var(--rm-muted);
}
.chip-ok { background: var(--rm-ok-soft); color: #156b5f; }
.chip-bad { background: var(--rm-bad-soft); color: #9f3129; }
.chip-pending { background: var(--rm-signal-soft); color: #8a5a00; }
.chip-live { background: var(--rm-signal-soft); color: #8a5a00; }
.chip-live::before {
    content: "";
    width: .5rem; height: .5rem;
    border-radius: 50%;
    background: var(--rm-signal);
}

/* ---------- filters --------------------------------------------------- */

.filters { padding: 1rem 1.25rem; border-bottom: 1px solid var(--rm-line); }
.filters .form-label { font-size: .75rem; color: var(--rm-muted); margin-bottom: .25rem; }

/* ---------- dashboard ------------------------------------------------- */

.summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    background: var(--rm-surface);
    border: 1px solid var(--rm-line);
    border-radius: var(--rm-radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
.summary > div {
    padding: 1rem 1.25rem;
    /* right and bottom hairlines; the container clips the ones on its outer edge */
    box-shadow: 1px 0 0 var(--rm-line), 0 1px 0 var(--rm-line);
    margin: 0 -1px -1px 0;
}
.summary .k { color: var(--rm-muted); font-size: .8125rem; }
.summary .v { font-size: 1.6rem; font-weight: 700; font-stretch: 87.5%; line-height: 1.2; color: var(--rm-text); text-decoration: none; }
.summary a.v:hover { color: var(--rm-blue); }
.summary .v small { font-size: .8rem; font-weight: 600; margin-left: .35rem; }

/* the 24-hour recording strip */
.onair td { vertical-align: middle; }
.onair .station-name { font-weight: 600; }
.onair .station-name a { text-decoration: none; }
.onair .station-name a:hover { text-decoration: underline; }
.onair .station-meta { color: var(--rm-muted); font-size: .8125rem; }
.tape {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 2px;
    min-width: 260px;
    height: 26px;
}
.tape span { border-radius: 2px; background: #e6eaf0; }
.tape span.rec { background: var(--rm-signal); }
.tape span.silent { background: var(--rm-bad); }
.tape .now { outline: 2px solid var(--rm-ink); outline-offset: 1px; }
.onair .tape-mobile { margin-top: .6rem; }
.onair .tape-mobile .tape { min-width: 0; height: 20px; }
.tape-scale { display: flex; justify-content: space-between; color: var(--rm-muted); font-size: .7rem; margin-top: .2rem; }
.tape-key { display: flex; gap: 1rem; color: var(--rm-muted); font-size: .8125rem; }
.tape-key i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 4.2rem 1fr auto; gap: .75rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--rm-line); align-items: center; }
.feed li:last-child { border-bottom: 0; }
.feed time { color: var(--rm-muted); font-size: .8125rem; }
.feed .what { font-weight: 600; }
.feed .where { color: var(--rm-muted); font-size: .8125rem; }

.offair { columns: 2 14rem; column-gap: 1.5rem; list-style: none; padding: 1rem 1.25rem; margin: 0; font-size: .875rem; }
.offair li { break-inside: avoid; padding: .2rem 0; color: var(--rm-muted); }
.offair li a { color: var(--rm-text); text-decoration: none; }
.offair li a:hover { color: var(--rm-blue); text-decoration: underline; }
.more { padding: 0 1.25rem 1rem; font-size: .875rem; }
.more summary { color: var(--rm-blue); cursor: pointer; }
.more .offair { padding: .5rem 0 0; }

/* ---------- detections ------------------------------------------------ */

.det-audio { height: 34px; width: 220px; max-width: 100%; }
.det-transcript { color: var(--rm-muted); font-size: .8125rem; max-width: 38ch; }
.review-btns { display: inline-flex; gap: .35rem; }
.review-btns .btn { padding: .2rem .5rem; }
.bulkbar { display: flex; gap: .5rem; align-items: center; padding: .75rem 1.25rem; border-bottom: 1px solid var(--rm-line); background: #fafbfd; }
.bulkbar .note { color: var(--rm-muted); font-size: .8125rem; margin-left: auto; }

/* ---------- reports --------------------------------------------------- */

.hours { display: grid; grid-template-columns: 3.2rem 1fr 2.5rem; gap: .25rem .6rem; align-items: center; font-size: .8125rem; }
.hours .h { color: var(--rm-muted); }
.hours .bar { display: flex; height: 10px; background: #eef1f5; border-radius: 3px; overflow: hidden; }
.hours .bar .s { background: var(--rm-blue); }
.hours .bar .m { background: var(--rm-signal); }
.legend-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin: 0 .3rem 0 .75rem; vertical-align: -1px; }

/* ---------- auth ------------------------------------------------------ */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--rm-surface); }
@media (max-width: 991.98px) { .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } }
.auth-side {
    background: var(--rm-ink);
    color: #c9d3e3;
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
@media (max-width: 991.98px) { .auth-side { padding: 1.5rem; } .auth-side .dial, .auth-side .pitch { display: none; } }
.auth-side .brand { padding: 0; }
.auth-side .pitch { max-width: 30ch; font-size: 1.05rem; line-height: 1.5; }
.auth-side .pitch h2 { color: #fff; font-size: 2.1rem; font-weight: 700; line-height: 1.1; margin-bottom: .75rem; }
.dial { width: 100%; max-width: 520px; margin: 2rem 0; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.auth-form .inner { width: 100%; max-width: 360px; }
.auth-form h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: .25rem; }
.auth-form .lede { color: var(--rm-muted); margin-bottom: 1.75rem; }

/* ---------- error ----------------------------------------------------- */

.error-page { max-width: 560px; padding: 3rem 0; }
.error-page .code { font-size: 4rem; font-weight: 700; font-stretch: 75%; color: var(--rm-signal); line-height: 1; }

@media (prefers-reduced-motion: no-preference) {
    .chip-live::before { animation: onair 2.4s ease-in-out infinite; }
}
@keyframes onair { 50% { opacity: .35; } }

/* ---------- recordings ------------------------------------------------ */

.player-panel { padding: 1rem 1.25rem; position: sticky; top: .75rem; z-index: 5; box-shadow: 0 6px 18px -12px rgba(21, 35, 61, .35); }
@media (max-width: 991.98px) { .player-panel { top: 3.6rem; } }
.player-panel audio { height: 40px; }
.player-hint { color: var(--rm-muted); font-size: .8125rem; margin-top: .4rem; }
.seek-time { font-variant-numeric: tabular-nums; font-size: .8125rem; color: var(--rm-muted); text-decoration: none; white-space: nowrap; }
a.seek-time { color: var(--rm-blue); }
a.seek-time:hover { text-decoration: underline; }
.transcript { list-style: none; margin: 0; padding: .5rem 0; max-height: 70vh; overflow-y: auto; }
.transcript li { display: grid; grid-template-columns: 4rem 1fr; gap: .75rem; padding: .3rem 1.25rem; line-height: 1.5; }
.transcript li.hit { background: var(--rm-signal-soft); box-shadow: inset 3px 0 0 var(--rm-signal); }
.transcript li.playing { background: #e8f0fb; }
.transcript li.hit.playing { background: #f9e7bd; }
.feed li .seek-time { align-self: start; padding-top: .1rem; }

/* clickable hours on the dashboard strip */
a.tape-cell { display: block; border-radius: 2px; background: #e6eaf0; }
a.tape-cell.rec { background: var(--rm-signal); }
a.tape-cell.silent { background: var(--rm-bad); }
a.tape-cell:hover, a.tape-cell:focus-visible { outline: 2px solid var(--rm-blue); outline-offset: 1px; }

/* recordings storage */
.storage-panel { padding: 1rem 1.25rem; }
.storage-panel .storage-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; align-items: baseline; margin-bottom: .6rem; }
.storage-panel .progress { height: .5rem; }

/* sign-in code */
.otp-input { font-family: var(--bs-font-monospace); font-size: 1.6rem; letter-spacing: .5em; text-align: center; padding: .55rem .75rem; }
.otp-help { margin-top: 1.1rem; font-size: .9rem; color: var(--rm-muted); }
.otp-help .btn-link { font-size: inherit; }

/* activity */
tr.idle td { color: var(--rm-muted); }
.top-pages { list-style: none; margin: 0; padding: .25rem 0; counter-reset: tp; }
.top-pages li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 1.25rem; border-bottom: 1px solid var(--rm-line); font-size: .9rem; }
.top-pages li:last-child { border-bottom: 0; }
.top-pages .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-pages .nums { white-space: nowrap; font-variant-numeric: tabular-nums; }
