:root {
  --bs-nav-link-font-size: 1rem;
  --bs-list-group-item-padding-x: 0.8rem;
  --bs-list-group-item-padding-y: 0.1rem;

  --dt-row-stripe: 160, 160, 160;

  --font-size-smaller: 0.8rem;
  --font-size-smallest: 0.65rem;
}

.navbar {
  --bs-navbar-padding-y: 0;
}

.navbar-brand {
  --bs-navbar-brand-font-size: 1rem;
  --bs-navbar-brand-margin-end: 0.5rem;
  padding-bottom: 0;
}

.dropdown-menu {
  --bs-dropdown-item-padding-x: 0.5rem;
  --bs-dropdown-item-padding-y: 0.1rem;
}

.accordion {
  --bs-accordion-btn-padding-x: 1.0rem;
  --bs-accordion-btn-padding-y: 0.5rem;
  --bs-accordion-body-padding-y: 0.5rem;
}

.card {
  --bs-card-spacer-x: 0.5rem;
  --bs-card-spacer-y: 0.25rem;
  --bs-card-cap-padding-x: 0.7rem;
  --bs-card-cap-padding-y: 0.2rem;
  --bs-card-cap-bg: rgba(var(--bs-body-color-rgb), 0.09);
  --bs-card-border-color: var(--bs-border-color);
}

.card-footer {
  --bs-card-cap-bg: rgba(var(--bs-body-color-rgb), 0.01);
}

.input-group-text {
  background-color: rgba(var(--bs-body-color-rgb), 0.09);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
}

.table {
  --bs-table-color: var(--bs-body-color);
  --bs-table-striped-color: var(--bs-body-color);
}

.btn-close {
  font-size: var(--font-size-smallest);
}

.btn-sm,
.btn-xs {
  border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important;
}

.btn-xs {
  --bs-btn-padding-y: 0.1rem;
  --bs-btn-padding-x: 0.3rem;
}

.form-control-static {
  --bs-border-width: 0;
}

.short-input {
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.auto-width {
  width: auto;
  display: inline;        /* .form-control is display:block, which would break the flow */
  field-sizing: content;  /* Automatically fits the text length */
  min-width: 100px;       /* Keeps it from completely collapsing when empty */
}

/* Tighter than Bootstrap's 0.5rem default, looser than .table-sm's 0.25rem. */
.table > :not(caption) > * > * {
  padding: 0.3rem;
}

.footer-hr {
  margin: 0;
}

.nonprod-warning {
  background-color: #dc3545;
  color: #ffffff;
  font-size: 1rem;
}

.flex-input-container {
  display: flex;
}

.flex-input-container > label {
  margin: 0.3rem;
}

.flex-input-container > input {
  flex: 2;
}

.list-group-small > .list-group-item {
  padding: 0.2rem 0.3rem;
  font-size: var(--font-size-smaller);
}

.report_entry_system,
.report_entry_stricken {
  filter: opacity(75%);
}

.report_entry_stricken {
  text-decoration: line-through;
}

.report_entry_system > .report_entry_text {
  margin: 0 0 0 0.5rem;
}

.report_entry_metadata {
  font-size: var(--font-size-smallest);
  font-weight: bold;
  text-decoration: underline;
  filter: opacity(75%);
  margin: 0.9rem 0 0 0;
}

/*
 * The app runs at a smaller type scale than Bootstrap's default. Anything that
 * needs to opt in explicitly can use .text-smaller (or Bootstrap's .fs-6 to opt
 * back out to 1rem).
 */
.table,
.btn-sm,
.btn-xs,
.form-control,
.control-label,
.control-follow-text,
.search-box,
.dt-info,
.footer-text,
.report_entry_text,
.report_entry_system,
.report_entry_stricken,
.text-smaller {
  font-size: var(--font-size-smaller);
}

.control-label {
  font-weight: 700;
}

/*
 * IMS links are flat by default, which suits the app's chrome (nav, dropdowns,
 * list groups, table cells) but not prose: a link sitting in a block of text
 * and distinguished from it only by color fails WCAG 1.4.1. So underline links
 * in running text, and give other plain links an underline on hover/focus as a
 * non-color cue that they're interactive.
 *
 * Links that are styled as components -- buttons, nav items, dropdown items,
 * pagination -- already look interactive, so they stay flat throughout.
 */
a {
  text-decoration: none;
}

a:not(.btn, .nav-link, .navbar-brand, .dropdown-item, .page-link):hover,
a:not(.btn, .nav-link, .navbar-brand, .dropdown-item, .page-link):focus-visible {
  text-decoration: underline;
}

main :is(p, li) a:not(.btn),
.modal-body :is(p, li) a:not(.btn) {
  text-decoration: underline;
}

/* ...but list groups and cards are chrome, not prose. */
main .list-group-item a,
main .card-header a,
main .dropdown-item {
  text-decoration: none;
}

h1 {
  margin-top: 0.8rem;
  font-size: 1.8rem;
}

/*
 * Below is a trick to hide the remove buttons (.remove-badge) from list
 * groups except when hovering, but only on non-touch devices.
 */

.no-touch .remove-badge {
  display: none;
}

.no-touch :is(.list-group-item, .report_entry):hover .remove-badge {
  display: inline-block;
}

/* Disable on touch devices, and override the hover behavior above, if editing
   is disabled. */
.no-edit .remove-badge,
.no-edit :is(.list-group-item, .report_entry):hover .remove-badge,
.no-edit :is(.new_incident, .new_field_report) {
  display: none;
}

#report_entry_add {
  resize: vertical;
  min-height: 8rem;
  field-sizing: content;
}

.item-hidden > .badge-visible,
.item-visible > .badge-hidden {
  display: none;
}

