:root {
  --app-bg: #f4f6f8;
  --app-border: #dfe3e7;
  --timeline-line: #cbd3da;
}

body {
  background: var(--app-bg);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body > main {
  flex: 1 0 auto;
}

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

.app-shell {
  max-width: 1180px;
}

.summary-card,
.panel-card,
.login-card {
  border: 0;
  border-radius: 1rem;
}

.quick-action {
  min-height: 78px;
  border-radius: 1rem;
  font-weight: 600;
}

.timeline {
  position: relative;
  padding-left: 1.65rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: .38rem;
  top: .5rem;
  bottom: .5rem;
  width: 2px;
  background: var(--timeline-line);
}

.timeline-item {
  position: relative;
  margin-bottom: 1rem;
}

.timeline-marker {
  position: absolute;
  left: -1.65rem;
  top: .9rem;
  width: .78rem;
  height: .78rem;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--timeline-line);
}

.timeline-card {
  border: 1px solid var(--app-border);
  border-radius: 1rem;
  background: #fff;
}

.filter-strip {
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.filter-strip::-webkit-scrollbar {
  display: none;
}

.mobile-fab {
  position: fixed;
  z-index: 1020;
  right: 1rem;
  bottom: 1rem;
  border-radius: 999px;
  min-width: 58px;
  min-height: 58px;
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.18);
}

.connection-pill {
  font-size: .78rem;
}

.table-responsive {
  border-radius: .75rem;
}

.org-node {
  border-left: 4px solid var(--bs-secondary);
}

.org-level-1 {
  margin-left: 1.25rem;
}

.org-level-2 {
  margin-left: 2.5rem;
}

pre.audit-json {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: .78rem;
  margin: 0;
}

@media (min-width: 768px) {
  .mobile-fab {
    display: none;
  }
}


/* Gemensam tabellstil */
.app-table-wrap {
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: 1rem;
  overflow: auto;
}

.app-table {
  --bs-table-bg: transparent;
}

.app-table thead th {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--bs-secondary-color);
  border-bottom-width: 1px;
  white-space: nowrap;
}

.app-table th,
.app-table td {
  white-space: nowrap;
  vertical-align: middle;
  padding: .75rem .85rem;
}

.app-table .table-text-wrap,
.app-table td.table-text-wrap,
.table-text-wrap {
  white-space: normal !important;
  min-width: 14rem;
  max-width: 30rem;
}

.app-table tbody tr:last-child td {
  border-bottom: 0;
}

.package-apply-group {
  min-width: min(100%, 360px);
}

.gap-x-3 {
  column-gap: 1rem;
}

.org-node {
  border-left: 4px solid var(--bs-secondary) !important;
}

@media (max-width: 767.98px) {
  .app-table th,
  .app-table td {
    padding: .65rem .7rem;
  }

  .package-apply-group {
    width: 100%;
  }
}


.task-sort-select {
  width: auto;
  min-width: 9.5rem;
}


/* Sidfot och säker bottenmarginal för flytande mobilknapp */
.app-footer {
  flex-shrink: 0;
  margin-top: 3rem;
  border-top: 1px solid var(--app-border);
  background: rgba(255, 255, 255, .72);
  padding: 1.25rem 0 calc(6.5rem + env(safe-area-inset-bottom));
}

.mobile-fab {
  bottom: calc(1rem + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .app-footer {
    padding-bottom: 1.5rem;
  }
}


/* Fast footermeny för insatsvyn */
.incident-bottom-spacer {
  height: 5.5rem;
}

.incident-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1035;
  background: var(--bs-dark);
  border-top: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 -.4rem 1rem rgba(0, 0, 0, .16);
  padding-bottom: env(safe-area-inset-bottom);
}

.incident-bottom-nav-inner {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  flex-wrap: nowrap !important;
  padding-left: .25rem;
  padding-right: .25rem;
}

.incident-bottom-nav-inner.incident-bottom-nav-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.incident-nav-create-wrap {
  position: relative;
  min-width: 0;
  min-height: 4.1rem;
}

.incident-nav-create {
  position: absolute;
  left: 50%;
  top: -.9rem;
  transform: translateX(-50%);
  display: flex;
  width: 5rem;
  flex-direction: column;
  align-items: center;
  gap: .22rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  z-index: 3;
}

.incident-nav-create-circle {
  display: grid;
  width: 3.65rem;
  height: 3.65rem;
  place-items: center;
  border: .22rem solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-danger);
  color: #fff;
  box-shadow: 0 .35rem .9rem rgba(var(--bs-danger-rgb), .38), 0 .15rem .35rem rgba(0, 0, 0, .28);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.incident-nav-create-circle i {
  font-size: 1.35rem;
}

.incident-nav-create-label {
  max-width: 5rem;
  overflow: hidden;
  color: rgba(255, 255, 255, .9);
  font-size: .61rem;
  font-weight: 700;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incident-nav-create:hover .incident-nav-create-circle,
.incident-nav-create:focus-visible .incident-nav-create-circle {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.06);
  box-shadow: 0 .45rem 1.05rem rgba(var(--bs-danger-rgb), .44), 0 .2rem .45rem rgba(0, 0, 0, .3);
}

.incident-nav-create:active .incident-nav-create-circle {
  transform: scale(.97);
}

.incident-nav-create-wrap .incident-create-menu {
  position: absolute !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  bottom: calc(100% + .7rem) !important;
  top: auto !important;
  margin: 0 !important;
}

[data-bs-theme="dark"] .incident-nav-create-circle {
  border-color: #090b0e;
}

.incident-nav-item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 4.1rem;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .45rem .2rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, .62);
  text-decoration: none;
  line-height: 1.1;
}

.incident-nav-item i {
  font-size: 1.05rem;
}

.incident-nav-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible !important;
}

.incident-task-count-badge {
  position: absolute;
  top: -.62rem;
  right: -.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.22rem;
  height: 1.22rem;
  padding: 0 .27rem;
  overflow: visible !important;
  border: 2px solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-danger);
  color: #fff;
  font-size: .61rem !important;
  font-weight: 700 !important;
  line-height: 1;
  letter-spacing: 0;
}

.incident-task-count-badge.is-zero {
  background: var(--bs-secondary);
  color: #fff;
}

.incident-nav-item span {
  max-width: 100%;
  overflow: hidden;
  font-size: .66rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incident-nav-item:hover,
.incident-nav-item:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .06);
}

.incident-nav-item.active {
  color: #fff;
  box-shadow: inset 0 3px 0 var(--bs-danger);
}

.incident-nav-item.active i {
  color: var(--bs-danger);
}

.incident-nav-more {
  position: relative;
  min-width: 0;
}

.incident-nav-more > .incident-nav-item {
  height: 100%;
}

.incident-nav-more .dropdown-menu {
  min-width: 13rem;
  border-radius: .85rem;
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .2);
}

.incident-page #incidentTabContent {
  scroll-margin-top: 5rem;
}

.incident-page .mobile-fab {
  z-index: 1040;
  bottom: calc(5.15rem + env(safe-area-inset-bottom));
}

.incident-page .app-footer {
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .incident-bottom-nav-inner {
    max-width: 760px;
  }

  .incident-nav-item span {
    font-size: .72rem;
  }

  .incident-page .app-footer {
    padding-bottom: 5.5rem;
  }
}


/* Samlad skapa-meny för insatsobjekt */
.incident-create-menu {
  width: min(22rem, calc(100vw - 2rem));
  max-height: calc(100vh - 10rem);
  overflow-y: auto;
  border-radius: 1rem;
  box-shadow: 0 .65rem 1.75rem rgba(0, 0, 0, .22);
}

.incident-create-heading {
  margin: 0 0 .65rem;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--bs-secondary-color);
}

.incident-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.incident-create-action {
  min-height: 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  border-radius: .85rem;
  font-weight: 650;
  line-height: 1.1;
  white-space: normal;
}

.incident-create-action i {
  font-size: 1.25rem;
}

.incident-create-action-wide {
  grid-column: 1 / -1;
  min-height: 3.7rem;
  flex-direction: row;
}

.incident-create-help {
  margin-top: .7rem;
  font-size: .75rem;
  line-height: 1.3;
  color: var(--bs-secondary-color);
}

/* Kompakt insatshuvud – inspirerat av prototypens sammanfattningskort */
.min-w-0 {
  min-width: 0;
}

.incident-navbar-brand {
  max-width: min(68vw, 520px);
  line-height: 1.05;
}

.incident-navbar-icon {
  flex: 0 0 auto;
  font-size: 1.15rem;
}

.incident-navbar-kicker {
  font-size: .65rem;
  font-weight: 500;
  margin-bottom: .08rem;
}

.incident-navbar-title {
  font-size: .92rem;
}

.incident-summary-card .card-body {
  padding: .85rem 1rem !important;
}

