/* TrackMyRupee - Unified Filter Toolbar System CSS */

:root {
  /* Themed via the app's shared Bootstrap color-mode variables so light/dark match every
     other input, button and dropdown in the app instead of using one-off hardcoded colors. */
  --tmr-filter-primary: var(--color-success, #1D9E75);
  --tmr-filter-primary-hover: var(--tmr-filter-primary);
  --tmr-filter-bg-active: rgba(var(--bs-primary-rgb), 0.1);
  --tmr-filter-border-active: var(--tmr-filter-primary);
  --tmr-filter-border-unset: var(--bs-border-color);
  --tmr-filter-text-muted: var(--bs-secondary-color);
  --tmr-filter-bg-muted: var(--bs-tertiary-bg);
  --tmr-filter-popover-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] {
  --tmr-filter-bg-active: rgba(var(--bs-primary-rgb), 0.16);
  --tmr-filter-popover-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.35);
}

.tmr-toolbar-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: transparent;
  margin-bottom: 8px;
}

/* Zone Layout */
.tmr-toolbar-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.tmr-toolbar-zones {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  flex: 1 1 auto;
  gap: 16px;
}

.tmr-toolbar-zone {
  display: flex;
  align-items: center;
}

/* Universal vertical centering for all icons in the filter toolbar and popovers */
.tmr-toolbar-container i.bi,
.tmr-popover-menu i.bi {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
}

.tmr-toolbar-container i.bi::before,
.tmr-popover-menu i.bi::before {
  vertical-align: 0;
  line-height: 1;
}

.tmr-btn-icon {
  font-size: 0.85rem;
  color: var(--bs-secondary-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.tmr-chevron-icon {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
  opacity: 0.8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: 0;
  flex-shrink: 0;
}

.tmr-add-filter-btn .tmr-btn-icon {
  color: inherit;
  font-size: 0.8rem;
}

/* Base Toolbar Control Buttons */
.tmr-toolbar-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--bs-border-color);
  background-color: var(--bs-body-bg);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--bs-body-color);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.tmr-time-label,
.tmr-sort-label,
.tmr-toolbar-btn > span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.tmr-toolbar-btn:hover {
  background-color: var(--bs-tertiary-bg);
  border-color: var(--bs-secondary-color);
}

.tmr-add-filter-btn {
  border: 1.5px dashed var(--bs-border-color);
  border-radius: 12px;
  background-color: transparent;
  color: var(--bs-body-color);
  font-weight: 600;
}

.tmr-add-filter-btn:hover {
  border-color: var(--tmr-filter-primary);
  color: var(--tmr-filter-primary);
  background-color: var(--tmr-filter-bg-active);
}

/* Persistent Search Input */
.tmr-search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 240px;
  flex: 1 1 240px;
  max-width: 360px;
}

.tmr-search-box .tmr-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  color: var(--bs-secondary-color);
  font-size: 0.9rem;
  pointer-events: none;
}

.tmr-search-box input {
  width: 100%;
  height: 38px;
  padding-left: 36px;
  padding-right: 34px;
  border-radius: 12px;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  font-size: 0.875rem;
  color: var(--bs-body-color);
  outline: none;
  transition: all 0.15s ease-in-out;
}

.tmr-search-box input:focus {
  border-color: var(--tmr-filter-primary);
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.15);
}

.tmr-search-box .tmr-search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--bs-secondary-color);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0.65;
  transition: all 0.15s ease-in-out;
  z-index: 2;
}

.tmr-search-box .tmr-search-clear-btn:hover {
  opacity: 1;
  color: var(--bs-body-color);
  background-color: var(--bs-tertiary-bg);
}

.tmr-search-box .tmr-search-clear-btn:focus-visible {
  outline: 2px solid var(--tmr-filter-primary);
  outline-offset: 1px;
}

/* Active Filter Chip Row */
.tmr-chip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tmr-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  position: relative;
  transition: all 0.15s ease-in-out;
  background-color: var(--tmr-filter-bg-active);
  border: 1px solid var(--tmr-filter-border-active);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  margin: 0;
}

