/* Override sheet layered on the vendored base sheet. Only the pieces the base
   does not cover: the webface, table density, the call-log controls and a few
   status glyphs. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --tblr-font-sans-serif: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cg-dot-size: 0.5rem;
  --cg-accent: color-mix(in srgb, var(--tblr-primary) 88%, #000000);
}

/* On the dark ground the base link and accent blues sit under 4.5:1, so both
   are lifted; every other colour stays as the base sheet defines it. */
[data-bs-theme="dark"] {
  --cg-accent: #6aa9e3;
  --tblr-link-color: #6aa9e3;
  --tblr-link-color-rgb: 106, 169, 227;
  --tblr-link-hover-color: #8ec0ec;
  --tblr-link-hover-color-rgb: 142, 192, 236;
}

/* An element carrying the attribute stays out of the layout whatever the
   component sheet sets on its class. */
[hidden] {
  display: none !important;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Wordmark, in the navbar and on the pages that have no navbar. */
.navbar-brand,
.brand-wordmark {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--tblr-body-color);
  text-decoration: none;
}

.navbar-brand {
  padding-right: 1.5rem;
}

.brand-wordmark {
  display: inline-block;
  font-size: 1.5rem;
}

.navbar .nav-link {
  font-weight: 500;
}

.navbar-nav .nav-item.active .nav-link {
  color: var(--cg-accent);
}

/* Figures read as data: lining, equal-width digits. */
.stat-figure,
.figure,
.score,
.calls-table td[data-f="time"],
.calls-table td[data-f="from"],
.calls-table td[data-f="duration"] {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1;
}

.stat-figure {
  margin-top: 0.125rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.card-link .stat-figure {
  color: var(--cg-accent);
}

.stat-figure-sm {
  font-size: 1rem;
  font-weight: 600;
}

.figure {
  font-weight: 600;
}

/* Filter row above the call table. */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.chiprow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.chiprow-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tblr-secondary);
}

.chip {
  --tblr-btn-padding-y: 0.3rem;
  --tblr-btn-padding-x: 0.6rem;
  --tblr-btn-font-size: 0.8125rem;
  gap: 0.375rem;
}

.chip[aria-pressed="true"] {
  --tblr-btn-color: #ffffff;
  --tblr-btn-bg: var(--tblr-primary);
  --tblr-btn-border-color: var(--tblr-primary);
  --tblr-btn-hover-color: #ffffff;
  --tblr-btn-hover-bg: var(--tblr-primary);
  --tblr-btn-hover-border-color: var(--tblr-primary);
  z-index: 1;
}

.chip .count {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 100rem;
  background: var(--tblr-bg-surface-secondary);
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.25rem;
  text-align: center;
}

.chip[aria-pressed="true"] .count {
  background: rgba(0, 0, 0, 0.22);
}

.search-group {
  flex: 1 1 16rem;
  max-width: 26rem;
}

.search-group .input-group-text {
  color: var(--tblr-secondary);
}

/* With the clear control removed the field keeps its own rounded end. */
.search-group:has(#calls-clear[hidden]) .form-control {
  border-top-right-radius: var(--tblr-border-radius);
  border-bottom-right-radius: var(--tblr-border-radius);
}

/* Sortable column headers: a full-width button with a state caret. */
.sortbtn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin: -0.4rem -0.45rem;
  padding: 0.4rem 0.45rem;
  font: inherit;
  color: inherit;
  text-align: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.sortbtn:hover {
  color: var(--tblr-body-color);
}

.sortbtn .arrow {
  width: 0;
  height: 0;
  border-left: 0.25rem solid transparent;
  border-right: 0.25rem solid transparent;
}

th[aria-sort="none"] .arrow {
  border-top: 0.3rem solid currentColor;
  opacity: 0.3;
}

th[aria-sort="ascending"] .arrow {
  border-bottom: 0.3rem solid currentColor;
}

th[aria-sort="descending"] .arrow {
  border-top: 0.3rem solid currentColor;
}

th[aria-sort="ascending"],
th[aria-sort="descending"] {
  color: var(--tblr-body-color);
}

/* Call table density. */
.calls-table > :not(caption) > * > * {
  padding: 0.4rem 0.45rem;
}

.calls-table td[data-f="time"] {
  font-size: 0.8125rem;
  color: var(--tblr-secondary);
}

.calls-table td[data-f="from"] a {
  color: var(--tblr-body-color);
  font-weight: 500;
  text-decoration: none;
}

.calls-table td[data-f="from"] a:hover {
  color: var(--cg-accent);
  text-decoration: underline;
}

