/**
 * InSec+ — Mobile & Tablet Shell
 * Smartphone ≤767px · Tablet 768–1023px · Laptop 1024–1439px (class only)
 * Desktop ≥1024px unverändert — alle Regeln unter Shell-Klassen
 */

:root {
  --mobile-bar-height: 3.25rem;
  --mobile-bottom-nav-height: 3.75rem;
  --mobile-quick-fab-clearance: 3.65rem;
  --mobile-shell-pad-x: 0.85rem;
  --insec-touch-min: 44px;
  --mobile-card-radius: 14px;
  --mobile-card-pad: 0.85rem;
  --mobile-stack-gap: 0.75rem;
  --bp-smartphone-max: 767px;
  --bp-tablet-max: 1023px;
  --bp-laptop-max: 1439px;
}

/* —— Backdrop (Drawer) —— */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) - 25);
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.insec-mobile-nav-lock {
  overflow: hidden;
  touch-action: none;
}

/* —— Bottom Navigation (Smartphone only) —— */
.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--z-modal) - 35);
  display: none;
  align-items: stretch;
  justify-content: space-around;
  gap: 0.15rem;
  min-height: var(--mobile-bottom-nav-height);
  padding:
    0.35rem var(--mobile-shell-pad-x)
    max(0.35rem, env(safe-area-inset-bottom));
  border-top: 0.5px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--sidebar-bg) 94%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
}

html.insec-mobile-shell .mobile-bottom-nav:not(.hidden) {
  display: flex;
}

.mobile-bottom-tab {
  flex: 1 1 0;
  min-width: 0;
  max-width: 5.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0.35rem 0.25rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.1;
  cursor: pointer;
  min-height: var(--insec-touch-min);
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.15s ease,
    background-color 0.15s ease,
    transform 0.12s ease;
}

.mobile-bottom-tab .ui-icon {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  opacity: 0.88;
}

.mobile-bottom-tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-bottom-tab:active {
  transform: scale(0.94);
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
}

.mobile-bottom-tab:focus-visible {
  outline: 2px solid var(--color-primary, #5b8def);
  outline-offset: 2px;
}

.mobile-bottom-tab.is-active {
  color: var(--text-main);
}

.mobile-bottom-tab.is-active .ui-icon {
  opacity: 1;
  color: var(--color-primary);
}

.mobile-bottom-tab.is-active span {
  font-weight: 700;
}

/* —— App Bar (Compact: Mobile + Tablet) —— */
.mobile-nav-toggle,
.mobile-back-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--insec-touch-min);
  height: var(--insec-touch-min);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  color: var(--text-main);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.mobile-nav-toggle .ui-icon,
.mobile-back-btn .ui-icon {
  width: 1.35rem;
  height: 1.35rem;
}

.mobile-nav-toggle:active,
.mobile-back-btn:active {
  transform: scale(0.94);
  background: color-mix(in srgb, var(--text-muted) 18%, transparent);
}

.mobile-nav-toggle:focus-visible,
.mobile-back-btn:focus-visible {
  outline: 2px solid var(--color-primary, #5b8def);
  outline-offset: 2px;
}

.mobile-app-bar__start {
  display: none;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.mobile-app-bar__brand {
  display: none;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
}

.mobile-app-bar__actions {
  display: contents;
}

.mobile-page-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

/* ============================================================
   COMPACT SHELL — Mobile + Tablet (Sidebar → Drawer)
   ============================================================ */

html.insec-compact-shell .mobile-nav-toggle:not(.hidden),
html.insec-compact-shell .mobile-back-btn:not(.hidden) {
  display: inline-flex;
}

html.insec-compact-shell .mobile-app-bar__start {
  display: flex;
}

html.insec-compact-shell .mobile-app-bar__brand {
  display: flex;
}

html.insec-compact-shell .app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  width: 100%;
  max-width: 100vw;
}

html.insec-compact-shell .sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: calc(var(--z-modal) - 15);
  width: min(18rem, 90vw);
  min-width: 0;
  max-width: none;
  height: 100dvh;
  max-height: 100dvh;
  transform: translate3d(-105%, 0, 0);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow:
    0 0 0 0.5px color-mix(in srgb, var(--line) 55%, transparent),
    0 16px 48px rgba(0, 0, 0, 0.45);
  padding-top: max(0.5rem, env(safe-area-inset-top));
  padding-bottom: max(0.55rem, env(safe-area-inset-bottom));
}

