:root {
  --sidebar-width: 260px;
  --sidebar-bg: #003ba0;
  --sidebar-hover: #002d7a;
  --fiuu-blue: #003ba0;
  --fiuu-blue-dark: #002d7a;
  --fiuu-blue-light: #4d8dff;
  --fiuu-dark: #151515;
  --gitlab-orange: #fc6d26;
}

body {
  background: #f4f6fa;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---------- Shared buttons ---------- */
.btn-fiuu,
.btn-white,
.btn-open,
.btn-refresh,
.btn-copy {
  border-radius: 0.6rem;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease,
              transform 0.18s ease, box-shadow 0.18s ease;
}

.btn-fiuu:active,
.btn-white:active,
.btn-open:active,
.btn-refresh:active,
.btn-copy:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}

.btn-fiuu:focus-visible,
.btn-white:focus-visible,
.btn-open:focus-visible,
.btn-refresh:focus-visible,
.btn-copy:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.4);
}

/* Primary action — Fiuu blue gradient */
.btn-fiuu {
  background: linear-gradient(135deg, #0653d3 0%, var(--fiuu-blue) 70%);
  color: #fff;
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 8px rgba(0, 59, 160, 0.25);
}

.btn-fiuu:hover {
  background: linear-gradient(135deg, #0a5ce4 0%, #0247b8 70%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 59, 160, 0.35);
}

/* Row-level Open links */
.btn-open {
  background: linear-gradient(135deg, #1257cc 0%, var(--fiuu-blue) 70%);
  color: #fff;
  border: none;
  box-shadow: 0 1px 4px rgba(0, 59, 160, 0.2);
}

.btn-open:hover {
  background: linear-gradient(135deg, #0a5ce4 0%, #0247b8 70%);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 59, 160, 0.35);
}

/* White button used on the blue sidebar (Go To GitLab) */
.btn-white {
  background: #fff;
  color: var(--fiuu-blue);
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 10px rgba(0, 18, 58, 0.25);
}

.btn-white:hover {
  background: #eaf1ff;
  color: var(--fiuu-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 18, 58, 0.35);
}

/* Outline refresh button used above the tables */
.btn-refresh {
  background: #fff;
  color: var(--fiuu-blue);
  border: 1px solid var(--fiuu-blue);
  font-weight: 600;
}

.btn-refresh i {
  display: inline-block;
  transition: transform 0.45s ease;
}

.btn-refresh:hover {
  background: var(--fiuu-blue);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 59, 160, 0.3);
}

.btn-refresh:hover i {
  transform: rotate(180deg);
}

/* While a refresh is in flight the icon spins and the button locks */
.btn-refresh.is-refreshing i {
  animation: refreshSpin 0.8s linear infinite;
}

.btn-refresh:disabled {
  opacity: 0.65;
}

@keyframes refreshSpin {
  to { transform: rotate(360deg); }
}

/* ---------- Login page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #00123a 0%, #002d7a 55%, #003ba0 100%);
}

.login-wrap {
  width: 100%;
  max-width: 560px;
  padding: 1.5rem 1rem;
}

.login-logo {
  height: 64px;
  display: block;
  margin: 0 auto 1.75rem;
}

.login-card {
  border: none;
  border-radius: 1.25rem;
  box-shadow: 0 20px 60px rgba(0, 18, 58, 0.5);
}

.login-app-name {
  color: var(--fiuu-blue);
  font-weight: 700;
  font-size: 1.4rem;
}

.login-card .form-label {
  color: #37415a;
}

.login-card .input-group-text {
  background: #f5f7fb;
  color: #64708a;
  border-color: #dbe3f0;
}

.login-card .form-control {
  border-color: #dbe3f0;
}

.login-card .form-control:focus {
  border-color: var(--fiuu-blue-light);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.2);
}

/* "How to get a token?" link next to the token label */
.token-help-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fiuu-blue);
  text-decoration: none;
}

.token-help-link:hover {
  text-decoration: underline;
  color: var(--fiuu-blue-dark);
}

/* Reassurance note about the token never being stored */
.token-note {
  background: #f0faf0;
  border: 1px solid #cdeccd;
  border-radius: 0.75rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.85rem;
  color: #2e5d2e;
}

.token-note .bi-shield-check {
  color: #23731a;
}

/* Token guide popup modal */
.token-help-modal {
  border: none;
  border-radius: 1rem;
  overflow: hidden;
}

.token-help-modal .modal-header {
  background: linear-gradient(135deg, #002d7a 0%, var(--fiuu-blue) 100%);
  color: #fff;
  border-bottom: none;
}

.token-help-modal .modal-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.token-help-modal .modal-body {
  font-size: 0.95rem;
  color: #3c4a63;
}

.token-help-modal .modal-footer {
  border-top: none;
  padding-top: 0;
}

.token-help-steps {
  margin: 0;
  padding-left: 1.25rem;
}

.token-help-steps li + li {
  margin-top: 0.6rem;
}

.token-help-steps a {
  color: var(--fiuu-blue);
  font-weight: 600;
  text-decoration: none;
}

.token-help-steps a:hover {
  text-decoration: underline;
}

.token-help-steps code {
  background: #e0e9fb;
  color: var(--fiuu-blue-dark);
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #fff;
  z-index: 1000;
}

.sidebar-brand {
  padding: 1.5rem 1rem 1.25rem;
  text-align: center;
}

.brand-logo {
  height: 34px;
}

.brand-app {
  font-size: 0.8rem;
  color: #9db1d6;
  margin-top: 0.6rem;
}

.sidebar-nav .nav-link {
  color: #c2d0ea;
  padding: 0.7rem 1.25rem;
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--sidebar-hover);
  color: #fff;
  border-left-color: #fff;
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer .btn {
  border-radius: 0.55rem;
  transition: background 0.18s ease, transform 0.18s ease;
}

.sidebar-footer .btn:hover {
  transform: translateY(-1px);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.user-username {
  font-size: 0.75rem;
  color: #9db1d6;
}

/* ---------- Main content ---------- */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 2rem 2.5rem;
  min-height: 100vh;
}

.page-title {
  font-weight: 700;
  color: var(--fiuu-dark);
}

.card-table {
  border: none;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(0, 29, 80, 0.08);
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: #f5f7fb;
  color: #64708a;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 0.95rem 1.1rem;
  border-bottom: 2px solid #e6ecf7;
}

.table td {
  vertical-align: middle;
  padding: 0.9rem 1.1rem;
  border-color: #eef2f9;
  transition: background 0.15s ease;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* Smooth hover highlight */
.table-hover tbody tr:hover td {
  background: #f2f7ff;
  --bs-table-accent-bg: transparent;
}

.table-hover tbody tr.sub-row:hover td {
  background: #f5f8fd;
}

/* Staggered fade-in when rows load */
@keyframes rowIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.row-in {
  animation: rowIn 0.35s ease both;
}

/* Status badges (GitLab-style colours) as pills with a status dot */
.badge-status-opened { background: #e3f8de; color: #23731a; }
.badge-status-merged { background: #e0e9fb; color: #003ba0; }
.badge-status-closed { background: #fde5e5; color: #c0392b; }
.badge-status-locked { background: #fff3e0; color: #b26a00; }

[class*='badge-status-'] {
  border-radius: 50rem;
  padding: 0.45em 0.9em;
  font-weight: 600;
  letter-spacing: 0.2px;
}

[class*='badge-status-']::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 6px;
  vertical-align: middle;
  opacity: 0.75;
}


.mr-title-project {
  font-size: 0.78rem;
  color: #8a93a5;
}

/* Expand/collapse chevron on work item rows — round icon button */
.btn-toggle-sub {
  color: var(--fiuu-blue);
  border: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn-toggle-sub:hover {
  background: #e0e9fb;
  color: var(--fiuu-blue-dark);
  transform: scale(1.1);
}

.btn-toggle-sub:active {
  transform: scale(0.95);
}

/* Sub-row listing a ticket's related MRs */
.sub-row td {
  background: #f5f8fd;
  border-top: none;
}

.sub-row-cell {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.sub-mr-item + .sub-mr-item {
  border-top: 1px dashed #dbe3f0;
}

/* Copy-link button next to every Open button */
.btn-copy {
  background: #fff;
  color: #5a6472;
  border: 1px solid #dbe3f0;
}

.btn-copy:hover {
  background: #f2f7ff;
  color: var(--fiuu-blue);
  border-color: var(--fiuu-blue);
  transform: translateY(-1px);
}

.btn-copy.copied {
  background: #e3f8de;
  color: #23731a;
  border-color: #23731a;
}

/* Assignment badges in the MR sub-row */
.badge-assign-current {
  background: #e0e9fb;
  color: #003ba0;
  border-radius: 50rem;
  font-weight: 600;
}

.badge-assign-past {
  background: #eef1f5;
  color: #5a6472;
  border-radius: 50rem;
  font-weight: 600;
}

/* ---------- Loading overlay ---------- */
#app-loader {
  position: fixed;
  inset: 0;
  z-index: 900; /* below the sidebar (1000) so the menu is never covered */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  background: linear-gradient(135deg, #00123a 0%, #002d7a 55%, #003ba0 100%);
  color: #fff;
  opacity: 1;
  transition: opacity 0.35s ease;
}

#app-loader.loader-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s 0.35s;
}

/* On pages with the menu bar, the overlay only covers the content area
   so the sidebar stays visible and clickable while loading */
body[data-page] #app-loader {
  left: var(--sidebar-width);
}

.loader-logo {
  height: 52px;
}

.loader-app-name {
  margin-top: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #c2d0ea;
  letter-spacing: 0.5px;
}

.loader-text {
  font-weight: 600;
  letter-spacing: 1px;
}

.loader-quote {
  margin-top: 0.75rem;
  max-width: 420px;
  font-style: italic;
  font-size: 0.95rem;
  color: #9db1d6;
}

/* ---------- Welcome splash (entry to the system) ---------- */
#welcome-splash {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  padding: 1rem;
  background: linear-gradient(135deg, #00123a 0%, #002d7a 55%, #003ba0 100%);
  color: #fff;
  opacity: 1;
  transition: opacity 0.7s ease;
}

#welcome-splash.splash-done {
  opacity: 0;
  pointer-events: none;
}

/* Soft glowing orbs drifting in the background */
.splash-glow {
  position: absolute;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.45;
  animation: splashFloat 6s ease-in-out infinite alternate;
}

.splash-glow-green {
  background: #44d62c;
  top: -120px;
  right: -80px;
}

.splash-glow-blue {
  background: #4d8dff;
  bottom: -140px;
  left: -100px;
  animation-delay: 1.5s;
}

.splash-logo {
  height: 72px;
  animation: splashLogoIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.splash-welcome {
  margin-top: 1.5rem;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #9db1d6;
  animation: splashRise 0.7s ease-out 0.5s both;
}

.splash-title {
  margin-top: 0.25rem;
  font-size: 1.8rem;
  font-weight: 700;
  max-width: 640px;
  line-height: 1.3;
  animation: splashRise 0.7s ease-out 0.75s both;
}

.splash-dots {
  margin-top: 1.75rem;
  display: flex;
  gap: 0.5rem;
  animation: splashRise 0.7s ease-out 1s both;
}

.splash-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #44d62c;
  animation: splashBounce 1s ease-in-out infinite;
}

.splash-dots span:nth-child(2) { animation-delay: 0.15s; }
.splash-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes splashLogoIn {
  from { opacity: 0; transform: scale(0.5) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes splashRise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes splashBounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%      { transform: translateY(-8px); opacity: 1; }
}

@keyframes splashFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-40px, 40px) scale(1.15); }
}

/* ---------- Your Activity chart ---------- */

/* Segmented time-range switch above the chart */
.range-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #fff;
  border: 1px solid #dbe3f0;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 29, 80, 0.06);
}

.range-btn {
  border: none;
  background: transparent;
  color: #5a6472;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
  border-radius: 0.55rem;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.range-btn:hover {
  background: #f2f7ff;
  color: var(--fiuu-blue);
}

.range-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.4);
}

.range-btn.active {
  background: linear-gradient(135deg, #0653d3 0%, var(--fiuu-blue) 70%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 59, 160, 0.25);
}

/* Work Items state switch — Closed reads red; Open keeps the default blue */
#state-switch .range-btn[data-state='closed'].active {
  background: linear-gradient(135deg, #c22727 0%, #dc3545 70%);
  box-shadow: 0 2px 8px rgba(194, 39, 39, 0.25);
}

/* Live open-ticket count inside the Open button */
.state-count {
  display: inline-block;
  min-width: 1.5em;
  margin-left: 0.45rem;
  padding: 0.08rem 0.45rem;
  border-radius: 999px;
  background: #e8f0fe;
  color: var(--fiuu-blue);
  font-size: 0.72rem;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.state-count:empty {
  display: none;
}

.range-btn.active .state-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Created / Last Updated cells on the MR table */
.mr-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mr-date-ago {
  font-size: 0.78rem;
  color: #8a93a5;
}

/* How the person was involved in a past MR (Author / Assignee / Reviewer) */
.mr-role {
  font-size: 0.72rem;
  color: #8a93a5;
  margin-top: 3px;
  white-space: nowrap;
}

/* Pagination bar under the Work Items table */
.wi-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid #eef1f7;
}

.wi-pagination[hidden] {
  display: none;
}

.btn-page {
  background: #fff;
  color: var(--fiuu-blue);
  border: 1px solid #dbe3f0;
  font-weight: 600;
}

.btn-page:hover:not(:disabled) {
  background: var(--fiuu-blue);
  border-color: var(--fiuu-blue);
  color: #fff;
}

.btn-page:disabled {
  color: #a6b0c3;
  background: #f7f9fc;
}

.page-label {
  color: #64708a;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Month picker living inside the segmented switch */
.month-select {
  position: relative;
  display: inline-flex;
}

.month-chevron {
  font-size: 0.7rem;
  margin-left: 0.35rem;
  transition: transform 0.18s ease;
}

#month-btn[aria-expanded='true'] .month-chevron {
  transform: rotate(180deg);
}

.month-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1100;
  width: 210px;
  max-height: 320px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #dbe3f0;
  border-radius: 0.9rem;
  box-shadow: 0 16px 44px rgba(0, 18, 58, 0.18);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: rowIn 0.18s ease both;
}

.month-panel[hidden] {
  display: none;
}

.month-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: none;
  background: transparent;
  border-radius: 0.55rem;
  padding: 0.45rem 0.75rem;
  text-align: left;
  font-size: 0.87rem;
  font-weight: 600;
  color: #37415a;
  transition: background 0.15s ease;
}