.calls-table th,
.calls-table td[data-f="time"],
.calls-table td[data-f="from"],
.calls-table td[data-f="class"],
.calls-table td[data-f="category"],
.calls-table td[data-f="line"],
.calls-table td[data-f="region"],
.calls-table td[data-f="country"],
.calls-table td[data-f="action"],
.calls-table td[data-f="duration"],
.calls-table td[data-f="media"] {
  white-space: nowrap;
}

.calls-table td[data-f="score"] {
  white-space: nowrap;
}

/* Two-letter code, set as data rather than prose. */
.calls-table td[data-f="country"] {
  font-family: var(--tblr-font-monospace);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

.calls-table .score {
  display: inline-block;
  min-width: 1.75rem;
  font-weight: 600;
}

/* The reason is a hint beside the figure, not a column of its own. */
.calls-table td[data-f="score"] .reason {
  display: inline-block;
  max-width: 22ch;
  overflow: hidden;
  vertical-align: bottom;
  text-overflow: ellipsis;
  font-size: 0.75rem;
}

/* Tabler's button focus shadow variables are undefined in the built sheet, so
   the ring is drawn with an outline instead. */
.btn:focus-visible,
.navbar-toggler:focus-visible {
  outline: 2px solid var(--cg-accent);
  outline-offset: 2px;
}

.calls-table td[data-f="name"],
.calls-table td[data-f="carrier"] {
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calls-table td[data-f="class"] > * + * {
  margin-left: 0.375rem;
}

.badge.verdict {
  text-transform: none;
  font-weight: 600;
}

/* The tinted label sits at the same hue as its background, which lands under
   4.5:1 either way, so it is pushed away from the ground on both themes. */
.badge.verdict.bg-red-lt {
  --cg-verdict: var(--tblr-red);
}

.badge.verdict.bg-green-lt {
  --cg-verdict: var(--tblr-green);
}

.badge.verdict.bg-azure-lt {
  --cg-verdict: var(--tblr-azure);
}

.badge.verdict {
  color: color-mix(in srgb, var(--cg-verdict, var(--tblr-secondary)) 58%, #000000) !important;
}

[data-bs-theme="dark"] .badge.verdict {
  color: color-mix(in srgb, var(--cg-verdict, var(--tblr-secondary)) 70%, #ffffff) !important;
}

/* In-progress marker, on a row and beside the call heading. */
.live-flag {
  --tblr-status-height: 1.375rem;
  padding-left: 0.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.live-flag::before {
  content: "";
  width: var(--cg-dot-size);
  height: var(--cg-dot-size);
  border-radius: 100rem;
  background: currentColor;
  animation: 1.6s ease-in-out infinite cg-pulse;
}

@keyframes cg-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

/* Recording link in the media column. */
.audio-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
}

.audio-link::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 0.4rem solid currentColor;
  border-top: 0.28rem solid transparent;
  border-bottom: 0.28rem solid transparent;
}

.audio-link:hover {
  text-decoration: underline;
}

/* Recording transport. One block per media source, full card width. */
.cg-player {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem;
  border: var(--tblr-border-width) var(--tblr-border-style) var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  background: var(--tblr-bg-surface-secondary);
}

.cg-player + .cg-player {
  margin-top: 0.75rem;
}

/* Only rendered while the element still carries its own controls. */
.cg-player audio {
  width: 100%;
}

.cg-player:focus-visible {
  outline: 2px solid var(--cg-accent);
  outline-offset: 2px;
}

.cg-player-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.cg-player-name {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tblr-body-color);
}

.cg-player-clock {
  font-family: var(--tblr-font-monospace);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1;
  font-size: 0.8125rem;
  color: var(--tblr-body-color);
}

.cg-player-sep {
  padding: 0 0.3rem;
}

/* Track fill: played, then buffered, then the remainder. */
.cg-seek {
  --cg-played: 0%;
  --cg-buffered: 0%;
  --cg-track: var(--tblr-border-color);
  --cg-buffer: color-mix(in srgb, var(--cg-accent) 30%, var(--tblr-border-color));
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2.75rem;
  margin: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.cg-seek::-webkit-slider-runnable-track {
  height: 0.875rem;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--cg-accent) 0% var(--cg-played),
    var(--cg-buffer) var(--cg-played) var(--cg-buffered),
    var(--cg-track) var(--cg-buffered) 100%
  );
}

.cg-seek::-moz-range-track {
  height: 0.875rem;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--cg-accent) 0% var(--cg-played),
    var(--cg-buffer) var(--cg-played) var(--cg-buffered),
    var(--cg-track) var(--cg-buffered) 100%
  );
}

.cg-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: -0.3125rem;
  border: 2px solid var(--tblr-bg-surface);
  border-radius: 50%;
  background: var(--cg-accent);
}

.cg-seek::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--tblr-bg-surface);
  border-radius: 50%;
  background: var(--cg-accent);
}

.cg-seek:focus-visible {
  outline: none;
}