.status-dot {
  width: .62rem;
  height: .62rem;
  flex: 0 0 .62rem;
  border-radius: 50%;
  background: var(--bs-secondary);
}

.status-dot-active {
  background: var(--bs-success);
  box-shadow: 0 0 0 .18rem rgba(25, 135, 84, .13);
}

.status-dot-planned {
  background: var(--bs-warning);
}

.status-dot-closed {
  background: var(--bs-secondary);
}


.status-dot-archived {
  background: var(--bs-info);
  box-shadow: 0 0 0 .18rem rgba(13, 202, 240, .12);
}

.incident-status-label {
  font-size: .92rem;
}

.incident-summary-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .2rem .38rem;
  line-height: 1.25;
}

.incident-summary-address {
  line-height: 1.25;
}

.incident-meta-separator {
  color: var(--bs-gray-500);
}

.incident-summary-actions {
  position: relative;
}

.incident-actions-menu-button {
  width: 2.15rem;
  height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 2.15rem;
  padding: 0;
  border-radius: .65rem;
}

.incident-actions-menu {
  min-width: 16.5rem;
  border-radius: .8rem;
  padding-top: .4rem;
  padding-bottom: .4rem;
}

.incident-actions-menu .dropdown-item {
  padding-top: .52rem;
  padding-bottom: .52rem;
}

.incident-menu-check {
  width: 1rem;
  flex: 0 0 1rem;
  text-align: center;
}

.incident-refresh-button {
  min-width: 7.1rem;
  min-height: 2.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  flex: 0 0 auto;
  padding: .3rem .62rem;
  white-space: nowrap;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.incident-refresh-button i {
  width: 1rem;
  text-align: center;
}

.incident-refresh-label {
  font-size: .76rem;
  font-weight: 600;
}

.incident-duration {
  font-weight: 500;
}

.incident-summary-stats {
  margin-left: -.25rem;
  margin-right: -.25rem;
}

.incident-stat-value {
  font-size: 1.05rem;
  line-height: 1.15;
}

.incident-stat-label {
  margin-top: .1rem;
  font-size: .68rem;
  line-height: 1.1;
}

.incident-page .quick-action {
  min-height: 60px;
  border-radius: .85rem;
  padding-top: .55rem;
  padding-bottom: .55rem;
}

.incident-page .quick-action i {
  display: inline-block !important;
  margin-right: .35rem;
  margin-bottom: 0 !important;
  font-size: 1rem !important;
}

@media (max-width: 575.98px) {
  .incident-page .app-navbar .container {
    padding-left: .75rem;
    padding-right: .75rem;
  }

  .incident-navbar-brand {
    max-width: calc(100vw - 5.5rem);
    margin-right: .25rem;
  }

  .incident-summary-card .card-body {
    padding: .7rem .8rem !important;
  }

  .incident-summary-meta {
    font-size: .75rem;
  }

  .incident-summary-address {
    font-size: .75rem;
  }

  .incident-refresh-button {
    min-width: 6.6rem;
    padding-left: .48rem;
    padding-right: .48rem;
  }

  .incident-refresh-label {
    font-size: .7rem;
  }

  .incident-actions-menu-button {
    width: 2.05rem;
    height: 2.05rem;
    flex-basis: 2.05rem;
  }

  .incident-actions-menu {
    min-width: min(17rem, calc(100vw - 2rem));
  }

  .connection-pill {
    font-size: .66rem;
  }

}


/* Operativ startsida / insatsöversikt */
.home-overview {
  max-width: 920px;
}

.home-overview-kicker {
  font-size: .68rem;
  letter-spacing: .055em;
}

.home-new-incident {
  min-width: 2.65rem;
  min-height: 2.4rem;
  border-radius: .75rem;
}

.home-filter-card {
  border-radius: .9rem;
  background: rgba(255, 255, 255, .78);
}

.home-filter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 310px);
  gap: .75rem;
  align-items: center;
}

.home-search .input-group-text,
.home-search .form-control {
  border-color: var(--app-border);
}

.home-incident-list {
  display: grid;
  gap: .65rem;
}

.home-incident-card {
  display: block;
  border-radius: 1rem;
}

.home-incident-card article {
  position: relative;
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}

.home-incident-card:hover article,
.home-incident-card:focus-visible article {
  transform: translateY(-1px);
  box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .09) !important;
}

.home-incident-status-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: .27rem;
}

.home-incident-title {
  font-weight: 700;
  font-size: .98rem;
}

.home-incident-time {
  margin-left: auto;
}

.home-incident-meta {
  min-width: 0;
}

.home-incident-counters {
  color: var(--bs-secondary-color);
  font-size: .72rem;
}

.home-incident-counters > span {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  white-space: nowrap;
}

.home-incident-counters i {
  width: .8rem;
  text-align: center;
  opacity: .7;
}

.home-incident-counters strong {
  color: var(--bs-body-color);
  font-size: .78rem;
}

.home-incident-arrow {
  align-self: center;
  flex: 0 0 auto;
  padding-left: .25rem;
}

.home-empty-state {
  margin-top: 1rem;
}

.home-empty-icon {
  width: 3.3rem;
  height: 3.3rem;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bs-light);
  color: var(--bs-secondary);
  font-size: 1.35rem;
}

.home-page .app-footer {
  padding-bottom: 1.5rem;
}

@media (max-width: 767.98px) {
  .home-overview {
    padding-left: .75rem;
    padding-right: .75rem;
  }

  .home-filter-layout {
    grid-template-columns: 1fr;
  }

  .home-search {
    width: 100%;
  }

  .home-incident-card .card-body {
    padding: .75rem .85rem !important;
  }

  .home-incident-title {
    font-size: .93rem;
  }

  .home-incident-time {
    margin-left: 0;
  }

  .home-incident-counters {
    gap: .7rem !important;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .home-incident-counters::-webkit-scrollbar {
    display: none;
  }

  .home-incident-counters span span {
    display: none;
  }

  .home-incident-arrow {
    padding-left: 0;
  }
}

@media (min-width: 992px) {
  .home-incident-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-incident-card article {
    height: 100%;
  }

  .home-incident-time {
    margin-left: 0;
  }
}


/* Dark mode */
.theme-toggle-button {
  min-width: 2.15rem;
}

.theme-floating-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1050;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
}

[data-bs-theme="dark"] {
  --app-bg: #0f1216;
  --app-border: #30363d;
  --timeline-line: #46505a;
}

[data-bs-theme="dark"] body {
  background: var(--app-bg);
}

[data-bs-theme="dark"] .timeline-card,
[data-bs-theme="dark"] .app-table-wrap {
  background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .timeline-marker {
  border-color: var(--bs-body-bg);
}

[data-bs-theme="dark"] .app-footer {
  background: rgba(24, 28, 33, .88);
}

[data-bs-theme="dark"] .home-filter-card {
  background: rgba(33, 37, 41, .82);
}

[data-bs-theme="dark"] .home-search .input-group-text {
  background: var(--bs-tertiary-bg) !important;
}

[data-bs-theme="dark"] .home-search .form-control {
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .bg-white {
  background-color: var(--bs-body-bg) !important;
}

[data-bs-theme="dark"] .text-dark {
  color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .btn-outline-dark {
  --bs-btn-color: #dee2e6;
  --bs-btn-border-color: #6c757d;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #495057;
  --bs-btn-hover-border-color: #6c757d;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #495057;
  --bs-btn-active-border-color: #6c757d;
}

[data-bs-theme="dark"] .btn-dark {
  --bs-btn-bg: #343a40;
  --bs-btn-border-color: #495057;
  --bs-btn-hover-bg: #495057;
  --bs-btn-hover-border-color: #5c636a;
}

[data-bs-theme="dark"] .badge.text-bg-light,
[data-bs-theme="dark"] .text-bg-light {
  color: var(--bs-body-color) !important;
  background-color: var(--bs-tertiary-bg) !important;
}

[data-bs-theme="dark"] .table-light {
  --bs-table-bg: #242a30;
  --bs-table-color: var(--bs-body-color);
  --bs-table-border-color: #343a40;
}

[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .dropdown-menu {
  border-color: var(--app-border);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .input-group-text {
  border-color: #495057;
}

[data-bs-theme="dark"] .card.shadow-sm,
[data-bs-theme="dark"] .home-incident-card article {
  box-shadow: 0 .35rem 1rem rgba(0, 0, 0, .28) !important;
}

[data-bs-theme="dark"] .incident-bottom-nav {
  background: #090b0e;
  border-top-color: rgba(255, 255, 255, .16);
}

[data-bs-theme="dark"] .home-empty-icon {
  background: var(--bs-tertiary-bg);
  color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] pre.audit-json {
  color: var(--bs-body-color);
}

@media (prefers-reduced-motion: reduce) {
  .home-incident-card article {
    transition: none;
  }
}


/* Förfinad toppmeny v4.7 */
.app-navbar {
  min-height: 3.75rem;
}

.app-navbar-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .5rem;
}

.app-navbar-desktop-links {
  gap: .15rem;
}

.app-navbar-desktop-links .nav-link {
  color: rgba(255, 255, 255, .68);
  border-radius: .7rem;
  padding: .45rem .7rem;
  font-size: .84rem;
  font-weight: 500;
  transition: color .15s ease, background-color .15s ease;
}

.app-navbar-desktop-links .nav-link:hover,
.app-navbar-desktop-links .nav-link:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .07);
}

.app-navbar-desktop-links .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, .1);
}

