/* ============================================================
   DevTickets — monochrome blue theme
   Bootstrap 5.3.3 tokens remap to a single blue family with
   cool neutrals. Light and dark modes share the same banner.
   ============================================================ */

:root {
  --hs-banner:         #265cc8;
  --hs-banner-text:    #ffffff;

  --hs-primary:        #265cc8;
  --hs-primary-hover:  #1d4aa0;
  --hs-primary-active: #163782;
  --hs-primary-text:   #ffffff;
  --hs-focus-ring:     rgba(38, 92, 200, 0.25);

  --hs-ink:            #1f2d3d;
  --hs-muted:          #5b6b7d;
  --hs-bg:             #f4f6fa;
  --hs-surface:        #ffffff;
  --hs-surface-alt:    #eef2f8;
  --hs-border:         #d6dde7;

  --hs-success:        #2f8f6f;
  --hs-warning:        #b27a00;
  --hs-danger:         #b3261e;

  --hs-shadow:    0 1px 2px rgba(15, 22, 35, 0.04), 0 2px 6px rgba(15, 22, 35, 0.06);
  --hs-shadow-lg: 0 4px 12px rgba(15, 22, 35, 0.08), 0 10px 24px rgba(15, 22, 35, 0.06);
  --hs-radius:    6px;
  --hs-radius-lg: 10px;
  --hs-font:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --bs-body-font-family: var(--hs-font);
  --bs-body-bg:          var(--hs-bg);
  --bs-body-color:       var(--hs-ink);
  --bs-emphasis-color:   var(--hs-ink);
  --bs-secondary-color:  var(--hs-muted);
  --bs-tertiary-bg:      var(--hs-surface-alt);
  --bs-border-color:     var(--hs-border);
  --bs-border-radius:    var(--hs-radius);
  --bs-link-color:       var(--hs-primary);
  --bs-link-hover-color: var(--hs-primary-hover);
  --bs-primary:          var(--hs-primary);
  --bs-primary-rgb:      38, 92, 200;
}

[data-bs-theme="dark"] {
  --hs-ink:         #e6ecf2;
  --hs-muted:       #8a9bb0;
  --hs-bg:          #0f1623;
  --hs-surface:     #19222f;
  --hs-surface-alt: #222d3d;
  --hs-border:      #2a3a52;
  --hs-shadow:      0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.5);
  --hs-shadow-lg:   0 4px 12px rgba(0, 0, 0, 0.55), 0 10px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;

  --bs-body-bg:         var(--hs-bg);
  --bs-body-color:      var(--hs-ink);
  --bs-emphasis-color:  var(--hs-ink);
  --bs-secondary-color: var(--hs-muted);
  --bs-tertiary-bg:     var(--hs-surface-alt);
  --bs-border-color:    var(--hs-border);
}

/* No-JS fallback: follow OS preference until the inline head script
   sets data-bs-theme. */
@media (prefers-color-scheme: dark) {
  html:not([data-bs-theme="light"]) {
    color-scheme: dark;
    --hs-ink:         #e6ecf2;
    --hs-muted:       #8a9bb0;
    --hs-bg:          #0f1623;
    --hs-surface:     #19222f;
    --hs-surface-alt: #222d3d;
    --hs-border:      #2a3a52;
    --hs-shadow:      0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.5);

    --bs-body-bg:         var(--hs-bg);
    --bs-body-color:      var(--hs-ink);
    --bs-emphasis-color:  var(--hs-ink);
    --bs-secondary-color: var(--hs-muted);
    --bs-tertiary-bg:     var(--hs-surface-alt);
    --bs-border-color:    var(--hs-border);
  }
}

/* ============================================================
   Base
   ============================================================ */

html {
  position: relative;
  min-height: 100%;
  font-size: 15px;
}