.tmr-chip.tmr-chip-unset {
  background-color: var(--bs-tertiary-bg);
  border: 1.5px dashed var(--tmr-filter-border-unset);
}

.tmr-chip-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  padding: 0 8px 0 12px;
  line-height: 1;
  color: var(--bs-body-color);
  border-right: 1px solid var(--bs-border-color-translucent);
  user-select: none;
}

.tmr-chip-value-btn {
  padding: 6px 8px;
  color: var(--tmr-filter-primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border: none;
  background: transparent;
  font-weight: 700;
  line-height: 1;
  outline: none;
}

.tmr-chip-value-btn > span {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.tmr-chip-value-btn i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.65rem;
  margin: 0;
}

.tmr-chip.tmr-chip-unset .tmr-chip-value-btn {
  color: var(--bs-secondary-color);
  font-weight: 500;
}

.tmr-chip-value-btn:hover {
  text-decoration: underline;
}

.tmr-chip-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  color: var(--bs-secondary-color);
  cursor: pointer;
  border: none;
  background: transparent;
  line-height: 1;
  transition: color 0.15s ease;
}

.tmr-chip-remove-btn i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.75rem;
  margin: 0;
}

.tmr-chip-remove-btn:hover {
  color: var(--bs-danger);
}

/* Clear All Button */
.tmr-clear-all-btn {
  border: none;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  margin: 0;
  transition: all 0.15s ease;
}

.tmr-clear-all-btn:hover {
  color: var(--bs-body-color);
  background-color: var(--bs-tertiary-bg);
}

/* Floating Popover Menus (No Layout Shift) */
.tmr-popover-menu {
  position: absolute;
  z-index: 1050;
  background: var(--bs-body-bg);
  border-radius: 14px;
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--tmr-filter-popover-shadow);
  min-width: 240px;
  max-width: 320px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: tmrFadeIn 0.12s ease-out;
}

@keyframes tmrFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tmr-popover-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--bs-border-color-translucent);
}

.tmr-popover-search {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--bs-border-color);
  background-color: var(--bs-tertiary-bg);
  font-size: 0.85rem;
  color: var(--bs-body-color);
  outline: none;
}

.tmr-popover-search:focus {
  border-color: var(--tmr-filter-primary);
  background-color: var(--bs-body-bg);
  box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.15);
}

.tmr-popover-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 4px 0;
  margin: 0;
  list-style: none;
}

.tmr-popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  font-size: 0.875rem;
  color: var(--bs-body-color);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.tmr-popover-item > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.tmr-popover-item:hover {
  background-color: var(--bs-tertiary-bg);
}

.tmr-popover-item.selected {
  font-weight: 700;
  color: var(--tmr-filter-primary);
  background-color: var(--tmr-filter-bg-active);
}

.tmr-popover-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--bs-border-color-translucent);
  background-color: var(--bs-tertiary-bg);
  min-height: 42px;
}

.tmr-popover-footer .tmr-footer-item,
.tmr-popover-footer .tmr-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  vertical-align: middle;
}

.tmr-popover-footer .tmr-footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  margin: 0;
  vertical-align: middle;
}

.tmr-popover-footer-btn {
  background: transparent;
  border: none;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.tmr-popover-footer-btn.clear {
  color: var(--bs-secondary-color);
}

.tmr-popover-footer-btn.clear:hover {
  color: var(--bs-body-color);
}

.tmr-popover-footer-btn.done {
  color: var(--tmr-filter-primary);
}

.tmr-popover-footer-btn.done:hover {
  color: var(--tmr-filter-primary-hover);
}

.tmr-popover-divider {
  height: 1px;
  background-color: var(--bs-border-color-translucent);
  margin: 4px 0;
  list-style: none;
}

.tmr-popover-section-header {
  padding: 6px 14px 2px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color);
  list-style: none;
  user-select: none;
}

.tmr-popover-item.tmr-popover-item-inactive {
  color: var(--bs-secondary-color);
  opacity: 0.85;
}

