/* Fleet responsive architecture — mobile & tablet. Desktop styles stay untouched. */

.touch-target {
  min-width: 44px;
  min-height: 44px;
}

.mobile-top-bar {
  display: none;
}

/* ---------- Mobile shell ---------- */
@media (max-width: 767px) {
  html, body {
    overflow-x: hidden;
  }

  .mobile-top-bar {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: calc(var(--z-sidebar) + 5);
    height: calc(var(--mobile-top-bar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 8px 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .mobile-top-bar__brand {
    font-weight: 800;
    font-size: 17px;
    color: var(--text);
    text-decoration: none;
    flex: 1;
    text-align: center;
  }
  .mobile-top-bar__brand:hover { text-decoration: none; color: var(--text); }

  .mobile-top-bar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    flex: none;
  }
  .mobile-top-bar__btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
  .mobile-top-bar__btn--primary {
    background: var(--primary);
    color: var(--text-on-blue);
    border-radius: 12px;
  }

  /* Single sidebar — off-canvas overlay on mobile.
     Drawer must sit ABOVE the mobile top bar (which is z-sidebar+5),
     otherwise Fleet/Balance/Add funds paint over the open panel. */
  .sidebar {
    width: min(var(--sidebar-width-expanded), calc(100vw - 24px)) !important;
    max-width: min(var(--sidebar-width-expanded), calc(100vw - 24px));
    transform: translateX(-105%);
    padding-top: env(safe-area-inset-top, 0px);
    transition: transform 160ms ease, box-shadow 160ms ease;
    box-shadow: none;
    background: var(--sidebar-surface);
    border-right: 1px solid var(--border-soft);
    border-radius: 0;
  }
  .sidebar.is-mobile-open,
  .app.is-navigation-overlay .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-nav-panel);
    z-index: calc(var(--z-sidebar) + 7);
  }

  .app.is-navigation-overlay .navigation-backdrop,
  .navigation-backdrop.is-visible {
    z-index: calc(var(--z-sidebar) + 6);
    background: var(--backdrop);
  }

  /* Mobile drawer header: close + brand, no overlap with Fleet chrome */
  .sidebar.is-mobile-open .sidebar__top,
  .app.is-navigation-overlay .sidebar .sidebar__top {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--sidebar-surface);
  }
  .sidebar.is-mobile-open .sidebar__toggle,
  .app.is-navigation-overlay .sidebar .sidebar__toggle {
    width: 44px;
    height: 44px;
  }
  .sidebar.is-mobile-open .sidebar__branding,
  .app.is-navigation-overlay .sidebar .sidebar__branding {
    display: flex;
    min-width: 0;
  }
  .sidebar.is-mobile-open .sidebar__text-sub,
  .app.is-navigation-overlay .sidebar .sidebar__text-sub {
    color: var(--text-secondary);
  }
  .sidebar.is-mobile-open .sidebar__footer,
  .app.is-navigation-overlay .sidebar .sidebar__footer {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar[data-mode="expanded"] .sidebar__item {
    min-height: 44px;
  }

  .content,
  .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-top: calc(var(--mobile-top-bar-h) + env(safe-area-inset-top, 0px));
  }

  .app.is-sidebar-expanded .content,
  .app.is-sidebar-expanded .app-main,
  .app.is-navigation-push .content,
  .app.is-navigation-push .app-main {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Fleet header — compact row: title + balance */
  .fleet .page-head,
  .fleet .page-head--fleet {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin-bottom: 4px;
    min-height: 0;
  }
  .fleet .page-head__titles h1 {
    font-size: 18px;
    line-height: 1.2;
  }
  .fleet .page-head__subtitle { display: none; }
  .fleet .page-head__count {
    display: none;
  }
  .fleet .page-head__actions {
    display: flex;
    margin-left: auto;
    gap: 8px;
  }
  .fleet .page-head__account {
    gap: 4px;
  }
  .fleet .page-head__chrome {
    padding-left: 8px;
    gap: 4px;
  }
  .fleet .page-head__theme {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
  }
  .fleet .page-head__add-device {
    display: none; /* use mobile + create device */
  }
  .fleet .page-head__add-funds {
    display: none !important; /* use mobile Add Funds control */
  }
  /* Compact balance control — details and Add funds live in the account popover */
  .account-balance {
    height: 34px;
    padding: 0 8px;
  }
  .account-balance__label {
    font-size: 11px;
  }

  /* Command bar — search full width + compact tools */
  .fleet .command-bar {
    padding: 4px 0 2px;
    gap: 6px;
    border-top: none;
    margin-bottom: 0;
  }
  .fleet .command-bar__row--search {
    flex-wrap: nowrap;
  }
  .fleet .search-box {
    flex: 1 1 auto;
    width: 100%;
    max-width: none;
    min-width: 0;
  }
  .fleet .search-box__kbd,
  .fleet .command-bar__meta {
    display: none !important;
  }
  .fleet .command-bar__refresh-wrap {
    display: none !important;
  }

  .fleet .command-bar__row--tools {
    display: none;
  }
  .fleet-m-toolbar:not([hidden]) {
    display: flex;
  }

  /* Groups navigator */
  .device-group-navigator__track,
  .custom-groups-track {
    scroll-snap-type: x proximity;
    gap: 4px;
  }
  .device-group-tab,
  .device-group-tab--new {
    min-height: 40px;
    scroll-snap-align: start;
  }
  .device-group-navigator__fixed--start,
  .device-group-navigator__fixed--end {
    box-shadow: none;
  }

  .fleet-control-deck__nav-row--quick {
    flex-wrap: wrap;
    min-height: 0;
  }
  .quick-filter-bar {
    flex: 1 1 100%;
  }
  .fleet-control-deck__filter-summary:not([hidden]) {
    padding: 0 0 4px;
  }

  .device-list-region,
  .fleet-table-wrap {
    border-radius: 0;
    border-left: none;
    border-right: none;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  /* Scrollport = collection. List root grows with cards (never clips them). */
  .device-list-collection {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    display: block;
  }

  .fleet .table-root[hidden],
  .fleet .table-root.is-desktop-only,
  .fleet .mobile-list-root[hidden] {
    display: none !important;
  }

  /* Cards mode — list root grows with cards inside the collection scroller */
  [data-layout="mobile"] .fleet[data-mview="cards"] #mobile-list-root,
  [data-layout="mobile"] .fleet:not([data-mview]) #mobile-list-root,
  [data-layout="mobile"] .fleet[data-mview="cards"] .device-list-region .mobile-list-root,
  [data-layout="mobile"] .fleet:not([data-mview]) .device-list-region .mobile-list-root {
    display: block !important;
    position: relative;
    flex: none !important;
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* List mode — full-bleed; detailed rules in fleet-mobile.css */
  [data-layout="mobile"] .fleet[data-mview="list"] .device-list-collection {
    overflow: hidden !important;
  }
  [data-layout="mobile"] .fleet[data-mview="list"] #mobile-list-root {
    display: none !important;
  }

  /* Keep the control deck above scrolling cards — no footer strip bleeding over. */
  .fleet-control-deck {
    position: relative;
    z-index: 5;
    background: var(--surface);
  }
  .mobile-device-item {
    position: relative;
    z-index: 0;
    background: var(--surface);
  }
  .mobile-device-item__row,
  .mobile-device-item__ports,
  .mobile-device-item__life {
    position: static !important;
  }

  /* Drawer → full height sheet */
  .drawer__panel {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 16px 16px 0 0;
    top: env(safe-area-inset-top, 0px);
    height: calc(100% - env(safe-area-inset-top, 0px));
  }

  /* Modals (Create Port, etc.) → full-height sheet */
  .modal {
    align-items: stretch;
    justify-content: flex-end;
  }
  .modal__panel,
  .modal__panel--sm,
  .modal__panel--lg {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none;
    height: calc(100% - env(safe-area-inset-top, 0px));
    margin-top: env(safe-area-inset-top, 0px);
    border-radius: 16px 16px 0 0;
  }
  .modal__panel--renew {
    width: 100% !important;
    max-width: 100% !important;
  }
  .modal--renew .renew-ck__periods {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .modal--renew .renew-ck__period {
    text-align: center;
    padding: 10px 8px;
  }
  .modal--renew .renew-ck__device-list.is-expanded {
    max-height: 28vh;
  }
  .modal__body {
    flex: 1;
    min-height: 0;
  }
  .modal__actions {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
  }
  .modal__actions .btn {
    min-height: 44px;
    flex: 1;
  }

  /* Simple yes/no confirmations — compact centered dialog, not full sheet */
  .modal--confirm {
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
  }

  .modal--confirm .modal__panel,
  .modal--confirm .modal__panel--sm,
  .modal--confirm .modal__panel--lg {
    width: min(300px, calc(100vw - 32px)) !important;
    max-width: min(300px, calc(100vw - 32px)) !important;
    height: auto !important;
    max-height: calc(100vh - 40px);
    margin-top: 0 !important;
    border-radius: 12px;
  }

  .modal--confirm .modal__head {
    padding: 14px 16px 0;
  }

  .modal--confirm .modal__head h2 {
    font-size: 15px;
    line-height: 1.25;
  }

  .modal--confirm .modal__body {
    flex: none;
    padding: 6px 16px 10px;
  }

  .modal--confirm .confirm__text {
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
  }

  .modal--confirm .modal__actions {
    position: static;
    justify-content: stretch;
    gap: 8px;
    padding: 0 16px 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    flex-wrap: nowrap;
  }

  .modal--confirm .modal__actions .btn {
    min-height: 34px;
    height: 34px;
    flex: 1;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 700;
    touch-action: manipulation;
  }

  /* Mobile compact confirm — sizing overrides (base in components.css) */
  .mconfirm {
    padding: 20px 16px;
  }

  .mconfirm__panel {
    width: min(300px, calc(100vw - 32px));
  }

  .mconfirm__actions .btn {
    min-height: 34px;
    height: 34px;
  }

  /* Content/info modals — compact centered dialog with scrollable body */
  .modal--dialog {
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    box-sizing: border-box;
  }

  .modal--dialog .modal__panel,
  .modal--dialog .modal__panel--sm,
  .modal--dialog .modal__panel--lg,
  .modal--dialog .modal__panel--plan-help {
    width: min(420px, calc(100vw - 24px)) !important;
    max-width: min(420px, calc(100vw - 24px)) !important;
    height: auto !important;
    max-height: calc(100dvh - 32px);
    margin-top: 0 !important;
    border-radius: 14px;
    overflow: hidden;
  }

  .modal--dialog .modal__head {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    padding-top: 14px;
  }

  .modal--dialog .modal__close {
    position: relative;
    z-index: 3;
    touch-action: manipulation;
  }

  .modal--dialog .modal__body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100dvh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal--dialog .modal__actions {
    position: static;
    flex-shrink: 0;
    margin-top: 0;
    padding-top: 8px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .modal--dialog .modal__actions .btn {
    min-height: 40px;
    touch-action: manipulation;
  }
}

/* Desktop/tablet: hide mobile-only chrome */
@media (min-width: 768px) {
  .mobile-top-bar { display: none !important; }
  .fleet-m-toolbar { display: none !important; }
  .fleet .page-head__count { display: none; }
  #mobile-list-root { display: none !important; }
}

/* Tablet tweaks */
@media (min-width: 768px) and (max-width: 1279px) {
  .fleet .command-bar__row--tools {
    flex-wrap: wrap;
  }
  .fleet .page-head__actions .btn {
    padding-left: 10px;
    padding-right: 10px;
  }
  .device-group-bar__scroll {
    scrollbar-width: none;
  }
  .device-group-bar__scroll::-webkit-scrollbar { display: none; }
}

/* ---------- Bottom sheet ---------- */
.bottom-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  pointer-events: none;
}
.bottom-sheet.is-open { pointer-events: auto; }
.bottom-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.bottom-sheet.is-open .bottom-sheet__backdrop { opacity: 1; }
.bottom-sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(88dvh, 640px);
  background: var(--surface-elevated);
  border-radius: 16px 16px 0 0;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  transform: translateY(110%);
  transition: transform 0.2s ease;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-sheet--full .bottom-sheet__panel {
  max-height: none;
  height: calc(100% - env(safe-area-inset-top, 0px));
  top: env(safe-area-inset-top, 0px);
  bottom: 0;
  border-radius: 16px 16px 0 0;
}
.bottom-sheet.is-open .bottom-sheet__panel { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  .bottom-sheet__panel,
  .bottom-sheet__backdrop { transition: none; }
}
.bottom-sheet__grab {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  margin: 8px auto 0;
  flex: none;
}
.bottom-sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border-soft);
  flex: none;
}
.bottom-sheet__head h2 {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
}
.bottom-sheet__sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.bottom-sheet__body {
  flex: 1;
  overflow: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.bottom-sheet__foot {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
}

/* Activity Timeline — event detail bottom sheet (mobile only) */
@media (max-width: 767px) {
  body.act-sheet-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    left: 0;
    right: 0;
  }

  .act-split.act-split--mobile {
    display: block;
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    gap: 0;
  }

  .act-split.act-split--mobile .act-timeline-card {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .act-tl-row {
    min-height: 44px;
    touch-action: manipulation;
  }

  .act-tl-row__detail {
    display: none;
  }

  .act-tl-row__time {
    font-size: 10px;
  }

  .act-tl-row__title {
    font-size: var(--fs-12);
    font-weight: 500;
  }

  .act-tl-row__sev.badge {
    height: 16px;
    padding: 0 5px;
    font-size: 10px;
  }

  .act-event-sheet {
    z-index: calc(var(--z-modal) + 5);
  }

  .act-event-sheet .bottom-sheet__backdrop {
    background: var(--backdrop-soft);
    border: none;
    padding: 0;
    cursor: default;
    touch-action: manipulation;
  }

  .act-event-sheet .bottom-sheet__panel {
    height: 74vh;
    max-height: 92vh;
    min-height: 55vh;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
  }

  .act-event-sheet.is-open .bottom-sheet__panel {
    transform: translateY(0);
  }

  .act-event-sheet .bottom-sheet__backdrop {
    transition: opacity 0.2s ease-out;
  }

  .act-event-sheet:not(.is-open) .bottom-sheet__panel {
    transition: transform 0.18s ease-in;
  }

  .act-event-sheet:not(.is-open) .bottom-sheet__backdrop {
    transition: opacity 0.18s ease-in;
  }

  .act-event-sheet__head {
    flex: none;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0 12px 10px;
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border-soft);
  }

  .act-event-sheet__head-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .act-event-sheet__icon {
    flex: none;
    width: 32px;
    height: 32px;
    margin-top: 2px;
  }

  .act-event-sheet__icon .icon {
    width: 16px;
    height: 16px;
  }

  .act-event-sheet__head-main {
    flex: 1;
    min-width: 0;
  }

  .act-event-sheet__head-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .act-event-sheet__title {
    margin: 0;
    font-size: var(--fs-14);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
  }

  .act-event-sheet__time {
    margin: 4px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
  }

  .act-event-sheet__close {
    flex: none;
    position: relative;
    z-index: 3;
    width: 40px;
    height: 40px;
    margin: -4px -6px 0 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
  }

  .act-event-sheet__close .icon {
    width: 18px;
    height: 18px;
    pointer-events: none;
  }

  .act-event-sheet__body {
    padding: 20px 12px 12px;
  }

  .act-event-sheet .act-insp__head,
  .act-event-sheet .act-insp__aside {
    display: none !important;
  }

  .act-event-sheet .act-insp {
    height: auto;
    overflow: visible;
  }

  .act-event-sheet .act-insp__body {
    overflow: visible;
    padding: 0;
  }

  .act-event-sheet .act-insp__layout {
    display: block;
  }

  .act-event-sheet .act-insp__main {
    overflow: visible;
  }

  .act-event-sheet .act-insp__tech,
  .act-event-sheet .act-insp__metrics-link {
    display: none !important;
  }

  .act-event-sheet .act-insp__section--float {
    margin-bottom: 20px;
  }

  .act-page .page-section__sub {
    display: none;
  }

  .act-page .act-tl-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .act-page .act-tl-toolbar__left {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex: none;
    min-width: 0;
  }

  .act-page .act-tl-toolbar__title {
    display: none;
  }

  .act-page .act-filter-select--events {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .act-page .act-flt-btn {
    flex: none;
  }

  .act-page .act-search-wrap {
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  /* Activity > Timeline — period bar, summary, subnav */
  .act-page .act-subnav {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 12px;
    padding-bottom: 3px;
  }

  .act-page .act-subnav::-webkit-scrollbar {
    display: none;
  }

  .act-page .act-subnav .ws-tab {
    flex: 0 0 auto;
    gap: 6px;
    padding: 0 10px;
    white-space: nowrap;
  }
  .act-page .act-subnav__icon .icon { width: 14px; height: 14px; }

  .act-page .act-period-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
    min-height: 0;
    margin-bottom: 12px;
  }

  .act-page .act-range {
    width: 100%;
    flex-wrap: wrap;
  }

  .act-page .act-range__field {
    flex: 1 1 140px;
    max-width: none;
  }

  .act-page .act-period-bar__main {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    flex: none;
    min-width: 0;
  }

  .act-page .act-period-seg {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    overflow: visible;
  }

  .act-page .act-period-seg__btn {
    height: 36px;
    min-width: 0;
    padding: 0 8px;
    font-size: 11px;
    gap: 4px;
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
  }

  .act-page .act-period-seg__btn:nth-child(2n) {
    border-right: none;
  }

  .act-page .act-period-seg__btn:nth-last-child(-n+2) {
    border-bottom: none;
  }

  .act-page .act-period-seg__btn--custom {
    padding: 0 8px;
  }

  .act-page .act-period-seg__custom-label {
    max-width: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
  }

  .act-page .act-period-seg__btn .icon {
    width: 13px;
    height: 13px;
    flex: none;
  }

  .act-page .act-period-seg__btn .plan-tier-badge--compact {
    padding: 0 4px;
    font-size: 9px;
    line-height: 1.3;
  }

  .act-page .act-period-seg__btn--custom.plan-locked-control .icon {
    display: none;
  }

  .act-page .act-period-bar__dl {
    width: 100%;
    margin-left: 0;
    justify-content: center;
    height: 36px;
  }

  .act-page .act-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }

  .act-page .act-summary__item {
    padding: 10px 12px;
    min-height: 0;
    gap: 8px;
  }

  .act-page .act-summary__icon {
    width: 32px;
    height: 32px;
    flex: none;
  }

  .act-page .act-summary__icon .icon {
    width: 14px;
    height: 14px;
  }

  .act-page .act-summary__value {
    font-size: var(--fs-16);
    line-height: 1.2;
  }

  .act-page .act-summary__label {
    font-size: 10px;
  }

  .act-page .act-tl-toolbar-wrap {
    margin-bottom: 10px;
  }

  .act-page .act-timeline-card {
    min-width: 0;
  }

  .act-page .act-top {
    margin-bottom: 12px;
    min-width: 0;
  }

  .act-up {
    gap: 12px;
  }

  .act-up-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0;
  }

  .act-up-summary__item:nth-child(n+4) {
    display: none;
  }

  .act-up-summary__item {
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px 8px;
    border-bottom: none;
    text-align: center;
  }

  .act-up-summary__item > div {
    width: 100%;
    text-align: center;
  }

  .act-up-summary__item:nth-child(3n) { border-right: none; }

  .act-up-summary__ico {
    width: 20px;
    height: 20px;
  }

  .act-up-summary__ico .icon {
    width: 10px;
    height: 10px;
  }

  .act-up-summary__value {
    font-size: var(--fs-12);
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
  }

  .act-up-summary__label {
    font-size: 9px;
    font-weight: 500;
    line-height: 1.15;
    max-width: 100%;
    text-align: center;
  }

  .act-up-grid {
    gap: 5px;
  }

  .act-up-tile {
    align-items: center;
    text-align: center;
    gap: 4px;
    padding: 5px 3px 6px;
    min-height: 0;
  }

  .act-up-tile__hour {
    width: 100%;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.1;
    text-align: center;
  }

  .act-up-tile__meta {
    align-items: center;
    width: 100%;
    margin-top: 0;
    font-size: 9px;
    font-weight: 500;
    line-height: 1.15;
    text-align: center;
  }

  .act-up-bar {
    height: 6px;
  }

  /* No hover tooltips on touch — details open via bottom sheet instead */
  .act-up-bar__seg[data-tip] {
    pointer-events: none;
  }

  /* Activity > Uptime — hour detail bottom sheet (mobile only) */
  .act-up-hour-sheet {
    z-index: calc(var(--z-modal) + 5);
  }

  .act-up-hour-sheet .bottom-sheet__backdrop {
    background: var(--backdrop-soft);
    border: none;
    padding: 0;
    cursor: default;
    touch-action: manipulation;
    transition: opacity 0.2s ease-out;
  }

  .act-up-hour-sheet:not(.is-open) .bottom-sheet__backdrop {
    transition: opacity 0.18s ease-in;
  }

  .act-up-hour-sheet .bottom-sheet__panel {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 92vh;
    min-height: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
  }

  .act-up-hour-sheet.is-open .bottom-sheet__panel {
    transform: translateY(0);
  }

  .act-up-hour-sheet:not(.is-open) .bottom-sheet__panel {
    transition: transform 0.18s ease-in;
  }

  .act-up-hsheet__head {
    flex: none;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0 16px 10px;
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border-soft);
  }

  .act-up-hsheet__head-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .act-up-hsheet__icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-top: 2px;
    border-radius: var(--radius-sm);
  }

  .act-up-hsheet__icon .icon { width: 14px; height: 14px; }
  .act-up-hsheet__icon--ok { color: var(--ok-text); background: var(--ok-soft); }
  .act-up-hsheet__icon--warn { color: var(--warn-text); background: var(--warn-soft); }
  .act-up-hsheet__icon--danger { color: var(--danger-text); background: var(--danger-soft); }
  .act-up-hsheet__icon--muted { color: var(--text-muted); background: var(--surface-2); }

  .act-up-hsheet__head-main { flex: 1; min-width: 0; }

  .act-up-hsheet__title {
    margin: 0;
    font-size: var(--fs-14);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text);
  }

  .act-up-hsheet__sub {
    margin: 3px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.25;
  }

  .act-up-hsheet__close,
  .act-up-hsheet__back {
    flex: none;
    width: 40px;
    height: 40px;
    margin: -4px -6px 0 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .act-up-hsheet__back {
    margin: -4px 0 0 -6px;
  }

  .act-up-hsheet__close .icon,
  .act-up-hsheet__back .icon {
    width: 18px;
    height: 18px;
    pointer-events: none;
  }

  .act-up-hsheet__body {
    flex: 1;
    overflow: auto;
    min-height: 0;
    max-height: calc(92vh - 72px);
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .act-up-hsheet__section { margin: 0 0 16px; }
  .act-up-hsheet__section:last-child { margin-bottom: 0; }

  .act-up-hsheet__section-title {
    margin: 0 0 8px;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .act-up-hsheet__divider {
    height: 1px;
    margin: 16px 0;
    background: var(--border-soft);
  }

  .act-up-hsheet__tl-ends {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
  }

  .act-up-hsheet__tl-ends span {
    flex: none;
    white-space: nowrap;
  }

  .act-up-hsheet__tl-ends span:last-child {
    text-align: right;
  }

  .act-up-hsheet__tl-bar {
    height: 10px;
  }

  .act-up-hsheet__tl-events {
    position: relative;
    min-height: 34px;
    margin-top: 6px;
  }

  .act-up-hsheet__tl-event {
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    text-align: center;
    pointer-events: none;
  }

  .act-up-hsheet__tl-event--compact {
    min-width: 88px;
    transform: translateX(-50%);
  }

  .act-up-hsheet__tl-event--compact .act-up-hsheet__tl-range {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
    white-space: nowrap;
  }

  .act-up-hsheet__tl-event--wide .act-up-hsheet__tl-bounds {
    display: flex;
    justify-content: space-between;
    width: 100%;
    gap: 4px;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.2;
  }

  .act-up-hsheet__tl-event--wide .act-up-hsheet__tl-bounds span {
    white-space: nowrap;
  }

  .act-up-hsheet__tl-dur {
    margin-top: 3px;
    font-size: 9px;
    font-weight: 650;
    color: var(--text-secondary);
    line-height: 1.2;
    white-space: nowrap;
  }

  .act-up-hsheet__tl-event--outage .act-up-hsheet__tl-dur,
  .act-up-hsheet__tl-event--outage .act-up-hsheet__tl-range {
    color: var(--danger-text);
  }

  .act-up-hsheet__tl-event--degraded .act-up-hsheet__tl-dur {
    color: var(--warn-text);
  }

  .act-up-hsheet__impact-title {
    margin: 0;
    font-size: var(--fs-13);
    font-weight: 650;
    color: var(--text);
    line-height: 1.25;
  }

  .act-up-hsheet__impact-detail {
    margin: 4px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.35;
  }

  .act-up-hsheet__duo {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
  }

  .act-up-hsheet__duo--second {
    margin-top: 12px;
  }

  .act-up-hsheet__field-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.2;
  }

  .act-up-hsheet__field-value {
    display: block;
    margin-top: 2px;
    font-size: var(--fs-13);
    font-weight: 650;
    color: var(--text);
    line-height: 1.25;
  }

  .act-up-hsheet__field-value--ok { color: var(--ok-text); }
  .act-up-hsheet__field-value--warn { color: var(--warn-text); }
  .act-up-hsheet__field-value--danger { color: var(--danger-text); }

  .act-up-hsheet__rel-list {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .act-up-hsheet__rel-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 16px;
    gap: 2px 8px;
    align-items: center;
    width: 100%;
    padding: 10px 0;
    border: none;
    border-bottom: 1px solid var(--border-soft);
    background: transparent;
    text-align: left;
    touch-action: manipulation;
  }

  .act-up-hsheet__rel-row:last-child { border-bottom: none; }

  .act-up-hsheet__rel-title {
    grid-column: 1;
    font-size: var(--fs-13);
    font-weight: 650;
    color: var(--text);
    line-height: 1.25;
  }

  .act-up-hsheet__rel-meta {
    grid-column: 1;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.25;
  }

  .act-up-hsheet__rel-chev {
    grid-column: 2;
    grid-row: 1 / span 2;
    color: var(--text-disabled);
  }

  .act-up-hsheet__rel-chev .icon { width: 14px; height: 14px; }

  .act-up-hsheet__view-all {
    margin-top: 8px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    color: var(--blue);
    touch-action: manipulation;
  }

  .act-up-hsheet__compact,
  .act-up-hsheet__empty {
    padding: 4px 0 8px;
  }

  .act-up-hsheet__stat {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }

  .act-up-hsheet__stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
  }

  .act-up-hsheet__stat-value {
    font-size: var(--fs-14);
    font-weight: 700;
    color: var(--text);
  }

  .act-up-hsheet__stat-value--ok { color: var(--ok-text); }

  .act-up-hsheet__note {
    margin: 10px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.35;
  }

  .act-up-hsheet__empty strong {
    display: block;
    font-size: var(--fs-14);
    font-weight: 700;
    color: var(--text);
  }

  .act-up-hsheet__empty p {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.35;
  }

  /* Activity > IP History — compact summary cards (mobile only) */
  .act-iph-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .act-iph-toolbar .act-range {
    width: 100%;
  }

  .act-iph-toolbar .act-range__field {
    flex: 1 1 140px;
    max-width: none;
  }

  .act-iph-toolbar .act-period-seg {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: auto;
    overflow: visible;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .act-iph-toolbar .act-period-seg::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .act-iph-toolbar .act-period-seg__btn {
    height: 36px;
    min-width: 0;
    padding: 0 8px;
    font-size: 11px;
    gap: 4px;
    border-right: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
  }

  .act-iph-toolbar .act-period-seg__btn:nth-child(2n) {
    border-right: none;
  }

  .act-iph-toolbar .act-period-seg__btn:nth-last-child(-n+2) {
    border-bottom: none;
  }

  .act-iph-toolbar .act-period-seg__btn--custom {
    padding: 0 8px;
  }

  .act-iph-toolbar .act-period-seg__custom-label {
    max-width: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
  }

  .act-iph-toolbar .act-period-seg__btn .icon {
    width: 13px;
    height: 13px;
    flex: none;
  }

  .act-iph-toolbar__right {
    width: 100%;
    margin-left: 0;
  }

  .act-iph-search {
    display: none !important;
  }

  .act-iph-export {
    width: 32px;
    min-width: 32px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }

  .act-iph-export__label,
  .act-iph-export__chev {
    display: none !important;
  }

  .act-iph-repeated-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
  }

  .act-iph-repeated-bar:disabled {
    opacity: 0.55;
    cursor: default;
  }

  .act-iph-repeated-bar__ico {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--blue-soft);
    color: var(--blue);
  }

  .act-iph-repeated-bar__ico .icon {
    width: 14px;
    height: 14px;
  }

  .act-iph-repeated-bar__main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .act-iph-repeated-bar__title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
  }

  .act-iph-repeated-bar__meta {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .act-iph-repeated-bar__chev {
    flex: none;
    color: var(--text-muted);
    opacity: 0.55;
  }

  .act-iph-repeated-bar__chev .icon {
    width: 14px;
    height: 14px;
  }

  .act-iph-repeated-list {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .act-iph-repeated-row {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
  }

  .act-iph-repeated-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  .act-iph-repeated-row__top {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .act-iph-repeated-row__ip {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .act-iph-repeated-row__count {
    flex: none;
    min-width: 28px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
  }

  .act-iph-repeated-row__meta {
    margin: 4px 0 0;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.3;
  }

  .act-iph-repeated-empty {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
  }

  .act-iph-summary {
    min-height: 0;
    max-height: none;
  }

  .act-iph-summary__item {
    gap: 2px;
    padding: 8px 10px;
  }

  .act-iph-summary__label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1.2;
  }

  .act-iph-summary__value {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.1;
  }

  .act-iph-summary__ip {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.1;
  }

  .act-iph-summary__sub {
    gap: 4px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
  }

  .act-iph-summary__ip-row {
    gap: 4px;
  }

  .act-iph-dot {
    width: 6px;
    height: 6px;
  }

  .act-iph-summary .act-iph-copy {
    width: 22px;
    height: 22px;
  }

  .act-iph-summary .act-iph-copy .icon {
    width: 12px;
    height: 12px;
  }

  .act-iph-summary__item--current {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "label status"
      "ip ip";
    gap: 2px 10px;
    align-items: center;
  }

  .act-iph-summary__item--current .act-iph-summary__label {
    grid-area: label;
  }

  .act-iph-summary__item--current .act-iph-summary__ips {
    grid-area: ip;
  }

  .act-iph-summary__item--current .act-iph-summary__ip-row {
    grid-area: ip;
    width: fit-content;
    max-width: 100%;
  }

  .act-iph-summary__item--current .act-iph-summary__sub {
    grid-area: status;
    justify-self: end;
    text-align: right;
    white-space: nowrap;
  }

  /* Activity > IP History — compact list rows (mobile only) */
  .act-iph-table tr.act-iph-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 10px;
    min-height: 34px;
    position: relative;
    cursor: default;
  }

  .act-iph-table tr.act-iph-row:hover {
    background: transparent;
  }

  .act-iph-table tr.act-iph-row.is-current:hover {
    background: color-mix(in srgb, var(--ok) 6%, var(--surface));
  }

  @supports not (background: color-mix(in srgb, white 50%, black)) {
    .act-iph-table tr.act-iph-row.is-current:hover {
      background: var(--ok-soft);
    }
  }

  .act-iph-table tr.act-iph-row td {
    display: block;
    width: auto;
    height: auto;
    padding: 0;
    border: none;
    white-space: nowrap;
  }

  .act-iph-table tr.act-iph-row td:nth-child(1) {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
  }

  .act-iph-table tr.act-iph-row td:nth-child(2) {
    flex: 0 1 auto;
    min-width: 0;
    margin-left: auto;
    text-align: right;
  }

  .act-iph-table tr.act-iph-row td:nth-child(3),
  .act-iph-table tr.act-iph-row td:nth-child(n+4):not(.act-iph-col--chev) {
    display: none !important;
  }

  .act-iph-table tr.act-iph-row .act-iph-col--chev {
    display: none !important;
  }

  .act-iph-table tr.act-iph-row .act-iph-acquired {
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .act-iph-table tr.act-iph-row .act-iph-dot {
    width: 6px;
    height: 6px;
    flex: none;
  }

  .act-iph-table tr.act-iph-row .act-iph-ipcell {
    gap: 2px;
    justify-content: flex-end;
    max-width: 100%;
  }

  .act-iph-table tr.act-iph-row .act-iph-ipcell .mono {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
  }

  .act-iph-table tr.act-iph-row .act-iph-copy {
    width: 20px;
    height: 20px;
  }

  .act-iph-table tr.act-iph-row .act-iph-copy .icon {
    width: 11px;
    height: 11px;
  }

  /* two cells on a phone: the IPv6 goes under the IPv4 */
  .act-iph-table tr.act-iph-row .act-iph-v6-inline {
    display: block;
    font-size: 10px;
    line-height: 1.2;
    color: var(--text-muted);
    text-align: right;
    padding-right: 22px;   /* under the IPv4 text, not its copy button */
  }

  .act-iph-table tr.act-iph-row.is-current {
    background: color-mix(in srgb, var(--ok) 6%, var(--surface));
  }

  @supports not (background: color-mix(in srgb, white 50%, black)) {
    .act-iph-table tr.act-iph-row.is-current {
      background: var(--ok-soft);
    }
  }

  .act-iph-table tr.act-iph-row.is-selected {
    background: transparent;
  }

  .act-iph-table tr.act-iph-row.is-current.is-selected {
    background: color-mix(in srgb, var(--ok) 6%, var(--surface));
  }

  /* Activity > IP History — detail bottom sheet (mobile only) */
  .act-iph-sheet {
    z-index: calc(var(--z-modal) + 5);
  }

  .act-iph-sheet .bottom-sheet__backdrop {
    background: var(--backdrop-soft);
    border: none;
    padding: 0;
    cursor: default;
    touch-action: manipulation;
    transition: opacity 0.2s ease-out;
  }

  .act-iph-sheet:not(.is-open) .bottom-sheet__backdrop {
    transition: opacity 0.18s ease-in;
  }

  .act-iph-sheet .bottom-sheet__panel {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 92vh;
    min-height: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
  }

  .act-iph-sheet.is-open .bottom-sheet__panel {
    transform: translateY(0);
  }

  .act-iph-sheet:not(.is-open) .bottom-sheet__panel {
    transition: transform 0.18s ease-in;
  }

  .act-iph-sheet__head {
    flex: none;
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 0 16px 10px;
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border-soft);
  }

  .act-iph-sheet__head-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .act-iph-sheet__head-main {
    flex: 1;
    min-width: 0;
  }

  .act-iph-sheet__head-top {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .act-iph-sheet__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  .act-iph-sheet__sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 6px 0 0;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 1.3;
  }

  .act-iph-sheet__close {
    flex: none;
    margin-top: 2px;
  }

  .act-iph-sheet__close .icon {
    width: 16px;
    height: 16px;
  }

  .act-iph-sheet__body {
    flex: 1;
    overflow: auto;
    min-height: 0;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .act-iph-sheet__body .act-iph-sec:first-child {
    margin-top: 0;
  }

  .act-iph-sheet__body .act-iph-sec {
    margin-top: 16px;
  }

  .act-iph-sheet__body .act-iph-sec__title {
    margin-bottom: 8px;
    font-size: 10px;
  }

  .act-iph-sheet__body .act-iph-field__label {
    font-size: 10px;
  }

  .act-iph-sheet__body .act-iph-field__value {
    font-size: 12px;
  }

  /* Activity > Usage — compact overview cards (mobile only) */
  .act-usage {
    gap: 10px;
  }

  .act-usage-overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-height: 0;
    max-height: none;
  }

  .act-usage-ov--desktop {
    display: none !important;
  }

  .act-usage-ov--mobile {
    display: flex;
  }

  .act-usage-ov--today,
  .act-usage-ov--peak {
    border-right: 1px solid var(--border-soft);
    border-bottom: none;
  }

  .act-usage-ov--month {
    border-right: none;
    border-bottom: none;
  }

  .act-usage-ov {
    gap: 3px;
    padding: 8px 10px;
  }

  .act-usage-ov__head.act-usage-ov--mobile {
    min-height: 0;
    justify-content: flex-start;
  }

  .act-usage-ov__label--ico {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    gap: 5px;
  }

  .act-usage-ov__label--ico .act-usage-dot {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
  }

  .act-usage-ov__ico-inline .icon {
    width: 11px;
    height: 11px;
  }

  .act-usage-trend {
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
  }

  .act-usage-ov__head {
    min-height: 0;
    gap: 6px;
  }

  .act-usage-ov__label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.03em;
  }

  .act-usage-ov__ico .icon {
    width: 11px;
    height: 11px;
  }

  .act-usage-ov__value {
    font-size: 16px;
    font-weight: 600;
    line-height: 1.1;
  }

  .act-usage-ov__du {
    gap: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
  }

  .act-usage-ov__sub {
    margin-top: 2px;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
  }

  .act-usage-ov__rates {
    gap: 2px;
    margin-top: 0;
  }

  .act-usage-rate {
    font-size: 13px;
    font-weight: 600;
    gap: 4px;
    line-height: 1.15;
  }

  .act-usage-rate__arrow {
    font-size: 11px;
  }

  .act-usage-live {
    gap: 4px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 600;
  }

  .act-usage-dot {
    width: 5px;
    height: 5px;
  }

  .act-usage-progress {
    margin-top: 0;
  }

  .act-usage-progress__meta {
    margin-bottom: 4px;
    font-size: 10px;
    font-weight: 500;
  }

  .act-usage-progress__track {
    height: 4px;
  }

  .act-usage-stack {
    height: 5px;
    margin: 2px 0 0;
  }

  .act-usage-break {
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.25;
  }

  .act-usage-break > div {
    gap: 5px;
  }

  .act-usage-swatch {
    width: 6px;
    height: 6px;
  }

  .act-usage-tz {
    font-size: 10px;
    padding: 0;
  }

  .act-usage-chart-card__head {
    align-items: flex-start;
    padding-bottom: 4px;
  }

  .act-usage-chart-card__controls {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .act-usage-chart-card__controls .btn {
    flex: 0 1 auto;
    max-width: 52%;
  }

  .act-usage-chart {
    height: 220px;
  }

  .act-usage-chart-wrap {
    padding: 0 8px 10px;
  }

  /* Usage by port — Stocks-style minimal rows (mobile only) */
  .act-usage-prow--desktop {
    display: none !important;
  }

  .act-usage-prow--mobile {
    display: block;
  }

  .act-usage-prow {
    display: block;
    max-height: none;
    min-height: 0;
    padding: 8px 12px;
  }

  .act-usage-prow-m {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px minmax(64px, auto);
    align-items: center;
    gap: 4px 8px;
    width: 100%;
  }

  .act-usage-prow-m__left {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
  }

  .act-usage-prow-m__port {
    font-size: 11px;
    font-weight: 500;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .act-usage-prow-m__name {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
  }

  .act-usage-prow-m__spark {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
  }

  .act-usage-prow-m__spark .act-usage-spark {
    width: 48px;
    height: 22px;
  }

  .act-usage-prow-m__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    min-width: 0;
  }

  .act-usage-prow-m__val {
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    white-space: nowrap;
  }

  .act-usage-prow-m__pill {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    white-space: nowrap;
  }

  .act-usage-prow-m__pill--live {
    background: color-mix(in srgb, var(--ok) 14%, transparent);
    color: var(--ok-text, #16a34a);
  }

  .act-usage-prow-m__pill--idle,
  .act-usage-prow-m__pill--off {
    background: var(--hover);
    color: var(--text-muted);
  }

  .act-usage-ports__head {
    padding: 8px 12px 6px;
  }

  .act-usage-ports__head .btn {
    max-width: 48%;
    font-size: 10px;
    font-weight: 500;
    height: 26px;
    padding: 0 7px;
  }

  .act-usage-ports__title {
    font-size: 12px;
    font-weight: 600;
  }

  .act-usage-ports__list {
    padding: 0;
  }

  /* Activity > Usage — month header centered (mobile) */
  .act-usage-toolbar--month {
    width: 100%;
    justify-content: center;
  }

  .act-usage-toolbar .act-usage-chart-nav__label {
    font-size: 13px;
    min-width: 96px;
  }

  .act-usage-toolbar .act-usage-export {
    width: 34px;
    min-width: 34px;
  }

  /* legacy period seg — other activity tabs */
  .act-usage-toolbar .act-period-seg {
    display: flex;
    width: 100%;
    max-width: 100%;
    height: 36px;
    overflow: hidden;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .act-usage-toolbar .act-period-seg::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .act-usage-toolbar .act-period-seg__btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 6px;
    font-size: 11px;
  }

  .act-usage-toolbar .act-period-seg__btn--custom {
    flex: 1.1 1 0;
    padding: 0 7px;
    gap: 4px;
  }

  .act-usage-toolbar .act-period-seg__custom-label {
    max-width: 52px;
    font-size: 11px;
  }

  .act-usage-toolbar .act-period-seg__btn--export {
    flex: 0 0 34px;
    width: 34px;
    min-width: 34px;
  }

  .act-usage-toolbar .act-period-seg__btn .icon {
    width: 13px;
    height: 13px;
  }

  /* Custom range — DateTimeRangePicker bottom sheet (mobile only) */
  .dtr-sheet {
    z-index: calc(var(--z-modal) + 6);
  }

  /* DTP calendar opens in #menu-root — must stack above the custom-range sheet. */
  body.act-sheet-open .popover.popover--dtp {
    z-index: calc(var(--z-modal) + 10);
  }

  .dtr-sheet .bottom-sheet__backdrop {
    background: var(--backdrop-soft);
    border: none;
    padding: 0;
    cursor: default;
    touch-action: manipulation;
    transition: opacity 0.2s ease-out;
  }

  .dtr-sheet:not(.is-open) .bottom-sheet__backdrop {
    transition: opacity 0.18s ease-in;
  }

  .dtr-sheet .bottom-sheet__panel,
  .dtr-sheet .dtr-sheet__panel {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: 92vh;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    padding-bottom: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    transform: translateY(100%);
    transition: transform 0.2s ease-out;
    overflow: hidden;
  }

  .dtr-sheet.is-open .bottom-sheet__panel {
    transform: translateY(0);
  }

  .dtr-sheet:not(.is-open) .bottom-sheet__panel {
    transition: transform 0.18s ease-in;
  }

  .dtr-sheet .bottom-sheet__grab {
    margin-top: 6px;
    margin-bottom: 2px;
  }

  .dtr-sheet .dtr-pop--sheet {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .dtr-sheet .dtr-pop__shell {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .dtr-sheet .dtr-pop__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
    padding: 0 16px 14px;
  }

  .dtr-sheet .dtr-pop__head--sheet {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 12px;
    padding-top: 2px;
  }

  .dtr-sheet .dtr-pop__head-main {
    flex: 1;
    min-width: 0;
  }

  .dtr-sheet .dtr-pop__title {
    margin: 0 0 2px;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  .dtr-sheet .dtr-pop__help {
    margin: 0;
    font-size: 12px;
  }

  .dtr-sheet .dtr-pop__close {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: -4px -8px 0 0;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    touch-action: manipulation;
  }

  .dtr-sheet .dtr-pop__close .icon {
    width: 18px;
    height: 18px;
  }

  .dtr-sheet .dtr-pop__close:hover,
  .dtr-sheet .dtr-pop__close:focus-visible {
    background: var(--hover);
    color: var(--text);
  }

  .dtr-sheet .dtr-pop__presets {
    display: none !important;
  }

  .dtr-sheet .dtr-pop__fields {
    gap: 10px;
    margin-bottom: 10px;
  }

  .dtr-sheet .dtr-pop__inputs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px;
    gap: 8px;
    align-items: stretch;
  }

  .dtr-sheet .dtr-pop__input {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
  }

  .dtr-sheet .dtr-pop__input input {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0 10px;
    font-size: 13px;
  }

  .dtr-sheet .dtr-pop__input--icon-right input {
    padding: 0 4px 0 10px;
  }

  .dtr-sheet .dtr-pop__input--time input {
    padding: 0 10px 0 4px;
  }

  .dtr-sheet .dtr-pop__cal-btn {
    position: static;
    flex: none;
    transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0 4px 0 0;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    touch-action: manipulation;
  }

  .dtr-sheet .dtr-pop__cal-btn .icon {
    width: 16px;
    height: 16px;
    flex: none;
  }

  .dtr-sheet .dtr-pop__cal-btn:hover,
  .dtr-sheet .dtr-pop__cal-btn:focus-visible {
    background: var(--hover);
    color: var(--blue);
  }

  .dtr-sheet .dtr-pop__input.is-cal-open .dtr-pop__cal-btn,
  .dtr-sheet .dtr-pop__col.is-cal-target .dtr-pop__cal-btn {
    color: var(--blue);
    background: var(--blue-soft);
  }

  .dtr-sheet .dtr-pop__col.is-cal-target .dtr-pop__input:not(.is-invalid) {
    border-color: color-mix(in srgb, var(--blue) 45%, var(--border));
  }

  .dtr-sheet .dtr-pop__col.is-cal-target .dtr-pop__input input:not(.is-invalid):not(:focus) {
    border-color: transparent;
  }

  .dtr-sheet .dtr-pop__ico {
    position: static;
    flex: none;
    transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 100%;
    padding: 0 0 0 6px;
    line-height: 0;
  }

  .dtr-sheet .dtr-pop__ico .icon {
    width: 15px;
    height: 15px;
    display: block;
    flex: none;
  }

  .dtr-cal-panel--sheet {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
  }

  .dtr-cal-panel__hint {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
  }

  .dtr-sheet .dtr-cal {
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  .dtr-sheet .dtr-cal-panel .dtr-cal {
    width: 100%;
  }

  .dtr-sheet .dtr-cal__week,
  .dtr-sheet .dtr-cal__grid {
    width: 100%;
    justify-content: stretch;
  }

  .dtr-sheet .dtr-cal {
    margin-top: 0;
  }

  .dtr-sheet .dtr-cal__nav {
    min-height: 36px;
    margin-bottom: 4px;
  }

  .dtr-sheet .dtr-cal__navbtn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .dtr-sheet .dtr-cal__navbtn .icon {
    width: 16px;
    height: 16px;
  }

  .dtr-sheet .dtr-cal__month {
    font-size: 15px;
    font-weight: 600;
  }

  .dtr-sheet .dtr-cal__week,
  .dtr-sheet .dtr-cal__grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
  }

  .dtr-sheet .dtr-cal__wd {
    height: 24px;
    font-size: 10px;
    font-weight: 600;
    width: auto;
  }

  .dtr-sheet .dtr-cal__day {
    height: auto;
    min-height: 38px;
    width: 100%;
    aspect-ratio: 1;
    max-height: 44px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
  }

  .dtr-sheet .dtr-cal__day.is-range {
    border-radius: 0;
  }

  .dtr-sheet .dtr-cal__day.is-start {
    border-radius: 8px 0 0 8px;
  }

  .dtr-sheet .dtr-cal__day.is-end {
    border-radius: 0 8px 8px 0;
  }

  .dtr-sheet .dtr-cal__day.is-single,
  .dtr-sheet .dtr-cal__day.is-start.is-end {
    border-radius: 8px;
  }

  .dtr-sheet .dtr-pop__foot {
    position: sticky;
    bottom: 0;
    z-index: 2;
    flex: none;
    min-height: 56px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface-elevated);
    border-top: 1px solid var(--border-soft);
  }

  .dtr-sheet .dtr-pop__tz {
    font-size: 12px;
    gap: 6px;
  }

  .dtr-sheet .dtr-pop__tz-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    color: var(--text-muted);
  }

  .dtr-sheet .dtr-pop__tz-ico .icon {
    width: 14px;
    height: 14px;
  }

  .dtr-sheet .dtr-pop__actions {
    gap: 8px;
  }

  .dtr-sheet .dtr-pop__actions .btn {
    height: 40px;
    min-height: 40px;
  }

  .dtr-sheet .dtr-pop__actions .btn--primary {
    min-width: 96px;
    max-width: 110px;
    padding: 0 16px;
  }

  .dtr-sheet .dtr-pop__err {
    margin-top: 8px;
    font-size: 12px;
  }

  /* Daily uptime — single-day picker (no From/To range) */
  .dtr-sheet--day .dtr-pop__head--sheet,
  .dtr-sheet .dtr-pop--day .dtr-pop__head--sheet {
    margin-bottom: 10px;
  }

  .dtr-sheet--day .dtr-pop__body,
  .dtr-sheet .dtr-pop--day .dtr-pop__body {
    padding-bottom: 12px;
  }
}

.action-sheet-list {
  list-style: none;
  margin: 0;
  padding: 4px 0 12px;
}
.action-sheet-list__divider {
  height: 1px;
  background: var(--border-soft);
  margin: 6px 12px;
}
.action-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-align: left;
}
.action-sheet-item:hover,
.action-sheet-item:focus-visible {
  background: var(--hover);
  outline: none;
}
.action-sheet-item .icon { width: 20px; height: 20px; color: var(--text-secondary); }
.action-sheet-item--danger { color: var(--danger); }
.action-sheet-item--danger .icon { color: var(--danger); }