body {
  margin-top: 64px;
  margin-bottom: 60px;
  font-family: var(--hs-font);
  font-size: 0.9375rem;
  line-height: 1.5;
  background-color: var(--hs-bg);
  color: var(--hs-ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1030;
}

main {
  padding-top: 1.25rem;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--hs-font);
  font-weight: 600;
  color: var(--hs-ink);
  letter-spacing: -0.01em;
  margin-top: 0;
  margin-bottom: 0.75rem;
}

h1, .h1 { font-size: 1.625rem; }   /* ~26px */
h2, .h2 { font-size: 1.25rem; }    /* ~20px */
h3, .h3 { font-size: 1.0625rem; }  /* ~17px */
h4, .h4 {
  font-size: 0.9375rem;            /* ~15px */
  font-weight: 600;
  color: var(--hs-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
h5, .h5 { font-size: 0.9375rem; }
h6, .h6 { font-size: 0.875rem; }

/* Defensive: keep any leftover .display-* sane. */
.display-1, .display-2, .display-3, .display-4 {
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.display-5, .display-6 {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

small, .small { font-size: 0.8125rem; }

a {
  color: var(--hs-primary);
  text-decoration: none;
}
a:hover {
  color: var(--hs-primary-hover);
  text-decoration: underline;
}

/* ============================================================
   Navbar (the fixed blue banner)
   ============================================================ */

.navbar.bg-brand {
  background-color: var(--hs-banner) !important;
  min-height: 64px;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-bottom: 0 !important;
}

.navbar.bg-brand .navbar-brand {
  color: var(--hs-banner-text);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.navbar.bg-brand .navbar-brand:hover { color: var(--hs-banner-text); opacity: 0.9; }

.navbar.bg-brand .nav-link,
.navbar.bg-brand .nav-link-on-brand,
.navbar.bg-brand .nav-link.text-dark {
  color: rgba(255, 255, 255, 0.85) !important;
  font-weight: 500;
  padding: 0.5rem 0.875rem;
  border-radius: var(--hs-radius);
  transition: background-color 120ms ease, color 120ms ease;
}

.navbar.bg-brand .nav-link:hover,
.navbar.bg-brand .nav-link-on-brand:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.navbar.bg-brand .nav-link.active,
.navbar.bg-brand .nav-link-on-brand.active {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.15);
}

.navbar.bg-brand .navbar-toggler {
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
}
.navbar.bg-brand .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath stroke='rgba(255,255,255,0.85)' stroke-width='2' stroke-linecap='round' d='M4 7h22M4 15h22M4 23h22'/%3E%3C/svg%3E");
}

.navbar.bg-brand form .nav-link.btn-link {
  color: rgba(255, 255, 255, 0.85) !important;
  text-decoration: none;
  padding: 0.5rem 0.875rem;
}
.navbar.bg-brand form .nav-link.btn-link:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.1);
}

/* ============================================================
   Dark mode toggle
   ============================================================ */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--hs-radius);
  color: #ffffff;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
}
.theme-toggle:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.theme-toggle-icon::before {
  content: "\263E";
  font-size: 16px;
  line-height: 1;
}
html[data-bs-theme="dark"] .theme-toggle-icon::before {
  content: "\2600";
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  font-family: var(--hs-font);
  font-weight: 500;
  border-radius: var(--hs-radius);
  padding: 0.5rem 1rem;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.btn-sm {
  padding: 0.3125rem 0.625rem;
  font-size: 0.8125rem;
}

.btn-primary {
  color: var(--hs-primary-text);
  background-color: var(--hs-primary);
  border-color: var(--hs-primary);
}
.btn-primary:hover,
.btn-primary:focus {
  color: var(--hs-primary-text);
  background-color: var(--hs-primary-hover) !important;
  border-color: var(--hs-primary-hover) !important;
}
.btn-primary:active,
.btn-primary.active {
  color: var(--hs-primary-text);
  background-color: var(--hs-primary-active) !important;
  border-color: var(--hs-primary-active) !important;
}

.btn-outline-primary {
  color: var(--hs-primary);
  border-color: var(--hs-primary);
  background-color: transparent;
}
.btn-outline-primary:hover {
  background-color: var(--hs-primary);
  border-color: var(--hs-primary);
  color: var(--hs-primary-text);
}

.btn-secondary,
.btn-light {
  background-color: var(--hs-surface);
  border-color: var(--hs-border);
  color: var(--hs-ink);
}
.btn-secondary:hover,
.btn-light:hover {
  background-color: var(--hs-surface-alt);
  border-color: var(--hs-border);
  color: var(--hs-ink);
}

.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 var(--hs-focus-ring);
}