.tmr-popover-menu.tmr-time-popover {
  min-width: 320px;
  max-width: 360px;
  padding: 8px 10px 12px;
  border-radius: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(90vh - 80px);
}

.tmr-popover-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 6px;
}

.tmr-section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
  user-select: none;
}

.tmr-section-label i {
  font-size: 0.9rem;
  line-height: 1;
  color: var(--bs-secondary-color);
}

.tmr-payday-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  background-color: rgba(var(--bs-primary-rgb), 0.1);
  color: var(--tmr-filter-primary);
  border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
  transition: all 0.15s ease-in-out;
}

.tmr-payday-badge:hover {
  background-color: rgba(var(--bs-primary-rgb), 0.18);
  color: var(--tmr-filter-primary);
  border-color: var(--tmr-filter-primary);
}

.tmr-time-popover .tmr-popover-list {
  padding: 2px 0;
  max-height: none;
  overflow: visible;
}

.tmr-time-popover .tmr-popover-item {
  display: block;
  padding: 8px 10px;
  margin: 2px 0;
  border-radius: 10px;
  font-size: 0.84rem;
  color: var(--bs-body-color);
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s ease;
  background-color: transparent;
}

.tmr-time-popover .tmr-popover-item:hover {
  background-color: var(--bs-tertiary-bg);
}

.tmr-time-popover .tmr-popover-item.selected {
  background-color: rgba(var(--bs-primary-rgb), 0.08);
}

.tmr-time-popover .tmr-item-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.tmr-time-popover .tmr-item-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tmr-time-popover .tmr-check-icon {
  color: var(--tmr-filter-primary);
  font-size: 0.95rem;
  font-weight: 800;
  width: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tmr-time-popover .tmr-check-spacer {
  display: inline-block;
  width: 16px;
}

.tmr-time-popover .tmr-item-label {
  font-weight: 600;
  color: var(--bs-body-color);
}

.tmr-time-popover .selected .tmr-item-label {
  font-weight: 600;
  color: var(--tmr-filter-primary);
}

.tmr-time-popover .tmr-item-range {
  font-size: 0.78rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
}


/* Custom range row styling */
.tmr-custom-range-row .tmr-custom-icon {
  font-size: 0.9rem;
  width: 16px;
  color: var(--bs-secondary-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tmr-custom-range-row .tmr-custom-chevron {
  font-size: 0.75rem;
  color: var(--bs-secondary-color);
  transition: transform 0.15s ease;
}

.tmr-custom-range-row.selected .tmr-custom-chevron,
.tmr-custom-range-row.drawer-open .tmr-custom-chevron {
  transform: rotate(90deg);
}

.tmr-time-popover .tmr-popover-divider {
  height: 1px;
  background-color: var(--bs-border-color-translucent);
  margin: 8px 4px;
}

.tmr-time-popover .tmr-custom-date-container {
  border-top: none;
  background-color: var(--bs-tertiary-bg);
  border-radius: 12px;
  margin-top: 6px;
  padding: 10px 12px 10px;
}

.tmr-custom-date-container {
  padding: 12px 14px 12px;
  border-top: 1px solid var(--bs-border-color-translucent);
  background-color: var(--bs-tertiary-bg);
}

.tmr-custom-date-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.tmr-custom-date-field {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tmr-custom-date-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--bs-secondary-color);
  margin-bottom: 4px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tmr-custom-date-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  height: 36px;
  padding: 4px 6px;
  font-size: 0.8125rem;
  line-height: normal;
  border-radius: 8px;
  border: 1px solid var(--bs-border-color);
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.tmr-custom-date-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  margin-left: 2px;
  padding: 0;
  opacity: 0.65;
  transition: opacity 0.15s ease;
}

.tmr-custom-date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.tmr-custom-date-input:focus {
  outline: none;
  border-color: var(--tmr-filter-primary);
  box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.15);
}

.tmr-custom-date-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.tmr-time-popover .tmr-custom-apply {
  background-color: var(--tmr-filter-primary);
  color: #ffffff !important;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.tmr-time-popover .tmr-custom-apply:hover {
  opacity: 0.92;
}

.tmr-time-popover .tmr-custom-apply:active {
  transform: scale(0.98);
}

.tmr-time-popover .tmr-custom-cancel {
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--bs-secondary-color);
  background: transparent;
  border: none;
  cursor: pointer;
}