.app-user-menu-toggle {
  max-width: 15rem;
  padding: .28rem .5rem .28rem .32rem;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: .85rem;
  color: #fff;
  background: rgba(255, 255, 255, .055);
}

.app-user-menu-toggle:hover,
.app-user-menu-toggle:focus,
.app-user-menu-toggle.show {
  color: #fff;
  border-color: rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .1);
}

.app-user-menu-toggle::after {
  margin-left: .1rem;
  opacity: .65;
}

.app-user-avatar {
  display: grid;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  place-items: center;
  border-radius: .65rem;
  background: var(--bs-danger);
  color: #fff;
  font-size: .76rem;
  font-weight: 700;
}

.app-user-menu-text {
  max-width: 9.75rem;
  line-height: 1.05;
}

.app-user-name {
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
}

.app-user-call-sign {
  margin-top: .16rem;
  color: rgba(255, 255, 255, .55);
  font-size: .66rem;
}

.app-user-menu {
  width: min(19rem, calc(100vw - 1rem));
  margin-top: .55rem !important;
  padding: .45rem;
  border-radius: 1rem;
}

.app-user-menu .dropdown-item {
  border-radius: .7rem;
  padding: .62rem .72rem;
  font-size: .88rem;
}

.app-user-menu .dropdown-item.active,
.app-user-menu .dropdown-item:active {
  color: var(--bs-body-color);
  background: var(--bs-tertiary-bg);
}

.app-user-menu .dropdown-item.text-danger:active {
  color: #fff !important;
  background: var(--bs-danger);
}

.app-user-menu-header {
  min-width: 0;
}

.app-user-presence-toggle {
  min-width: 5.4rem;
}

.app-user-presence-toggle .form-check-input {
  cursor: pointer;
}

.app-user-presence-toggle [data-presence-toggle-label] {
  font-size: .69rem;
  line-height: 1.1;
}

.app-user-menu .dropdown-divider {
  margin: .35rem 0;
}

[data-bs-theme="dark"] .app-user-menu {
  border-color: #343a40;
}

@media (max-width: 575.98px) {
  .app-navbar {
    min-height: 3.35rem;
  }

  .app-navbar-inner {
    padding-left: .7rem;
    padding-right: .7rem;
  }

  .app-brand-label {
    font-size: .93rem;
  }

  .app-user-menu-toggle {
    padding: .26rem;
    border-radius: .7rem;
  }

  .app-user-menu-toggle::after {
    display: none;
  }

  .app-user-avatar {
    width: 1.95rem;
    height: 1.95rem;
    flex-basis: 1.95rem;
  }

  .incident-navbar-brand {
    max-width: calc(100vw - 4.5rem);
  }
}

@media (min-width: 576px) and (max-width: 991.98px) {
  .app-user-menu-text {
    max-width: 8rem;
  }
}

/* Bekräftelse vid avslut/arkivering */
.incident-confirm-icon {
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(var(--bs-danger-rgb), .1);
  color: var(--bs-danger);
  font-size: 1.05rem;
}

/* Snabbstatus för uppgifter */
.task-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
  white-space: nowrap;
}

.task-quick-status {
  min-width: 6.4rem;
}

.incident-confirm-icon.is-primary {
  background: rgba(var(--bs-primary-rgb), .1);
  color: var(--bs-primary);
}

.incident-confirm-icon.is-success {
  background: rgba(var(--bs-success-rgb), .1);
  color: var(--bs-success);
}

@media (max-width: 575.98px) {
  .task-quick-status {
    min-width: 0;
  }
}


/* PWA / iPhone standalone */
@supports (padding: max(0px)) {
  .pwa-standalone body {
    padding-top: env(safe-area-inset-top);
  }

  /* Vanliga PWA-sidor behöver bara ta hänsyn till iPhones safe-area. */
  .pwa-standalone .app-footer {
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }

  /* Insatsvyn har en fast bottom-meny. Håll alltid hela footern ovanför den. */
  .pwa-standalone body.incident-page .app-footer {
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
  }
}

/* Nytt sedan sist */
.new-since-panel {
  border-left: .28rem solid var(--bs-primary) !important;
}

.new-since-icon {
  display: inline-grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  color: var(--bs-primary);
  background: rgba(var(--bs-primary-rgb), .1);
}

.timeline-item.is-new-since-last .timeline-card,
tr.is-new-since-last > td {
  background: rgba(var(--bs-primary-rgb), .075);
}

.timeline-item.is-new-since-last .timeline-card {
  outline: 1px solid rgba(var(--bs-primary-rgb), .18);
  outline-offset: -1px;
}

.new-since-badge {
  font-size: .64rem;
  letter-spacing: .01em;
}

.report-list-item:last-child {
  border-bottom: 0 !important;
}

@media (max-width: 575.98px) {
  .new-since-panel .btn {
    flex: 1 1 auto;
  }
}

/* Topbar: snabb växling mellan ljust och mörkt läge */
.app-navbar-actions {
  flex: 0 0 auto;
}

.app-theme-toggle {
  width: 2.35rem;
  height: 2.35rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: .78rem;
  color: rgba(255, 255, 255, .82);
  background: rgba(255, 255, 255, .055);
}

.app-theme-toggle:hover,
.app-theme-toggle:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .11);
  border-color: rgba(255, 255, 255, .24);
}

/* Huvudmeny på översikt, dagbesked, feedback och information */
.main-bottom-spacer {
  height: 5.5rem;
}

.main-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1035;
  background: var(--bs-dark);
  border-top: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 -.4rem 1rem rgba(0, 0, 0, .16);
  padding-bottom: env(safe-area-inset-bottom);
}

.main-bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
  padding-left: .2rem;
  padding-right: .2rem;
}

.main-bottom-nav-inner.main-bottom-nav-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.main-nav-item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 4.1rem;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .45rem .12rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, .62);
  text-decoration: none;
  line-height: 1.1;
}

.main-nav-item i {
  font-size: 1.05rem;
}

.main-nav-item span {
  max-width: 100%;
  overflow: hidden;
  font-size: .62rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav-item:hover,
.main-nav-item:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .06);
}

.main-nav-item.active {
  color: #fff;
  box-shadow: inset 0 3px 0 var(--bs-danger);
}

.main-nav-item.active i {
  color: var(--bs-danger);
}

.main-nav-more {
  position: relative;
  min-width: 0;
}

.main-nav-more > .main-nav-item {
  height: 100%;
}

.main-nav-more .dropdown-menu {
  min-width: 14rem;
  border-radius: .85rem;
  box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .2);
}

.main-nav-page .app-footer {
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
}

/* Ny operativ startsida */
.home-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
}

.home-metric-card {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .8rem .9rem;
  border: 1px solid var(--app-border);
  border-radius: .9rem;
  background: var(--bs-body-bg);
}

.home-metric-card[href] {
  transition: transform .12s ease, border-color .12s ease;
}

.home-metric-card[href]:hover,
.home-metric-card[href]:focus-visible {
  transform: translateY(-1px);
  border-color: var(--bs-secondary-color);
}

.home-metric-icon {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 2rem;
  border-radius: .65rem;
  background: var(--bs-tertiary-bg);
}

.home-metric-card strong,
.home-metric-card small {
  display: block;
}

.home-metric-card strong {
  font-size: 1.15rem;
  line-height: 1;
}

.home-metric-card small {
  margin-top: .16rem;
  color: var(--bs-secondary-color);
  line-height: 1.1;
}

.home-daily-briefing {
  overflow: hidden;
}

.home-daily-briefing > a:hover,
.home-daily-briefing > a:focus-visible {
  background: var(--bs-tertiary-bg);
}

.home-daily-icon,
.feedback-icon,
.daily-empty-icon {
  width: 2.7rem;
  height: 2.7rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 2.7rem;
  border-radius: .85rem;
  background: rgba(var(--bs-danger-rgb), .09);
  color: var(--bs-danger);
  font-size: 1.15rem;
}

/* Dagbesked */
.daily-briefing-shell,
.feedback-shell,
.info-shell {
  max-width: 1040px;
}

.daily-date-nav {
  max-width: 33rem;
}

.daily-date-picker {
  max-width: 19rem;
  margin: 0 auto;
}

.daily-prose {
  white-space: normal;
  overflow-wrap: anywhere;
}