html.insec-compact-shell .app.app-mobile-nav-open .sidebar {
  transform: translate3d(0, 0, 0);
}

html.insec-compact-shell .sidebar .nav .nav-item {
  min-height: var(--insec-touch-min);
  width: calc(100% - 1rem);
  max-width: none;
  margin: 2px 0.5rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  border-radius: 12px;
}

html.insec-compact-shell .sidebar .nav .nav-item:active {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
}

html.insec-compact-shell .sidebar .account-icon-btn {
  width: var(--insec-touch-min);
  height: var(--insec-touch-min);
  min-width: var(--insec-touch-min);
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .brand--drawer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding-right: 0.25rem;
}

html.insec-compact-shell .mobile-drawer-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--insec-touch-min);
  height: var(--insec-touch-min);
  margin-left: auto;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text-muted) 12%, transparent);
  color: var(--text-main);
  cursor: pointer;
  flex-shrink: 0;
}

html.insec-compact-shell .mobile-drawer-close:not(.hidden) {
  display: inline-flex;
}

html.insec-compact-shell .mobile-drawer-close:active {
  transform: scale(0.94);
  background: color-mix(in srgb, var(--text-muted) 20%, transparent);
}

html.insec-compact-shell .content {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  max-width: 100vw;
  height: auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding:
    0
    var(--mobile-shell-pad-x)
    max(0.85rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

html.insec-mobile-shell .content {
  padding-bottom: calc(
    var(--mobile-bottom-nav-height)
    + var(--mobile-quick-fab-clearance)
    + max(0.85rem, env(safe-area-inset-bottom))
  );
}

html.insec-modal-open.insec-mobile-shell .content {
  padding-bottom: calc(var(--mobile-quick-fab-clearance) + max(1rem, env(safe-area-inset-bottom)));
}

html.insec-compact-shell .content-topbar {
  position: sticky;
  top: 0;
  z-index: calc(var(--z-dropdown) + 2);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "start title actions"
    "maint maint maint";
  align-items: center;
  gap: 0.35rem 0.45rem;
  margin: 0 calc(var(--mobile-shell-pad-x) * -1) 0.75rem;
  padding:
    max(0.55rem, env(safe-area-inset-top))
    var(--mobile-shell-pad-x)
    0.65rem;
  background: color-mix(in srgb, var(--bg-primary) 92%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 0.5px solid color-mix(in srgb, var(--line) 70%, transparent);
}

html.insec-compact-shell .mobile-app-bar__start {
  grid-area: start;
}

html.insec-compact-shell .mobile-app-bar__brand {
  grid-area: title;
  justify-content: flex-start;
  min-width: 0;
}

html.insec-compact-shell .mobile-app-bar__actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  min-width: 0;
}

html.insec-compact-shell .content-topbar-spacer {
  grid-area: maint;
  display: none;
  width: 100%;
  min-width: 0;
}

html.insec-compact-shell .content-topbar-spacer:has(.maintenance-mode-badge:not(.hidden)) {
  display: block;
}

html.insec-compact-shell .maintenance-mode-badge {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  font-size: 0.72rem;
  margin-top: 0.15rem;
}

html.insec-mobile-shell .topbar-location-wrap {
  max-width: var(--insec-touch-min);
}

html.insec-mobile-shell .topbar-loc-trigger-label,
html.insec-mobile-shell .topbar-loc-trigger-chevron {
  display: none;
}

html.insec-compact-shell .topbar-location-wrap {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 6.5rem;
}

html.insec-compact-shell .topbar-location-trigger {
  min-height: var(--insec-touch-min);
  min-width: var(--insec-touch-min);
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  max-width: 100%;
}

html.insec-compact-shell .topbar-loc-trigger-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 4.5rem;
}

html.insec-compact-shell .topbar-profile-mini {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: var(--insec-touch-min);
  min-height: var(--insec-touch-min);
  width: var(--insec-touch-min);
  height: var(--insec-touch-min);
  padding: 0;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
}

html.insec-compact-shell .topbar-mini-name {
  display: none !important;
}

html.insec-compact-shell .topbar-mini-avatar-wrap {
  margin: 0;
}

html.insec-compact-shell .topbar-notify-btn {
  width: var(--insec-touch-min);
  height: var(--insec-touch-min);
}

html.insec-compact-shell .topbar-notify-dropdown.insec-popover-portaled,
html.insec-compact-shell .topbar-location-menu.insec-popover-portaled {
  max-width: calc(100vw - var(--mobile-shell-pad-x) * 2);
}

html.insec-compact-shell .topbar-notify-clear {
  min-height: var(--insec-touch-min);
  padding: 0.45rem 0.75rem;
}

html.insec-compact-shell .topbar-notify-filter {
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: var(--insec-touch-min);
  padding: 0.35rem 0.65rem;
}

html.insec-compact-shell .view > h2:first-child,
html.insec-compact-shell .view-header h2 {
  display: none;
}

html.insec-compact-shell .view {
  max-width: 100%;
  overflow-x: hidden;
}

html.insec-compact-shell .view-header {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

html.insec-compact-shell .card,
html.insec-compact-shell .empty-state,
html.insec-compact-shell .detail-card,
html.insec-compact-shell .database-modern-list,
html.insec-compact-shell .db-result-item {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: var(--mobile-card-radius);
}

html.insec-compact-shell .cards {
  grid-template-columns: 1fr;
  gap: var(--mobile-stack-gap);
}

html.insec-compact-shell .person-grid,
html.insec-compact-shell .form-grid,
html.insec-compact-shell .form-grid--acp-create {
  grid-template-columns: 1fr !important;
}

html.insec-compact-shell .list-table-host,
html.insec-compact-shell .data-table-wrap,
html.insec-compact-shell .acp-list-wrap {
  overflow-x: visible;
  max-width: 100%;
}

html.insec-compact-shell .data-table-scroll:not(:has(.insec-mobile-card-table)),
html.insec-compact-shell .acp-table-scroll:not(:has(.insec-mobile-card-table)) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* —— Tabellen → Karten —— */
html.insec-compact-shell .insec-mobile-card-table thead {
  display: none;
}

html.insec-compact-shell .insec-mobile-card-table,
html.insec-compact-shell .insec-mobile-card-table tbody {
  display: block;
  width: 100%;
}

html.insec-compact-shell .insec-mobile-card-table tr {
  display: block;
  width: 100%;
  margin-bottom: var(--mobile-stack-gap);
  padding: var(--mobile-card-pad);
  border: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  border-radius: var(--mobile-card-radius);
  background: var(--bg-card, var(--bg-secondary));
  box-sizing: border-box;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 35%, transparent);
}

html.insec-compact-shell .insec-mobile-card-table tr.staff-row,
html.insec-compact-shell .insec-mobile-card-table tr[data-staff-id],
html.insec-compact-shell .insec-mobile-card-table tr[data-user-id] {
  cursor: pointer;
}

html.insec-compact-shell .insec-mobile-card-table tr:active {
  background: color-mix(in srgb, var(--color-primary) 8%, var(--bg-card, var(--bg-secondary)));
}

html.insec-compact-shell .insec-mobile-card-table td {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.35rem 0;
  border: none;
  text-align: right;
  width: 100%;
  box-sizing: border-box;
}

html.insec-compact-shell .insec-mobile-card-table td::before {
  content: attr(data-label);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  flex: 0 0 auto;
  min-width: 5.5rem;
  max-width: 42%;
  text-align: left;
}

html.insec-compact-shell .insec-mobile-card-table .acp-td-user {
  display: block;
  padding-bottom: 0.65rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  text-align: left;
}

html.insec-compact-shell .insec-mobile-card-table .acp-td-user::before {
  display: none;
}

html.insec-compact-shell .insec-mobile-card-table .acp-td-actions {
  display: block;
  padding-top: 0.5rem;
  text-align: left;
}

html.insec-compact-shell .insec-mobile-card-table .acp-td-status,
html.insec-compact-shell .insec-mobile-card-table .acp-td-last-active {
  display: block;
  text-align: left;
}

html.insec-compact-shell .insec-mobile-card-table .acp-user-last-active {
  font-size: 0.82rem;
}

html.insec-compact-shell .insec-mobile-card-table .acp-td-actions::before {
  display: block;
  margin-bottom: 0.45rem;
}

html.insec-compact-shell .insec-mobile-card-table .acp-actions-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.45rem 0.55rem;
  max-width: none;
  min-width: 0;
  width: 100%;
}