/* Bulk actions — stacked layout in bottom sheet */
.action-sheet-list--stacked {
  padding: 0 0 8px;
}

.action-sheet-list__header {
  padding: 10px 16px 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  list-style: none;
}

.action-sheet-list__header:first-child {
  padding-top: 2px;
}

.action-sheet-list--stacked .action-sheet-list__divider {
  margin: 4px 12px;
}

.action-sheet-item--stacked {
  align-items: flex-start;
  min-height: 48px;
  padding: 10px 16px;
  gap: 12px;
}

.action-sheet-item.is-disabled,
.action-sheet-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.bottom-sheet--device-actions .action-sheet-item--stacked {
  min-height: 52px;
}

.bottom-sheet--device-actions .action-sheet-cancel {
  width: 100%;
}

.action-sheet-item--stacked .icon {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
}

.action-sheet-item__body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
  text-align: left;
}

.action-sheet-item__label {
  font-size: var(--fs-13);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.action-sheet-item__hint {
  font-size: var(--fs-11);
  font-weight: 400;
  line-height: 1.3;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.action-sheet-item--stacked.action-sheet-item--danger .action-sheet-item__label,
.action-sheet-item--stacked.action-sheet-item--danger .icon {
  color: var(--danger);
}

.action-sheet-item--stacked.action-sheet-item--danger .action-sheet-item__hint {
  color: var(--text-muted);
}

.bottom-sheet.bottom-sheet--actions-stacked .bottom-sheet__panel {
  max-height: min(92dvh, 720px);
}

.bottom-sheet.bottom-sheet--actions-stacked .bottom-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---------- Mobile device list ---------- */
.mobile-device-list-root {
  display: block;
  width: 100%;
}
.mobile-device-list-root .state-box {
  min-height: 220px;
  justify-content: center;
}
.mobile-device-list {
  display: block;
  width: 100%;
}
.mobile-device-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface);
  min-height: 116px;
}
.mobile-device-item.is-selected {
  background: var(--blue-soft);
}
.mobile-device-item__top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.mobile-device-item__status {
  flex: none;
  width: 14px;
  display: flex;
  justify-content: center;
}
.mobile-device-item__status .status__label { display: none !important; }
.mobile-device-item__check {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mobile-device-item__name {
  flex: 1;
  min-width: 0;
  font-weight: 800;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
}
.mobile-device-item__name:hover { color: var(--blue); }
.mobile-device-item__top .issue-badge {
  width: 30px;
  height: 30px;
}
.mobile-device-item__meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding-left: 22px;
}
.mobile-device-item__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-left: 22px;
}
.mobile-device-item__primary {
  display: block;
  font-weight: 700;
  font-size: 13px;
}
.mobile-device-item__secondary {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.mobile-device-item__ip {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 58%;
}
.mobile-device-item__ip .mono {
  font-size: 12px;
  font-weight: 600;
  min-width: 0;
}
.mobile-device-item__ip-busy {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.mobile-device-item__ports {
  border: none;
  background: transparent;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  text-align: left;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.mobile-device-item__life {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: right;
  padding-top: 12px;
}
.mobile-device-item__extra {
  padding-left: 22px;
  font-size: 11px;
}
.mobile-device-list__pager {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
}
.mobile-device-list__pager-inner,
.mobile-device-list__pager-btns {
  display: none !important;
}
.mobile-device-list__end {
  flex: none;
  flex-shrink: 0;
  min-height: 0;
  padding: 0;
}
.mobile-device-list__end:empty,
.mobile-device-list__end.is-empty {
  display: block;
  height: 1px;
  min-height: 1px;
  max-height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
.mobile-device-list__end:not(:empty):not(.is-empty) {
  height: auto;
  max-height: none;
  opacity: 1;
  pointer-events: auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
}
.mobile-device-list__end-inner {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Mobile selection bar */
.mobile-select-bar {
  display: none;
}
@media (max-width: 767px) {
  body:has(.main--fleet),
  .app:has(.main--fleet) {
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }
  .main--fleet {
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
  }
  .fleet-page {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }
  .device-list-region {
    min-height: 0;
    overflow: hidden;
  }
  .mobile-select-bar:not([hidden]) {
    display: flex;
    position: relative;
    flex: none;
    z-index: 6;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--blue-soft);
    border-top: 1px solid var(--blue-border-soft);
  }
  .mobile-select-bar__meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
  }
  .mobile-select-bar__title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .mobile-select-bar__count {
    font-weight: 800;
    color: var(--blue);
    font-size: 13px;
  }
  .mobile-select-bar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .mobile-select-bar__actions .btn {
    min-height: 44px;
  }
}
@media (max-width: 767px) {
  .modal.team-change-role-modal { align-items: center; justify-content: center; padding: 16px; }
  .modal.team-change-role-modal .modal__panel {
    width: min(360px, calc(100vw - 32px)) !important;
    max-width: 360px !important;
    height: auto !important;
    min-height: 0;
    max-height: calc(100dvh - 32px);
    margin: 0 !important;
    border-radius: 14px;
    flex: 0 1 auto;
  }
  .modal.team-change-role-modal .modal__head { padding: 14px 16px; }
  .modal.team-change-role-modal .modal__body { padding: 0 16px 12px; flex: 0 1 auto; overflow-y: auto; }
  .modal.team-change-role-modal .modal__body > p { overflow-wrap: anywhere; }
  .modal.team-change-role-modal .modal__actions { padding: 12px 16px; position: static; gap: 8px; }
}