.daily-operational-note {
  padding: .9rem 1rem;
  border-left: .25rem solid var(--bs-warning);
  border-radius: .6rem;
  background: rgba(var(--bs-warning-rgb), .08);
}

.daily-patrol-card,
.daily-edit-row {
  background: var(--bs-body-bg);
}

.daily-contact-row:last-child {
  border-bottom: 0 !important;
  padding-bottom: 0 !important;
}

.daily-empty-state .daily-empty-icon {
  margin-left: auto;
  margin-right: auto;
}

.feedback-message {
  white-space: normal;
  overflow-wrap: anywhere;
}

.app-info-links .list-group-item {
  background: transparent;
}

@media (max-width: 767.98px) {
  .home-dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-metric-card {
    padding: .72rem;
  }

  .main-nav-item span {
    font-size: .58rem;
  }
}

@media (min-width: 768px) {
  .main-bottom-nav-inner {
    max-width: 760px;
  }

  .main-nav-item span {
    font-size: .7rem;
  }

  .main-nav-page .app-footer {
    padding-bottom: 5.5rem;
  }
}

[data-bs-theme="dark"] .main-bottom-nav {
  background: #090b0e;
  border-top-color: rgba(255, 255, 255, .16);
}

[data-bs-theme="dark"] .home-metric-card,
[data-bs-theme="dark"] .daily-patrol-card,
[data-bs-theme="dark"] .daily-edit-row {
  border-color: var(--app-border);
}

@supports (padding: max(0px)) {
  .pwa-standalone body.main-nav-page .app-footer {
    padding-bottom: calc(5.75rem + env(safe-area-inset-bottom));
  }
}

/* Användartillgänglighet */
.app-user-availability-dot {
  position: absolute;
  right: -0.08rem;
  bottom: -0.08rem;
  width: .66rem;
  height: .66rem;
  border-radius: 999px;
  border: 2px solid var(--bs-dark);
  background: var(--bs-secondary);
}
.app-user-availability-dot.is-available,
.availability-indicator.is-available { background: var(--bs-success); }
.app-user-availability-dot.is-unavailable,
.availability-indicator.is-unavailable { background: var(--bs-secondary); }
.availability-indicator {
  display: inline-block;
  width: .8rem;
  height: .8rem;
  border-radius: 999px;
  flex: 0 0 auto;
}
.availability-roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .65rem;
}
.availability-person {
  border: 1px solid var(--bs-border-color);
  border-radius: .85rem;
  padding: .75rem .85rem;
  background: var(--bs-body-bg);
}

/* Dagbesked v13: ledning, LPO, patruller, händelser och områdesmallar */
.daily-template-shell {
  max-width: 1180px;
}

.daily-command-grid,
.daily-patrol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .65rem;
}

.daily-command-card,
.daily-district-card,
.daily-template-picker {
  background: var(--bs-body-bg);
}

.daily-district-header {
  background: var(--bs-tertiary-bg);
}

.daily-district-contact {
  min-width: 10rem;
}

.daily-event-list {
  display: grid;
  gap: 0;
}

.daily-event-row {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  gap: .85rem;
  align-items: start;
  padding: .8rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}

.daily-event-row:first-child {
  padding-top: 0;
}

.daily-event-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.daily-event-time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--bs-secondary-color);
}

.daily-edit-section + .daily-edit-section {
  border-top: 1px solid var(--bs-border-color);
  padding-top: 1.25rem;
  margin-top: .25rem;
}

.daily-template-page .list-group-item.active-template {
  background: var(--bs-tertiary-bg);
  border-radius: .65rem;
  padding-left: .7rem !important;
  padding-right: .7rem !important;
}

[data-bs-theme="dark"] .daily-command-card,
[data-bs-theme="dark"] .daily-district-card,
[data-bs-theme="dark"] .daily-template-picker {
  border-color: var(--app-border) !important;
}

@media (max-width: 575.98px) {
  .daily-command-grid,
  .daily-patrol-grid {
    grid-template-columns: 1fr;
  }

  .daily-event-row {
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: .6rem;
  }
}

/* Dagbesked v14: kompakt operativt läsblad */
.daily-briefing-sheet {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .9rem;
  background: var(--bs-body-bg);
  box-shadow: 0 .25rem .8rem rgba(0, 0, 0, .055);
  font-size: 1rem;
  line-height: 1.38;
}

.daily-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .85rem;
}

.daily-sheet-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: .035em;
}

.daily-sheet-date,
.daily-sheet-updated,
.daily-sheet-footer,
.daily-sheet-subline,
.daily-sheet-muted,
.daily-sheet-inline-note {
  color: var(--bs-secondary-color);
  font-size: .86rem;
}

.daily-sheet-updated {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.daily-sheet-summary {
  margin: .7rem 0;
  overflow-wrap: anywhere;
}

.daily-sheet-command {
  display: grid;
  gap: .22rem;
  margin-top: .55rem;
}

.daily-sheet-command-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: .35rem;
  row-gap: .05rem;
  overflow-wrap: anywhere;
}

.daily-sheet-command-role {
  flex: 0 0 auto;
}

.daily-sheet-command-value {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .18rem .48rem;
  min-width: 0;
}

.daily-sheet-command-value a,
.daily-sheet-district-head a,
.daily-sheet-patrol-phone {
  color: inherit;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.daily-sheet-alert {
  margin-top: .85rem;
  padding: .65rem .75rem;
  border-left: .2rem solid var(--bs-warning);
  background: rgba(var(--bs-warning-rgb), .08);
  border-radius: .35rem;
  overflow-wrap: anywhere;
}

.daily-sheet-section-title {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 1rem 0 .7rem;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .12em;
}

.daily-sheet-section-title::before,
.daily-sheet-section-title::after {
  content: "";
  height: 1px;
  background: var(--bs-border-color);
  flex: 1 1 auto;
}

.daily-sheet-events {
  display: grid;
  gap: .28rem;
  margin-bottom: .85rem;
}

.daily-sheet-event {
  display: flex;
  flex-wrap: wrap;
  gap: .18rem .45rem;
  overflow-wrap: anywhere;
}

.daily-sheet-event strong {
  font-variant-numeric: tabular-nums;
}

.daily-sheet-districts {
  display: grid;
  gap: .82rem;
}

.daily-sheet-district {
  min-width: 0;
}

.daily-sheet-district-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .3rem .55rem;
  font-size: 1.03rem;
}

.daily-sheet-district-head strong {
  font-weight: 800;
}

.daily-sheet-patrol {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  padding-left: .85rem;
  margin-top: .16rem;
  min-width: 0;
}