html.insec-compact-shell .insec-mobile-card-table .acp-actions-stack {
  flex-direction: column;
  gap: 0.45rem;
  max-width: none;
  width: 100%;
}

html.insec-compact-shell .insec-mobile-card-table .acp-grid-btn,
html.insec-compact-shell .insec-mobile-card-table .ghost-btn {
  width: 100%;
  min-height: var(--insec-touch-min);
  justify-content: flex-start;
}

html.insec-compact-shell .insec-mobile-card-table .trash-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
}

html.insec-compact-shell .insec-mobile-card-table .trash-actions .ghost-btn {
  width: 100%;
}

html.insec-compact-shell .staff-list-name {
  display: block;
  font-weight: 600;
}

/* —— ACP / Tabs / Filter —— */
html.insec-compact-shell .acp-main-tabs,
html.insec-compact-shell .acp-nav-tabs,
html.insec-compact-shell .shifts-main-tabs,
html.insec-compact-shell .shifts-view-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-left: 0.28rem;
  padding-right: max(0.28rem, var(--mobile-shell-pad-x));
  scroll-padding-inline: 0.5rem;
  margin-left: 0;
  margin-right: 0;
}

html.insec-compact-shell .acp-main-tabs::-webkit-scrollbar,
html.insec-compact-shell .acp-nav-tabs::-webkit-scrollbar {
  display: none;
}