.month-item:hover,
.month-item:focus-visible {
  background: #f2f7ff;
  outline: none;
}

.month-item.selected {
  background: #e0e9fb;
  color: var(--fiuu-blue);
}

.month-item .bi-check-lg {
  color: var(--fiuu-blue);
}

/* While refetching, hold the previous content dimmed under a spinner — no flash */
.is-loading {
  position: relative;
  pointer-events: none;
}

.is-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.6);
  animation: loadingFadeIn 0.2s ease;
}

.is-loading::after {
  content: '';
  position: absolute;
  top: min(50%, 14rem);
  left: 50%;
  width: 2.2rem;
  height: 2.2rem;
  margin: -1.1rem 0 0 -1.1rem;
  border: 3px solid rgba(6, 83, 211, 0.2);
  border-top-color: var(--fiuu-blue);
  border-radius: 50%;
  z-index: 6;
  animation: refreshSpin 0.7s linear infinite;
}

@keyframes loadingFadeIn {
  from { opacity: 0; }
}

/* ---------- AI Review card (own activity only) ---------- */
.ai-review .card-body {
  padding: 1.1rem 1.25rem;
}

.ai-review-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.ai-review-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #0653d3 0%, #7b5cff 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 2px 8px rgba(6, 83, 211, 0.3);
}