/* ============================================================
   Forms
   ============================================================ */

.form-control,
.form-select {
  background-color: var(--hs-surface);
  border-color: var(--hs-border);
  color: var(--hs-ink);
  border-radius: var(--hs-radius);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.form-control {
    padding: 0.5rem 0.75rem;
}
.form-select {
    padding: 0.5rem 2.5rem 0.5rem 0.75rem;
}
.form-control:focus,
.form-select:focus {
  background-color: var(--hs-surface);
  border-color: var(--hs-primary);
  color: var(--hs-ink);
}

.form-label {
  font-weight: 500;
  color: var(--hs-ink);
  margin-bottom: 0.375rem;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--hs-muted);
  text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ============================================================
   Tables
   ============================================================ */

.table {
  --bs-table-bg:            var(--hs-surface);
  --bs-table-color:         var(--hs-ink);
  --bs-table-striped-bg:    var(--hs-surface-alt);
  --bs-table-striped-color: var(--hs-ink);
  --bs-table-hover-bg:      var(--hs-surface-alt);
  --bs-table-hover-color:   var(--hs-ink);
  --bs-table-border-color:  var(--hs-border);

  background-color: var(--hs-surface);
  border-radius: var(--hs-radius);
  overflow: hidden;
  color: var(--hs-ink);
}

.table > thead {
  background-color: var(--hs-surface);
}

.table > thead th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hs-muted);
  border-bottom: 1px solid var(--hs-border);
  padding: 0.5rem 0.625rem;
}

.table > tbody td {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--hs-border);
  vertical-align: middle;
}

.table > tfoot td {
  padding: 0.5rem 0.625rem;
}

.table > tbody tr:last-child td {
  border-bottom: none;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: var(--hs-surface);
}
.table-striped > tbody > tr:nth-of-type(even) > * {
  background-color: var(--hs-surface-alt);
}

.table-hover > tbody > tr:hover > * {
  background-color: var(--hs-surface-alt);
}

.table-responsive {
  background-color: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  box-shadow: var(--hs-shadow);
}
.table-responsive > .table {
  margin-bottom: 0;
}

main .table:not(.table-responsive .table) {
  border: 1px solid var(--hs-border);
  box-shadow: var(--hs-shadow);
  margin-bottom: 1.5rem;
}

/* Denser variant for data-heavy tables. */
.table-dense > :where(thead, tbody, tfoot) > tr > * {
  padding: 0.3125rem 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
}
.table-dense > thead th {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
}
table.table-dense .btn-sm {
    font-size: 0.6875rem;
    padding: 0.2rem 0.5rem;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background-color: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius-lg);
  box-shadow: var(--hs-shadow);
  color: var(--hs-ink);
}

.card-header {
  background-color: var(--hs-surface);
  border-bottom: 1px solid var(--hs-border);
  font-weight: 600;
  color: var(--hs-ink);
  padding: 0.75rem 1rem;
}

.card-body {
  padding: 1rem;
}

.card-footer {
  background-color: var(--hs-surface);
  border-top: 1px solid var(--hs-border);
}

/* ============================================================
   Nav tabs
   ============================================================ */

.nav-tabs {
  border-bottom: 1px solid var(--hs-border);
  gap: 0.25rem;
}