@media (max-width: 340px) {
  .tmr-custom-date-row {
    flex-direction: column;
    gap: 8px;
  }
}

/* Responsive Handling */
@media (max-width: 767.98px) {
  .tmr-desktop-only {
    display: none !important;
  }
}

@media (min-width: 768px) {
  .tmr-mobile-only {
    display: none !important;
  }
}

/* --- Mobile Layout (< 768px): toolbar --- */
@media (max-width: 767.98px) {
  .tmr-toolbar-container {
    gap: 8px;
    margin-bottom: 6px;
  }

  .tmr-toolbar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .tmr-search-box {
    flex: 0 0 auto;
    min-width: 0;
    max-width: none;
    width: 100%;
    margin-bottom: 6px;
  }

  /* TIME / FILTERS / DISPLAY as a horizontally scrollable pill strip so nothing wraps
     awkwardly on narrow screens. min-width: 0 is required so the flex item can shrink
     below its content's intrinsic width instead of overflowing the whole page. */
  .tmr-toolbar-zones {
    display: flex;
    align-items: center;
    min-width: 0;
    width: 100%;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -2px;
    padding: 0 16px 2px 2px;
  }

  .tmr-toolbar-zones::-webkit-scrollbar {
    display: none;
  }

  .tmr-toolbar-zone {
    flex: 0 0 auto;
  }

  .tmr-btn-icon {
    font-size: 0.75rem;
  }

  /* Compact sm-sized control buttons */
  .tmr-toolbar-btn {
    height: 31px;
    min-height: 31px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 0.8125rem;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .tmr-toolbar-btn i {
    font-size: 0.7rem !important;
  }

  .tmr-add-filter-btn {
    border-radius: 8px;
  }

  /* Compact sm-sized active filter chips */
  .tmr-chip-row {
    gap: 6px;
  }

  .tmr-chip {
    height: 28px;
    font-size: 0.78rem;
    border-radius: 8px;
    margin-bottom: 2px;
  }

  .tmr-chip-label {
    padding: 2px 6px 2px 8px;
    font-size: 0.75rem;
  }

  .tmr-chip-value-btn {
    padding: 2px 6px;
    font-size: 0.78rem;
  }

  .tmr-chip-remove-btn {
    padding: 2px 6px;
    font-size: 0.75rem;
  }

  .tmr-clear-all-btn {
    font-size: 0.75rem;
    padding: 2px 6px;
  }
}

/* --- Mobile Layout (< 768px): popovers become bottom sheets with bottom margin/clearance --- */
@media (max-width: 767.98px) {
  .tmr-popover-menu {
    position: fixed !important;
    left: 12px !important;
    right: 12px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: auto !important;
    max-width: 440px !important;
    min-width: 0 !important;
    bottom: calc(82px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))) !important;
    top: auto !important;
    max-height: calc(85vh - (82px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-radius: 20px !important;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.22), 0 4px 15px rgba(0, 0, 0, 0.12) !important;
    animation: tmrSlideUp 0.18s ease-out;
    /* Must sit cleanly above bottom navigation and back/forward browser controls */
    z-index: 1200 !important;
  }

  .tmr-popover-menu.tmr-time-popover {
    padding-bottom: 16px !important;
  }

  /* Extra bottom clearance in mobile app / PWA standalone mode */
  .is-mobile-app .tmr-popover-menu {
    bottom: calc(90px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))) !important;
    max-height: calc(85vh - (90px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))) !important;
  }

  .tmr-popover-list {
    max-height: calc(50vh - 40px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0 8px;
  }

  .tmr-popover-header {
    padding: 10px 12px;
  }

  .tmr-popover-item {
    padding: 8px 14px;
    font-size: 0.8125rem;
  }

  .tmr-popover-footer {
    padding: 10px 14px;
  }

  .tmr-popover-footer-btn {
    font-size: 0.8125rem;
  }
}

