:root { --lineup-height: calc(100vh - 230px); }
body { min-height: 100vh; }
.navbar-brand i { font-size: 1.2rem; }
.stat-card .display-6 { font-size: 1.8rem; font-weight: 600; }
.stat-card .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--bs-secondary-color); }
.status-dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; }
.status-dot.ok { background: var(--bs-success); }
.status-dot.warn { background: var(--bs-warning); }
.status-dot.bad { background: var(--bs-danger); }
.status-dot.idle { background: var(--bs-secondary); }
.table td, .table th { vertical-align: middle; }
.mono { font-family: var(--bs-font-monospace); font-size: .875em; }

/* lineup editor */
.lineup-pane { height: var(--lineup-height); min-height: 420px; overflow-y: auto; }
/* side by side: both cards fill the window below the page header (lineup.js sets --lineup-fill),
   and only the lists inside them scroll, never the page */
@media (min-width: 992px) {
  #lineup { height: var(--lineup-fill, calc(100vh - 200px)); min-height: 360px; }
  #lineup > [class*="col-"] { height: 100%; }
  #lineup .card { height: 100%; display: flex; flex-direction: column; }
  #lineup .lineup-pane { flex: 1 1 0; height: auto; min-height: 0; }
}
.cat-item { cursor: pointer; display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border-bottom: 1px solid var(--bs-border-color-translucent); user-select: none; }
.cat-item:hover { background: var(--bs-tertiary-bg); }
.cat-item.active { background: var(--bs-primary-bg-subtle); border-left: 3px solid var(--bs-primary); padding-left: calc(.6rem - 3px); }
.cat-item.is-hidden .cat-name, .stream-row.is-hidden .stream-name { text-decoration: line-through; opacity: .55; }
.cat-item .handle { cursor: grab; color: var(--bs-secondary-color); }
.cat-item .cat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .orig { font-size: .75rem; color: var(--bs-secondary-color); }
.cat-item .actions { visibility: hidden; display: flex; gap: .15rem; }
.cat-item:hover .actions, .cat-item.active .actions { visibility: visible; }
.btn-icon { padding: .1rem .35rem; line-height: 1; }
.sortable-ghost { opacity: .4; }
.stream-row img.logo { width: 34px; height: 34px; object-fit: contain; border-radius: 4px; background: var(--bs-tertiary-bg); }
.stream-row { cursor: default; }
.badge-rating { min-width: 3.4rem; }
.empty-state { color: var(--bs-secondary-color); text-align: center; padding: 4rem 1rem; }
.login-card { max-width: 380px; }
.no-drag .handle { visibility: hidden; }

/* phones and tablets */
/* the sticky navbar would cover anything scrolled to the top of the page */
html { scroll-padding-top: 4.5rem; }
/* below the side-by-side layout: the category list is a shorter box of its own, and the
   channel list just grows with the page (a second scrolling box inside the page is hard to use
   with a thumb) */
@media (max-width: 991.98px) {
  #catList { height: 55vh; min-height: 260px; }
  #lineup .col-lg-7 .lineup-pane { height: auto; min-height: 0; overflow: visible; }
}
/* touch screens: iOS zooms into any text box under 16px when it's tapped, and small buttons
   are hard to hit */
@media (pointer: coarse) {
  .form-control, .form-select, .form-control-sm, .form-select-sm, .input-group-sm > .form-control,
  .input-group-sm > .form-select { font-size: 16px; }
  .btn-icon { padding: .4rem .6rem; }
  .cat-item { padding-top: .6rem; padding-bottom: .6rem; }
  .cat-item .handle { padding: .4rem .25rem; margin: -.4rem 0; font-size: 1.1rem; }
  .stream-row .form-check-input, #selAll { width: 1.35em; height: 1.35em; }
  .stream-row { cursor: pointer; }
}
/* collapsed navigation (phones, tablets): the bar stays at the top, so an opened menu taller
   than the screen (a phone on its side) scrolls inside itself instead of running off the bottom */
