html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
  background-color: #f5f6f8;
  color: #2b2f33;
}

/* --- Simple, clean surface styling --- */
.navbar {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.navbar-brand {
  font-weight: 600;
}

.card {
  border: 1px solid #e7e9ec;
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.table {
  background-color: #fff;
}

.btn {
  border-radius: 0.4rem;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-check-input:focus, .form-select:focus {
  box-shadow: 0 0 0 0.2rem rgba(37, 140, 251, 0.25);
}

main {
  padding-top: 0.5rem;
}

/* --- Priority colours: red = Urgent, green = Low --- */
.badge.priority-urgent { background-color: #dc3545; color: #fff; }
.badge.priority-high   { background-color: #fd7e14; color: #fff; }
.badge.priority-medium { background-color: #ffc107; color: #212529; }
.badge.priority-low    { background-color: #198754; color: #fff; }

.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
}

/* --- TV monitoring mode (/Tickets/Distribute?tv=true) ---
   Hides the site chrome so only the distribution board shows, sized to be
   readable on a wall-mounted display. */
body.tv-mode > header,
body.tv-mode > .footer {
  display: none;
}

/* Scale with the display rather than assuming a wall TV: readable at 1080p, still
   fits a small window (tested down to 849x557) without a horizontal scrollbar. */
body.tv-mode {
  margin-bottom: 0;
  font-size: clamp(0.7rem, 1.15vw, 1.15rem);
}

body.tv-mode > .container {
  max-width: 100%;
  padding: 0.4rem 0.5rem 0;
}

body.tv-mode .table {
  font-size: 1em;
}

/* Trim the chrome so vertical space goes to ticket rows, not padding. */
body.tv-mode h1 {
  font-size: clamp(0.95rem, 1.9vw, 1.75rem);
}

body.tv-mode .card {
  margin-bottom: 0.5rem !important;
}

body.tv-mode .card-header {
  padding: 0.2rem 0.5rem;
}

body.tv-mode .table > :not(caption) > * > * {
  padding: 0.2rem 0.35rem;
}

body.tv-mode .btn-sm,
body.tv-mode .form-select-sm {
  padding: 0.1rem 0.3rem;
  font-size: 0.85em;
}

/* The assign controls reserve 260px on the full-size board; let them shrink here. */
body.tv-mode .table th[style] {
  min-width: 0 !important;
}

/* Priority colours, defined once and shared by the ticket rows and the legend.
   --tv-tint is the row fill; --tv-edge is the saturated bar, matching the priority
   badge colours used on the full-size board. */
body.tv-mode .tv-priority-urgent {
  --tv-tint: #f8d7da;
  --tv-edge: #dc3545;
}

body.tv-mode .tv-priority-high {
  --tv-tint: #ffe5d0;
  --tv-edge: #fd7e14;
}

body.tv-mode .tv-priority-medium {
  --tv-tint: #fff3cd;
  --tv-edge: #ffc107;
}

body.tv-mode .tv-priority-low {
  --tv-tint: #d1e7dd;
  --tv-edge: #198754;
}

/* Tint each row by priority so the board reads at a glance and the Priority column can
   be dropped. Bootstrap paints cells from --bs-table-bg, so setting the variable (rather
   than background-color) keeps the realtime highlight, which sets it inline, on top. */
body.tv-mode .table > tbody > tr[class*="tv-priority-"] {
  --bs-table-bg: var(--tv-tint);
}

body.tv-mode .table > tbody > tr[class*="tv-priority-"] > td:first-child {
  border-left: 8px solid var(--tv-edge);
}

/* Legend: the row tint is the only priority cue left once the column is gone. */
body.tv-mode .tv-legend-item {
  background-color: var(--tv-tint);
  border-left: 6px solid var(--tv-edge);
  border-radius: 0.2rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.8em;
  white-space: nowrap;
  color: #212529;
}

/* Exit control stays out of the way until the mouse finds it. */
.tv-exit {
  position: fixed;
  bottom: 0.75rem;
  right: 0.75rem;
  z-index: 1080;
  opacity: 0.2;
  transition: opacity 0.2s;
}

.tv-exit:hover,
.tv-exit:focus {
  opacity: 1;
}