/*
 * Bootstrap's .badge forces white text, which is unreadable on the light
 * backgrounds of .btn-warning and .btn-light. Defer to the button's own
 * (theme-aware, contrast-checked) foreground color instead.
 */
.badge.btn-warning,
.badge.btn-light {
  color: var(--bs-btn-color);
}

/*
 * Bootstrap's .btn-outline-secondary keeps its light-theme grey (#6c757d) in
 * dark mode, where it doesn't have enough contrast against the dark background.
 * Use the theme's own body/border colors, which do.
 */
[data-bs-theme="dark"] .btn-outline-secondary {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: var(--bs-border-color);
  --bs-btn-hover-color: var(--bs-body-color);
  --bs-btn-hover-bg: var(--bs-secondary-bg);
  --bs-btn-hover-border-color: var(--bs-border-color);
}

.hide-history :is(.report_entry_system, .report_entry_stricken) {
  display: none;
}

.bi {
  width: 1em;
  height: 1em;
  vertical-align: -.125em;
  fill: currentcolor
}

.logo-icon {
  width: 2.5rem;
  height: 1.8rem;
  fill: currentcolor
}

@media print {
  .no-print {
    display: none;
  }

  /* don't print the full name under the abbreviation */
  abbr[title]:after {
    content: "";
  }

  .event_access .card-header {
    position: static;
    box-shadow: none;
  }
}

.hidden {
  display: none !important;
}

/* Bootstrap's .visually-hidden-focusable reveals this on keyboard focus; these
   rules just make it look like a button when it appears. */
.skip-link:focus-visible {
  display: inline-block;
  margin: 0.25rem;
  padding: 0.5rem 1rem;
  border-radius: var(--bs-border-radius);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  outline: 2px solid var(--bs-primary);
  text-decoration: none;
}

.dropdown-item-checkable {
  padding: var(--bs-dropdown-item-padding-y) 1.5rem;
}

.dropdown-item-checked::before {
  position: absolute;
  left: .4rem;
  content: '✓';
  font-weight: 600;
}

/* Rows in these tables are click-to-open. They're rendered by DataTables, so
   the rows can't carry .show-pointer themselves. */
:is(#queue_table, #field_reports_table, #visits_table, #places_table, #search_results_table) > tbody > tr,
.show-pointer {
  cursor: pointer;
}

/*
 * Event cards on the admin Events & Permissions page can be taller than the
 * window, so each card's header stays pinned to the top while its own card is
 * on screen. The header's usual background is translucent, so it needs an
 * opaque backing color to keep the card body from showing through it.
 */
.event_access .card-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background-color: var(--bs-card-bg);
  background-image: linear-gradient(var(--bs-card-cap-bg), var(--bs-card-cap-bg));
}

/* Set by admin_events.ts while the header is actually pinned. */
.event_access .card-header.is-stuck {
  box-shadow: 0 0.25rem 0.35rem -0.1rem rgba(var(--bs-body-color-rgb), 0.2);
}

/*
 * Grant Blocks on the admin Events & Permissions page. A "grant" groups the
 * access rules that share a level, validity, and date window; its targets
 * ("whos") render as chips beneath the shared terms.
 */
.grant {
  border: var(--bs-border-width) solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  background-color: rgba(var(--bs-body-color-rgb), 0.02);
}

.grant-description {
  padding: 0.35rem 0.55rem 0;
}

.grant-header {
  padding: 0.35rem 0.55rem;
  border-bottom: var(--bs-border-width) dashed var(--bs-border-color);
}

.grant-body {
  padding: 0.5rem 0.55rem;
}

/* A not-yet-saved grant the admin is composing. */
.grant-draft {
  border-style: dashed;
  background-color: transparent;
}

.who-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--bs-font-monospace);
  font-size: var(--font-size-smaller);
  line-height: 1.5;
  background-color: var(--bs-body-bg);
  border: var(--bs-border-width) solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 0.1rem 0.1rem 0.1rem 0.45rem;
}

/*
 * Plain-language gloss for an expression whose literal form is opaque, e.g. "*".
 * Roman and muted, so it reads as an annotation rather than part of the
 * monospace expression the admin actually typed.
 */
.who-gloss {
  font-family: var(--bs-body-font-family);
  color: var(--bs-secondary-color);
  margin-left: 0.4rem;
}

/*
 * A chip whose target doesn't match any known person, position, or team. Use
 * Bootstrap's coordinated subtle-background / emphasis-text danger tokens,
 * which are contrast-checked in both themes (a plain --bs-danger foreground on
 * a tinted background falls below the WCAG AA text-contrast threshold).
 */
.who-chip.who-unknown {
  color: var(--bs-danger-text-emphasis);
  border-color: var(--bs-danger-border-subtle);
  background-color: var(--bs-danger-bg-subtle);
}

.who-remove {
  border: 0;
  border-left: var(--bs-border-width) solid var(--bs-border-color);
  background: transparent;
  color: var(--bs-secondary-color);
  padding: 0 0.4rem;
  margin-left: 0.35rem;
  line-height: 1;
  cursor: pointer;
}

.who-remove:hover,
.who-remove:focus-visible {
  color: var(--bs-danger);
}

.who-chip.who-unknown .who-remove {
  border-left-color: var(--bs-danger-border-subtle);
  color: var(--bs-danger-text-emphasis);
}

.overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: 1000;
  top: 40%;
  left: 0;
}

.white-space-pre-wrap {
  white-space: pre-wrap !important;
}

.mw-4rem {
  min-width: 4rem !important;
}

.place-dl > dd {
  padding-left: 1rem;
}

.hover-placeholder::placeholder {
  opacity: 0;
  transition: opacity 0.05s ease;
}

.hover-placeholder:hover::placeholder {
  opacity: 1;
}