@media (max-width: 991.98px) {
  .navbar .navbar-collapse { max-height: calc(100dvh - 4rem); overflow-y: auto; }
  .navbar .nav-account { padding: .5rem 0 .25rem; }
}
/* Tenants table on a phone: one card per tenant instead of a table to scroll sideways */
.min-w-0 { min-width: 0; }
.tenant-cards .list-group-item { padding: .85rem 1rem; }
.tenant-cards .counts { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
/* Rules table on a phone: each rule stacks its fields, labelled */
@media (max-width: 767.98px) {
  .rules-table thead { display: none; }
  .rules-table, .rules-table tbody, .rules-table tr, .rules-table td { display: block; width: 100%; }
  .rules-table tr { position: relative; display: flex; flex-direction: column; padding: .6rem .75rem; border-bottom: 1px solid var(--bs-border-color); }
  .rules-table tr.d-none { display: none; }
  .rules-table tr > td { border: 0; padding: .1rem 0; }
  .rules-table td:empty { display: none; }
  .rules-table td[data-label]::before { content: attr(data-label) ": "; color: var(--bs-secondary-color); font-size: .85em; }
  .rules-table td.rule-id { position: absolute; top: .6rem; right: .75rem; width: auto; }
  .rules-table td.rule-kind { order: -1; font-weight: 600; padding-right: 3rem; }
  .rules-table td.rule-actions { text-align: start !important; padding-top: .4rem; }
  .rules-table tr#emptyRow td { display: block; }
}

/* Ratings page */
.search-poster { width: 46px; height: 68px; border-radius: 4px; overflow: hidden; background: var(--bs-tertiary-bg); }
.search-poster img { width: 100%; height: 100%; object-fit: cover; }

/* analytics: palette roles from the data-viz reference palette, light + dark steps */
.viz-root {
  --viz-surface: #fcfcfb; --viz-ink: #0b0b0b; --viz-ink-2: #52514e; --viz-muted: #898781;
  --viz-grid: #e1e0d9; --viz-axis: #c3c2b7;
  --viz-s1: #2a78d6; --viz-s2: #eb6834; --viz-s3: #1baf7a; --viz-s4: #eda100;
  --viz-critical: #d03b3b;
  --viz-seq-0: #f0efec;
  --viz-seq-1: #cde2fb; --viz-seq-2: #9ec5f4; --viz-seq-3: #6da7ec; --viz-seq-4: #3987e5;
  --viz-seq-5: #256abf; --viz-seq-6: #184f95; --viz-seq-7: #0d366b;
}
[data-bs-theme="dark"] .viz-root {
  --viz-surface: #1a1a19; --viz-ink: #f0efec; --viz-ink-2: #c3c2b7; --viz-muted: #898781;
  --viz-grid: #2c2c2a; --viz-axis: #383835;
  --viz-s1: #3987e5; --viz-s2: #d95926; --viz-s3: #199e70; --viz-s4: #c98500;
  --viz-critical: #d03b3b;
  --viz-seq-0: #2c2c2a;
  --viz-seq-1: #104281; --viz-seq-2: #184f95; --viz-seq-3: #1c5cab; --viz-seq-4: #256abf;
  --viz-seq-5: #2a78d6; --viz-seq-6: #5598e7; --viz-seq-7: #86b6ef;
}
.viz-root .card { background: var(--viz-surface); }
.viz-hero { font-size: 3.25rem; font-weight: 600; line-height: 1.1; color: var(--viz-ink); }
.viz-tile-label { font-size: .85rem; color: var(--viz-ink-2); }
.viz-tile-value { font-size: 1.6rem; font-weight: 600; color: var(--viz-ink); }
.viz-card-title { font-weight: 600; color: var(--viz-ink); margin: 0; }
.viz-card-sub { font-size: .8rem; color: var(--viz-ink-2); }
.viz-chart { position: relative; height: 280px; }
.viz-chart.short { height: 220px; }
#vizBody.is-loading { opacity: .5; transition: opacity .15s; }
.viz-table { font-size: .85rem; font-variant-numeric: tabular-nums; }
.viz-table td.num, .viz-table th.num { text-align: right; }
.viz-heat { display: grid; grid-template-columns: 2.6rem repeat(24, minmax(0, 1fr)); gap: 2px; font-size: .7rem; color: var(--viz-muted); }
.viz-heat .cell { aspect-ratio: 1 / 1; border-radius: 3px; min-height: 12px; outline-offset: 1px; cursor: default; }
.viz-heat .cell:hover, .viz-heat .cell:focus { outline: 2px solid var(--viz-ink); }
.viz-heat .rowlbl { align-self: center; color: var(--viz-ink-2); }
.viz-heat .collbl { text-align: center; }
.viz-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .8rem; color: var(--viz-ink-2); }
.viz-legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }
.viz-legend .key.line { height: 2px; border-radius: 1px; vertical-align: 3px; }
.viz-ramp { display: inline-flex; gap: 2px; vertical-align: middle; }
.viz-ramp span { width: 14px; height: 10px; border-radius: 2px; }
.viz-seg { display: flex; gap: 2px; height: 28px; }
.viz-seg > div { border-radius: 4px; color: #fff; font-size: .75rem; padding: 0 .4rem; display: flex; align-items: center; white-space: nowrap; overflow: hidden; min-width: 0; }
.viz-tooltip { position: fixed; z-index: 1080; pointer-events: none; background: var(--bs-body-bg); color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color); border-radius: 6px; padding: .4rem .55rem; font-size: .8rem; box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.viz-tooltip strong { font-size: .95rem; }
.viz-empty { color: var(--viz-muted); font-size: .9rem; padding: 2.5rem 0; text-align: center; }
