*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background: #f8fafc;
}

/* =========================
   App Shell
========================= */

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
}

.sidebar-column {
  flex: 0 0 280px;
  width: 280px;
  min-width: 260px;
  max-width: 300px;
}

.sidebar-wrapper {
  height: 100vh;
  overflow-y: auto;
}

.sidebar-title,
.app-title {
  overflow-wrap: anywhere;
}

.sidebar-nav-link {
  line-height: 1.25;
  white-space: normal;
}

.main-content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: calc(100vw - 280px);
}

.main-content-inner,
.page-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.app-title {
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1.15;
}

.app-subtitle {
  line-height: 1.35;
}

.page-container h2,
.page-container h3,
.card h3,
.card h4 {
  overflow-wrap: anywhere;
}

/* =========================
   Employee Search Filters
========================= */

.employee-search-filters {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(170px, 1fr) minmax(170px, 1fr);
  gap: 16px;
  align-items: end;
  margin-bottom: 24px;
}

.filter-field {
  width: 100%;
  min-width: 0;
}

.filter-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

/* =========================
   Dash Dropdown Base
========================= */

.Select,
.Select-control,
.filter-field .Select,
.filter-field .Select-control {
  width: 100% !important;
  max-width: 100% !important;
}

.Select-control {
  min-height: 44px !important;
}

.Select-placeholder,
.Select-value,
.Select-value-label,
.Select-input {
  max-width: 100% !important;
}

.Select-placeholder,
.Select-value-label {
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 42px !important;
  max-width: calc(100% - 44px) !important;
}

.Select-input {
  height: 42px !important;
  line-height: 42px !important;
}

.Select-input > input {
  max-width: 100% !important;
}

.Select-arrow-zone {
  width: 34px !important;
}

/* =========================
   Employee Dropdown Fix
   Keep this simple. Do not force display:flex or fixed positioning on virtualized rows.
========================= */

.employee-dropdown,
.employee-dropdown .Select,
.employee-dropdown .Select-control {
  width: 100% !important;
  max-width: 100% !important;
}

.employee-dropdown .Select-control {
  min-height: 46px !important;
  background: #ffffff !important;
  border-color: #d1d5db !important;
}

.employee-dropdown .Select-placeholder,
.employee-dropdown .Select-value-label,
.employee-dropdown .Select-input,
.employee-dropdown .Select-input input {
  color: #111827 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.employee-dropdown .Select-placeholder,
.employee-dropdown .Select-value-label {
  display: block !important;
  max-width: calc(100% - 46px) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 44px !important;
}

.employee-dropdown .Select-input {
  height: 44px !important;
  line-height: 44px !important;
}

.employee-dropdown .Select-menu-outer {
  z-index: 99999 !important;
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12) !important;
  max-height: 280px !important;
  overflow: hidden !important;
}

.employee-dropdown .Select-menu {
  background: #ffffff !important;
  max-height: 280px !important;
}

/* Make every dropdown row/text visible */
.employee-dropdown .Select-menu-outer,
.employee-dropdown .Select-menu-outer *,
.employee-dropdown .ReactVirtualized__Grid,
.employee-dropdown .ReactVirtualized__Grid *,
.employee-dropdown .ReactVirtualized__Grid__innerScrollContainer,
.employee-dropdown .ReactVirtualized__Grid__innerScrollContainer *,
.employee-dropdown .Select-option,
.employee-dropdown .VirtualizedSelectOption,
.employee-dropdown .VirtualizedSelectFocusedOption,
.employee-dropdown .VirtualizedSelectSelectedOption {
  color: #111827 !important;
  opacity: 1 !important;
  visibility: visible !important;
  background-color: #ffffff;
}