.nav-tabs .nav-link {
  color: var(--hs-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.625rem 1rem;
  font-weight: 500;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
}
.nav-tabs .nav-link:hover {
  color: var(--hs-ink);
  border-color: transparent;
  background: transparent;
}
.nav-tabs .nav-link.active {
  color: var(--hs-primary);
  background: transparent;
  border-bottom-color: var(--hs-primary);
}

.nav-pills .nav-link {
  color: var(--hs-ink);
  border-radius: var(--hs-radius);
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  color: var(--hs-primary-text);
  background-color: var(--hs-primary);
}

/* ============================================================
   Alerts — subdued semantic tints + left accent bar
   ============================================================ */

.alert {
  border: 1px solid transparent;
  border-left-width: 4px;
  border-radius: var(--hs-radius);
  padding: 0.875rem 1rem;
  color: var(--hs-ink);
}

.alert-primary,
.alert-info {
  background-color: rgba(38, 92, 200, 0.08);
  border-color: rgba(38, 92, 200, 0.2);
  border-left-color: var(--hs-primary);
}

.alert-success {
  background-color: rgba(47, 143, 111, 0.1);
  border-color: rgba(47, 143, 111, 0.25);
  border-left-color: var(--hs-success);
}

.alert-warning {
  background-color: rgba(178, 122, 0, 0.1);
  border-color: rgba(178, 122, 0, 0.25);
  border-left-color: var(--hs-warning);
}

.alert-danger {
  background-color: rgba(179, 38, 30, 0.08);
  border-color: rgba(179, 38, 30, 0.22);
  border-left-color: var(--hs-danger);
}

[data-bs-theme="dark"] .alert-primary,
[data-bs-theme="dark"] .alert-info,
[data-bs-theme="dark"] .alert-success,
[data-bs-theme="dark"] .alert-warning,
[data-bs-theme="dark"] .alert-danger {
  color: var(--hs-ink);
}

/* Bootstrap text utilities used for inline semantic colour. */
.text-danger  { color: var(--hs-danger)  !important; }
.text-success { color: var(--hs-success) !important; }
.text-warning { color: var(--hs-warning) !important; }

/* ============================================================
   Badges (used by Git/ViewRef ticket status)
   ============================================================ */

.badge.bg-success { background-color: var(--hs-success) !important; }
.badge.bg-warning { background-color: var(--hs-warning) !important; color: #fff !important; }
.badge.bg-danger  { background-color: var(--hs-danger)  !important; }
.badge.bg-primary,
.badge.bg-info    { background-color: var(--hs-primary) !important; }

/* ============================================================
   Footer
   ============================================================ */

footer.footer {
  background-color: var(--hs-surface);
  border-top: 1px solid var(--hs-border);
  color: var(--hs-muted);
}
footer.footer a {
  color: var(--hs-primary);
}

/* ============================================================
   Utilities
   ============================================================ */

.nowrap { white-space: nowrap; }

.border-top    { border-top: 1px solid var(--hs-border) !important; }
.border-bottom { border-bottom: 1px solid var(--hs-border) !important; }
.text-muted    { color: var(--hs-muted) !important; }

/* Gap between stacked sections inside a page. */
.section-gap { margin-top: 1.5rem; }

/* Standard wrapper around a Chart.js <canvas>. Replaces inline
   height:300px; width:100%; margin-bottom:15px on chart divs. */
.chart-canvas-wrap {
  position: relative;
  height: 18rem;
  width: 100%;
  margin-bottom: 1rem;
}

/* Spacer row in tables that needs to be in DOM but visually hidden. */
.d-none-row { display: none; }

/* Rendered Jira description (AdfRenderer output) and mirrored comment/history text. */
.jira-description :is(h1, h2, h3, h4, h5, h6) { margin-top: 1rem; }
.jira-description :first-child { margin-top: 0; }
.jira-description pre {
  background-color: var(--hs-surface);
  border: 1px solid var(--hs-border);
  border-radius: 0.25rem;
  padding: 0.75rem;
  overflow-x: auto;
}
.jira-description blockquote {
  border-left: 3px solid var(--hs-border);
  padding-left: 0.75rem;
  color: var(--hs-muted);
}
.adf-mention {
  background-color: var(--hs-surface);
  border-radius: 0.2rem;
  padding: 0 0.25rem;
  font-weight: 600;
}
.adf-unsupported {
  color: var(--hs-muted);
  font-style: italic;
}

@media (min-width: 1200px) {
  main { padding-top: 1.25rem; }
}

/* ============================================================
   Developer calendar tab — Google-Calendar-style block layout
   Dynamic per-cell grid positions and per-block hsl() colours
   come from the view (data-driven); CSS only owns chrome.
   ============================================================ */
.calendar-wrap {
  position: relative;
  overflow: auto;
  max-height: 75vh;
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius);
  background: var(--hs-surface);
}

.calendar-grid {
  display: grid;
  grid-template-columns: 60px repeat(var(--days), 120px);
  grid-template-rows: 32px repeat(var(--hours), var(--row-px, 40px));
}

.cal-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 4;
  background: var(--hs-surface);
  border-right: 1px solid var(--hs-border);
  border-bottom: 1px solid var(--hs-border);
  grid-row: 1;
  grid-column: 1;
}

