/* =========================================================
   App-style mobile experience
   Mirrors the fh260 mobile app (dark navy chrome, bottom
   tab bar, card-based Home dashboard) on phone-sized
   screens only. Desktop/laptop layout (above 768px) is
   left completely untouched.
========================================================= */

.app-tab-bar,
.app-topbar,
.app-profile-menu,
.app-home-mobile {
  display: none;
}

@media screen and (max-width: 768px) {
  /* ---------------------------------------------------
     Hide the old desktop-style chrome on phones: the
     hamburger, its slide-out menu, the old profile
     dropdown, and the footer are all replaced by the
     app-style top bar / bottom tab bar below.
  --------------------------------------------------- */
  .top-nav,
  #nav-menu,
  .hamburger,
  footer,
  header:not(.app-topbar) {
    display: none !important;
  }

  /* ---------- App-style top bar ---------- */
  .app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: #0a0f2c;
    padding: 0 12px;
    z-index: 1006;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  }

  .app-topbar-side {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 44px;
  }

  .app-topbar-title {
    color: #ffffff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.3px;
  }

  .app-back-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 20px;
    padding: 6px;
    cursor: pointer;
  }

  .app-avatar {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    border: 2px solid #007aff;
    background-color: #0b3f73;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
  }

  .app-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .app-bell-btn {
    position: relative;
    background-color: #ffffff;
    border: none;
    color: #0b3f73;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
  }

  .app-bell-btn.has-actions {
    animation: appBellShake 2.5s ease-in-out infinite;
  }

  .app-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: #e53935;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
  }

  @keyframes appBellShake {
    0%, 82%, 100% { transform: rotate(0deg); }
    84% { transform: rotate(14deg); }
    86% { transform: rotate(-14deg); }
    88% { transform: rotate(10deg); }
    90% { transform: rotate(-10deg); }
    92% { transform: rotate(0deg); }
  }

  /* ---------- Profile dropdown menu ---------- */
  .app-profile-menu {
    position: fixed;
    top: 60px;
    right: 12px;
    background-color: #c0c0c0;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
    z-index: 1007;
    overflow: hidden;
    min-width: 190px;
  }

  .app-profile-menu.open {
    display: block;
  }

  .app-profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .app-profile-menu-item:last-child {
    border-bottom: none;
  }

  .app-profile-menu-item.danger {
    color: #dc3545;
  }

  .app-profile-menu-item i {
    width: 18px;
    text-align: center;
  }

  /* Reserve space for the fixed top bar and bottom tab bar */
  body.has-app-topbar {
    padding-top: 56px;
  }

  body.has-app-tab-bar {
    padding-bottom: 64px;
  }

  /* ---------- App-style bottom tab bar ---------- */
  .app-tab-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1005;
    background-color: #0a0f2c;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .app-tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 0 6px;
    color: #8e8e93;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
  }

  .app-tab-item i {
    font-size: 18px;
  }

  .app-tab-item.active {
    color: #007aff;
  }

  /* =====================================================
     HOME SCREEN (app-accurate dashboard)
  ===================================================== */

  .app-home-mobile {
    display: block;
    background-color: #f2f2f2;
    padding: 14px 14px 8px;
  }

  body.app-dark-mode .app-home-mobile {
    background-color: #0a0f2c;
  }

  .app-home-greeting {
    font-size: 19px;
    font-weight: 700;
    color: #222;
    margin: 4px 0 14px;
  }

  body.app-dark-mode .app-home-greeting {
    color: #ffffff;
  }

  /* Required action card */
  .app-required-card {
    background-color: #8b0000;
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 18px;
    color: #ffffff;
  }

  .app-required-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }

  .app-required-card-header h3 {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
  }

  .app-required-eye {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 15px;
    cursor: pointer;
  }

  .app-required-empty {
    text-align: center;
    padding: 18px 8px;
  }

  .app-required-empty p:first-child {
    font-weight: 700;
    margin: 0 0 4px;
  }

  .app-required-empty p {
    font-size: 12.5px;
    color: #f2d9d9;
    margin: 0;
  }

  .app-required-item {
    background-color: #6e0000;
    border-radius: 10px;
    padding: 12px;
  }

  .app-required-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
  }

  .app-required-type-badge {
    background-color: #ffd700;
    color: #6e0000;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
  }

  .app-required-id {
    color: #ddd;
    font-size: 11px;
  }

  .app-required-status {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    color: #1a1a1a;
  }

  .app-required-row {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    color: #f0e6e6;
    margin-bottom: 3px;
  }

  .app-required-row span:last-child {
    color: #ffffff;
    font-weight: 600;
  }

  .app-required-amount {
    color: #90ee90 !important;
  }

  .app-required-desc {
    font-size: 12px;
    color: #f2d9d9;
    margin: 6px 0 10px;
  }

  .app-required-buttons {
    display: flex;
    gap: 8px;
  }

  .app-approve-btn,
  .app-reject-btn {
    flex: 1;
    border: none;
    padding: 9px 0;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }

  .app-approve-btn {
    background-color: #28a745;
  }

  .app-reject-btn {
    background-color: #dc3545;
  }

  .app-approve-btn:disabled,
  .app-reject-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }

  .app-required-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 10px;
  }

  .app-required-pagination button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    border-radius: 14px;
    cursor: pointer;
  }

  .app-required-pagination span {
    color: #f0e6e6;
    font-size: 12px;
  }

  /* Quick actions */
  .app-quick-actions {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
  }

  .app-quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: #333;
  }

  body.app-dark-mode .app-quick-action {
    color: #ddd;
  }

  .app-quick-action-circle {
    width: 54px;
    height: 54px;
    border-radius: 27px;
    background-color: #0a0f2c;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
  }

  .app-quick-action span {
    font-size: 11px;
    font-weight: 600;
  }

  /* Accounts scroller */
  .app-accounts-scroller {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 4px 6px;
    margin-bottom: 20px;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 4px;
  }

  .app-accounts-scroller::-webkit-scrollbar {
    display: none;
  }

  .app-account-card {
    flex: 0 0 auto;
    width: 200px;
    background-color: #2a2d2e;
    border-radius: 14px;
    padding: 16px;
    color: #ffffff;
    scroll-snap-align: start;
  }

  .app-account-card h4 {
    font-size: 12.5px;
    font-weight: 600;
    color: #bbbbbb;
    margin: 0 0 10px;
  }

  .app-account-card .app-account-value {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
  }

  .app-account-card.expenditure .app-account-value { color: #087fe5; }
  .app-account-card.receipts .app-account-value { color: #2fa84f; }
  .app-account-card.balance .app-account-value { color: #d9364f; }

  /* Demo / promo carousel */
  .app-demo-carousel-wrap {
    overflow: hidden;
    border-radius: 14px;
  }

  .app-demo-carousel {
    display: flex;
    gap: 12px;
    transition: transform 0.5s ease;
  }

  .app-demo-slide {
    flex: 0 0 100%;
    min-height: 150px;
    background: linear-gradient(135deg, #0b3f73, #0b73ff);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff;
    text-align: center;
    padding: 20px;
  }

  .app-demo-slide i {
    font-size: 30px;
  }

  .app-demo-slide h4 {
    margin: 0;
    font-size: 15px;
  }

  .app-demo-slide p {
    margin: 0;
    font-size: 12px;
    color: #e6f0ff;
  }

  .app-demo-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
  }

  .app-demo-dots span {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background-color: #ccc;
  }

  .app-demo-dots span.active {
    background-color: #007aff;
    width: 16px;
  }

  /* Hide the desktop hero/summary/forex sections on phones;
     the app-style dashboard above replaces them. */
  main > .hero,
  main > .main-content {
    display: none !important;
  }
}