.ai-review-title {
  font-weight: 700;
  color: #1d2635;
}

.ai-review-sub {
  font-size: 0.78rem;
  color: #8a93a5;
}

.ai-review-list {
  margin: 0;
  padding-left: 1.15rem;
}

.ai-review-list li {
  margin: 0.32rem 0;
  color: #3d4757;
}

.ai-review-list li::marker {
  color: var(--fiuu-blue);
}

.ai-review-list li.focus {
  margin-top: 0.6rem;
  color: #1d2635;
}

.chart-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 0;
  border-radius: 0.5rem;
  outline: none;
}

.chart-row:focus-visible {
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.4);
}

/* Category names live in the text tokens, never the bar color */
.chart-label {
  flex: none;
  width: 130px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  color: #5a6472;
}

/* Day / week labels are longer than category names */
#activity-chart.mode-timeline .chart-label {
  width: 160px;
}

/* Days or weeks that haven't happened yet.
   (Dim via color, not row opacity — the row-in animation's fill mode
   would override an opacity set on the row itself.) */
.chart-row.is-future .chart-label {
  color: #b3bccb;
}

.chart-value.is-zero {
  color: #8a93a5;
  font-weight: 600;
}

/* Shared baseline all bars grow from */
.chart-track {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-left: 2px solid #e6ecf7;
  min-width: 0;
}