.cg-seek:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--tblr-bg-surface-secondary), 0 0 0 5px var(--cg-accent);
}

.cg-seek:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--tblr-bg-surface-secondary), 0 0 0 5px var(--cg-accent);
}

.cg-player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

/* Tighter inside a group than between them, so the two read apart. */
.cg-player-group {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.cg-pbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.25rem;
  border: var(--tblr-border-width) var(--tblr-border-style) var(--tblr-border-color);
  border-radius: 999px;
  background: var(--tblr-bg-surface);
  color: var(--tblr-body-color);
  line-height: 1;
  cursor: pointer;
}

.cg-pbtn:hover {
  border-color: var(--cg-accent);
  color: var(--cg-accent);
}

.cg-pbtn:focus-visible {
  outline: 2px solid var(--cg-accent);
  outline-offset: 2px;
}

/* The interval sits beside the arc rather than inside it. */
.cg-pbtn-skip {
  gap: 0.125rem;
  padding: 0 0.5rem;
}

.cg-pbtn-skip .icon {
  width: 22px;
  height: 22px;
}

.cg-pbtn-num {
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: lining-nums;
  pointer-events: none;
}

.cg-pbtn-main {
  min-width: 3.5rem;
  height: 3.5rem;
  border-color: transparent;
  background: var(--cg-accent);
  color: #ffffff;
}

.cg-pbtn-main:hover {
  border-color: transparent;
  background: var(--cg-accent);
  color: #ffffff;
}

/* The dark-ground accent is the lighter of the two, so the glyph flips. */
[data-bs-theme="dark"] .cg-pbtn-main,
[data-bs-theme="dark"] .cg-pbtn-main:hover {
  color: #10161d;
}

.cg-pbtn-main .icon {
  width: 28px;
  height: 28px;
}

.cg-pbtn-rate {
  min-width: 3.25rem;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}

/* Call detail. */
.datagrid-content {
  overflow-wrap: anywhere;
}

.callback {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.list-group-item.line {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.list-group-item.line b {
  flex: 0 0 4rem;
  padding-top: 0.1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--tblr-secondary);
}

.list-group-item.caller b {
  color: var(--tblr-azure);
}

.raw-block + .raw-block {
  margin-top: 0.5rem;
}

.raw-block > summary {
  padding: 0.4rem 0.6rem;
  border-radius: var(--tblr-border-radius);
  background: var(--tblr-bg-surface-secondary);
  cursor: pointer;
  font-weight: 500;
}

.raw-block > pre {
  max-height: 24rem;
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  overflow: auto;
  border: var(--tblr-border-width) var(--tblr-border-style) var(--tblr-border-color);
  border-radius: var(--tblr-border-radius);
  background: var(--tblr-bg-surface-secondary);
  font-size: 0.75rem;
  line-height: 1.5;
}

/* Chart surfaces keep a fixed box so the canvas has something to size against. */
.chart-box {
  position: relative;
  height: 16rem;
}

/* Columns that carry secondary detail drop out on small screens. */
@media (max-width: 991.98px) {
  .hide-narrow {
    display: none;
  }

  .calls-table td[data-f="score"] .reason {
    max-width: 12ch;
  }
}

/* Below the breakpoint the joined group would run off the viewport, so the
   chips wrap as separate controls. */
@media (max-width: 767.98px) {
  .chiprow {
    display: block;
  }

  .chiprow-label {
    display: block;
    margin-bottom: 0.375rem;
  }

  .chips.btn-group {
    flex-wrap: wrap;
    gap: 0.375rem;
  }

  .chips.btn-group > .btn,
  .chips.btn-group > .btn:not(:first-child),
  .chips.btn-group > .btn:not(:last-child) {
    flex: 0 0 auto;
    margin-left: 0;
    min-height: 44px;
    border-radius: var(--tblr-border-radius);
  }

  .navbar-toggler {
    min-width: 44px;
    min-height: 44px;
  }

  .filterbar {
    gap: 0.75rem;
  }

  .search-group {
    max-width: none;
  }
}

@media print {
  .navbar,
  .filterbar,
  .btn-list,
  .cg-player-controls,
  .cg-seek {
    display: none !important;
  }

  .card {
    border: 1px solid #000000;
    break-inside: avoid;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-flag::before {
    animation: none;
  }
}

@media (forced-colors: active) {
  .chip[aria-pressed="true"] {
    outline: 2px solid;
  }

  .badge.verdict,
  .live-flag,
  .cg-pbtn {
    border: 1px solid;
  }

  .cg-seek::-webkit-slider-thumb {
    forced-color-adjust: none;
  }

  .cg-seek::-moz-range-thumb {
    forced-color-adjust: none;
  }

  .sortbtn .arrow {
    forced-color-adjust: none;
  }
}