@keyframes tmrSlideUp {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

.tmr-popover-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  /* .mobile-bottom-nav uses z-index: 1090 !important - must sit above it too */
  z-index: 1190;
  animation: tmrFadeIn 0.15s ease-out;
}

/* ==========================================================================
   Dashboard Header Inline Filter Bar (Desktop & Mobile)
   Aligns Month Navigation (< Sep 2026 >) and Filter Buttons on the same row.
   ========================================================================== */

.dashboard-header-container {
  width: 100%;
  position: relative;
  z-index: 100;
}

.dashboard-header-main {
  width: 100%;
  gap: 16px;
  flex-wrap: nowrap;
}

.dashboard-header-left {
  gap: 16px;
  flex-shrink: 0;
}

.dashboard-month-nav {
  gap: 6px;
  flex-shrink: 0;
}

.dashboard-nav-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  color: var(--bs-body-color);
  background: transparent;
  border: none;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.dashboard-nav-btn:hover {
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-primary);
}

.dashboard-month-title {
  font-size: 1.5rem;
  line-height: 1.2;
  white-space: nowrap;
}

.dashboard-filter-slot {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
}

.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 0;
}

.dashboard-action-btn {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  font-size: 1.25rem;
}

/* Dashboard specific overrides for TMR Toolbar */
#tmr-toolbar-dashboard {
  margin-bottom: 0 !important;
  gap: 0 !important;
}

#tmr-toolbar-dashboard .tmr-toolbar-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
}

#tmr-toolbar-dashboard .tmr-toolbar-zones {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  width: auto !important;
  flex: 0 0 auto !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
}

#tmr-toolbar-dashboard .tmr-time-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-chip-row {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.dashboard-chip-row:empty {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* --- Mobile Responsiveness (< 768px) --- */
@media (max-width: 767.98px) {
  .dashboard-header-main {
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .dashboard-header-main::-webkit-scrollbar {
    display: none;
  }

  .dashboard-header-left {
    gap: 6px;
    flex-shrink: 0;
  }

  .dashboard-month-nav {
    gap: 2px;
  }

  .dashboard-nav-btn {
    width: 26px;
    height: 28px;
    min-width: 26px;
    min-height: 28px;
    font-size: 0.85rem;
  }

  .dashboard-month-title {
    font-size: 1.1rem;
  }

  #tmr-toolbar-dashboard .tmr-toolbar-row {
    flex-direction: row !important;
    align-items: center !important;
    gap: 4px !important;
  }

  #tmr-toolbar-dashboard .tmr-toolbar-zones {
    width: auto !important;
    flex: 0 0 auto !important;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  #tmr-toolbar-dashboard .tmr-toolbar-btn {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 8px !important;
    font-size: 0.775rem !important;
    gap: 3px !important;
    border-radius: 8px !important;
  }

  #tmr-toolbar-dashboard .tmr-toolbar-btn .tmr-btn-icon {
    font-size: 0.75rem !important;
  }

  #tmr-toolbar-dashboard .tmr-time-label {
    max-width: 120px;
  }

  .dashboard-filter-slot {
    margin-left: 0 !important;
  }

  .dashboard-header-actions {
    gap: 2px;
  }

  .dashboard-action-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    font-size: 1rem;
    padding: 0 !important;
  }
}

.dashboard-sub-row {
  min-height: 28px;
}

@media (min-width: 768px) {
  .dashboard-sub-row:empty,
  .dashboard-sub-row:not(:has(*:not(:empty))) {
    display: none !important;
  }
}

/* Extra small devices (< 360px) */
@media (max-width: 359.98px) {
  .dashboard-month-title {
    font-size: 1rem;
  }
  #tmr-toolbar-dashboard .tmr-time-label {
    max-width: 90px;
  }
}