/* Single-category bar (Today view) — color is set inline per category */
.chart-bar {
  height: 18px;
  border-radius: 0 4px 4px 0; /* rounded data-end, square at the baseline */
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.18s ease;
}

/* Stacked bar (week/month views) — segments split the row by category,
   separated by a 2px surface gap; only the data-end is rounded */
.chart-bar-stack {
  height: 18px;
  display: flex;
  gap: 2px;
  overflow: hidden;
  border-radius: 0 4px 4px 0;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1), filter 0.18s ease;
}

.chart-seg {
  min-width: 3px;
}

.chart-row:hover .chart-bar,
.chart-row:focus-visible .chart-bar,
.chart-row:hover .chart-bar-stack,
.chart-row:focus-visible .chart-bar-stack {
  filter: brightness(1.12) saturate(1.15);
}

.chart-value {
  flex: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fiuu-dark);
}

.chart-empty i {
  font-size: 2rem;
}

/* Follows the cursor over a bar row */
#chart-tooltip {
  position: fixed;
  z-index: 2000;
  max-width: 260px;
  background: #151515;
  color: #e8ecf3;
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

#chart-tooltip.visible {
  opacity: 1;
}

#chart-tooltip strong {
  color: #fff;
  font-size: 0.9rem;
  margin-right: 2px;
}

