:root {
  --sidebar-width: 240px;
}

body {
  overflow-x: hidden;
  background: #f8f9fa;
}

.app-wrapper {
  display: flex;
  min-height: calc(100vh - 56px);
}

body[data-page="home"] .app-wrapper {
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  border-right: 1px solid rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  padding-top: 0.75rem;
  background: var(--bs-body-bg);
}

body[data-page="home"] .sidebar {
  top: 0;
  height: 100vh;
}

.content {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1.25rem 1.5rem 2rem;
}

header.navbar {
  position: sticky;
  top: 0;
  z-index: 1030;
}

.backdrop {
  display: none;
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1050;
    display: none;
  }

  .sidebar.show {
    display: block;
  }

  .backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1040;
  }

  .backdrop.show {
    display: block;
  }

  .content {
    padding: 1rem;
  }
}

@media (min-width: 992px) {
  #sidebar {
    display: block !important;
  }

  .backdrop {
    display: none !important;
  }
}

.page-header h1 {
  font-weight: 600;
}

.nav-tabs .nav-link {
  font-weight: 500;
}

.nav-tabs .nav-link.active {
  font-weight: 600;
}

.table-toolbar .form-label {
  color: #6c757d;
}

.table-toolbar .btn {
  white-space: nowrap;
}

.table {
  --bs-table-hover-bg: rgba(120, 194, 173, 0.12);
  font-size: 0.925rem;
  white-space: nowrap;
}

.table thead th.col-header {
  position: relative;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #495057;
  border-bottom-width: 1px;
  vertical-align: middle;
}

.col-header-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
}

.col-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border: 0;
  border-radius: 0.25rem;
  background: transparent;
  color: #6c757d;
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.col-filter-btn svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: currentColor;
}

.col-header:hover .col-filter-btn,
.col-header.is-open .col-filter-btn,
.col-header.is-filtered .col-filter-btn {
  opacity: 1;
  visibility: visible;
}

@media (hover: none) {
  .col-filter-btn {
    opacity: 0.45;
    visibility: visible;
  }
}

.col-filter-btn:hover,
.col-header.is-open .col-filter-btn {
  background: rgba(0, 0, 0, 0.06);
  color: #343a40;
}

.col-header.is-filtered .col-filter-btn {
  color: #78c2ad;
  background: rgba(120, 194, 173, 0.18);
}

.col-filter-popover {
  position: absolute;
  top: calc(100% - 0.15rem);
  left: 0;
  z-index: 20;
  min-width: 180px;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 0.4rem;
  box-shadow: 0 0.35rem 1rem rgba(0, 0, 0, 0.12);
}

.col-filter-popover[hidden] {
  display: none !important;
}

.table td {
  vertical-align: middle;
}

.approval-actions {
  display: inline-flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
}

.approval-actions .btn {
  white-space: nowrap;
}

.notes-cell,
.justification-cell {
  max-width: 240px;
  white-space: normal;
  min-width: 140px;
}

.notes-wrap {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: 100%;
}

.notes-text {
  flex: 1 1 auto;
  min-width: 0;
}

.notes-edit-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  border-radius: 0.25rem;
  background: transparent;
  color: #6c757d;
  opacity: 0;
  visibility: hidden;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.notes-edit-btn svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: currentColor;
}

.notes-cell:hover .notes-edit-btn,
.notes-edit-btn:focus-visible {
  opacity: 1;
  visibility: visible;
}

.notes-edit-btn:hover,
.notes-edit-btn:focus-visible {
  background: rgba(0, 0, 0, 0.06);
  color: #343a40;
}

@media (hover: none) {
  .notes-edit-btn {
    opacity: 0.55;
    visibility: visible;
  }
}

.empty-state td {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #6c757d;
  white-space: normal;
}

.page-hint {
  font-size: 0.9rem;
}

body[data-page="home"] .content-home {
  padding-top: 1.25rem;
}

.page-title-strip {
  background: var(--bs-primary, #2c3e50);
  color: #fff;
  margin: 0.35rem -1.5rem 1.5rem;
  padding: 0.95rem 1.5rem;
  width: calc(100% + 3rem);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.page-title-strip-heading {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
}

.page-title-menu {
  margin-bottom: 0.75rem !important;
}

@media (max-width: 991.98px) {
  .page-title-strip {
    margin-left: -1rem;
    margin-right: -1rem;
    width: calc(100% + 2rem);
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.welcome-panel {
  max-width: 48rem;
  padding: 0 0 1rem;
}

.welcome-summary {
  font-size: 1.15rem;
  line-height: 1.6;
}

.welcome-summary strong {
  color: #212529;
  font-weight: 700;
}

.welcome-breakdown {
  max-width: 36rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 0.5rem;
}

.welcome-breakdown-list li {
  font-size: 1.05rem;
  line-height: 1.55;
  padding: 0.35rem 0;
}

.welcome-breakdown-list li + li {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.welcome-breakdown-list strong {
  color: #212529;
  font-weight: 700;
}
