/* Melde-Tool's own colours on top of Tabler (no NetBox colours). */
/* Accent: DEU blue #0374B5 (white text on it: 5.0:1, WCAG AA); lighter in dark mode. */
:root,
[data-bs-theme=light] {
  --tblr-primary: #0374b5;
  --tblr-primary-rgb: 3, 116, 181;
  --tblr-primary-fg: #ffffff;
  --tblr-primary-darken: #03639a;
  --tblr-primary-lt: #e6f1f8;
  --tblr-primary-lt-rgb: 230, 241, 248;
  --tblr-link-color: #0374b5;
  --tblr-link-color-rgb: 3, 116, 181;
  --tblr-link-hover-color: #03639a;
  --tblr-link-hover-color-rgb: 3, 99, 154;
}

[data-bs-theme=dark] {
  --tblr-primary: #4aa3df;
  --tblr-primary-rgb: 74, 163, 223;
  --tblr-primary-fg: #04182a;
  --tblr-primary-darken: #3a95d3;
  --tblr-primary-lt: #12324c;
  --tblr-primary-lt-rgb: 18, 50, 76;
  --tblr-link-color: #6db6e8;
  --tblr-link-color-rgb: 109, 182, 232;
  --tblr-link-hover-color: #9acdf0;
  --tblr-link-hover-color-rgb: 154, 205, 240;
}

/* Logo: icon tile + two-colour wordmark ("Melde-" in the text colour, "Tool" in the accent). */
:root {
  --mt-logo-accent: #0374b5;
  --mt-logo-accent-on-dark: #a9d8f5;
}

.text-logo {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.25rem;
  line-height: 1;
}

.text-logo-lg {
  font-size: 2rem;
}

.mt-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.mt-logo-icon {
  width: 1.6em;
  height: 1.6em;
  flex: none;
}

.mt-logo-tile {
  fill: var(--mt-logo-accent);
}

.mt-wordmark {
  color: var(--tblr-body-color);
}

.mt-wordmark-accent {
  color: var(--mt-logo-accent);
}

[data-bs-theme=dark] .mt-wordmark {
  color: #ffffff;
}

[data-bs-theme=dark] .mt-wordmark-accent {
  color: var(--mt-logo-accent-on-dark);
}

/* Theme switch: show only the button that switches away from the current theme. */
[data-bs-theme=dark] .theme-only-light,
:root:not([data-bs-theme=dark]) .theme-only-dark {
  display: none !important;
}

/* Staging only (STAGING setting): a red bar so nobody mistakes it for the real tool. */
.test-banner {
  background: #c8102e;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 0.25rem;
}

/* Legal texts (accounts/legal.py): headings sized for a card, placeholders stand out. */
.legal-text h2 { font-size: 1.125rem; margin-top: 1.75rem; }
.legal-text h3 { font-size: 1rem; margin-top: 1.25rem; }
.legal-text mark { background: #ffe066; color: #1d273b; padding: 0 0.2em; }
.legal-text table { width: 100%; margin-bottom: 1rem; }
.legal-text th, .legal-text td { padding: 0.35rem 0.5rem; border-top: 1px solid var(--tblr-border-color); vertical-align: top; }

/* Searchable selects (Tom Select, static/js/searchable-select.js): its Bootstrap 5 theme
   reads --bs-* variables; Tabler names them --tblr-*. */
.ts-wrapper,
.ts-dropdown {
  --bs-body-bg: var(--tblr-bg-forms);
  --bs-body-color: var(--tblr-body-color);
  --bs-border-color: var(--tblr-border-color);
  --bs-border-color-translucent: var(--tblr-border-color-translucent);
  --bs-border-radius: var(--tblr-border-radius);
  --bs-border-radius-lg: var(--tblr-border-radius-lg);
  --bs-border-radius-sm: var(--tblr-border-radius-sm);
  --bs-border-width: var(--tblr-border-width);
  --bs-box-shadow-inset: none;
  --bs-form-invalid-color: var(--tblr-form-invalid-color);
  --bs-form-valid-color: var(--tblr-form-valid-color);
  --bs-secondary-bg: var(--tblr-secondary-bg);
  --bs-tertiary-bg: var(--tblr-tertiary-bg);
}
.ts-dropdown .optgroup-header {
  padding-top: .5rem;
  font-size: 1rem;
  font-weight: var(--tblr-font-weight-bold, 700);
  color: var(--tblr-body-color);
}
.ts-dropdown .optgroup .option {
  padding-left: 1.25rem;
}
.ts-dropdown .active {
  background-color: var(--tblr-primary-lt);
  color: var(--tblr-body-color);
}

/* Disciplines (Q119; the mapping Discipline → colour is competitions.terms.DISCIPLINE_COLOURS).
   A badge: tinted background, dark text of the same hue (contrast ≥ 7:1); in dark mode a
   deep tint with light text. --mt-accent is the solid colour, for a Category row's edge. */
.mt-discipline {
  background: var(--mt-tint);
  color: var(--mt-ink);
  border: 1px solid var(--mt-edge, transparent);
  font-weight: 600;
}
.mt-discipline-red    { --mt-accent: #d63939; --mt-tint: #fbe7e7; --mt-ink: #8f1a1a; }
.mt-discipline-blue   { --mt-accent: #066fd1; --mt-tint: #e3eefb; --mt-ink: #0a4787; }
.mt-discipline-green  { --mt-accent: #2fb344; --mt-tint: #e2f4e5; --mt-ink: #1a5e25; }
.mt-discipline-yellow { --mt-accent: #f0a800; --mt-tint: #fdf1cf; --mt-ink: #6b4a00; }
.mt-discipline-grey   { --mt-accent: #8a94a3; --mt-tint: #eceef1; --mt-ink: #3f4651; }
.mt-discipline-black  { --mt-accent: #1d232b; --mt-tint: #1d232b; --mt-ink: #ffffff; }

[data-bs-theme=dark] .mt-discipline-red    { --mt-tint: #4a1d20; --mt-ink: #f6b3b3; }
[data-bs-theme=dark] .mt-discipline-blue   { --mt-accent: #4299e1; --mt-tint: #16304d; --mt-ink: #a9cff5; }
[data-bs-theme=dark] .mt-discipline-green  { --mt-tint: #173b20; --mt-ink: #9fe0aa; }
[data-bs-theme=dark] .mt-discipline-yellow { --mt-tint: #45360d; --mt-ink: #f7d47c; }
[data-bs-theme=dark] .mt-discipline-grey   { --mt-tint: #2c333d; --mt-ink: #c9cfd6; }
[data-bs-theme=dark] .mt-discipline-black  { --mt-accent: #9aa3af; --mt-tint: #000000; --mt-ink: #ffffff; --mt-edge: #6b7380; }

/* A Category row: its Discipline's colour as a straight bar on the left edge. Drawn as a
   background image: Bootstrap paints table cells with an inset box-shadow, so a shadow
   here would replace that. Tabler rounds the top corner of every first cell in a card table,
   which would bend the bar, so these cells stay square. */
tr[class*="mt-discipline-"] > td:first-child {
  background-image: linear-gradient(to right, var(--mt-accent) 4px, transparent 4px);
  border-radius: 0;
}

/* Icons inside small buttons. */
.btn-sm .icon {
  width: 1rem;
  height: 1rem;
}

/* Numbers in tables are tabular (equal-width digits), so columns of numbers line up. */
.table {
  font-variant-numeric: tabular-nums;
}