/* Category breakdown lines under the tooltip headline */
#chart-tooltip .tooltip-part {
  color: #b8c1d1;
  font-size: 0.75rem;
  padding-left: 2px;
}

#chart-tooltip .tooltip-part:first-of-type {
  margin-top: 3px;
}

/* Identity swatch — carries the category color so text never has to */
.cat-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: baseline;
}

#chart-tooltip .cat-dot {
  width: 7px;
  height: 7px;
  margin-right: 5px;
}

/* ---------- User switcher (top right of the Activity page) ---------- */
.user-select {
  position: relative;
}

.user-select-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: #fff;
  border: 1px solid #dbe3f0;
  border-radius: 0.75rem;
  padding: 0.45rem 0.9rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #37415a;
  box-shadow: 0 2px 8px rgba(0, 29, 80, 0.06);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.user-select-btn:hover {
  border-color: var(--fiuu-blue-light);
  box-shadow: 0 4px 12px rgba(0, 29, 80, 0.12);
  transform: translateY(-1px);
}

.user-select-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.4);
}

.user-select-btn[aria-expanded='true'] .user-select-chevron {
  transform: rotate(180deg);
}

.user-select-chevron {
  font-size: 0.75rem;
  color: #8a93a5;
  transition: transform 0.18s ease;
}

