/* ══════════════════════════════════════════════════════════
       DESIGN SYSTEM & THEME VARIABLES (Sakura/htbloom — light/day default)
       ══════════════════════════════════════════════════════════ */
    :root {
      --bg: #FFFFFF;
      --bg-secondary: #F8F7F5;
      --surface: #F8F7F5;
      --surface-hover: #EDECE8;
      --border: #EDECE8;
      --border-light: #E5E4DC;
      --text-primary: #1A1A1A;
      --text-secondary: #88887E;
      --text-muted: #C2C1BC;

      /* HT Bloom accent palette — theme-independent (same day/night, D-05) */
      /* --accent-primary IS the Sakura "--primary" token; --accent-teal IS the Sakura "--accent" token — never swapped by theme */
      --accent-primary: #FF3060;   /* Bloom pink — primary/CTA */
      --accent-teal: #00C4B4;      /* Bloom teal — secondary actions */
      --accent-green: #22C55E;     /* Success */
      --accent-red: #FF4040;       /* Alert / Danger */
      --accent-blue: #3B82F6;      /* Navigation / Info */
      --cta-text: #FFFFFF;

      --route-color: var(--accent-primary);
      --dest-color: var(--accent-teal);
      --pill-bg: rgba(0,196,180,0.07);
      --pill-border: rgba(0,196,180,0.25);
      --accent-bg: rgba(0,196,180,0.08);
      --accent-border: rgba(0,196,180,0.25);

      --shadow: rgba(0, 0, 0, 0.08);
      --glow: rgba(255, 48, 96, 0.15);
      --map-bg: #F2F1EB;

      --header-height: 52px;
      --tabbar-height: 68px;

      transition: background 0.3s ease;
    }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
      -webkit-tap-highlight-color: transparent;
      user-select: none;
    }

    html, body {
      height: 100%;
      width: 100%;
      overflow: hidden;
      background: var(--bg);
      color: var(--text-primary);
      transition: background 0.3s ease;
      font-family: 'Onest', sans-serif;
      overscroll-behavior: contain;
    }

    /* Scroll helpers */
    .scroll-y {
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }

    /* Screen manager */
    .screen {
      position: absolute;
      top: var(--header-height);
      bottom: var(--tabbar-height);
      left: 0;
      right: 0;
      display: none;
      flex-direction: column;
      background: var(--bg);
      animation: fadeIn 0.2s ease-in-out;
    }
    .screen.active {
      display: flex;
    }

    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }

    /* ══════════════════════════════════════════════════════════
       HEADER BAR
       ══════════════════════════════════════════════════════════ */
    header.app-header {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: var(--header-height);
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      z-index: 1000;
    }
    .header-left {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .logo-icon {
      width: 26px;
      height: 26px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .logo-text {
      font-weight: 800;
      font-size: 20px;
      letter-spacing: -1px;
      color: var(--text-primary);
    }
    .logo-text span {
      color: var(--accent-primary);
      font-weight: 600;
      letter-spacing: -0.5px;
    }
    .header-right {
      display: flex;
      align-items: center;
      gap: 12px;
    }
    .online-pill {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      font-weight: 600;
      color: var(--accent-teal);
      background: rgba(0,196,180,.07);
      border: 1px solid rgba(0,196,180,.25);
      padding: 5px 12px;
      border-radius: 20px;
    }
    .online-pill-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--accent-teal);
      animation: dot-blink 2s infinite;
    }
    .connection-status {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 12px;
      font-weight: 600;
      background: var(--surface);
      border: 1px solid var(--border);
      padding: 4px 10px;
      border-radius: 20px;
    }
    .status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: var(--accent-red);
      transition: background 0.3s;
    }
    .status-dot.online {
      background: var(--accent-green);
      box-shadow: 0 0 8px var(--accent-green);
      animation: pulse 2s infinite;
    }

    @keyframes pulse {
      0% { opacity: 1; }
      50% { opacity: 0.4; }
      100% { opacity: 1; }
    }

    @keyframes dot-blink {
      0% { opacity: 1; }
      50% { opacity: .3; }
      100% { opacity: 1; }
    }

    .battery-status {
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      gap: 4px;
    }

    /* ══════════════════════════════════════════════════════════
       BOTTOM TAB BAR
       ══════════════════════════════════════════════════════════ */
    nav.tab-bar {
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
      height: var(--tabbar-height);
      background: var(--surface);
      border-top: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-around;
      padding-bottom: env(safe-area-inset-bottom);
      z-index: 1000;
    }
    .tab-btn {
      flex: 1;
      height: 100%;
      background: none;
      border: none;
      color: var(--text-muted);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      cursor: pointer;
      font-family: 'Onest', sans-serif;
      transition: all 0.2s;
    }
    .tab-btn.active {
      color: var(--accent-primary);
    }
    .tab-icon {
      width: 22px;
      height: 22px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .tab-icon svg { width: 22px; height: 22px; }
    .tab-label {
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    /* ══════════════════════════════════════════════════════════
       SCREEN 1: LOGIN
       ══════════════════════════════════════════════════════════ */
    #screen-login {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 2000;
      background: var(--bg);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }
    #screen-login.active {
      display: flex;
    }
    #screen-otp, #screen-register, #screen-link-telegram {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 2000;
      background: var(--bg);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }
    #screen-otp.active, #screen-register.active, #screen-link-telegram.active {
      display: flex;
    }
    .otp-inputs-wrapper {
      display: flex;
      gap: 8px;
      justify-content: space-between;
      margin-top: 10px;
    }
    .otp-digit-input {
      width: 48px;
      height: 56px;
      text-align: center;
      font-size: 24px;
      font-weight: bold;
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 12px;
      color: var(--text-primary);
      outline: none;
      transition: border-color 0.2s;
    }
    .otp-digit-input:focus {
      border-color: var(--accent-primary);
    }
    .login-container {
      width: 100%;
      max-width: 360px;
      display: flex;
      flex-direction: column;
      gap: 20px;
    }
    .login-header-section {
      text-align: center;
      margin-bottom: 10px;
    }
    .login-logo {
      width: 64px;
      height: 64px;
      background: var(--surface);
      border: 1.5px solid var(--border);
      border-radius: 16px;
      margin: 0 auto 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 32px;
      box-shadow: none;
    }
    .login-header-section h1 {
      font-size: 24px;
      font-weight: 800;
      letter-spacing: -0.03em;
      margin-bottom: 6px;
    }
    .login-header-section p {
      font-size: 14px;
      color: var(--text-secondary);
    }
    
    .input-field {
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .input-field label {
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-muted);
    }
    .phone-input-wrapper {
      position: relative;
    }
    .phone-input-wrapper input {
      width: 100%;
      height: 52px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      color: var(--text-primary);
      font-size: 16px;
      font-weight: 600;
      padding: 0 16px;
      outline: none;
      transition: all 0.2s;
    }
    .phone-input-wrapper input:focus {
      border-color: var(--accent-teal);
      box-shadow: 0 0 0 3px rgba(0, 196, 180, 0.15);
    }
    
    /* Fix Chrome autofill styling in dark mode */
    .phone-input-wrapper input:-webkit-autofill,
    .phone-input-wrapper input:-webkit-autofill:hover,
    .phone-input-wrapper input:-webkit-autofill:focus,
    .phone-input-wrapper input:-webkit-autofill:active {
      -webkit-text-fill-color: var(--text-primary) !important;
      -webkit-box-shadow: 0 0 0px 1000px var(--surface) inset !important;
      transition: background-color 5000s ease-in-out 0s;
    }
    
    .pin-display-wrapper {
      display: flex;
      justify-content: center;
      gap: 16px;
      margin: 12px 0;
    }
    .pin-dot {
      width: 16px;
      height: 16px;
      border-radius: 50%;
      border: 2px solid var(--border);
      background: transparent;
      transition: all 0.15s ease-out;
    }
    .pin-dot.filled {
      background: var(--accent-primary);
      border-color: var(--accent-primary);
      box-shadow: 0 0 8px var(--accent-primary);
      transform: scale(1.1);
    }
    
    .atm-keyboard {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
      margin-top: 10px;
    }
    .key-btn {
      height: 54px;
      border-radius: 12px;
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text-primary);
      font-size: 20px;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.1s;
    }
    .key-btn:active {
      background: var(--surface-hover);
      transform: scale(0.95);
    }
    .key-btn.special-btn {
      background: var(--bg-secondary);
      font-size: 16px;
      font-weight: 500;
      color: var(--text-secondary);
    }
    
    .btn-login {
      height: 52px;
      background: var(--accent-primary);
      border: none;
      border-radius: 16px;
      color: #FFFFFF;
      font-weight: 800;
      font-size: 15px;
      cursor: pointer;
      transition: all 0.2s;
      margin-top: 12px;
      box-shadow: 0 4px 16px rgba(255, 48, 96, 0.25);
    }
    .btn-login:disabled {
      background: var(--border);
      color: var(--text-muted);
      box-shadow: none;
      cursor: not-allowed;
    }
    .btn-login:not(:disabled):active {
      transform: translateY(1px);
    }
    
    .login-error {
      min-height: 20px;
      color: var(--accent-red);
      font-size: 13px;
      text-align: center;
      font-weight: 600;
    }

    /* ══════════════════════════════════════════════════════════
       SCREEN 2: WAITING FOR ORDERS
       ══════════════════════════════════════════════════════════ */
    #screen-waiting {
      position: absolute;
      width: 100%;
      height: 100%;
    }
    .map-container {
      flex: 1;
      position: relative;
      background: var(--map-bg);
    }
    .map-instance {
      width: 100%;
      height: 100%;
      transform: translateZ(0);
    }
    
    .bottom-sheet {
      background: var(--surface);
      border-top: 1px solid var(--border);
      padding: 16px 20px;
      box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.13);
      display: flex;
      flex-direction: column;
      gap: 16px;
      z-index: 999;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .waiting-status-panel {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--surface);
      border: 1px solid var(--border);
    }
    .waiting-text {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .waiting-title {
      font-size: 20px;
      font-weight: 800;
      letter-spacing: -0.01em;
      color: var(--text-primary);
    }
    .waiting-subtitle {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-secondary);
      display: flex;
      align-items: center;
      gap: 6px;
    }
    
    /* Toggle switch */
    .switch-btn {
      min-width: 120px;
      height: 48px;
      border-radius: 24px;
      border: none;
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text-secondary);
      font-weight: 700;
      font-size: 13px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      transition: all 0.25s;
    }
    .switch-btn.active {
      background: var(--accent-primary);
      color: var(--cta-text);
      box-shadow: none;
      border-color: transparent;
    }
    
    /* 📍 Custom marker styles */
    .pulse-marker-icon {
      background: none;
      border: none;
    }
    .pulse-marker {
      width: 18px;
      height: 18px;
      background: var(--route-color);
      border: 3px solid #fff;
      border-radius: 50%;
      box-shadow: 0 0 12px rgba(255, 48, 96, 0.8);
      position: relative;
    }
    .pulse-marker::after {
      content: '';
      width: 38px;
      height: 38px;
      background: var(--glow);
      border-radius: 50%;
      position: absolute;
      top: -13px;
      left: -13px;
      animation: pulse-ring 1.8s infinite ease-out;
    }
    @keyframes pulse-ring {
      0% { transform: scale(0.4); opacity: 1; }
      100% { transform: scale(1.6); opacity: 0; }
    }

    .shop-marker-icon {
      background: none;
      border: none;
    }
    .shop-marker {
      width: 26px;
      height: 26px;
      background: var(--route-color);
      border: 2px solid var(--bg);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      box-shadow: 0 0 12px rgba(255, 48, 96, 0.6);
      color: #fff;
    }

    .client-marker-icon {
      background: none;
      border: none;
    }
    .client-marker {
      width: 26px;
      height: 26px;
      background: var(--dest-color);
      border: 2px solid var(--bg);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      box-shadow: 0 0 12px rgba(0, 196, 180, 0.6);
      color: #fff;
    }

    /* ══════════════════════════════════════════════════════════
       SCREEN 3: NEW ORDER POPUP (Modal)
       ══════════════════════════════════════════════════════════ */
    .modal-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(10, 13, 18, 0.85);
      backdrop-filter: blur(8px);
      z-index: 3000;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
    }
    .modal-overlay.active {
      display: flex;
    }
    .order-popup-card {
      width: 100%;
      max-width: 360px;
      background: var(--surface);
      border: 1px solid var(--accent-primary);
      border-radius: 20px;
      padding: 24px;
      box-shadow: 0 16px 48px rgba(255, 48, 96, 0.15);
      display: flex;
      flex-direction: column;
      gap: 16px;
      position: relative;
      animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    @keyframes popIn {
      from { transform: scale(0.8) translateY(20px); opacity: 0; }
      to { transform: scale(1) translateY(0); opacity: 1; }
    }
    
    .popup-badge {
      align-self: center;
      background: rgba(255, 48, 96, 0.1);
      border: 1px solid var(--accent-primary);
      color: var(--accent-primary);
      padding: 6px 16px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      animation: pulse-glow 1.5s infinite;
    }
    
    @keyframes pulse-glow {
      0% { box-shadow: 0 0 0 0 rgba(255, 48, 96, 0.4); }
      70% { box-shadow: 0 0 0 8px rgba(255, 48, 96, 0); }
      100% { box-shadow: 0 0 0 0 rgba(255, 48, 96, 0); }
    }

    .popup-header {
      text-align: center;
    }
    .popup-title {
      font-size: 22px;
      font-weight: 800;
      color: var(--text-primary);
      margin-bottom: 4px;
    }
    .popup-subtitle {
      font-family: 'JetBrains Mono', monospace;
      font-size: 14px;
      color: var(--accent-primary);
      font-weight: 600;
    }

    .incoming-overlay {
      background: rgba(0, 0, 0, 0.52);
      backdrop-filter: none;
      align-items: flex-end !important;
      padding: 0 !important;
    }
    .incoming-sheet {
      width: 100%;
      max-width: 100%;
      background: var(--surface);
      border: none;
      border-top-left-radius: 28px;
      border-top-right-radius: 28px;
      padding: 20px 20px 28px;
      box-shadow: none;
      animation: slideUp 0.25s ease-out;
    }
    @keyframes slideUp {
      from { transform: translateY(100%); }
      to { transform: translateY(0); }
    }
    .incoming-badge-wrap {
      text-align: center;
      margin-bottom: 14px;
    }
    .incoming-badge {
      display: inline-block;
      background: var(--accent-primary);
      color: var(--cta-text);
      padding: 5px 18px;
      border-radius: 20px;
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 1px;
      text-transform: uppercase;
    }
    .incoming-order-id {
      font-family: 'JetBrains Mono', monospace;
      font-size: 10px;
      color: var(--text-muted);
      text-align: center;
      margin-top: 6px;
    }

    .incoming-meta-row {
      display: flex;
      gap: 16px;
      padding-top: 10px;
      margin-top: 2px;
      border-top: 1px solid var(--border);
    }
    .incoming-meta-row span:first-child {
      font-size: 13px;
      font-weight: 700;
      color: var(--text-primary);
    }
    .incoming-meta-row .dot-sep {
      color: var(--border);
    }
    .incoming-eta {
      font-size: 13px;
      font-weight: 600;
      color: var(--accent-teal);
    }

    .timer-container {
      width: 100%;
      height: 3px;
      background: var(--border);
      border-radius: 2px;
      overflow: hidden;
    }
    .timer-bar {
      width: 100%;
      height: 100%;
      background: var(--accent-primary);
      transition: width 1s linear;
    }

    .popup-actions {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 12px;
    }
    .incoming-actions {
      display: flex;
      gap: 10px;
      margin-top: 16px;
    }
    .popup-btn {
      height: 48px;
      border-radius: 12px;
      font-weight: 700;
      font-size: 14px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      border: none;
      font-family: 'Onest', sans-serif;
      transition: all 0.15s;
    }
    .popup-btn.decline {
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--accent-red);
    }
    .popup-btn.decline:active {
      background: var(--surface-hover);
    }
    .popup-btn.accept {
      background: linear-gradient(135deg, var(--accent-teal), #00c4a7);
      color: #000;
      box-shadow: 0 4px 16px rgba(0, 196, 180, 0.25);
    }
    .popup-btn.accept:active {
      transform: translateY(1px);
    }
    .incoming-actions .popup-btn {
      height: 52px;
      border-radius: 16px;
    }
    .incoming-actions .popup-btn.decline {
      flex: 1;
      border: 1.5px solid var(--border);
      color: var(--text-secondary);
      font-size: 15px;
      font-weight: 600;
    }
    .incoming-actions .popup-btn.accept {
      flex: 2;
      background: var(--accent-primary);
      color: var(--cta-text);
      box-shadow: none;
      font-size: 15px;
      font-weight: 800;
    }

    /* ══════════════════════════════════════════════════════════
       SCREEN 4: ACTIVE ORDER SCREEN
       ══════════════════════════════════════════════════════════ */
    /* Defensive: guarantees this screen shows even if a future
       ID-selector rule tries to set display on #screen-active again */
    #screen-active.active {
      display: flex !important;
    }
    .active-map-area {
      flex: 1;
      width: 100%;
      position: relative;
      background: var(--map-bg);
      /* Android WebView sometimes fails to paint this pane until a touch-driven
         repaint (e.g. panning) forces it — promote to its own GPU layer upfront
         so it's composited immediately instead of only "while moving". */
      transform: translateZ(0);
      will-change: transform;
    }

    .active-bottom-sheet {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      max-height: 72vh;
      overflow-y: auto;
      background: var(--surface);
      border-top-left-radius: 24px;
      border-top-right-radius: 24px;
      padding: 8px 16px 16px;
      box-shadow: 0 -6px 32px rgba(0, 0, 0, 0.13);
      z-index: 10;
      transform: translateZ(0);
      will-change: transform;
      -webkit-backface-visibility: hidden;
    }
    .sheet-handle {
      width: 36px;
      height: 4px;
      background: var(--border);
      border-radius: 2px;
      margin: 0 auto 16px;
      flex-shrink: 0;
    }

    .route-card {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 8px 16px;
      margin-bottom: 10px;
    }
    .route-row {
      display: flex;
      align-items: flex-start;
      gap: 10px;
    }
    .route-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
      margin-top: 3px;
      box-sizing: border-box;
    }
    .route-dot.pickup {
      background: var(--route-color);
    }
    .route-dot.dropoff {
      border: 2px solid var(--dest-color);
      background: var(--surface);
    }
    .route-text {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .route-row-lbl {
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-muted);
    }
    .route-row-val {
      font-size: 15px;
      font-weight: 600;
      color: var(--text-primary);
    }
    .route-connector {
      margin: 6px 0 8px 4.5px;
      height: 14px;
      width: 0;
      border-left: 1.5px dashed var(--border);
    }

    .client-card {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--bg);
      padding: 8px 16px;
      border-radius: 16px;
      border: 1px solid var(--border);
      margin-bottom: 10px;
    }
    .client-details {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .client-name {
      font-size: 15px;
      font-weight: 600;
      color: var(--text-primary);
    }
    .client-phone {
      font-family: 'JetBrains Mono', monospace;
      font-size: 13px;
      font-weight: 600;
      color: var(--text-secondary);
    }
    .btn-call {
      width: 42px;
      height: 42px;
      border-radius: 50%;
      background: var(--accent-primary);
      border: none;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: var(--cta-text);
      transition: transform 0.2s;
      flex-shrink: 0;
    }
    .btn-call:active {
      transform: scale(0.9);
    }

    .photo-preview-box {
      display: none;
      align-items: center;
      gap: 10px;
      background: var(--bg);
      border: 1px dashed var(--border);
      padding: 8px;
      border-radius: 16px;
      margin-bottom: 8px;
    }
    .photo-thumbnail {
      width: 48px;
      height: 48px;
      object-fit: cover;
      border-radius: 6px;
      border: 1px solid var(--border);
    }
    .photo-meta {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .photo-meta-title {
      font-size: 12px;
      font-weight: 600;
      color: var(--accent-green);
    }
    .photo-meta-size {
      font-size: 10px;
      color: var(--text-muted);
    }

    .button-group {
      display: flex;
      gap: 8px;
    }

    .btn-action-main {
      flex: 1;
      height: 52px;
      border-radius: 16px;
      border: none;
      font-weight: 800;
      font-size: 15px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      font-family: 'Onest', sans-serif;
      transition: all 0.2s;
    }
    .btn-action-main.step1 {
      background: var(--accent-primary);
      color: var(--cta-text);
      box-shadow: 0 4px 12px var(--glow);
    }
    .btn-action-main.step2 {
      background: var(--accent-teal);
      color: var(--cta-text);
      box-shadow: 0 4px 12px rgba(0, 196, 180, 0.25);
    }
    .btn-action-main.step3 {
      background: linear-gradient(135deg, var(--accent-green), #00bd7c);
      color: var(--cta-text);
      box-shadow: 0 4px 12px rgba(0, 214, 143, 0.25);
    }
    .btn-action-main:disabled {
      background: var(--border);
      color: var(--text-muted);
      box-shadow: none;
      cursor: not-allowed;
    }

    .btn-action-secondary {
      height: 52px;
      padding: 0 14px;
      border-radius: 16px;
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--accent-teal);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      cursor: pointer;
      flex-shrink: 0;
      transition: all 0.2s;
    }
    .btn-action-secondary:active {
      background: var(--surface-hover);
    }
    .btn-action-secondary-lbl {
      font-size: 13px;
      font-weight: 600;
      color: var(--accent-teal);
      white-space: nowrap;
    }

    .order-footer-row {
      display: flex;
      align-items: center;
      gap: 8px;
      padding-top: 8px;
    }
    .order-id-mono {
      font-family: 'JetBrains Mono', monospace;
      font-size: 10px;
      font-weight: 600;
      color: var(--text-muted);
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .order-priority-badge {
      font-size: 10px;
      font-weight: 600;
      color: var(--text-secondary);
      background: var(--bg);
      padding: 3px 9px;
      border-radius: 8px;
      border: 1px solid var(--border);
      flex-shrink: 0;
    }
    .order-priority-badge.urgent {
      background: rgba(255, 64, 64, 0.12);
      color: var(--accent-red);
      border-color: rgba(255, 64, 64, 0.3);
    }
    .order-eta-txt {
      font-size: 10px;
      font-weight: 600;
      color: var(--accent-teal);
      flex-shrink: 0;
    }

    /* ══════════════════════════════════════════════════════════
       SCREEN 5: STATISTICS
       ══════════════════════════════════════════════════════════ */
    .stats-scroll {
      flex: 1;
      padding: 16px 16px 32px;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .stats-header-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 20px;
      padding: 16px 18px;
      display: flex;
      align-items: center;
      gap: 14px;
    }
    .stats-avatar {
      width: 52px;
      height: 52px;
      border-radius: 50%;
      background: var(--accent-bg);
      border: 2px solid var(--accent-border);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 20px;
      font-weight: 800;
      color: var(--accent-primary);
      flex-shrink: 0;
    }
    .stats-header-card h2 {
      font-size: 20px;
      font-weight: 800;
      color: var(--text-primary);
      margin-bottom: 2px;
    }
    .stats-header-card p {
      font-size: 13px;
      font-weight: 600;
      color: var(--accent-teal);
      margin: 0;
    }

    .stats-grid-2x2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }
    .stats-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 14px;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    .stats-card-val {
      font-family: 'JetBrains Mono', monospace;
      font-size: 20px;
      font-weight: 800;
      color: var(--accent-primary);
    }
    .stats-card-val.teal {
      color: var(--accent-teal);
    }
    .stats-card-val.warn {
      color: #FF6B6B;
    }
    .stats-card-lbl {
      font-size: 10px;
      text-transform: uppercase;
      color: var(--text-muted);
      font-weight: 600;
      letter-spacing: 0.05em;
    }

    .telemetry-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }
    .telemetry-title {
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      color: var(--text-secondary);
      letter-spacing: 0.06em;
      border-bottom: 1px solid var(--border);
      padding-bottom: 8px;
    }
    .telemetry-row {
      display: flex;
      justify-content: space-between;
      font-size: 13px;
      font-weight: 600;
    }
    .telemetry-lbl {
      color: var(--text-muted);
    }
    .telemetry-val {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 600;
      color: var(--text-primary);
    }

    .leaderboard-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 16px;
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .leaderboard-title {
      font-size: 10px;
      font-weight: 600;
      text-transform: uppercase;
      color: var(--text-secondary);
      letter-spacing: 0.06em;
      border-bottom: 1px solid var(--border);
      padding-bottom: 8px;
    }
    .leaderboard-row {
      display: flex;
      align-items: center;
      gap: 10px;
      font-size: 13px;
      padding: 4px 6px;
      border-radius: 8px;
    }
    .leaderboard-row.me {
      background: var(--accent-bg);
      border: 1px solid var(--accent-border);
    }
    .leaderboard-rank {
      width: 22px;
      text-align: center;
      font-weight: 700;
      color: var(--text-muted);
    }
    .leaderboard-name {
      flex: 1;
      color: var(--text-primary);
      font-weight: 600;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .leaderboard-pct {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 600;
      color: var(--accent-teal);
    }

    .btn-logout {
      height: 48px;
      border-radius: 12px;
      background: rgba(255, 71, 87, 0.1);
      border: 1px solid rgba(255, 71, 87, 0.25);
      color: var(--accent-red);
      font-weight: 700;
      font-size: 13px;
      cursor: pointer;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      transition: all 0.2s;
      margin-top: 10px;
    }
    .btn-logout:active {
      background: rgba(255, 71, 87, 0.18);
    }

    /* ══════════════════════════════════════════════════════════
       GLOBAL UTILITIES (OFFLINE BANNER & TOASTS)
       ══════════════════════════════════════════════════════════ */
    #offline-banner {
      position: fixed;
      top: var(--header-height);
      left: 0;
      width: 100%;
      background: var(--accent-red);
      color: #fff;
      font-size: 13px;
      font-weight: 800;
      text-align: center;
      padding: 6px 12px;
      z-index: 1001;
      display: none;
      box-shadow: 0 4px 12px rgba(255, 71, 87, 0.25);
      animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
      from { transform: translateY(-100%); }
      to { transform: translateY(0); }
    }

    .toast-container {
      position: fixed;
      bottom: calc(var(--tabbar-height) + 12px);
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      flex-direction: column;
      gap: 8px;
      z-index: 4000;
      width: calc(100% - 32px);
      max-width: 320px;
      pointer-events: none;
    }
    .toast {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 12px 16px;
      color: var(--text-primary);
      font-size: 13px;
      font-weight: 600;
      box-shadow: 0 8px 24px var(--shadow);
      display: flex;
      align-items: center;
      gap: 10px;
      animation: slideUpToast 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    .toast.success { border-color: var(--accent-green); }
    .toast.error { border-color: var(--accent-red); }
    
    @keyframes slideUpToast {
      from { transform: translateY(20px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }

    /* Screen Instructions / Warning Overlay */
    .gps-warning-overlay {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: var(--bg);
      z-index: 5000;
      display: none;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 30px;
      text-align: center;
    }
    .gps-warning-overlay.active {
      display: flex;
    }
    .warning-icon {
      font-size: 48px;
      color: var(--accent-red);
      margin-bottom: 16px;
    }
    .gps-warning-overlay h2 {
      font-size: 20px;
      font-weight: 800;
      margin-bottom: 8px;
    }
    .gps-warning-overlay p {
      font-size: 14px;
      color: var(--text-secondary);
      line-height: 1.5;
    }
    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }

    /* Mobile Archive Card (for courier history) */
    .mobile-archive-card {
      background: var(--bg-secondary);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px;
      box-shadow: 0 2px 6px var(--shadow);
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 12px;
      text-align: left;
    }
    .mobile-archive-card.cancelled {
      border-left: 3px solid var(--accent-red);
    }
    .mobile-archive-card.delivered {
      border-left: 3px solid var(--accent-green);
    }
    .mobile-archive-card-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .mobile-archive-id {
      font-family: 'JetBrains Mono', monospace;
      font-weight: 700;
      font-size: 13px;
      color: var(--text-primary);
    }
    .mobile-archive-time {
      font-size: 11px;
      color: var(--text-muted);
    }
    .mobile-archive-badge {
      font-size: 10px;
      font-weight: 800;
      padding: 2px 8px;
      border-radius: 6px;
      text-transform: uppercase;
      letter-spacing: 0.02em;
    }
    .mobile-archive-badge.delivered {
      background: rgba(34, 197, 94, 0.1);
      color: var(--accent-green);
    }
    .mobile-archive-badge.cancelled {
      background: rgba(255, 64, 64, 0.1);
      color: var(--accent-red);
    }
    .mobile-archive-badge.in_transit {
      background: rgba(59, 130, 246, 0.1);
      color: var(--accent-blue);
    }
    .mobile-archive-addresses {
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: 13px;
      color: var(--text-secondary);
    }
    .mobile-address-row {
      display: flex;
      align-items: flex-start;
      gap: 6px;
    }
    .mobile-address-dot {
      font-size: 11px;
      line-height: 1.5;
    }
    .mobile-address-text {
      flex: 1;
      word-break: break-word;
    }
    .mobile-archive-card-bottom {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-top: 1px dashed var(--border);
      padding-top: 8px;
      font-size: 12px;
      color: var(--text-secondary);
    }
    .mobile-archive-courier {
      font-weight: 600;
    }
    .mobile-archive-duration {
      font-weight: 700;
      color: var(--accent-teal);
    }
    .mobile-day-divider {
      font-size: 11px;
      font-weight: 700;
      color: var(--text-secondary);
      margin: 16px 0 8px;
      letter-spacing: 0.05em;
      text-align: left;
    }