/* Normal non-virtualized options */
.employee-dropdown .Select-option {
  min-height: 42px !important;
  line-height: 26px !important;
  padding: 8px 12px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Virtualized options: do not override display or position */
.employee-dropdown .VirtualizedSelectOption,
.employee-dropdown .VirtualizedSelectFocusedOption,
.employee-dropdown .VirtualizedSelectSelectedOption {
  padding: 8px 12px !important;
  line-height: 28px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  font-size: 14px !important;
  text-align: start !important;
}

/* Focused / selected row */
.employee-dropdown .VirtualizedSelectFocusedOption,
.employee-dropdown .Select-option.is-focused {
  background-color: #eef6ff !important;
  color: #111827 !important;
}

.employee-dropdown .VirtualizedSelectSelectedOption,
.employee-dropdown .Select-option.is-selected {
  background-color: #e0f2fe !important;
  color: #111827 !important;
}

.employee-dropdown .Select-noresults {
  color: #6b7280 !important;
  background: #ffffff !important;
  padding: 10px 12px !important;
}

/* =========================
   Date Pickers
========================= */

.DateRangePicker,
.DateRangePickerInput,
.DateInput,
.DateInput_input,
.SingleDatePicker,
.SingleDatePickerInput {
  width: 100% !important;
  max-width: 100% !important;
}

.DateInput_input {
  font-size: 15px !important;
  padding: 10px 12px !important;
}

/* =========================
   Summary Cards
========================= */

.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.summary-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.summary-card h3,
.summary-card h4,
.summary-card p {
  overflow-wrap: anywhere;
}

/* =========================
   Graphs And Tables
========================= */

.responsive-graph,
.dash-graph,
.js-plotly-plot,
.plot-container,
.svg-container {
  width: 100% !important;
  max-width: 100% !important;
}

.responsive-graph {
  overflow-x: hidden;
  margin-bottom: 12px;
}

.dash-table-container,
.responsive-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.responsive-table-wrapper {
  margin-top: 8px;
}

.dash-spreadsheet-container,
.dash-spreadsheet-inner {
  max-width: 100%;
}

.card,
.card-body,
.alert {
  min-width: 0;
  max-width: 100%;
}

/* =========================
   Bootstrap / General
========================= */

.btn {
  max-width: 100%;
}

img,
svg,
canvas {
  max-width: 100%;
}

/* =========================
   Tablet
========================= */

@media (max-width: 992px) {
  .sidebar-column {
    flex-basis: 240px;
    width: 240px;
    min-width: 220px;
  }

  .main-content {
    max-width: calc(100vw - 240px);
  }

  .main-content-inner {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }

  .sidebar-wrapper {
    padding: 1.25rem !important;
  }

  .sidebar-nav-link {
    font-size: 0.92rem;
    padding: 0.45rem 0.65rem;
  }

  .employee-search-filters {
    grid-template-columns: minmax(220px, 1.4fr) minmax(160px, 1fr);
  }

  .employee-search-filters .filter-field:first-child {
    grid-column: 1 / -1;
  }

  .summary-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================
   Mobile / Small Tablet
========================= */

@media (max-width: 768px) {
  .app-shell {
    display: block;
    min-height: 0;
  }

  .sidebar-column,
  .main-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .sidebar-wrapper {
    position: static !important;
    height: auto;
    min-height: 0 !important;
    overflow: visible;
    border-right: 0 !important;
    border-bottom: 1px solid #dee2e6;
    padding: 0.9rem 1rem !important;
  }

  .sidebar-brand {
    margin-bottom: 0.6rem;
  }

  .sidebar-title {
    margin-bottom: 0.15rem !important;
    font-size: 1rem;
  }

  .sidebar-subtitle {
    margin-bottom: 0 !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
  }

  .sidebar-nav-link {
    flex: 0 0 auto;
    margin-bottom: 0 !important;
    padding: 0.45rem 0.75rem;
    white-space: nowrap;
    border-radius: 999px !important;
    font-size: 0.88rem;
  }

  .main-content-inner {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-bottom: 2rem !important;
  }

  .app-header {
    padding-top: 1.25rem !important;
    padding-bottom: 1rem !important;
  }

  .app-title {
    font-size: 1.55rem;
  }

  .app-subtitle {
    font-size: 1rem !important;
  }

  .employee-search-filters {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card-body {
    padding: 1rem;
  }

  .Select-menu-outer {
    position: absolute !important;
  }

  .employee-dropdown .Select-menu-outer {
    max-height: 260px !important;
  }
}

/* =========================
   Mobile
========================= */

@media (max-width: 576px) {
  body {
    overflow-x: hidden;
  }

  .main-content-inner {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .page-container {
    padding: 0 !important;
  }

  .page-container h2,
  .page-container h3,
  .card h3 {
    font-size: 1.25rem;
    line-height: 1.25;
  }

  .page-container h4,
  .card h4 {
    font-size: 1.05rem;
    line-height: 1.3;
  }

  .page-container p {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .employee-search-filters {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

  .filter-field label {
    font-size: 0.95rem;
  }

  .Select-control {
    min-height: 44px !important;
  }

  .Select-placeholder,
  .Select-value-label {
    font-size: 14px !important;
    line-height: 42px !important;
  }

  .Select-menu {
    max-height: 240px !important;
  }

  .employee-dropdown .Select-menu,
  .employee-dropdown .Select-menu-outer {
    max-height: 240px !important;
  }

  .employee-dropdown .Select-option,
  .employee-dropdown .VirtualizedSelectOption,
  .employee-dropdown .VirtualizedSelectFocusedOption,
  .employee-dropdown .VirtualizedSelectSelectedOption {
    font-size: 14px !important;
  }

  .summary-cards-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .summary-card {
    padding: 12px;
  }

  .summary-card h4 {
    font-size: 0.95rem;
    margin-bottom: 6px;
  }

  .summary-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0;
  }

  .responsive-graph {
    max-height: 330px;
    overflow: hidden;
  }

  .responsive-graph .dash-graph {
    height: 320px !important;
  }

  .responsive-table-wrapper {
    max-height: 420px;
    overflow-x: auto;
    overflow-y: auto;
  }

  .responsive-table-wrapper .dash-table-container {
    min-width: 620px;
  }

  .dash-table-container {
    font-size: 0.85rem;
  }

  .dash-spreadsheet-container table {
    min-width: 640px;
  }

  .DateRangePickerInput {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
  }

  .DateRangePickerInput .DateInput {
    flex: 1 1 130px;
  }

  .SingleDatePicker,
  .SingleDatePickerInput,
  .DateInput,
  .DateInput_input {
    width: 100% !important;
  }

  .btn {
    white-space: normal;
  }
}