.user-select-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: #e0e9fb;
  flex: none;
}

.user-select-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1100;
  width: 300px;
  background: #fff;
  border: 1px solid #dbe3f0;
  border-radius: 0.9rem;
  box-shadow: 0 16px 44px rgba(0, 18, 58, 0.18);
  padding: 0.6rem;
  animation: rowIn 0.18s ease both;
}

.user-select-search {
  width: 100%;
  border: 1px solid #dbe3f0;
  border-radius: 0.6rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.user-select-search:focus {
  outline: none;
  border-color: var(--fiuu-blue-light);
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.2);
}

.user-select-list {
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-select-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 0.6rem;
  padding: 0.45rem 0.6rem;
  text-align: left;
  transition: background 0.15s ease;
}

.user-select-item:hover,
.user-select-item:focus-visible {
  background: #f2f7ff;
  outline: none;
}

.user-select-item.selected {
  background: #e0e9fb;
}

.user-select-item .bi-check-lg {
  margin-left: auto;
  color: var(--fiuu-blue);
  font-size: 0.95rem;
}

.user-select-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-select-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: #37415a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-select-item-sub {
  font-size: 0.75rem;
  color: #8a93a5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-select-note {
  padding: 0.9rem 0.6rem;
  text-align: center;
  font-size: 0.85rem;
  color: #8a93a5;
}

/* ---------- Summary stat tiles ---------- */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 900px) {
  .stat-tiles {
    grid-template-columns: 1fr;
  }
}

.stat-tile {
  background: #fff;
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 6px 24px rgba(0, 29, 80, 0.08);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #8a93a5;
}

.stat-value {
  margin-top: 0.15rem;
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--fiuu-dark);
  line-height: 1.2;
}

/* Text-valued tiles (category / day names) sit a step smaller than numbers */
.stat-value.stat-value-text {
  font-size: 1.25rem;
  padding-top: 0.25rem;
}

.stat-sub {
  font-size: 0.8rem;
  color: #8a93a5;
}

/* ---------- Chart toolbar: legend + view toggle ---------- */
.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  min-height: 32px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
}

.legend-item {
  font-size: 0.8rem;
  font-weight: 600;
  color: #5a6472;
  white-space: nowrap;
}

.view-toggle {
  flex: none;
  margin-left: auto;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: #f5f7fb;
  border: 1px solid #dbe3f0;
  border-radius: 0.6rem;
}

.view-btn {
  border: none;
  background: transparent;
  color: #8a93a5;
  width: 30px;
  height: 26px;
  border-radius: 0.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background 0.18s ease, color 0.18s ease;
}

.view-btn:hover {
  color: var(--fiuu-blue);
}

.view-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(77, 141, 255, 0.4);
}

.view-btn.active {
  background: #fff;
  color: var(--fiuu-blue);
  box-shadow: 0 1px 4px rgba(0, 29, 80, 0.12);
}

/* ---------- Table view (the chart's accessible twin) ---------- */
.chart-table .table {
  margin-bottom: 0;
}

.chart-table th {
  background: #f5f7fb;
  color: #64708a;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.chart-table th,
.chart-table td {
  padding: 0.55rem 0.8rem;
  white-space: nowrap;
}

.chart-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chart-table td.num.total {
  font-weight: 700;
}

/* Total column pinned to the right edge while the table scrolls */
.chart-table th.total,
.chart-table td.total {
  position: sticky;
  right: 0;
  background: #fff;
  box-shadow: -6px 0 8px -6px rgba(0, 29, 80, 0.18);
}

.chart-table th.total {
  background: #f5f7fb;
}

.chart-table td.num.is-zero {
  color: #b3bccb;
}

.chart-table tr.is-future td {
  color: #b3bccb;
}