.daily-sheet-patrol-main {
  display: flex;
  flex-wrap: wrap;
  gap: .12rem .4rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.daily-sheet-patrol-main strong {
  font-variant-numeric: tabular-nums;
}

.daily-sheet-patrol-phone {
  flex: 0 0 auto;
  font-size: .9rem;
}

.daily-sheet-empty {
  color: var(--bs-secondary-color);
  font-size: .9rem;
}

.daily-sheet-footer {
  border-top: 1px solid var(--bs-border-color);
  margin-top: 1rem;
  padding-top: .6rem;
}

.daily-availability-secondary {
  max-width: 1040px;
}

[data-bs-theme="dark"] .daily-briefing-sheet {
  border-color: var(--app-border);
  box-shadow: none;
}

@media (max-width: 575.98px) {
  .daily-briefing-sheet {
    padding: 1rem .95rem;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin-left: -.75rem;
    margin-right: -.75rem;
    font-size: .98rem;
  }

  .daily-sheet-title {
    font-size: 1.23rem;
  }

  .daily-sheet-patrol {
    padding-left: .6rem;
  }
}

/* Dagbesked v15: utsättningslista / operativ tabellvy */
.daily-duty-sheet {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  border: 1px solid var(--bs-border-color);
  border-radius: .9rem;
  background: var(--bs-body-bg);
  overflow: hidden;
  box-shadow: 0 .25rem .8rem rgba(0, 0, 0, .045);
}

.daily-duty-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem .75rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.daily-duty-kicker {
  color: var(--bs-secondary-color);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
}

.daily-duty-area {
  font-size: 1.35rem;
  font-weight: 850;
  letter-spacing: .035em;
}

.daily-duty-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--bs-secondary-color);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.daily-roster-scroll {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

.daily-roster-table {
  width: 100%;
  min-width: 820px;
  margin: 0;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: .82rem;
  line-height: 1.23;
}

.daily-roster-table + .daily-roster-table {
  margin-top: .75rem;
}

.daily-roster-table th,
.daily-roster-table td {
  padding: .34rem .42rem;
  border: 1px solid var(--bs-border-color);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.daily-roster-table th {
  font-weight: 800;
}

.daily-roster-table thead th,
.daily-roster-section-row th,
.daily-roster-main-title th {
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
  text-transform: uppercase;
  letter-spacing: .025em;
}

.daily-roster-main-title th {
  text-align: center;
  font-size: .88rem;
}

.daily-roster-date-cell {
  width: 12%;
  font-variant-numeric: tabular-nums;
}

.daily-roster-label {
  width: 12%;
  white-space: nowrap;
}

.daily-roster-priority-one th,
.daily-roster-priority-one td {
  background: rgba(var(--bs-success-rgb), .13);
}

.daily-roster-priority-two th,
.daily-roster-priority-two td {
  background: rgba(var(--bs-warning-rgb), .18);
}

.daily-roster-multiline {
  white-space: normal;
}

.daily-roster-empty-cell,
.daily-roster-subtext,
.daily-roster-inline-meta {
  color: var(--bs-secondary-color);
}

.daily-roster-inline-meta {
  margin-left: .45rem;
}

.daily-roster-subtext {
  margin-top: .12rem;
}

.daily-command-table th:nth-child(1) { width: 20%; }
.daily-command-table th:nth-child(2) { width: 25%; }
.daily-command-table th:nth-child(3) { width: 18%; }
.daily-command-table th:nth-child(4) { width: 16%; }
.daily-command-table th:nth-child(5) { width: 21%; }

.daily-roster-table a {
  color: inherit;
  text-decoration: none;
}

.daily-competence-table th:nth-child(1) { width: 18%; }
.daily-competence-table th:nth-child(2),
.daily-competence-table th:nth-child(3) { width: 9%; }
.daily-competence-table th:nth-child(4),
.daily-competence-table th:nth-child(5) { width: 11%; }
.daily-competence-table th:nth-child(6) { width: 14%; }
.daily-competence-table th:nth-child(7) { width: 28%; }

.daily-competence-table td:not(.daily-roster-info-cell) {
  text-align: center;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.daily-district-cell {
  background: var(--bs-tertiary-bg);
}

.daily-district-cell strong,
.daily-district-cell a,
.daily-district-cell small {
  display: block;
}

.daily-district-cell a {
  margin-top: .08rem;
  font-variant-numeric: tabular-nums;
}

.daily-district-cell small {
  margin-top: .13rem;
  color: var(--bs-secondary-color);
  font-weight: 500;
}

.daily-roster-info-cell {
  color: var(--bs-secondary-color);
}

.daily-roster-info-cell strong {
  color: var(--bs-body-color);
  margin-right: .25rem;
}

.daily-resource-table th:nth-child(1) { width: 18%; }
.daily-resource-table th:nth-child(2) { width: 15%; }
.daily-resource-table th:nth-child(3),
.daily-resource-table th:nth-child(4),
.daily-resource-table th:nth-child(5) { width: 15%; }
.daily-resource-table th:nth-child(6) { width: 22%; }

.daily-halfnight-table thead tr:first-child th {
  text-align: left;
  font-size: .87rem;
  letter-spacing: .045em;
}

.daily-duty-sheet-footer {
  padding: .6rem 1rem .7rem;
  border-top: 1px solid var(--bs-border-color);
  color: var(--bs-secondary-color);
  font-size: .78rem;
}

[data-bs-theme="dark"] .daily-duty-sheet {
  box-shadow: none;
}

@media (max-width: 575.98px) {
  .daily-duty-sheet {
    margin-left: -.75rem;
    margin-right: -.75rem;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .daily-duty-sheet-head {
    padding: .8rem .85rem .65rem;
  }

  .daily-duty-area {
    font-size: 1.16rem;
  }

  .daily-roster-table {
    min-width: 760px;
    font-size: .79rem;
  }

  .daily-roster-table th,
  .daily-roster-table td {
    padding: .31rem .36rem;
  }

  .daily-roster-table th:first-child,
  .daily-roster-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bs-body-bg);
    box-shadow: 1px 0 0 var(--bs-border-color);
  }

  .daily-roster-table thead th:first-child,
  .daily-roster-section-row th:first-child,
  .daily-roster-main-title th:first-child,
  .daily-district-cell {
    background: var(--bs-tertiary-bg) !important;
  }

  .daily-roster-priority-one th:first-child {
    background: rgba(var(--bs-success-rgb), .18) !important;
  }

  .daily-roster-priority-two th:first-child {
    background: rgba(var(--bs-warning-rgb), .22) !important;
  }
}

@media (max-width: 575.98px) {
  .daily-roster-table th[colspan] {
    position: static !important;
    box-shadow: none !important;
  }
}

/* Dagbesked v18: förenklad, snabböverskådlig vy */
.daily-briefing-compact {
  padding: .25rem 1rem 1rem;
}

.daily-brief-block {
  padding: .8rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}

.daily-brief-block:last-child {
  border-bottom: 0;
  padding-bottom: .2rem;
}

.daily-brief-section-title {
  margin: 0 0 .55rem;
  font-size: .8rem;
  font-weight: 850;
  letter-spacing: .075em;
  color: var(--bs-secondary-color);
}

.daily-brief-text {
  white-space: normal;
  line-height: 1.4;
}

.daily-priority-line {
  margin-top: .35rem;
  font-size: .92rem;
}

.daily-command-simple {
  min-width: 580px;
  --bs-table-bg: transparent;
}

.daily-command-simple th,
.daily-command-simple td {
  padding: .42rem .5rem;
  border-color: var(--bs-border-color);
  white-space: nowrap;
}

.daily-command-simple thead th {
  color: var(--bs-secondary-color);
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 750;
}

.daily-command-simple tbody th {
  font-weight: 750;
}

.daily-command-simple a,
.daily-district-heading a {
  color: inherit;
  text-decoration: none;
}

.daily-event-list {
  display: grid;
  gap: .2rem;
}

.daily-event-line {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: .55rem;
  padding: .38rem 0;
  border-top: 1px solid color-mix(in srgb, var(--bs-border-color) 65%, transparent);
}

.daily-event-line:first-child {
  border-top: 0;
}

.daily-event-time {
  color: var(--bs-secondary-color);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.daily-district-list {
  display: grid;
  gap: .45rem;
}

.daily-district-compact {
  padding: .7rem .75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .65rem;
  background: var(--bs-tertiary-bg);
}

.daily-district-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  font-size: 1rem;
}

.daily-district-heading a {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  white-space: nowrap;
}

.daily-district-responsible,
.daily-district-note,
.daily-patrol-detail,
.daily-brief-empty {
  color: var(--bs-secondary-color);
  font-size: .82rem;
}

.daily-district-responsible {
  margin-top: .08rem;
}

.daily-patrol-list {
  margin-top: .4rem;
}

.daily-patrol-line {
  padding: .35rem 0;
  border-top: 1px solid var(--bs-border-color);
}

.daily-patrol-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
}

.daily-patrol-main span {
  color: var(--bs-secondary-color);
  font-size: .82rem;
  text-align: right;
}

.daily-patrol-detail {
  margin-top: .08rem;
}

.daily-district-note {
  margin-top: .35rem;
  padding-top: .35rem;
  border-top: 1px dashed var(--bs-border-color);
}

@media (max-width: 575.98px) {
  .daily-briefing-compact {
    padding: .15rem .8rem .8rem;
  }

  .daily-brief-block {
    padding: .72rem 0;
  }

  .daily-command-simple {
    min-width: 520px;
    font-size: .84rem;
  }

  .daily-district-compact {
    padding: .62rem .68rem;
  }
}

.daily-command-list {
  display: grid;
  gap: .2rem;
}

.daily-command-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .28rem .55rem;
  padding: .28rem 0;
  border-top: 1px solid var(--bs-border-color);
}

.daily-command-line:first-child {
  border-top: 0;
}

.daily-command-function {
  min-width: 4.4rem;
}

.daily-command-call {
  font-variant-numeric: tabular-nums;
  color: var(--bs-secondary-color);
}

.daily-command-line a {
  margin-left: auto;
  color: inherit;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

.daily-district-compact {
  padding: .58rem 0;
  border: 0;
  border-top: 1px solid var(--bs-border-color);
  border-radius: 0;
  background: transparent;
}

.daily-district-compact:first-child {
  border-top: 0;
}

@media (max-width: 575.98px) {
  .daily-command-function {
    min-width: 3.7rem;
  }
  .daily-command-line a {
    margin-left: 0;
  }
}

/* Dagbesked v19: snabb patrullhantering */
.daily-patrol-fab {
  position: fixed;
  right: 1rem;
  bottom: calc(5.15rem + env(safe-area-inset-bottom));
  z-index: 1040;
  width: 58px;
  height: 58px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 999px;
  box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .2);
  font-size: 1.1rem;
}

.daily-patrol-edit {
  flex: 0 0 auto;
  line-height: 1;
}

.daily-competency-picker {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.daily-competency-option {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.5rem;
  padding: .45rem .75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  background: var(--bs-tertiary-bg);
  cursor: pointer;
  font-weight: 700;
  user-select: none;
}

.daily-competency-option:has(input:checked) {
  border-color: var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 12%, var(--bs-body-bg));
}

