/* Mobile dashboard refresh. Kept separate from the login styles so each
   experience can evolve without overriding the other. */
@media (max-width: 760px) {
  :root {
    --mobile-navy: #062a4a;
    --mobile-blue: #087fc5;
    --mobile-sky: #39b8e9;
    --mobile-ink: #102e4a;
    --mobile-muted: #6e8297;
    --mobile-surface: #ffffff;
    --mobile-canvas: #f3f8fb;
    --mobile-line: #dce9f1;
  }

  body:has(.app-shell) {
    background: var(--mobile-canvas);
    color: var(--mobile-ink);
  }
  html,
  body:has(.app-shell),
  body:has(.app-shell) #root,
  .app-shell,
  .main-area,
  .content {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
  }

  .app-shell {
    display: block !important;
    min-height: 100dvh;
    background:
      radial-gradient(circle at 8% 1%, rgba(77, 198, 235, .18), transparent 25rem),
      var(--mobile-canvas);
  }

  /* Compact navigation: identity and logout on the first row, main links
     scroll horizontally below it instead of occupying a tall panel. */
  .sidebar {
    position: sticky !important;
    top: 0;
    z-index: 100;
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 12px 14px 10px !important;
    border: 0 !important;
    border-radius: 0 0 20px 20px !important;
    background:
      radial-gradient(circle at 92% -60%, rgba(83, 201, 239, .5), transparent 11rem),
      linear-gradient(135deg, var(--mobile-navy), #064a7b 62%, #087fbd) !important;
    box-shadow: 0 10px 26px rgba(5, 43, 73, .22) !important;
  }

  .sidebar .brand {
    order: 1;
    flex: 1 1 170px;
    min-width: 0;
    padding: 0 !important;
    gap: 9px;
    color: #fff;
  }

  .sidebar .brand-mark {
    width: 35px !important;
    height: 35px !important;
    flex: 0 0 35px;
  }

  .sidebar .brand-copy { min-width: 0; }
  .sidebar .brand-copy b {
    display: block;
    overflow: hidden;
    color: #fff !important;
    font-size: 12px !important;
    line-height: 1.15;
    letter-spacing: -.2px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .sidebar .brand-copy small {
    color: rgba(224, 246, 255, .76) !important;
    font-size: 8px !important;
    letter-spacing: .04em;
  }

  .sidebar .workspace-label,
  .sidebar .kitchen-pill,
  .sidebar .sidebar-bottom .profile { display: none !important; }

  .sidebar .sidebar-bottom {
    order: 2;
    display: flex !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .sidebar .sidebar-bottom .logout {
    display: inline-flex !important;
    width: auto !important;
    height: 32px !important;
    margin: 0 !important;
    padding: 0 11px !important;
    border: 1px solid rgba(255, 255, 255, .32) !important;
    border-radius: 17px !important;
    background: rgba(255, 255, 255, .13) !important;
    box-shadow: none !important;
    color: #fff !important;
    font-size: 9px !important;
    font-weight: 800 !important;
  }

  .sidebar nav {
    order: 3;
    display: flex !important;
    flex: 1 0 100%;
    width: 100%;
    margin: 0 !important;
    padding: 2px 0 0 !important;
    gap: 7px !important;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }

  .nav-item,
  .sidebar-collapsed .nav-item {
    flex: 1 0 58px;
    width: auto !important;
    min-width: 58px;
    height: 57px !important;
    padding: 6px 3px !important;
    gap: 3px !important;
    border: 0 !important;
    border-radius: 13px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: rgba(228, 245, 255, .76) !important;
    font-size: 9px !important;
    font-weight: 700 !important;
    line-height: 1.05;
    white-space: nowrap;
  }

  .nav-item span,
  .sidebar-collapsed .nav-item span {
    width: 26px !important;
    height: 26px !important;
    border: 1px solid rgba(191, 230, 248, .28) !important;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, .09) !important;
    box-shadow: none !important;
    color: #dff5ff !important;
  }
  .nav-item span::before { width: 15px !important; height: 15px !important; }
  .nav-item.active,
  .sidebar-collapsed .nav-item.active {
    background: linear-gradient(145deg, #1e91cd, #51c8ed) !important;
    box-shadow: 0 8px 16px rgba(6, 34, 63, .25) !important;
    color: #fff !important;
  }
  .nav-item.active span { background: rgba(255, 255, 255, .17) !important; border-color: rgba(255, 255, 255, .55) !important; }

  .main-area { min-height: calc(100dvh - 112px); }
  .app-header { display: none !important; }
  .content {
    max-width: none !important;
    padding: 18px 16px 38px !important;
  }

  .page-title,
  .section-intro {
    margin: 0 0 15px !important;
  }
  .page-title h1,
  .section-intro h1 {
    margin: 0 !important;
    color: var(--mobile-ink) !important;
    font-size: 25px !important;
    line-height: 1.15 !important;
    letter-spacing: -.7px !important;
  }
  .section-intro { padding: 6px 2px 4px; }
  .section-intro .eyebrow,
  .page-title .eyebrow {
    color: #0875b5 !important;
    font-size: 9px !important;
    font-weight: 800;
    letter-spacing: .14em !important;
  }
  .section-intro p,
  .page-title p { margin: 7px 0 0 !important; color: var(--mobile-muted) !important; font-size: 13px !important; line-height: 1.5 !important; }
  .main-area > .content > .page-title h1,
  .main-area > .content > .page-title h2 { color: #fff !important; text-shadow: 0 2px 10px rgba(3, 43, 72, .18); }
  .main-area > .content > .page-title p { color: #e8f7fd !important; font-weight: 600 !important; }
  .main-area > .content > .page-title .eyebrow { color: #aeeeff !important; }

  .welcome-banner {
    min-height: 136px !important;
    margin: 0 0 14px !important;
    padding: 21px 20px !important;
    overflow: hidden;
    border: 0 !important;
    border-radius: 19px !important;
    background:
      radial-gradient(circle at 90% 74%, transparent 0 66px, rgba(255, 255, 255, .14) 67px 68px, transparent 69px),
      linear-gradient(112deg, #083555, #087aba 61%, #50c6e9) !important;
    box-shadow: 0 14px 24px rgba(8, 89, 139, .18) !important;
  }
  .welcome-banner h1,
  .welcome-banner h2,
  .welcome-banner b { color: #fff !important; font-size: 25px !important; line-height: 1.15 !important; }
  .welcome-banner p,
  .welcome-banner span,
  .welcome-banner small { color: rgba(235, 249, 255, .82) !important; font-size: 12px !important; }

  /* The volunteer home now acts as a launchpad. Empty statistics and the
     placeholder activity panel are replaced by controls that open real pages. */
  .mobile-actions-mode > .stats-grid,
  .mobile-actions-mode > .panel { display: none !important; }
  .quick-actions-mobile {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
  }
  .quick-actions-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin: 4px 2px 1px;
  }
  .quick-actions-heading span {
    color: #0875b5;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .14em;
  }
  .quick-actions-heading b { color: var(--mobile-ink); font-size: 15px; }
  .quick-action {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 98px;
    padding: 14px 12px;
    overflow: hidden;
    border: 1px solid var(--mobile-line);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 9px 20px rgba(20, 72, 104, .07);
    color: var(--mobile-ink);
    text-align: left;
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .quick-action:first-of-type { grid-column: 1 / -1; min-height: 84px; }
  .quick-action::after {
    position: absolute;
    right: -25px;
    bottom: -42px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(66, 191, 231, .17), transparent 70%);
    content: "";
    pointer-events: none;
  }
  .quick-action:active { transform: scale(.975); box-shadow: 0 4px 10px rgba(20, 72, 104, .09); }
  .quick-action:focus-visible { outline: 3px solid rgba(12, 147, 207, .36); outline-offset: 2px; }
  .quick-action-icon {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    margin-right: 10px;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, #e5f6fc, #c8edfb);
    color: #087ab9;
    animation: quick-icon-float 3.2s ease-in-out infinite;
  }
  .quick-action:nth-of-type(3) .quick-action-icon { animation-delay: .3s; }
  .quick-action:nth-of-type(4) .quick-action-icon { animation-delay: .6s; }
  .quick-action:nth-of-type(5) .quick-action-icon { animation-delay: .9s; }
  .quick-action-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .quick-action-copy { display: grid; gap: 3px; min-width: 0; }
  .quick-action-copy b { color: #0b2c48 !important; font-size: 13px; line-height: 1.15; }
  .quick-action-copy small { color: #526a7f !important; font-size: 9px; font-weight: 600; line-height: 1.3; }
  .quick-camera { background: linear-gradient(110deg, #fff, #f4fbfe); }
  .quick-camera .quick-action-icon { background: linear-gradient(145deg, #0878b7, #43c0e8); color: #fff; }
  .quick-action-arrow,
  .mobile-back-dashboard { display: none !important; }

  .staff-identity-mobile {
    margin: 0 0 14px;
    padding: 16px;
    border: 1px solid var(--mobile-line);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 9px 20px rgba(20, 72, 104, .07);
  }
  .staff-identity-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
  .staff-identity-head > span:last-child { display: grid; min-width: 0; }
  .staff-identity-logo {
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 15px;
    background: #eef8fc;
  }
  .staff-identity-logo img { width: 40px; height: 40px; object-fit: contain; }
  .staff-identity-head small { color: #0b7cb8; font-size: 8px; font-weight: 800; letter-spacing: .12em; }
  .staff-identity-head b { overflow: hidden; color: #102e4a; font-size: 16px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
  .staff-identity-head em { color: #5f778c; font-size: 10px; font-style: normal; font-weight: 600; }
  .staff-identity-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .staff-identity-details span { min-width: 0; padding: 10px; border-radius: 12px; background: #f2f8fb; }
  .staff-identity-details span:nth-child(3),
  .staff-identity-details span:nth-child(6) { grid-column: 1 / -1; }
  .staff-identity-details small,
  .staff-identity-details b { display: block; }
  .staff-identity-details small { margin-bottom: 3px; color: #6e8497; font-size: 7px; font-weight: 800; letter-spacing: .08em; }
  .staff-identity-details b { color: #163953; font-size: 10px; line-height: 1.35; overflow-wrap: anywhere; }
  @keyframes quick-icon-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
  }

  .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin: 0 0 14px !important;
  }
  .stat-card {
    min-height: 112px;
    padding: 14px !important;
    border: 1px solid var(--mobile-line) !important;
    border-radius: 17px !important;
    background: rgba(255, 255, 255, .94) !important;
    box-shadow: 0 8px 18px rgba(18, 67, 101, .06) !important;
  }
  .stat-card .stat-icon { width: 36px !important; height: 36px !important; margin-bottom: 11px !important; border-radius: 12px !important; }
  .stat-card b { color: var(--mobile-ink) !important; font-size: 23px !important; line-height: 1.05 !important; }
  .stat-card span,
  .stat-card small { color: var(--mobile-muted) !important; font-size: 10px !important; }

  .panel,
  .payroll-card,
  .camera-card,
  .location-card {
    margin: 0 0 14px !important;
    padding: 16px !important;
    border: 1px solid var(--mobile-line) !important;
    border-radius: 18px !important;
    background: var(--mobile-surface) !important;
    box-shadow: 0 10px 22px rgba(23, 68, 99, .06) !important;
  }
  .panel-title { margin-bottom: 13px !important; }
  .panel-title h2,
  .panel h2,
  .payroll-card h2 { color: var(--mobile-ink) !important; font-size: 17px !important; }
  .panel p,
  .payroll-card p { color: var(--mobile-muted) !important; font-size: 12px !important; line-height: 1.5; }

  .attendance-layout,
  .two-cols { display: grid !important; grid-template-columns: 1fr !important; gap: 14px !important; }
  .camera-card { padding: 12px !important; }
  .camera-frame { min-height: 280px !important; border-radius: 15px !important; }
  .camera-empty b { font-size: 42px !important; }
  .camera-empty span { font-size: 18px !important; }
  .camera-empty small { font-size: 11px !important; }
  .attendance-times { gap: 8px !important; }
  .attendance-times span { padding: 10px !important; border-radius: 12px !important; }

  .primary,
  .camera-card .primary,
  .attendance-layout .primary {
    min-height: 46px !important;
    border: 0 !important;
    border-radius: 13px !important;
    background: linear-gradient(100deg, #0871b2, #0a95d3 58%, #40bee7) !important;
    box-shadow: 0 10px 18px rgba(0, 116, 185, .22) !important;
    color: #fff !important;
    font-size: 12px !important;
    font-weight: 800 !important;
  }
  .primary:disabled { opacity: .58; box-shadow: none !important; }

  .table-wrap {
    width: calc(100% + 8px) !important;
    margin: 0 -4px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .table-wrap table { min-width: 540px; }
  .table-wrap th { color: #6e8297 !important; font-size: 9px !important; letter-spacing: .08em; }
  .table-wrap td { color: #2c4861 !important; font-size: 11px !important; }

  .payroll-card { padding: 18px !important; }
  .payroll-card .primary { width: 100% !important; }
  .empty-state { padding: 32px 18px !important; border-radius: 16px !important; }

  /* The dashboard cards are the primary mobile navigation. The old top menu
     is removed and logout becomes a single footer action on every portal. */
  .app-shell {
    display: flex !important;
    flex-direction: column !important;
  }
  .main-area {
    order: 1 !important;
    flex: 1 0 auto !important;
    min-height: auto !important;
  }
  .sidebar {
    position: static !important;
    order: 2 !important;
    z-index: auto !important;
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: 16px 14px 24px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  .sidebar .brand,
  .sidebar .workspace-label,
  .sidebar .kitchen-pill,
  .sidebar nav { display: none !important; }
  .sidebar .sidebar-bottom {
    position: static !important;
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .sidebar .sidebar-bottom .logout {
    display: inline-flex !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    padding: 7px 10px !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #557389 !important;
    font-size: 9px !important;
    font-weight: 800 !important;
  }
  .sidebar .sidebar-bottom .logout::after {
    display: none !important;
    content: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .quick-action,
  .quick-action-icon { transition: none !important; animation: none !important; }
}

@media (max-width: 380px) {
  .sidebar { padding-inline: 10px !important; }
  .sidebar .brand-copy b { font-size: 11px !important; }
  .nav-item,
  .sidebar-collapsed .nav-item { flex-basis: 54px; min-width: 54px; font-size: 8px !important; }
  .content { padding-inline: 12px !important; }
}