html.insec-compact-shell .acp-tab,
html.insec-compact-shell .acp-nav-tab,
html.insec-compact-shell .shifts-main-tab {
  flex: 0 0 auto;
  min-width: max-content;
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .acp-loc-discord-layout,
html.insec-compact-shell .acp-loc-layout,
html.insec-compact-shell .acp-rbac-discord-layout,
html.insec-compact-shell .acp-rbac-layout {
  grid-template-columns: 1fr !important;
}

html.insec-compact-shell .acp-loc-sidebar,
html.insec-compact-shell .acp-rbac-sidebar {
  max-height: min(40dvh, 280px);
  min-height: 0;
}

html.insec-compact-shell .acp-loc-side-item,
html.insec-compact-shell .acp-rbac-side-item {
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .acp-rbac-rank-btn {
  width: 1.85rem;
  height: 1.85rem;
  font-size: 0.85rem;
}

html.insec-compact-shell .filter-row,
html.insec-compact-shell .acp-filter-buttons {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-right: var(--mobile-shell-pad-x);
  scroll-padding-inline: 0.5rem;
}

html.insec-compact-shell .database-search-row,
html.insec-compact-shell .dashboard-search-row {
  flex-direction: column;
  align-items: stretch;
}

html.insec-compact-shell .acp-user-searchbar--with-action {
  flex-wrap: wrap;
  align-items: stretch;
}

html.insec-compact-shell .acp-user-searchbar--with-action .list-search-input {
  flex: 1 1 12rem;
  min-width: 0;
}

html.insec-compact-shell .acp-user-searchbar--with-action .acp-create-user-btn {
  flex: 1 1 100%;
  width: 100%;
  margin-left: 0;
  justify-content: center;
}

html.insec-compact-shell .insec-mobile-card-table .acp-td-actions {
  text-align: left;
}

html.insec-compact-shell .insec-mobile-card-table .acp-actions-head,
html.insec-compact-shell .insec-mobile-card-table .acp-actions-cols {
  margin-left: 0;
  min-width: 0;
  max-width: none;
}

html.insec-compact-shell .dashboard-search-hero .filter-row,
html.insec-compact-shell .search-section .filter-row,
html.insec-compact-shell .filter-row--wrap {
  flex-wrap: wrap;
  overflow-x: visible;
  gap: 0.45rem;
  padding-right: 0;
}

html.insec-compact-shell .dashboard-search-hero .filter-row .filter-btn,
html.insec-compact-shell .search-section .filter-row .filter-btn,
html.insec-compact-shell .filter-row--wrap .filter-btn {
  flex: 0 0 auto;
  flex-shrink: 0;
  max-width: 100%;
  white-space: nowrap;
}

html.insec-compact-shell .database-search-row .list-search-input,
html.insec-compact-shell .input-database-search {
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .database-advanced-toggle {
  min-height: var(--insec-touch-min);
  min-width: var(--insec-touch-min);
}

html.insec-compact-shell .rte-toolbar {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* —— Formulare & Buttons —— */
html.insec-compact-shell input,
html.insec-compact-shell select,
html.insec-compact-shell textarea,
html.insec-compact-shell .list-search-input,
html.insec-compact-shell .dropdown-trigger,
html.insec-compact-shell .insec-dd-trigger {
  font-size: 16px;
  max-width: 100%;
  box-sizing: border-box;
}

html.insec-compact-shell .auth-form input,
html.insec-compact-shell .auth-form select,
html.insec-compact-shell .auth-form textarea,
html.insec-compact-shell .form-grid input,
html.insec-compact-shell .form-grid select,
html.insec-compact-shell .form-grid textarea,
html.insec-compact-shell .modal-dialog input:not([type="checkbox"]):not([type="radio"]),
html.insec-compact-shell .modal-dialog select,
html.insec-compact-shell .modal-dialog textarea,
html.insec-compact-shell .modal-dialog .dropdown-trigger,
html.insec-compact-shell .modal-dialog .insec-dd-trigger {
  width: 100%;
}

html.insec-compact-shell .insec-dd-menu input[type="search"],
html.insec-compact-shell .dropdown-inline-search {
  font-size: 16px;
}

html.insec-compact-shell .input-eye-btn {
  width: var(--insec-touch-min);
  height: var(--insec-touch-min);
  min-width: var(--insec-touch-min);
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .acp-grid-btn {
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .search-history-chip {
  min-height: 2.75rem;
  padding: 0.45rem 0.75rem;
}

html.insec-compact-shell button,
html.insec-compact-shell .filter-btn,
html.insec-compact-shell .ghost-btn,
html.insec-compact-shell .btn-strong {
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .modal-actions,
html.insec-compact-shell .view-header-actions,
html.insec-compact-shell .person-dossier-actions,
html.insec-compact-shell .event-dossier-actions {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
}

html.insec-compact-shell .modal-actions .ghost-btn,
html.insec-compact-shell .modal-actions .btn-strong,
html.insec-compact-shell .view-header-actions > *,
html.insec-compact-shell .person-action-btn {
  width: 100%;
  justify-content: center;
}

html.insec-compact-shell .person-note-modal-actions-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

html.insec-compact-shell .person-note-modal-actions-col > button {
  width: 100%;
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .app-confirm-modal__actions {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

html.insec-compact-shell .app-confirm-modal__actions .app-confirm-btn {
  width: 100%;
  min-height: var(--insec-touch-min);
}

html.insec-mobile-shell .modal-dialog,
html.insec-mobile-shell .app-confirm-modal__panel {
  padding-bottom: calc(var(--mobile-bottom-nav-height) + max(1rem, env(safe-area-inset-bottom)));
}

html.insec-modal-open .mobile-bottom-nav {
  display: none !important;
}

html.insec-compact-shell #shift-modal.modal-overlay:not(.hidden) {
  align-items: flex-end;
  padding: 0;
}

html.insec-compact-shell .shift-modal-dialog,
html.insec-compact-shell #shift-modal .modal-dialog {
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-radius: 16px 16px 0 0;
  max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
}

html.insec-compact-shell .shift-modal-close-btn {
  width: var(--insec-touch-min);
  height: var(--insec-touch-min);
  min-width: var(--insec-touch-min);
  min-height: var(--insec-touch-min);
}

/* —— Bottom Sheet Dialoge —— */
html.insec-compact-shell .modal-overlay:not(.hidden) {
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

html.insec-compact-shell .modal-dialog {
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-radius: 16px 16px 0 0;
  max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px)));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
}

html.insec-compact-shell .modal-dialog--wide {
  max-width: 100%;
}

html.insec-compact-shell .app-confirm-modal:not(.hidden) {
  align-items: flex-end;
  padding: 0;
}

html.insec-compact-shell .app-confirm-modal__panel {
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-radius: 16px 16px 0 0;
  padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
}

html.insec-compact-shell .insec-popover-portaled.insec-dd-menu,
html.insec-compact-shell .dropdown-menu.insec-dd-menu {
  max-width: calc(100vw - var(--mobile-shell-pad-x) * 2);
}

/* —— Dienstplan —— */
html.insec-compact-shell .shifts-plan-layout {
  grid-template-columns: 1fr !important;
}

html.insec-compact-shell .shifts-cal-grid,
html.insec-compact-shell .shifts-cal-grid--plan {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html.insec-compact-shell .shifts-cal-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

html.insec-compact-shell .shifts-cal-cell {
  min-width: 0;
  min-height: 4.25rem;
  font-size: 0.68rem;
  padding: 0.2rem;
}

html.insec-compact-shell .shifts-toolbar--plan {
  flex-wrap: wrap;
  gap: 0.45rem;
}

html.insec-compact-shell .shifts-cal-grid--plan {
  min-height: min(360px, 55dvh);
  grid-auto-rows: minmax(3.75rem, 1fr);
}

html.insec-compact-shell .shift-chip {
  font-size: 0.68rem;
  padding: 0.2rem 0.35rem;
  min-height: 1.5rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.insec-compact-shell .shifts-pick-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: 100%;
  max-width: 100%;
  max-height: min(72dvh, calc(100dvh - var(--mobile-bar-height)));
  border-radius: 16px 16px 0 0;
  transform: translateY(105%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: calc(var(--z-modal) - 20);
}

html.insec-compact-shell .shifts-pick-panel.is-open {
  transform: translateY(0);
}

html.insec-mobile-shell .shifts-pick-panel.is-open {
  padding-bottom: calc(var(--mobile-bottom-nav-height) + env(safe-area-inset-bottom));
}

html.insec-compact-shell .quick-event-fab,
html.insec-compact-shell .shifts-fab {
  z-index: calc(var(--z-modal) - 30);
}

html.insec-mobile-shell .quick-event-fab,
html.insec-mobile-shell .shifts-fab {
  left: max(0.85rem, env(safe-area-inset-left));
  right: max(0.85rem, env(safe-area-inset-right));
  width: auto;
  max-width: calc(100vw - max(0.85rem, env(safe-area-inset-left)) - max(0.85rem, env(safe-area-inset-right)));
  box-sizing: border-box;
  text-align: center;
  bottom: calc(var(--mobile-bottom-nav-height) + max(0.65rem, env(safe-area-inset-bottom)));
}

html.insec-tablet-shell .quick-event-fab,
html.insec-tablet-shell .shifts-fab {
  bottom: max(0.85rem, env(safe-area-inset-bottom));
  right: max(0.85rem, env(safe-area-inset-right));
}

/* —— Detail-Ansichten —— */
html.insec-compact-shell .person-dossier,
html.insec-compact-shell .event-dossier,
html.insec-compact-shell .staff-dossier {
  max-width: 100%;
  overflow-x: hidden;
}

html.insec-compact-shell .event-dossier-head-row,
html.insec-compact-shell .person-dossier-head-row {
  flex-wrap: wrap;
}

html.insec-compact-shell .dossier-action-card,
html.insec-compact-shell .event-dossier-action-card {
  width: 100%;
  max-width: 100%;
}

html.insec-compact-shell .settings-layout,
html.insec-compact-shell .settings-nav {
  flex-direction: column;
}

html.insec-compact-shell .timeline-feed,
html.insec-compact-shell .activity-log-list {
  max-width: 100%;
}

html.insec-compact-shell .topbar-notify-filters {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
}

html.insec-compact-shell .topbar-notify-item {
  min-height: 4.25rem;
}

html.insec-compact-shell .db-result-item,
html.insec-compact-shell .filter-btn,
html.insec-compact-shell .checkbox-line {
  min-height: var(--insec-touch-min);
}

html.insec-compact-shell .checkbox-line {
  align-items: center;
  gap: 0.65rem;
}

html.insec-compact-shell img,
html.insec-compact-shell video {
  max-width: 100%;
  height: auto;
}

/* —— Tablet-spezifisch —— */
html.insec-tablet-shell {
  --mobile-shell-pad-x: 1.15rem;
}

html.insec-tablet-shell .cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html.insec-tablet-shell .sidebar {
  width: min(20rem, 42vw);
}

html.insec-tablet-shell .topbar-location-wrap {
  max-width: 10rem;
}

html.insec-tablet-shell .topbar-loc-trigger-label {
  max-width: 6rem;
}

/* —— Laptop-Hinweis (nur Klasse, kein Layout-Bruch) —— */
html.insec-laptop-shell .content {
  max-width: 100%;
}

/* —— Sehr kleine Smartphones —— */
@media (max-width: 480px) {
  :root {
    --mobile-shell-pad-x: 0.75rem;
  }

  html.insec-compact-shell .topbar-location-wrap {
    max-width: 6.5rem;
  }

  html.insec-compact-shell .topbar-loc-trigger-label {
    max-width: 3.25rem;
  }

  html.insec-mobile-shell .mobile-bottom-tab {
    font-size: 0.58rem;
  }

  html.insec-mobile-shell .mobile-bottom-tab .ui-icon {
    width: 1.25rem;
    height: 1.25rem;
  }

  html.insec-compact-shell .shifts-cal-cell {
    min-height: 3.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.insec-compact-shell .sidebar,
  .mobile-nav-backdrop,
  html.insec-compact-shell .shifts-pick-panel {
    transition: none;
  }
}

/* ============================================================
   Login / Registrierung (≤767px, ohne Shell-Klasse)
   ============================================================ */
@media (max-width: 767px) {
  .login-screen {
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
  }

  .login-layout {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .login-hero {
    min-width: 0;
    overflow: visible;
    padding: 1.35rem 1rem 1.15rem;
  }

  .login-hero-content {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .login-panel {
    justify-content: flex-start;
    overflow-x: clip;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding:
      max(1rem, env(safe-area-inset-top))
      max(1rem, env(safe-area-inset-right))
      max(2rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
  }

  .login-card {
    border-radius: var(--mobile-card-radius, 14px);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .login-panel-header {
    min-width: 0;
    max-width: 100%;
  }

  .insec-brand-logo-img {
    width: min(100%, 16rem);
    max-width: 100%;
    height: auto;
    margin-inline: auto;
  }

  .login-hero-lead {
    font-size: 0.92rem;
    line-height: 1.45;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    text-align: center;
    padding-inline: 0.15rem;
  }

  .login-auth-switch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .login-auth-switch-btn {
    width: 100%;
    min-width: 0;
    padding-inline: 0.4rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .login-card .auth-form input,
  .login-card .auth-form select,
  .login-card .auth-form .dropdown-trigger {
    min-height: var(--insec-touch-min, 44px);
    font-size: 16px;
  }

  .login-auth-switch-btn,
  .login-card .btn-strong,
  .login-card .ghost-btn {
    min-height: var(--insec-touch-min, 44px);
  }

  .login-card .input-eye-btn {
    width: var(--insec-touch-min, 44px);
    height: var(--insec-touch-min, 44px);
    min-width: var(--insec-touch-min, 44px);
    min-height: var(--insec-touch-min, 44px);
  }

  .register-grid {
    grid-template-columns: 1fr !important;
  }

  .checkbox-line {
    min-height: var(--insec-touch-min, 44px);
    align-items: center;
  }
}

/* —— UI-Konsistenz (Compact Shell) —— */
html.insec-compact-shell .view-lead,
html.insec-compact-shell .settings-muted,
html.insec-compact-shell .dashboard-location-hint {
  font-size: 0.88rem;
  line-height: 1.45;
  max-width: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

html.insec-compact-shell .empty-state {
  padding: var(--mobile-card-pad);
  text-align: center;
}

html.insec-compact-shell .empty-state p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}

html.insec-compact-shell .db-result-item {
  padding: var(--mobile-card-pad);
  min-height: var(--insec-touch-min);
  gap: 0.65rem;
}

html.insec-compact-shell .activity-log-item,
html.insec-compact-shell .timeline-item,
html.insec-compact-shell .search-result-item {
  padding: var(--mobile-card-pad);
  border-radius: var(--mobile-card-radius);
}

html.insec-compact-shell .settings-nav-btn {
  width: 100%;
  justify-content: flex-start;
  min-height: var(--insec-touch-min);
  border-radius: 12px;
}

html.insec-compact-shell .settings-section,
html.insec-compact-shell .detail-card,
html.insec-compact-shell .search-section {
  padding: var(--mobile-card-pad);
}

html.insec-compact-shell .person-dossier-actions,
html.insec-compact-shell .event-dossier-actions {
  gap: 0.5rem;
}

html.insec-compact-shell .dossier-section-title {
  font-size: 0.95rem;
  margin-bottom: 0.55rem;
}

html.insec-compact-shell .filter-btn {
  min-height: var(--insec-touch-min);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
}

html.insec-compact-shell .mobile-bottom-tab:focus-visible {
  outline: 2px solid var(--color-primary, #5b8def);
  outline-offset: 2px;
}

html.insec-compact-shell .sidebar .nav-item:focus-visible {
  outline: 2px solid var(--color-primary, #5b8def);
  outline-offset: 1px;
}

html.insec-compact-shell .login-error,
html.insec-compact-shell .login-success,
html.insec-compact-shell .acp-feedback {
  font-size: 0.88rem;
  line-height: 1.4;
  border-radius: 10px;
}

html.insec-compact-shell .shifts-view-tab {
  min-height: var(--insec-touch-min);
  padding: 0.45rem 0.75rem;
}

html.insec-compact-shell .database-advanced-panel,
html.insec-compact-shell .acp-panel-card {
  border-radius: var(--mobile-card-radius);
  padding: var(--mobile-card-pad);
}

html.insec-mobile-shell .insec-toast-host {
  bottom: calc(var(--mobile-bottom-nav-height) + max(0.75rem, env(safe-area-inset-bottom)));
  width: min(28rem, calc(100vw - 1.5rem));
}

html.insec-compact-shell .topbar-notify-list {
  max-height: min(62dvh, calc(100dvh - var(--mobile-bar-height) - 6rem));
}

html.insec-compact-shell .event-form-intro-row {
  grid-template-columns: 1fr;
  max-width: none;
}

html.insec-compact-shell .event-form-section--description {
  height: auto !important;
  min-height: 0 !important;
}

html.insec-compact-shell .event-form-intro-row .event-rte-embed-host .rte-editor {
  min-height: 9rem;
}

html.insec-compact-shell .event-form-layout {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

html.insec-compact-shell .event-form-nav {
  position: sticky;
  top: calc(var(--mobile-bar-height, 3.25rem) + 0.35rem);
  z-index: 2;
  padding: 0.65rem 0.55rem;
}

html.insec-compact-shell .event-form-checklist {
  flex-direction: row;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 0.45rem;
  padding-bottom: 0.15rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

html.insec-compact-shell .event-form-check-item {
  flex: 0 0 auto;
}

html.insec-compact-shell .event-form-check-btn {
  width: auto;
  min-height: var(--insec-touch-min, 44px);
  padding: 0.45rem 0.65rem;
  white-space: nowrap;
}

html.insec-compact-shell .event-form-check-hint {
  display: none;
}

html.insec-compact-shell .event-form-nav-label {
  margin-bottom: 0.45rem;
}

html.insec-compact-shell .event-form-actionbar {
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  margin-bottom: calc(var(--mobile-bottom-nav-height, 0px) + 0.35rem);
}

html.insec-compact-shell .event-form-actionbar .btn-cta-green {
  width: 100%;
  min-height: var(--insec-touch-min, 44px);
}

html.insec-compact-shell .event-form-section {
  scroll-margin-top: calc(var(--mobile-bar-height, 3.25rem) + 4.5rem);
}
