:root {
  --app-shell-gutter: clamp(0.75rem, 1.5vw, 1.5rem);
  --page-surface-padding-y: clamp(1rem, 1vw + 0.75rem, 1.5rem);
  --page-surface-padding-x: clamp(0.875rem, 1vw + 0.75rem, 1.5rem);
}

html,
body {
  overflow-x: hidden;
}

body {
  background: #f5f7fb;
}

.app-shell {
  min-height: 100dvh;
}

.app-bar {
  position: sticky;
  top: 0;
  z-index: 1300;
}

.app-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.app-drawer .mud-drawer-content {
  background: #fff;
}

.app-drawer-header {
  padding-inline: 1rem;
}

.app-nav-menu {
  padding: 0.25rem 0.5rem 1rem;
}

.app-nav-button {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.main-content-shell {
  padding: calc(64px + var(--app-shell-gutter)) var(--app-shell-gutter) var(--app-shell-gutter);
}

.page-surface {
  padding: var(--page-surface-padding-y) var(--page-surface-padding-x);
  border-radius: 18px;
}

.page-toolbar {
  gap: 1rem;
  flex-wrap: wrap;
}

.page-toolbar-intro,
.page-toolbar-panel {
  min-width: 0;
}

.page-toolbar-panel {
  margin-left: auto;
}

.page-toolbar-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}

.page-toolbar-filters {
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-toolbar-select {
  width: clamp(11rem, 22vw, 18rem);
  max-width: 100%;
}

.page-toolbar-field {
  width: clamp(12rem, 24vw, 18rem);
  max-width: 100%;
}

.split-page-shell {
  min-height: calc(100dvh - 7.5rem);
}

.split-page-filter-panel {
  height: 100%;
}

.page-data-grid {
  height: calc(100dvh - 10rem);
}

.page-data-grid .mud-table-toolbar {
  gap: 0.75rem;
  flex-wrap: wrap;
}

.responsive-data-grid {
  width: 100%;
}

.responsive-table-shell {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.responsive-detail-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  min-width: 42rem;
}

@media (max-width: 959.98px) {
  .main-content-shell {
    padding: 72px 0.75rem 1rem;
  }

  .page-surface {
    padding: 1rem;
  }

  .page-toolbar {
    flex-direction: column !important;
  }

  .page-toolbar-panel {
    width: 100%;
    margin-left: 0;
    align-items: stretch !important;
  }

  .page-toolbar-actions,
  .page-toolbar-filters {
    justify-content: stretch;
  }

  .page-toolbar-actions > *,
  .page-toolbar-filters > * {
    flex: 1 1 100%;
  }

  .page-toolbar-select,
  .page-toolbar-field {
    width: 100%;
  }

  .split-page-shell {
    min-height: auto;
  }

  .split-page-filter-panel {
    height: auto;
  }

  .page-data-grid {
    height: auto !important;
  }

  .page-data-grid .mud-table-toolbar .mud-spacer {
    display: none;
  }

  .page-data-grid .mud-table-toolbar .mud-button-root {
    width: 100%;
    margin-left: 0 !important;
  }

  .responsive-detail-table {
    min-width: 34rem;
  }
}

@media (max-width: 599.98px) {
  .app-title {
    font-size: 1rem;
  }

  .page-toolbar-actions,
  .page-toolbar-filters {
    width: 100%;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .page-toolbar-actions > *,
  .page-toolbar-filters > * {
    width: 100%;
    flex: 0 0 auto;
    max-width: 100%;
  }

  .page-toolbar-actions .mud-menu,
  .page-toolbar-actions .mud-menu-activator {
    width: 100%;
  }

  .page-toolbar-actions .mud-button-root,
  .page-toolbar-actions .mud-menu,
  .page-toolbar-actions .mud-menu-activator,
  .page-toolbar-filters .mud-input-control,
  .page-toolbar-filters .mud-input-control-root {
    width: 100% !important;
    max-width: 100%;
  }

  .page-toolbar-actions .mud-button-root,
  .page-toolbar-actions .mud-menu-activator,
  .page-toolbar-filters .mud-input-control {
    justify-content: center;
  }

  .responsive-data-grid .mud-table-cell {
    min-width: 0;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.35rem;
  }

  .responsive-data-grid .mud-table-cell-label {
    flex: 0 0 auto !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .responsive-data-grid .mud-table-cell > :not(.mud-table-cell-label) {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .responsive-data-grid .mud-typography {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .user-list-grid .user-list-identity,
  .user-list-grid .user-list-email,
  .user-list-grid .user-list-roles,
  .user-list-grid .user-list-actions {
    width: 100%;
    min-width: 0;
  }

  .user-list-grid .user-list-identity,
  .user-list-grid .user-list-email,
  .user-list-grid .user-list-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .user-list-grid .user-list-identity-text {
    min-width: 0;
    flex: 1 1 0;
  }

  .user-list-grid .user-list-value,
  .user-list-grid .user-list-department {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .user-list-grid .user-list-roles,
  .user-list-grid .user-list-actions {
    gap: 0.25rem;
  }

  .user-list-grid .mud-chip {
    max-width: 100%;
  }

  .user-list-grid .mud-icon-button {
    margin-left: 0;
  }

  .responsive-detail-table {
    min-width: 30rem;
  }
}
