/* RWA — Tahap 1: fondasi UI panel Petugas (HP + desktop).
   Styles intentionally scoped to .rwa-petugas; existing admin, login, auth,
   meter entry, database functions, and historic mobile layout are preserved. */

/* Existing home hero and quick actions are mobile-only in the source ZIP.
   Enable a responsive desktop composition without duplicating components. */
.layout.rwa-petugas {
  --rwa-blue: #2681ff;
  --rwa-mint: #08cda7;
  --rwa-orange: #f5a220;
  --rwa-purple: #9160fb;
  min-height: 100vh;
}
.rwa-petugas .rwa-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 83px;
  min-height: 38px;
  padding: 7px 11px;
  border: 1px solid #d3e2eb;
  border-radius: 12px;
  background: #eef5fa;
  color: #1b506a;
  font: 750 12px inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}
.rwa-petugas .rwa-theme-toggle > span:first-child { font-size: 17px; line-height: 1; }
.rwa-petugas .rwa-theme-toggle:focus-visible,
.rwa-petugas .rwa-desktop-meter-fab:focus-visible,
.rwa-petugas .staff-home-menu-item:focus-visible {
  outline: 3px solid #59cce7;
  outline-offset: 3px;
}
.rwa-petugas .rwa-desktop-meter-fab { display: none; }