.daily-competency-option .form-check-input {
  margin: 0;
}

@media (min-width: 768px) {
  .daily-patrol-fab {
    right: max(1.5rem, calc((100vw - 1180px) / 2 + 1.5rem));
  }
}

/* Breadcrumbs */
.app-breadcrumb-wrap {
  border-bottom: 1px solid var(--bs-border-color-translucent);
  background: color-mix(in srgb, var(--bs-body-bg) 94%, var(--bs-secondary-bg));
}
.app-breadcrumb {
  --bs-breadcrumb-divider: '›';
  padding: .45rem 0;
  font-size: .82rem;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.app-breadcrumb::-webkit-scrollbar { display: none; }
.app-breadcrumb a { color: var(--bs-secondary-color); text-decoration: none; }
.app-breadcrumb a:hover { color: var(--bs-body-color); }
.app-breadcrumb .active { color: var(--bs-body-color); font-weight: 600; }

/* Dagbesked: låst arbetsläge + snabbregistrering */
.daily-lock-strip {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
  font-size: .86rem;
}
.daily-lock-strip span { color: var(--bs-secondary-color); }
.daily-quick-fab {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(5.6rem + env(safe-area-inset-bottom));
  z-index: 1035;
}
.daily-quick-fab-button {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 .4rem 1.2rem rgba(0,0,0,.2);
}
.daily-quick-menu {
  width: min(21rem, calc(100vw - 2rem));
  padding: .45rem;
  border-radius: 1rem;
}
.daily-quick-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem .75rem;
  border-radius: .75rem;
  white-space: normal;
}
.daily-quick-menu .dropdown-item span:last-child { min-width: 0; }
.daily-quick-menu .dropdown-item strong,
.daily-quick-menu .dropdown-item small { display: block; }
.daily-quick-menu .dropdown-item small { color: var(--bs-secondary-color); margin-top: .08rem; }
.daily-quick-icon {
  width: 2.2rem;
  height: 2.2rem;
  flex: 0 0 auto;
  border-radius: .65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bs-tertiary-bg);
}
.daily-command-line,
.daily-event-line { align-items: center; }

@media (max-width: 575.98px) {
  .app-breadcrumb { font-size: .78rem; }
  .daily-quick-fab { bottom: calc(5.25rem + env(safe-area-inset-bottom)); }
}

/* v18: topbar med fast breadcrumb */
.app-topbar-sticky {
  position: sticky;
  top: 0;
  z-index: 1040;
}
.app-topbar-sticky .app-navbar { position: static; }
.app-topbar-sticky .app-breadcrumb-wrap {
  background: color-mix(in srgb, var(--bs-dark) 94%, var(--bs-body-bg));
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(0,0,0,.18);
}
.app-topbar-sticky .app-breadcrumb { color: rgba(255,255,255,.7); }
.app-topbar-sticky .app-breadcrumb a { color: rgba(255,255,255,.68); }
.app-topbar-sticky .app-breadcrumb a:hover { color: #fff; }
.app-topbar-sticky .app-breadcrumb .active { color: #fff; }
.app-topbar-sticky .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.38); }

#toastArea { z-index: 1095; padding-top: calc(.75rem + env(safe-area-inset-top)) !important; }
#toastArea .toast { max-width: min(92vw, 380px); }

.app-pull-refresh {
  --pull-distance: 0px;
  position: fixed;
  top: calc(env(safe-area-inset-top) + .45rem);
  left: 50%;
  z-index: 1085;
  display: flex;
  align-items: center;
  gap: .5rem;
  max-width: calc(100vw - 2rem);
  padding: .55rem .8rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  box-shadow: 0 .35rem 1rem rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-130% + min(var(--pull-distance), 72px)));
  transition: opacity .12s ease, transform .12s ease;
  font-size: .82rem;
  white-space: nowrap;
}
.app-pull-refresh.is-visible { opacity: 1; }
.app-pull-refresh.is-ready .app-pull-refresh-icon { transform: rotate(180deg); }
.app-pull-refresh-icon { display:inline-flex; transition: transform .16s ease; }

