/* ShiftNevis mobile dashboard polish v2. Desktop is intentionally untouched. */
@media (max-width: 760px) {
  body:has(.dashboard-mobile-home) {
    background: #f7f5fb;
  }

  body:has(.dashboard-mobile-home) .app-header {
    min-height: 60px !important;
    padding: 7px 10px !important;
  }

  body:has(.dashboard-mobile-home) .app-header__logo {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
  }

  body:has(.dashboard-mobile-home) .app-header__title {
    grid-template-columns: 38px minmax(0, 1fr) !important;
    column-gap: 7px !important;
  }

  body:has(.dashboard-mobile-home) .app-header__title > b {
    font-size: 14px !important;
  }

  body:has(.dashboard-mobile-home) .app-header__subtitle {
    font-size: 9.5px !important;
  }

  /* Dashboard action cluster must remain visible: Home + notifications + logout. */
  body:has(.dashboard-mobile-home) .app-header__tools .btn--home,
  body:has(.dashboard-mobile-home) .app-header__tools .btn--danger,
  body:has(.dashboard-mobile-home) .app-header__tools .sn-notify {
    display: inline-flex !important;
  }

  body:has(.dashboard-mobile-home) .app-header__tools > .btn:not(.btn--home):not(.btn--danger),
  body:has(.dashboard-mobile-home) .app-header__tools .autosave-status {
    display: none !important;
  }

  /* Workspace becomes one compact context strip. */
  body:has(.dashboard-mobile-home) .mobile-workspace-bar {
    margin: 7px 9px 0 !important;
    padding: 7px 8px !important;
    border-radius: 14px !important;
  }

  body:has(.dashboard-mobile-home) .mobile-workspace-bar__head {
    grid-template-columns: 30px minmax(0, 1fr) 30px !important;
    gap: 7px !important;
  }

  body:has(.dashboard-mobile-home) .mobile-workspace-bar__icon,
  body:has(.dashboard-mobile-home) .mobile-workspace-bar__manage {
    width: 30px !important;
    height: 30px !important;
    border-radius: 9px !important;
  }

  body:has(.dashboard-mobile-home) .mobile-workspace-bar__head small,
  body:has(.dashboard-mobile-home) .mobile-owner-row,
  body:has(.dashboard-mobile-home) .mobile-workspace-bar__select {
    display: none !important;
  }

  body:has(.dashboard-mobile-home) .mobile-workspace-bar__head b,
  body:has(.dashboard-mobile-home) .mobile-workspace-bar__head span:not(.mobile-workspace-bar__icon) {
    display: inline !important;
    font-size: 10.5px !important;
    line-height: 1.4 !important;
  }

  body:has(.dashboard-mobile-home) .mobile-workspace-bar__head b:after {
    content: " · ";
    color: #a69daf;
  }

  body:has(.dashboard-mobile-home) .content {
    padding: 8px 8px calc(68px + env(safe-area-inset-bottom, 0px) + 14px) !important;
  }

  body:has(.dashboard-mobile-home) .dashboard-footer,
  body:has(.dashboard-mobile-home) .footer,
  body:has(.dashboard-mobile-home) .back-to-top {
    display: none !important;
  }

  .dashboard-mobile-home {
    display: grid;
    gap: 8px;
    width: 100%;
    padding-bottom: 4px;
  }

  .mobile-home-hero,
  .mobile-home-card {
    border: 1px solid #e7e0ef;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(31, 23, 56, 0.035);
  }

  .mobile-home-hero {
    padding: 12px;
    background: linear-gradient(145deg, #fff, #f8f4ff);
    border-color: #ded2f7;
  }

  .mobile-home-hero__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 9px;
  }

  .mobile-home-hero__top > div > span {
    display: block;
    color: var(--brand-3);
    font-size: 10px;
    font-weight: 900;
  }

  .mobile-home-hero h1 {
    margin: 3px 0 0;
    color: #211a30;
    font-size: 19px;
    line-height: 1.35;
    font-weight: 950;
  }

  .mobile-home-hero__top strong {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 8px;
    border: 1px solid #c6efdc;
    border-radius: 999px;
    color: #08734c;
    background: #f0fdf4;
    font-size: 9.5px;
    font-weight: 900;
    white-space: nowrap;
  }

  .mobile-home-hero__top strong.is-pending {
    color: var(--brand-3);
    border-color: #ddd0fa;
    background: #f7f2ff;
  }

  .mobile-home-hero__copy {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.75;
    font-weight: 700;
  }

  .mobile-home-hero__actions {
    display: grid;
    grid-template-columns: 1.12fr .88fr;
    gap: 7px;
    margin-top: 10px;
  }

  .mobile-home-hero__actions .btn,
  .mobile-home-main-action {
    min-height: 42px;
    border-radius: 12px;
    padding: 8px 9px;
    font-size: 10.5px;
    box-shadow: none;
  }

  .mobile-home-main-action {
    width: 100%;
    margin-top: 10px;
  }

  .mobile-home-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .mobile-home-kpi {
    min-width: 0;
    min-height: 66px;
    padding: 9px 10px;
    border: 1px solid #ebe5f2;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(31, 23, 56, 0.025);
  }

  .mobile-home-kpi > span {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    color: #7b7287;
    font-size: 9.5px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-home-kpi > span i {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--brand-3);
    background: #f4efff;
    font-size: 10px;
  }

  .mobile-home-kpi b {
    display: block;
    margin-top: 5px;
    overflow: hidden;
    color: #211a30;
    font-size: 17px;
    line-height: 1.2;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-home-kpi--success { border-top: 2px solid #34d399; }
  .mobile-home-kpi--warning { border-top: 2px solid #f59e0b; }
  .mobile-home-kpi--danger { border-top: 2px solid #f87171; }
  .mobile-home-kpi--info { border-top: 2px solid #60a5fa; }
  .mobile-home-kpi--brand { border-top: 2px solid var(--brand); }

  .mobile-home-alert {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid #f5d9ab;
    border-radius: 14px;
    color: #8a5704;
    background: #fffaf0;
  }

  .mobile-home-alert > i {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #fff0d5;
  }

  .mobile-home-alert b,
  .mobile-home-alert span {
    display: block;
  }

  .mobile-home-alert b { font-size: 10.5px; }
  .mobile-home-alert span { margin-top: 2px; font-size: 9.5px; font-weight: 750; }
  .mobile-home-alert button {
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid #f1cc8e;
    border-radius: 9px;
    color: inherit;
    background: #fff;
    font: inherit;
    font-size: 9.5px;
    font-weight: 900;
  }

  .mobile-home-card {
    padding: 11px;
  }

  .mobile-home-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 7px;
  }

  .mobile-home-card__head span {
    display: block;
    color: var(--brand-3);
    font-size: 9px;
    font-weight: 900;
  }

  .mobile-home-card__head h2 {
    margin: 2px 0 0;
    color: #272031;
    font-size: 13px;
    font-weight: 950;
  }

  .mobile-home-card__head > button {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid #e3daf0;
    border-radius: 9px;
    color: var(--brand-3);
    background: #faf7ff;
    font: inherit;
    font-size: 9px;
    font-weight: 900;
  }

  .mobile-workload-row {
    padding: 8px 1px;
    border-bottom: 1px solid #f0ecf4;
  }

  .mobile-workload-row:last-child { border-bottom: 0; }

  .mobile-workload-row__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .mobile-workload-row__head b,
  .mobile-workload-row__head small {
    display: block;
  }

  .mobile-workload-row__head b { font-size: 10.5px; }
  .mobile-workload-row__head small { margin-top: 2px; color: #8b8395; font-size: 8.5px; font-weight: 750; }
  .mobile-workload-row__head > span { color: #463d52; font-size: 10px; font-weight: 900; white-space: nowrap; }

  .mobile-workload-row__track {
    height: 7px;
    margin-top: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #ece8f1;
  }

  .mobile-workload-row__track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #9f7aea, #6d28d9);
  }

  .mobile-workload-row__status {
    display: block;
    margin-top: 3px;
    color: #9b5b14;
    font-size: 8.5px;
    font-weight: 850;
  }

  .mobile-home-insights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .mobile-home-insight {
    display: grid;
    grid-template-columns: 25px minmax(0, 1fr);
    grid-template-areas: "icon label" "icon value";
    align-items: center;
    column-gap: 7px;
    padding: 8px;
    border: 1px solid #eee9f3;
    border-radius: 12px;
    background: #fcfbfd;
  }

  .mobile-home-insight > i {
    grid-area: icon;
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--brand-3);
    background: #f2ecff;
    font-size: 9px;
  }

  .mobile-home-insight span {
    grid-area: label;
    overflow: hidden;
    color: #847b8f;
    font-size: 8.5px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-home-insight b {
    grid-area: value;
    overflow: hidden;
    margin-top: 1px;
    color: #2c2435;
    font-size: 10.5px;
    font-weight: 950;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-home-insight--success > i { color: #08734c; background: #e9f9f1; }
  .mobile-home-insight--warning > i { color: #a45d09; background: #fff4df; }
  .mobile-home-insight--danger > i { color: #b91c1c; background: #fef2f2; }
  .mobile-home-insight--neutral > i { color: #6b7280; background: #f3f4f6; }

  .mobile-home-empty {
    padding: 14px 6px;
    color: #8a8294;
    text-align: center;
    font-size: 9.5px;
    font-weight: 750;
  }

  .mobile-setup-list {
    display: grid;
  }

  .mobile-setup-list button {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 8px;
    min-height: 50px;
    padding: 6px 2px;
    border: 0;
    border-bottom: 1px solid #f0ecf4;
    color: #31293b;
    background: transparent;
    text-align: right;
    font: inherit;
  }

  .mobile-setup-list button:last-child { border-bottom: 0; }
  .mobile-setup-list button > i { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--brand-3); background: #f3edff; }
  .mobile-setup-list b, .mobile-setup-list small { display: block; }
  .mobile-setup-list b { font-size: 10.5px; }
  .mobile-setup-list small { margin-top: 2px; color: #8a8293; font-size: 8.5px; font-weight: 750; }
  .mobile-setup-list em { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 999px; color: #6d28d9; background: #f2ecff; font-size: 9px; font-style: normal; font-weight: 950; }

  /* Fixed five-item app navigation. */
  html body .app .sidebar .sidebar__nav {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-columns: initial !important;
    gap: 3px !important;
    height: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    min-height: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    padding: 3px 5px calc(3px + env(safe-area-inset-bottom, 0px)) !important;
    overflow: hidden !important;
  }

  html body .app .sidebar .sidebar__group--primary {
    display: contents !important;
  }

  html body .app .sidebar .sidebar__group--primary > .sidebar__btn,
  html body .app .sidebar .sidebar__nav > .sidebar__group:not(.sidebar__group--primary) {
    display: none !important;
  }

  html body .app .sidebar .sidebar__group--primary > .sidebar__btn[onclick*="setPage('dashboard')"],
  html body .app .sidebar .sidebar__group--primary > .sidebar__btn[onclick*="setPage('staff')"],
  html body .app .sidebar .sidebar__group--primary > .sidebar__btn[onclick*="setPage('calendarNeeds')"],
  html body .app .sidebar .sidebar__group--primary > .sidebar__btn[onclick*="setPage('builder')"],
  html body .app .sidebar .sidebar__group--primary > .mobile-bottom-more {
    display: flex !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 56px !important;
    max-height: 56px !important;
    padding: 5px 2px !important;
  }

  html body .app .sidebar .sidebar__group--primary > .sidebar__btn b {
    font-size: 9.5px !important;
  }

  .mobile-nav-more-sheet {
    position: fixed;
    inset: 0;
    z-index: 4000;
    visibility: hidden;
    pointer-events: none;
  }

  .mobile-nav-more-sheet.is-open {
    visibility: visible;
    pointer-events: auto;
  }

  .mobile-nav-more-sheet__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(28, 20, 40, .28);
    opacity: 0;
    transition: opacity .18s ease;
  }

  .mobile-nav-more-sheet.is-open .mobile-nav-more-sheet__backdrop { opacity: 1; }

  .mobile-nav-more-sheet > section {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    padding: 11px;
    border: 1px solid #e5dcef;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 -12px 40px rgba(31, 23, 56, .15);
    transform: translateY(14px);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease;
  }

  .mobile-nav-more-sheet.is-open > section { transform: translateY(0); opacity: 1; }

  .mobile-nav-more-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 9px;
  }

  .mobile-nav-more-sheet__head b { font-size: 13px; }
  .mobile-nav-more-sheet__head button { width: 30px; height: 30px; border: 0; border-radius: 9px; color: #6e657a; background: #f5f1f8; }

  .mobile-nav-more-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .mobile-nav-more-grid button {
    min-height: 62px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 3px;
    border: 1px solid #ebe4f2;
    border-radius: 13px;
    color: #554b62;
    background: #fbfaff;
    font: inherit;
    font-size: 9.5px;
    font-weight: 900;
  }

  .mobile-nav-more-grid button i { color: var(--brand-3); font-size: 14px; }
}