@media (min-width: 701px) {
  .rwa-petugas .staff-mobile-home .staff-home-intro {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr);
    gap: 17px;
    margin-bottom: 29px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 230px;
    padding: 28px 30px;
    border-radius: 22px;
    background: linear-gradient(122deg, #116abf, #0b9bac 68%, #02a68f);
    color: white;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero::after {
    position: absolute;
    content: '';
    z-index: -1;
    width: 230px;
    height: 230px;
    top: -90px;
    right: -75px;
    border: 28px solid rgba(255,255,255,.07);
    border-radius: 50%;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: #d5f9ff;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero h2 {
    margin: 17px 0 8px;
    color: #fff;
    font: 800 clamp(24px, 2.3vw, 34px)/1.2 Manrope, sans-serif;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero p { margin: 0; color: #e0f8ff; font-size: 12px; line-height: 1.65; }
  .rwa-petugas .staff-mobile-home .staff-home-hero-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
  .rwa-petugas .staff-mobile-home .staff-home-hero-meta span {
    padding: 7px 10px;
    border: 1px solid #ffffff38;
    border-radius: 999px;
    background: #ffffff20;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts {
    padding: 22px;
    border: 1px solid #dce8f3;
    border-radius: 22px;
    background: #fff;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 20px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading h3 { margin: 0; font-size: 16px; }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading > span { font-size: 11px; color: #71869b; }
  .rwa-petugas .staff-mobile-home .staff-home-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 15px 7px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    border: none;
    background: none;
    color: #38586a;
    font: 700 11px/1.25 inherit;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border: 1px solid #dce9fa;
    border-radius: 17px;
    background: #ecf5ff;
    color: #2588d1;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-item:nth-child(3n + 2) .staff-home-menu-icon { background: #e2fbf2; color: #009d7b; }
  .rwa-petugas .staff-mobile-home .staff-home-menu-item:nth-child(3n) .staff-home-menu-icon { background: #eee9ff; color: #7550c9; }
  .rwa-petugas .staff-mobile-home .staff-home-menu-primary .staff-home-menu-icon {
    background: linear-gradient(135deg, #01bda6, #168aff);
    border-color: transparent;
    color: white;
  }
  .rwa-petugas .rwa-desktop-meter-fab {
    position: fixed;
    z-index: 600;
    right: 28px;
    bottom: 27px;
    display: inline-flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    padding: 13px 19px;
    border: 1px solid #ffffff3a;
    border-radius: 18px;
    background: linear-gradient(120deg, #0dbd99, #147de9);
    box-shadow: 0 12px 30px #0376bf50;
    color: #fff;
    font: 800 13px Manrope, sans-serif;
    cursor: pointer;
  }
  .rwa-petugas .rwa-desktop-meter-fab:hover { filter: brightness(1.1); }
}
@media (min-width: 701px) and (max-width: 1100px) {
  .rwa-petugas .staff-mobile-home .staff-home-intro { grid-template-columns: minmax(0, 1fr); }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts { padding: 19px 23px; }
  .rwa-petugas .staff-mobile-home .staff-home-menu-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .rwa-petugas .rwa-theme-toggle { min-width: 41px; width: 41px; min-height: 41px; padding: 0; }
  .rwa-petugas .rwa-theme-label { display: none; }
  .rwa-petugas .top-right { gap: 9px; }
  .rwa-petugas .top-right > span:not(.status-dot) { display: none; }
}

/* Dark palette is applied only to authenticated Petugas. Light mode inherits
   the previously approved presentation and the desktop additions above. */
.layout.rwa-petugas[data-rwa-theme="dark"] {
  --rwa-page: #081426;
  --rwa-panel: #111f36;
  --rwa-panel-2: #14253d;
  --rwa-line: #273b59;
  --rwa-text: #ebf3ff;
  --rwa-muted: #9cb0cd;
  background: var(--rwa-page);
  color: var(--rwa-text);
}
.rwa-petugas[data-rwa-theme="dark"] .sidebar {
  background: linear-gradient(180deg, #11223b, #0a182d 95%);
  border-right: 1px solid #294066;
  color: #c7d6ed;
}
.rwa-petugas[data-rwa-theme="dark"] .sidebar .brand,
.rwa-petugas[data-rwa-theme="dark"] .sidebar .sidebar-bottom { border-color: #2b3b55; }
.rwa-petugas[data-rwa-theme="dark"] .sidebar .nav-item { color: #c0d2e9; }
.rwa-petugas[data-rwa-theme="dark"] .sidebar .nav-item:hover { background: #203958; }
.rwa-petugas[data-rwa-theme="dark"] .sidebar .nav-item.active {
  background: linear-gradient(100deg, #164b91, #173d67);
  color: #fff;
  box-shadow: inset 3px 0 #3699ff;
}
.rwa-petugas[data-rwa-theme="dark"] .main { background: var(--rwa-page); color: var(--rwa-text); }
.rwa-petugas[data-rwa-theme="dark"] .topbar {
  background: #101d32 !important;
  border-bottom: 1px solid #293955;
  color: var(--rwa-text);
  box-shadow: 0 4px 18px #040b1b40;
}
.rwa-petugas[data-rwa-theme="dark"] .topbar h2,
.rwa-petugas[data-rwa-theme="dark"] .topbar .eyebrow { color: var(--rwa-text); }
.rwa-petugas[data-rwa-theme="dark"] .topbar .eyebrow { color: #8ca8d2; }
.rwa-petugas[data-rwa-theme="dark"] .top-right { color: #abc1dd; }
.rwa-petugas[data-rwa-theme="dark"] .rwa-theme-toggle,
.rwa-petugas[data-rwa-theme="dark"] .mobile-logout {
  border: 1px solid #31496b;
  background: #1d304c;
  color: #e2f1ff;
}
.rwa-petugas[data-rwa-theme="dark"] .content { background: transparent; }
.rwa-petugas[data-rwa-theme="dark"] .page-heading h1,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-section-title,
.rwa-petugas[data-rwa-theme="dark"] h2,
.rwa-petugas[data-rwa-theme="dark"] .panel-head h3,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-progress-heading h3 {
  color: var(--rwa-text);
}
.rwa-petugas[data-rwa-theme="dark"] .page-heading p,
.rwa-petugas[data-rwa-theme="dark"] .panel-head p,
.rwa-petugas[data-rwa-theme="dark"] .stat-hint,
.rwa-petugas[data-rwa-theme="dark"] .chart-unit { color: var(--rwa-muted); }
.rwa-petugas[data-rwa-theme="dark"] .panel,
.rwa-petugas[data-rwa-theme="dark"] .form-panel,
.rwa-petugas[data-rwa-theme="dark"] .analytics-panel,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-tab-panel,
.rwa-petugas[data-rwa-theme="dark"] .account-stat-card,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-progress-panel,
.rwa-petugas[data-rwa-theme="dark"] .modal,
.rwa-petugas[data-rwa-theme="dark"] .dialog {
  border: 1px solid var(--rwa-line);
  background: var(--rwa-panel);
  color: var(--rwa-text);
  box-shadow: 0 10px 24px #030b1960;
}
.rwa-petugas[data-rwa-theme="dark"] .panel-head,
.rwa-petugas[data-rwa-theme="dark"] .form-actions { border-color: var(--rwa-line); }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-period-toolbar,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-tabs,
.rwa-petugas[data-rwa-theme="dark"] .account-tabs,
.rwa-petugas[data-rwa-theme="dark"] .review-summary {
  background: #14263f;
  border-color: var(--rwa-line);
  color: #ccdaf0;
  box-shadow: none;
}
.rwa-petugas[data-rwa-theme="dark"] .dashboard-tab,
.rwa-petugas[data-rwa-theme="dark"] .account-tab { color: #afc2da; }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-tab.active,
.rwa-petugas[data-rwa-theme="dark"] .account-tab.active { background: #25436b; color: #fff; }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-period-controls label,
.rwa-petugas[data-rwa-theme="dark"] .form-grid label { color: #b3c6e0; }
.rwa-petugas[data-rwa-theme="dark"] select,
.rwa-petugas[data-rwa-theme="dark"] input,
.rwa-petugas[data-rwa-theme="dark"] textarea,
.rwa-petugas[data-rwa-theme="dark"] .search-box {
  background: #0d1b30;
  border-color: #38506e;
  color: #f0f5ff;
}
.rwa-petugas[data-rwa-theme="dark"] input::placeholder,
.rwa-petugas[data-rwa-theme="dark"] textarea::placeholder { color: #91a8c5; }
.rwa-petugas[data-rwa-theme="dark"] select option { background: #15273e; color: #f5f8ff; }
.rwa-petugas[data-rwa-theme="dark"] .btn.secondary,
.rwa-petugas[data-rwa-theme="dark"] .icon-btn {
  background: #213959;
  border: 1px solid #375679;
  color: #e1efff;
}
.rwa-petugas[data-rwa-theme="dark"] .btn.secondary:hover { background: #2b4c72; }
.rwa-petugas[data-rwa-theme="dark"] .inline-link,
.rwa-petugas[data-rwa-theme="dark"] .text-btn { color: #65cfff; }
.rwa-petugas[data-rwa-theme="dark"] .empty,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-no-data-note,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-empty-value,
.rwa-petugas[data-rwa-theme="dark"] .bar-column em { color: #a3b7d2; }
.rwa-petugas[data-rwa-theme="dark"] table { color: #e3edfc; }
.rwa-petugas[data-rwa-theme="dark"] th { background: #192c48; color: #bfcee5; border-color: #334965; }
.rwa-petugas[data-rwa-theme="dark"] td { color: #d7e7fa; border-color: #2a405c; }
.rwa-petugas[data-rwa-theme="dark"] .cell-sub { color: #96aac6; }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-progress-track,
.rwa-petugas[data-rwa-theme="dark"] .bar-track { background: #273c5d; }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-progress-track span { background: linear-gradient(90deg, #05d4ae, #298fff); }
.rwa-petugas[data-rwa-theme="dark"] .bar-track > span { background: linear-gradient(180deg, #39a5ff, #08cda7); }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-bar-column > b,
.rwa-petugas[data-rwa-theme="dark"] .bar-column small { color: #c1d3e8; }

/* Status cards: actual Supabase counts are untouched, only the surfaces change. */
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-card {
  border: 1px solid #ffffff22;
  border-radius: 19px;
  background: linear-gradient(145deg, #267bf4, #1455d5);
  box-shadow: 0 9px 19px #06132966;
  color: #fff;
}
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-card:nth-child(3n + 2) { background: linear-gradient(135deg, #0abb97, #038c79); }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-card:nth-child(3n) { background: linear-gradient(135deg, #9751f5, #692bd3); }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stat-section + .dashboard-stat-section .stat-card:nth-child(3n + 1) { background: linear-gradient(135deg, #ffac26, #df7205); }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stat-section + .dashboard-stat-section .stat-card:nth-child(3n + 2) { background: linear-gradient(135deg, #0bbf94, #008b73); }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stat-section + .dashboard-stat-section .stat-card:nth-child(3n) { background: linear-gradient(135deg, #9b58ef, #6232c7); }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-label,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-value,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-hint,
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-open-hint { color: #fff; }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-label { opacity: .88; }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-hint { opacity: .79; }
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-icon {
  background: #ffffff29;
  color: #fff;
}
.rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-card:hover { filter: brightness(1.09); }

/* Desktop and mobile start pages preserve existing shortcuts and permissions. */
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-hero {
  background: linear-gradient(125deg, #1756ad, #0d79a6 60%, #049784);
}
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-shortcuts {
  background: #12243b;
  border-color: var(--rwa-line);
  box-shadow: 0 10px 25px #06112660;
}
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-shortcuts-heading h3 { color: #f1f5ff; }
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-shortcuts-heading > span { color: #a6bbd9; }
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-menu-item { color: #d4e5ff; }
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-menu-icon,
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-menu-item:nth-child(3n + 2) .staff-home-menu-icon,
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-menu-item:nth-child(3n) .staff-home-menu-icon {
  background: #1c3657;
  border: 1px solid #324e70;
  color: #a7d5ff;
}
.rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .staff-home-menu-primary .staff-home-menu-icon {
  background: linear-gradient(130deg, #08c9a1, #0b7ff0) !important;
  color: #fff !important;
  border-color: #378dc0;
}
@media (max-width: 700px) {
  .layout.rwa-petugas[data-rwa-theme="dark"] { background: #081426 !important; }
  .rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .content { background: #081426 !important; }
  .rwa-petugas[data-rwa-theme="dark"] .sidebar.mobile-drawer { background: #0e2038; }
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-nav {
    background: #102039;
    border-color: #2b4262;
    box-shadow: 0 -9px 32px #01081788;
  }
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-item { color: #9eb5d2; }
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-item.active,
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-item:nth-child(2).active,
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-item:nth-child(3).active,
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-item:nth-child(4).active {
    background: #1c3d66;
    color: #7dbbff;
  }
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-item:hover { background: #1a3454; }
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-nav .mobile-bottom-fab,
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-nav .mobile-bottom-fab.active { background: transparent; }
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-fab-circle {
    background: linear-gradient(145deg, #0acfa4, #167eff);
    border-color: #102039;
    color: white;
  }
  .rwa-petugas[data-rwa-theme="dark"] .mobile-bottom-nav .mobile-bottom-fab-label { color: #a5e5ff; }
  .rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-card,
  .rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .dashboard-stats-grid .stat-card:nth-child(2n) {
    border: 1px solid #ffffff29;
    background: linear-gradient(145deg, #267bf4, #1455d5);
  }
  .rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-card:nth-child(3n + 2),
  .rwa-petugas[data-rwa-theme="dark"] .staff-mobile-home .dashboard-stats-grid .stat-card:nth-child(3n + 2) { background: linear-gradient(135deg, #0abb97, #038c79); }
  .rwa-petugas[data-rwa-theme="dark"] .dashboard-stats-grid .stat-card:nth-child(3n) { background: linear-gradient(135deg, #9751f5, #692bd3); }
  .rwa-petugas[data-rwa-theme="dark"] .dashboard-stat-section + .dashboard-stat-section .stat-card:nth-child(3n + 1) { background: linear-gradient(135deg, #ffac26, #df7205); }
  .rwa-petugas[data-rwa-theme="dark"] .form-panel .form-actions { background: #13243d; }
}
@media (prefers-reduced-motion: reduce) {
  .rwa-petugas .rwa-theme-toggle,
  .rwa-petugas .rwa-desktop-meter-fab { transition: none; }
}

/* RWA — Tahap 2: compact Petugas mobile home and adaptive bottom navigation.
   Presentation-only overrides. Scoped to the authenticated Petugas shell and
   its home route; no data, route, permission, or business logic is changed. */
@media (max-width: 700px) {
  .rwa-petugas .staff-mobile-home .content {
    padding: 13px 12px 18px;
  }

  .rwa-petugas .staff-mobile-home .staff-home-intro {
    margin-bottom: 13px;
  }

  /* Shorter welcome banner: preserve the approved gradient and all live text. */
  .rwa-petugas .staff-mobile-home .staff-home-hero {
    padding: 16px 15px 14px;
    border-radius: 20px;
    box-shadow: 0 10px 22px rgba(5, 116, 167, .16);
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero-tag {
    font-size: 8px;
    letter-spacing: .9px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero h2 {
    margin: 9px 0 5px;
    font-size: clamp(19px, 5.6vw, 24px);
    letter-spacing: -.55px;
    line-height: 1.2;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero p {
    max-width: 330px;
    font-size: 10.5px;
    line-height: 1.48;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero-meta {
    gap: 6px;
    margin-top: 11px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero-meta span {
    padding: 6px 8px;
    font-size: 9px;
    line-height: 1.25;
  }

  /* Six existing quick actions remain a compact 3 x 2 grid. */
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts {
    margin-top: 10px;
    padding: 13px 11px 10px;
    border-radius: 18px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading {
    gap: 7px;
    margin: 0 2px 9px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading h3 {
    font-size: 14px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading > span {
    font-size: 9px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 5px;
    row-gap: 8px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-item {
    min-height: 76px;
    gap: 5px;
    padding: 2px 0;
    font-size: 9.5px;
    line-height: 1.2;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    box-shadow: 0 3px 8px rgba(17, 91, 140, .07);
  }

  /* Bring the first dashboard section closer to the quick actions. */
  .rwa-petugas .staff-mobile-home .page-heading {
    margin-top: 12px;
    margin-bottom: 10px;
    gap: 8px;
  }
  .rwa-petugas .staff-mobile-home .page-heading h1 {
    font-size: 19px;
    letter-spacing: -.55px;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section {
    margin-bottom: 15px;
  }
  .rwa-petugas .staff-mobile-home .dashboard-section-title {
    margin: 0 0 8px;
    font-size: 13px;
  }

  /* P4: each statistics group becomes a swipeable horizontal strip.
     Each card remains a real existing link, retaining its route and data. */
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid {
    display: flex !important;
    flex-wrap: nowrap;
    grid-template-columns: none !important;
    align-items: stretch;
    gap: 9px;
    width: 100%;
    margin: 0;
    padding: 2px 1px 9px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 1px;
    scrollbar-width: thin;
    scrollbar-color: #9db2c9 transparent;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid > .stat-card {
    flex: 0 0 clamp(180px, 52vw, 218px);
    width: auto;
    min-width: 0;
    min-height: 154px;
    padding: 12px 11px 11px;
    scroll-snap-align: start;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid .stat-icon {
    width: 35px;
    height: 35px;
    border-radius: 11px;
    margin-bottom: 8px;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid .stat-label {
    font-size: 10px;
    line-height: 1.3;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid .stat-value {
    margin: 5px 0 3px;
    font-size: clamp(21px, 5.8vw, 25px);
    line-height: 1.12;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid .stat-hint {
    margin: 1px 0 7px;
    font-size: 9px;
    line-height: 1.35;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid .stat-open-hint {
    font-size: 9px;
    line-height: 1.3;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid::-webkit-scrollbar {
    height: 4px;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid::-webkit-scrollbar-track {
    background: transparent;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #9db2c9;
  }

  /* P5: adaptive bottom navigation. Keep the same links and FAB positions. */
  .rwa-petugas .mobile-bottom-nav {
    height: calc(66px + env(safe-area-inset-bottom, 0px));
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom, 0px));
    gap: 0;
    border-radius: 20px 20px 0 0;
  }
  .rwa-petugas .mobile-bottom-item {
    min-height: 46px;
    padding: 4px 1px;
    gap: 3px;
    border-radius: 12px;
    font-size: 9px;
    letter-spacing: -.1px;
  }
  .rwa-petugas .mobile-bottom-item > svg,
  .rwa-petugas .mobile-bottom-more-icon {
    width: 19px;
    height: 19px;
  }
  .rwa-petugas .mobile-bottom-nav .mobile-bottom-fab {
    top: -9px;
    min-height: 62px;
    padding: 0;
    gap: 2px;
  }
  .rwa-petugas .mobile-bottom-fab-circle {
    width: min(50px, 100%);
    height: 50px;
    min-height: 50px;
    border-width: 3px;
  }
  .rwa-petugas .mobile-bottom-fab-plus {
    font-size: 28px;
  }
  .rwa-petugas .mobile-bottom-nav .mobile-bottom-fab-label {
    font-size: 8.5px;
    line-height: 1.12;
  }
  .layout.rwa-petugas.has-meter-shortcut {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Very narrow phones: protect labels and tap targets without hiding menu items. */
@media (max-width: 359px) {
  .rwa-petugas .staff-mobile-home .content {
    padding: 11px 9px 16px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero {
    padding: 14px 13px 12px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero h2 {
    font-size: 19px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts {
    padding: 12px 9px 9px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-grid {
    column-gap: 3px;
    row-gap: 7px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-item {
    min-height: 72px;
    font-size: 9px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-icon {
    width: 43px;
    height: 43px;
    border-radius: 13px;
  }
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid > .stat-card {
    flex-basis: 180px;
  }
  .rwa-petugas .mobile-bottom-nav {
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding: 3px 3px calc(3px + env(safe-area-inset-bottom, 0px));
  }
  .rwa-petugas .mobile-bottom-item {
    min-height: 43px;
    padding: 3px 0;
    gap: 2px;
    font-size: 8px;
    letter-spacing: -.2px;
  }
  .rwa-petugas .mobile-bottom-item > svg,
  .rwa-petugas .mobile-bottom-more-icon {
    width: 17px;
    height: 17px;
  }
  .rwa-petugas .mobile-bottom-nav .mobile-bottom-fab {
    top: -7px;
    min-height: 56px;
  }
  .rwa-petugas .mobile-bottom-fab-circle {
    width: min(44px, 100%);
    height: 44px;
    min-height: 44px;
  }
  .rwa-petugas .mobile-bottom-fab-plus { font-size: 25px; }
  .rwa-petugas .mobile-bottom-nav .mobile-bottom-fab-label { font-size: 7.5px; }
  .layout.rwa-petugas.has-meter-shortcut {
    padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Wider phones can use slightly roomier controls while retaining the same layout. */
@media (min-width: 431px) and (max-width: 700px) {
  .rwa-petugas .mobile-bottom-nav {
    height: calc(68px + env(safe-area-inset-bottom, 0px));
    padding-top: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .rwa-petugas .mobile-bottom-item {
    font-size: 9.5px;
  }
  .rwa-petugas .mobile-bottom-nav .mobile-bottom-fab {
    top: -10px;
    min-height: 65px;
  }
  .rwa-petugas .mobile-bottom-fab-circle {
    width: min(52px, 100%);
    height: 52px;
    min-height: 52px;
  }
  .layout.rwa-petugas.has-meter-shortcut {
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Short landscape viewports: reduce navigation height and reserve only the
   space needed by the raised Catat Meter action. */
@media (max-width: 700px) and (orientation: landscape) and (max-height: 480px) {
  .rwa-petugas .staff-mobile-home .content {
    padding-top: 10px;
    padding-bottom: 14px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-intro {
    margin-bottom: 10px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero {
    padding: 12px 14px 10px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero h2 {
    margin: 6px 0 3px;
    font-size: 19px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-hero-meta {
    margin-top: 8px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts {
    margin-top: 8px;
    padding: 9px 9px 7px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading {
    margin-bottom: 5px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-grid {
    row-gap: 4px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-item {
    min-height: 62px;
    gap: 3px;
    font-size: 8.5px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
  .rwa-petugas .mobile-bottom-nav {
    height: calc(54px + env(safe-area-inset-bottom, 0px));
    padding: 2px 5px calc(2px + env(safe-area-inset-bottom, 0px));
  }
  .rwa-petugas .mobile-bottom-item {
    min-height: 40px;
    gap: 2px;
    font-size: 8px;
  }
  .rwa-petugas .mobile-bottom-item > svg,
  .rwa-petugas .mobile-bottom-more-icon {
    width: 17px;
    height: 17px;
  }
  .rwa-petugas .mobile-bottom-nav .mobile-bottom-fab {
    top: -6px;
    min-height: 49px;
  }
  .rwa-petugas .mobile-bottom-fab-circle {
    width: min(40px, 100%);
    height: 40px;
    min-height: 40px;
  }
  .rwa-petugas .mobile-bottom-fab-plus { font-size: 23px; }
  .rwa-petugas .mobile-bottom-nav .mobile-bottom-fab-label { font-size: 7.5px; }
  .layout.rwa-petugas.has-meter-shortcut {
    padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rwa-petugas .staff-mobile-home .dashboard-stat-section .dashboard-stats-grid {
    scroll-behavior: auto;
    scroll-snap-type: none;
  }
}

/* Landscape phones have enough width for a two-column intro, keeping both the
   welcome message and all six quick actions clear of the short bottom bar. */
@media (min-width: 560px) and (max-width: 700px) and (orientation: landscape) and (max-height: 480px) {
  .rwa-petugas .staff-mobile-home .staff-home-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts {
    margin-top: 0;
    padding: 9px 8px 7px;
  }
}

@media (min-width: 560px) and (max-width: 700px) and (orientation: landscape) and (max-height: 480px) {
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts {
    padding: 8px 8px 6px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading {
    margin-bottom: 4px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading h3 {
    font-size: 13px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-shortcuts-heading > span {
    font-size: 8px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-item {
    min-height: 54px;
    font-size: 8px;
  }
  .rwa-petugas .staff-mobile-home .staff-home-menu-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }
  .rwa-petugas .staff-mobile-home .page-heading {
    margin-top: 8px;
    margin-bottom: 7px;
  }
  .rwa-petugas .staff-mobile-home .dashboard-period-toolbar {
    padding: 8px 10px;
    margin-bottom: 9px;
  }
}

/* RWA — Tahap 3: Petugas uses the existing header drawer instead of a fixed
   bottom navigation. Keep this presentation-only and scoped to Petugas.
   Catat Meter remains available from the permission-aware Home shortcut and
   the existing Pemeriksaan page button; no floating shortcut is shown. */
.rwa-petugas .rwa-desktop-meter-fab {
  display: none !important;
}

@media (max-width: 700px) {
  /* Replace the bottom bar with the existing accessible header menu button. */
  .rwa-petugas .mobile-bottom-nav {
    display: none !important;
  }
  .layout.rwa-petugas,
  .layout.rwa-petugas.has-meter-shortcut {
    padding-bottom: 0 !important;
  }
  .rwa-petugas .mobile-menu-btn {
    display: inline-flex !important;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid #dce8eb;
    border-radius: 12px;
    background: #f3f8f9;
    color: #173e50;
    font-size: 23px;
    line-height: 1;
    padding: 0;
    box-shadow: 0 2px 7px rgba(16, 47, 70, .06);
    -webkit-tap-highlight-color: transparent;
  }
  .rwa-petugas .mobile-menu-btn:focus-visible {
    outline: 3px solid #0d948877;
    outline-offset: 2px;
  }
  .rwa-petugas[data-rwa-theme="dark"] .mobile-menu-btn {
    border-color: #324b6a;
    background: #142b47;
    color: #dceaff;
    box-shadow: 0 2px 8px #020b18aa;
  }
  .rwa-petugas[data-rwa-theme="light"] .mobile-menu-btn {
    border-color: #dce8eb;
    background: #f3f8f9;
    color: #173e50;
  }

  /* Restore the existing Catat Meter action on Pemeriksaan only when the
     shell confirms inspection_submit permission via has-meter-shortcut. */
  .layout.rwa-petugas.has-meter-shortcut .catat-meter-legacy-toggle {
    display: inline-flex !important;
  }
  .layout.rwa-petugas.has-meter-shortcut .form-panel .form-actions {
    bottom: env(safe-area-inset-bottom, 0px) !important;
  }
}