.daily-briefing-switcher .list-group-item { border-radius: .75rem; margin-bottom: .35rem; border: 1px solid var(--bs-border-color); }
.daily-briefing-switcher .list-group-item.active { background: var(--bs-dark); border-color: var(--bs-dark); color: #fff; }

/* Snabbknapp för ny insats i huvudmenyn */
.main-bottom-nav-inner.main-bottom-nav-five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.main-nav-create-wrap {
  position: relative;
  min-width: 0;
  min-height: 4.1rem;
}

.main-nav-create {
  position: absolute;
  left: 50%;
  top: -.9rem;
  transform: translateX(-50%);
  display: flex;
  width: 5rem;
  flex-direction: column;
  align-items: center;
  gap: .22rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  text-decoration: none;
  z-index: 2;
}

.main-nav-create-circle {
  display: grid;
  width: 3.65rem;
  height: 3.65rem;
  place-items: center;
  border: .22rem solid var(--bs-dark);
  border-radius: 999px;
  background: var(--bs-danger);
  color: #fff;
  box-shadow: 0 .35rem .9rem rgba(var(--bs-danger-rgb), .38), 0 .15rem .35rem rgba(0, 0, 0, .28);
  transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.main-nav-create-circle i {
  font-size: 1.35rem;
}

.main-nav-create-label {
  max-width: 5rem;
  overflow: hidden;
  color: rgba(255, 255, 255, .9);
  font-size: .61rem;
  font-weight: 700;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-nav-create:hover,
.main-nav-create:focus-visible {
  color: #fff;
}

.main-nav-create:hover .main-nav-create-circle,
.main-nav-create:focus-visible .main-nav-create-circle {
  transform: translateY(-2px) scale(1.04);
  filter: brightness(1.06);
  box-shadow: 0 .45rem 1.05rem rgba(var(--bs-danger-rgb), .44), 0 .2rem .45rem rgba(0, 0, 0, .3);
}

.main-nav-create:active .main-nav-create-circle {
  transform: scale(.97);
}

[data-bs-theme="dark"] .main-nav-create-circle {
  border-color: #090b0e;
}

@media (max-width: 374.98px) {
  .main-nav-create {
    width: 4.35rem;
  }
  .main-nav-create-circle {
    width: 3.35rem;
    height: 3.35rem;
  }
  .main-nav-create-label {
    max-width: 4.35rem;
    font-size: .56rem;
  }
}

/* v22: compact dagbesked editing */
.daily-lpo-edit-summary {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: .72rem .85rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  background: var(--bs-body-bg);
}
.daily-lpo-edit-summary > .min-w-0 { min-width: 0; }

/* Dynamisk organisationslogotyp */
.app-brand-logo,.login-brand-logo,.app-install-logo{object-fit:contain;background:rgba(255,255,255,.96)}
.app-brand-logo{border-radius:.4rem;background:transparent}
.login-brand-logo{background:transparent}
.login-brand-logo,.app-install-logo{box-shadow:0 .25rem .75rem rgba(0,0,0,.12)}

/* v37: separata brandingbilder för gränssnittslogga och appikon */
.app-brand-logo,
.login-brand-logo,
.app-install-logo {
  display: block;
  object-fit: contain;
  background: transparent;
}
.app-brand-logo-symbol {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: .4rem;
}
.app-brand-logo-wordmark {
  width: auto;
  height: 32px;
  max-width: min(190px, 44vw);
  border-radius: 0;
}
.login-brand-logo {
  margin-left: auto;
  margin-right: auto;
  box-shadow: none;
}
.login-brand-logo-symbol {
  width: 84px;
  height: 84px;
  border-radius: 1rem;
}
.login-brand-logo-wordmark {
  width: auto;
  height: auto;
  max-width: min(100%, 360px);
  max-height: 120px;
  border-radius: 0;
}
.app-install-logo {
  width: 84px;
  height: 84px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 .25rem .75rem rgba(0,0,0,.12);
}
.branding-admin-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: .5rem;
  overflow: hidden;
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  background-image:
    linear-gradient(45deg, rgba(127,127,127,.12) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(127,127,127,.12) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(127,127,127,.12) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(127,127,127,.12) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.branding-admin-preview img {
  display: block;
  max-width: 100%;
  max-height: 72px;
  object-fit: contain;
}
.branding-admin-preview-wide {
  width: min(180px, 48%);
}
.branding-admin-preview-square {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  padding: .35rem;
}
.branding-admin-preview-square img {
  width: 100%;
  height: 100%;
}


/* Hjälptext längst ned på inloggningssidan.
   Footern ligger i det normala dokumentflödet så den aldrig kan överlappa
   lösenords- eller passkey-kontrollerna. */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
}
.login-main {
  width: 100%;
}
.login-account-help {
  position: static;
  flex: 0 0 auto;
  width: 100%;
  padding: 0 1rem 1.25rem;
}
.login-account-help .container {
  max-width: 48rem;
}
@media (max-height:700px),(max-width:575.98px) {
  .login-main {
    align-items: flex-start !important;
    padding-top: 4rem !important;
    padding-bottom: 2rem !important;
  }
}

/* Loginfinjusteringar */
.login-account-help {
  display: flex;
  justify-content: center;
  text-align: center;
}
.login-account-help .container {
  display: flex;
  justify-content: center;
  width: 100%;
}
.login-account-help p {
  width: 100%;
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  line-height: 1.55;
}
@media (min-width: 992px) {
  .login-column {
    max-width: 620px;
  }
  .login-card {
    border-radius: 1.25rem;
  }
  .login-card .form-control-lg,
  .login-card .btn-lg {
    min-height: 3.25rem;
  }
}
@media (min-width: 1400px) {
  .login-column {
    max-width: 680px;
  }
}

/* Förfinad sidfot i inloggat läge */
.app-footer {
  border-top: 1px solid color-mix(in srgb, var(--app-border) 78%, transparent);
  background: color-mix(in srgb, var(--bs-body-bg) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.app-footer-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
}
.app-footer-brand {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: .7rem;
  min-width: 0;
  flex: 1 1 auto;
}
.app-footer-mark {
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 2.15rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--app-border);
  border-radius: .7rem;
  background: var(--bs-tertiary-bg);
  color: var(--bs-danger);
  box-shadow: 0 .2rem .65rem rgba(0,0,0,.06);
}
.app-footer-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.2;
  min-width: 0;
}
.app-footer-brand-text strong {
  color: var(--bs-body-color);
  font-size: .88rem;
  font-weight: 650;
}
.app-footer-brand-text span,
.app-footer-meta {
  color: var(--bs-secondary-color);
  font-size: .75rem;
}
.app-footer-meta {
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: right;
}
/* Behåll vänster/höger-layout även på normala mobilbredder. */
@media (max-width: 430px) {
  .app-footer-inner { gap: .45rem; }
  .app-footer-brand { gap: .5rem; }
  .app-footer-mark {
    width: 1.9rem;
    height: 1.9rem;
    flex-basis: 1.9rem;
    border-radius: .6rem;
  }
  .app-footer-mark img {
    width: 1.32rem;
    height: 1.32rem;
  }
  .app-footer-brand-text strong { font-size: .82rem; }
  .app-footer-brand-text span,
  .app-footer-meta { font-size: .68rem; }
}
/* Stapla först på extremt smala viewportar där båda sidorna inte får plats. */
@media (max-width: 339.98px) {
  .app-footer-inner {
    flex-direction: column;
    justify-content: center;
    gap: .7rem;
    text-align: center;
  }
  .app-footer-brand {
    justify-content: center;
    flex: 0 1 auto;
  }
  .app-footer-meta { text-align: center; }
}
[data-bs-theme="dark"] .app-footer {
  background: rgba(15,18,22,.88);
}
[data-bs-theme="dark"] .app-footer-mark {
  box-shadow: 0 .2rem .8rem rgba(0,0,0,.2);
}
.app-footer-mark img {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
  border-radius: .38rem;
}

/* v3.4.4: verkligt centrerad och responsiv loginlayout.
   Bootstrap-gridens negativa row-marginaler tas ur ekvationen och loginytan
   får en egen responsiv bredd som växer tydligt på större skärmar. */
.login-main {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}
.login-column {
  width: min(100%, 34rem);
  max-width: none;
  margin-inline: auto;
}
.login-card {
  width: 100%;
}

@media (min-width: 768px) {
  .login-column {
    width: min(100%, 40rem);
  }
}

@media (min-width: 992px) {
  .login-column {
    width: min(100%, 46rem);
  }
  .login-card .card-body {
    padding: 3rem !important;
  }
}

@media (min-width: 1200px) {
  .login-column {
    width: min(100%, 50rem);
  }
  .login-card .card-body {
    padding: 3.25rem 3.5rem !important;
  }
}

@media (min-width: 1600px) {
  .login-column {
    width: min(100%, 54rem);
  }
}

@media (max-width: 575.98px) {
  .login-main {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  .login-column {
    width: 100%;
  }
}

/* v3.4.6: app-required / installationsvy */
.app-required-page {
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -12%, rgba(220,53,69,.13), transparent 34rem),
    var(--bs-tertiary-bg);
}
.app-required-shell {
  width: min(100% - 2rem, 820px);
  min-height: 100dvh;
  margin-inline: auto;
  padding: clamp(2rem, 6vh, 5rem) 0 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.app-required-brand {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  text-align: center;
}
.app-required-ui-logo {
  display: block;
  object-fit: contain;
  background: transparent;
}
.app-required-ui-logo-symbol {
  width: 104px;
  height: 104px;
}
.app-required-ui-logo-wordmark {
  width: auto;
  height: auto;
  max-width: min(100%, 430px);
  max-height: 132px;
}
.app-required-heading {
  max-width: 650px;
}
.app-required-eyebrow {
  display: inline-block;
  margin-bottom: .45rem;
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--bs-danger);
}
.app-required-heading h1 {
  margin: 0 0 .55rem;
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  font-weight: 800;
  letter-spacing: -.025em;
}
.app-required-heading p {
  margin: 0;
  color: var(--bs-secondary-color);
  font-size: clamp(.98rem, 2vw, 1.08rem);
  line-height: 1.6;
}
.app-required-card {
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: 1.5rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--bs-body-bg) 96%, transparent);
  box-shadow: 0 1.25rem 3.5rem rgba(0,0,0,.12);
}
.app-required-app-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .25rem;
}
.app-required-icon-wrap {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  padding: 6px;
  border: 1px solid var(--bs-border-color);
  border-radius: 1.25rem;
  background: var(--bs-tertiary-bg);
  box-shadow: inset 0 1px rgba(255,255,255,.12);
}
.app-required-icon-wrap img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 1rem;
}
.app-required-install-panel,
.app-required-instructions {
  border: 1px solid var(--bs-border-color-translucent);
  border-radius: 1.15rem;
  padding: 1.15rem;
  background: var(--bs-tertiary-bg);
}
.app-required-instructions {
  margin-top: 1rem;
}
.app-required-install-copy {
  display: flex;
  align-items: flex-start;
  gap: .85rem;
}
.app-required-step-number {
  flex: 0 0 2rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--bs-danger);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  box-shadow: 0 .35rem .8rem rgba(220,53,69,.18);
}
.app-required-steps {
  display: grid;
  gap: .7rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.app-required-steps li {
  display: grid;
  grid-template-columns: 1.8rem 1fr;
  align-items: start;
  gap: .75rem;
  line-height: 1.45;
}
.app-required-steps li > span {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 50%;
  background: var(--bs-body-bg);
  color: var(--bs-secondary-color);
  font-size: .75rem;
  font-weight: 800;
}
.app-required-launch-note {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  margin-top: 1rem;
  padding: .9rem 1rem;
  border-radius: .95rem;
  background: rgba(var(--bs-info-rgb), .09);
  color: var(--bs-body-color);
}
.app-required-launch-note > i {
  margin-top: .15rem;
  color: var(--bs-info);
}
.app-required-launch-note div {
  display: grid;
  gap: .15rem;
}
.app-required-launch-note span {
  color: var(--bs-secondary-color);
  font-size: .9rem;
}
.app-required-divider {
  height: 1px;
  margin: 1.25rem 0 1rem;
  background: var(--bs-border-color-translucent);
}
.app-required-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.app-required-footnote {
  margin: 1rem auto 0;
  color: var(--bs-secondary-color);
  font-size: .82rem;
  text-align: center;
}
@media (max-width: 575.98px) {
  .app-required-shell {
    width: min(100% - 1.25rem, 820px);
    padding-top: 1.5rem;
    justify-content: flex-start;
  }
  .app-required-brand {
    gap: 1rem;
    margin-bottom: 1.25rem;
  }
  .app-required-ui-logo-symbol {
    width: 86px;
    height: 86px;
  }
  .app-required-ui-logo-wordmark {
    max-width: min(100%, 320px);
    max-height: 100px;
  }
  .app-required-card {
    border-radius: 1.2rem;
  }
  .app-required-icon-wrap {
    width: 72px;
    height: 72px;
  }
  .app-required-icon-wrap img {
    width: 60px;
    height: 60px;
  }
  .app-required-session-row {
    align-items: stretch;
    flex-direction: column;
  }
  .app-required-session-row .btn {
    width: 100%;
  }
}
@media (min-width: 768px) {
  .app-required-card {
    padding: 2.15rem;
  }
  .app-required-install-panel,
  .app-required-instructions {
    padding: 1.35rem;
  }
}

/* v3.4.7: temaanpassad branding, skarpare footerikon och större topbarlogga */
html:not([data-bs-theme="dark"]) .brand-theme-dark,
html[data-bs-theme="dark"] .brand-theme-light {
  display: none !important;
}

/* Topbaren behåller samma höjd men ger ordmärket mer av den tillgängliga ytan. */
.app-navbar {
  height: 3.75rem;
  min-height: 3.75rem;
  padding-block: 0;
}
.app-navbar .navbar-brand {
  min-width: 0;
  height: 100%;
  padding-block: 0;
  align-items: center;
}
.app-brand-logo-wordmark {
  height: 3.1rem;
  max-height: 3.1rem;
  max-width: min(280px, 56vw);
}
.app-brand-logo-symbol {
  width: 2.65rem;
  height: 2.65rem;
  flex-basis: 2.65rem;
}

/* Retina/HiDPI: själva img-elementet får en större källa och fyller markytan bättre. */
.app-footer-mark img {
  width: 1.75rem;
  height: 1.75rem;
  image-rendering: auto;
}

/* Förhandsvisningen av mörk logga ska visas mot en verkligt mörk yta. */
.branding-admin-preview-dark {
  background-color: #161b22;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,.055) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,.055) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.055) 75%);
}

@media (max-width: 575.98px) {
  .app-navbar {
    height: 3.35rem;
    min-height: 3.35rem;
  }
  .app-brand-logo-wordmark {
    height: 2.65rem;
    max-height: 2.65rem;
    max-width: min(240px, 58vw);
  }
  .app-brand-logo-symbol {
    width: 2.3rem;
    height: 2.3rem;
    flex-basis: 2.3rem;
  }
  .app-footer-mark img {
    width: 1.5rem;
    height: 1.5rem;
  }
}

/* v3.4.12: statiskt mörk appkrom oberoende av valt innehållstema */
:root {
  --app-chrome-bg: #20242b;
  --app-chrome-bottom-bg: #101318;
  --app-chrome-border: rgba(255, 255, 255, .13);
}

/* Topbaren är alltid mörk. Ljust/mörkt tema gäller endast sidinnehållet. */
.app-navbar {
  background: var(--app-chrome-bg) !important;
  border-bottom: 1px solid var(--app-chrome-border);
  box-shadow: 0 .2rem .75rem rgba(0, 0, 0, .16) !important;
}

/* Huvudnavigation och incidentnavigation behåller samma mörka identitet i båda teman. */
.main-bottom-nav,
.incident-bottom-nav {
  background: var(--app-chrome-bottom-bg) !important;
  border-top-color: var(--app-chrome-border) !important;
  box-shadow: 0 -.35rem 1rem rgba(0, 0, 0, .2);
}

/* Plusknappens mörka ring ska alltid smälta ihop med den statiska bottombaren. */
.main-nav-create-circle,
.incident-nav-create-circle,
[data-bs-theme="dark"] .main-nav-create-circle,
[data-bs-theme="dark"] .incident-nav-create-circle {
  border-color: var(--app-chrome-bottom-bg) !important;
}

/* v3.5.0: PWA-first / native-lik appupplevelse */
:root {
  --app-safe-top: env(safe-area-inset-top, 0px);
  --app-safe-right: env(safe-area-inset-right, 0px);
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-safe-left: env(safe-area-inset-left, 0px);
}

html,
body {
  -webkit-tap-highlight-color: transparent;
}

/* Appkrom ska kännas som permanent native navigation, inte vanlig webbnavigation. */
.app-topbar-sticky,
.main-bottom-nav,
.incident-bottom-nav {
  -webkit-user-select: none;
  user-select: none;
}

.app-navbar,
.main-bottom-nav,
.incident-bottom-nav {
  -webkit-backdrop-filter: saturate(155%) blur(18px);
  backdrop-filter: saturate(155%) blur(18px);
}

.main-nav-item,
.main-nav-create,
.incident-nav-item,
.incident-nav-create,
.app-theme-toggle,
.navbar .btn,
.navbar .nav-link {
  touch-action: manipulation;
}

.main-nav-item:active,
.incident-nav-item:active,
.app-theme-toggle:active,
.quick-action:active,
.home-metric-card[href]:active {
  transform: scale(.97);
}

.main-nav-item,
.incident-nav-item,
.quick-action,
.home-metric-card[href] {
  transition: transform .09s ease, background-color .12s ease, border-color .12s ease, color .12s ease;
}

/* Pekskärmar: Apples rekommenderade känsla med minst ungefär 44 px tryckyta. */
@media (pointer: coarse) {
  .btn:not(.btn-sm),
  .form-control:not(.form-control-sm),
  .form-select:not(.form-select-sm) {
    min-height: 44px;
  }

  .dropdown-item,
  .list-group-item-action {
    min-height: 44px;
  }
}

/* Förhindra iOS Safari från att zooma in formulärfält. */
@media (max-width: 767.98px) {
  input.form-control,
  textarea.form-control,
  select.form-select {
    font-size: 16px;
  }
}

/* Installerat läge: topbaren fyller även statusfältets safe-area. */
@media (display-mode: standalone) {
  html,
  body {
    min-height: 100%;
    overscroll-behavior-y: none;
  }

  body {
    padding-top: 0 !important;
  }

  .app-topbar-sticky {
    top: 0;
    padding-top: var(--app-safe-top);
    background: var(--app-chrome-bg);
  }

  .main-bottom-nav,
  .incident-bottom-nav {
    padding-left: var(--app-safe-left);
    padding-right: var(--app-safe-right);
    padding-bottom: var(--app-safe-bottom);
  }

  /* Native-appar har inte en webb-sidfot under sitt innehåll. Tabbaren räcker. */
  body:not(.login-page):not(.app-required-page) .app-footer {
    display: none !important;
  }

  /* Desktopmenyn duplicerar tabbaren på iPad-landskap; göm den i installerad app. */
  .app-navbar-desktop-links {
    display: none !important;
  }

  .main-bottom-spacer,
  .incident-bottom-spacer {
    height: calc(4.8rem + var(--app-safe-bottom));
  }

  main.app-shell,
  body > main.container {
    padding-left: max(.85rem, var(--app-safe-left));
    padding-right: max(.85rem, var(--app-safe-right));
  }
}

/* Samma regler när JS upptäckt iOS standalone, även om media query är sen att slå igenom. */
.pwa-standalone .app-topbar-sticky {
  padding-top: var(--app-safe-top);
  background: var(--app-chrome-bg);
}
.pwa-standalone body:not(.login-page):not(.app-required-page) .app-footer {
  display: none !important;
}
.pwa-standalone .app-navbar-desktop-links {
  display: none !important;
}

/* Mobil-PWA: Bootstrap-modaler beter sig som native bottom sheets. */
@media (display-mode: standalone) and (max-width: 575.98px) {
  .modal-dialog:not(.modal-fullscreen) {
    width: 100%;
    max-width: none;
    min-height: 100%;
    margin: 0;
    display: flex;
    align-items: flex-end;
  }

  .modal-dialog:not(.modal-fullscreen) .modal-content {
    max-height: min(92dvh, 760px);
    overflow: hidden;
    border: 0;
    border-radius: 1.3rem 1.3rem 0 0;
    box-shadow: 0 -1rem 2.5rem rgba(0, 0, 0, .28);
  }

  .modal-dialog:not(.modal-fullscreen) .modal-header {
    position: relative;
    padding-top: 1.25rem;
  }

  .modal-dialog:not(.modal-fullscreen) .modal-header::before {
    content: "";
    position: absolute;
    top: .45rem;
    left: 50%;
    width: 2.7rem;
    height: .28rem;
    border-radius: 999px;
    background: var(--bs-secondary-bg);
    transform: translateX(-50%);
  }

  .modal-dialog:not(.modal-fullscreen) .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-dialog:not(.modal-fullscreen) .modal-footer {
    padding-bottom: max(1rem, var(--app-safe-bottom));
  }
}

/* Nätverksstatus – liten systemlik statusindikator ovanför tabbaren. */
.app-network-status {
  position: fixed;
  left: 50%;
  bottom: calc(5.15rem + var(--app-safe-bottom));
  z-index: 1088;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  max-width: calc(100vw - 2rem);
  padding: .5rem .75rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(20, 24, 29, .94);
  color: #fff;
  box-shadow: 0 .35rem 1.2rem rgba(0,0,0,.24);
  font-size: .78rem;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, .65rem);
  transition: opacity .16s ease, transform .16s ease;
}
.app-network-status.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.app-network-status.is-online i { color: var(--bs-success); }
.app-network-status.is-offline i { color: var(--bs-warning); }

@media (min-width: 992px) {
  .app-network-status {
    bottom: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .main-nav-item,
  .incident-nav-item,
  .quick-action,
  .home-metric-card[href],
  .app-network-status {
    transition: none !important;
  }
}