.cal-day-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--hs-surface);
  border-bottom: 1px solid var(--hs-border);
  border-left: 1px solid var(--hs-border);
  text-align: center;
  padding: 6px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--hs-ink);
  grid-row: 1;
}

.cal-day-header.weekend { background: var(--hs-surface-alt); }

.cal-hour-label {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--hs-surface);
  border-right: 1px solid var(--hs-border);
  border-top: 1px solid var(--hs-border);
  font-size: 0.72rem;
  text-align: right;
  padding: 2px 6px 0 0;
  color: var(--hs-muted);
}

.cal-day-col {
  position: relative;
  border-left: 1px solid var(--hs-border);
  border-top: 1px solid var(--hs-border);
  background-image: linear-gradient(to bottom, var(--hs-border) 1px, transparent 1px);
  background-size: 100% var(--row-px, 40px);
  background-position: 0 0;
}

.cal-day-col.weekend { background-color: rgba(0, 0, 0, 0.025); }

.cal-block {
  position: absolute;
  left: 2px;
  right: 2px;
  padding: 3px 5px;
  border-radius: 3px;
  color: #fff;
  font-size: 0.7rem;
  line-height: 1.15;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
  transition: filter 120ms ease;
  display: block;
  text-overflow: ellipsis;
  white-space: normal;
  word-break: break-word;
}

.cal-block:hover {
  filter: brightness(1.1);
  color: #fff;
  text-decoration: none;
  z-index: 5;
}

.cal-block strong { font-weight: 600; }

.cal-clip-top, .cal-clip-bottom {
  display: block;
  text-align: center;
  font-size: 0.55rem;
  line-height: 1;
  opacity: 0.85;
}
.cal-clip-bottom { position: absolute; bottom: 1px; left: 0; right: 0; }

[data-bs-theme="dark"] .cal-day-col.weekend { background-color: rgba(255, 255, 255, 0.03); }
[data-bs-theme="dark"] .calendar-wrap,
[data-bs-theme="dark"] .cal-corner,
[data-bs-theme="dark"] .cal-day-header,
[data-bs-theme="dark"] .cal-hour-label { background: var(--bs-body-bg); }
[data-bs-theme="dark"] .cal-day-header.weekend { background: rgba(255, 255, 255, 0.04); }

a.navbar-brand:hover { text-decoration: none; }

[data-bs-theme="dark"] {
    a {
        color: color-mix(var(--hs-banner),var(--hs-ink) 33%);
    }
}

@media (prefers-color-scheme: dark) {
    html:not([data-bs-theme="light"]) {
        a {
            color: color-mix(var(--hs-banner),var(--hs-ink) 33%);
        }
    }
}
