/* mobile.css: phone layout fixes (also used inside the WPM_KRIVA Android app).
   Only CSS; loaded after style.css. Nothing here applies above 860px wide. */

@media (max-width: 860px) {
  /* --- top: brand row + one-line scrolling menu instead of the tall wrapped menu --- */
  .layout { position: relative; }
  .sidebar { position: static; height: auto; min-height: 0; overflow: visible; }
  .sidebar .brand { min-height: 56px; padding: .55rem 1rem; padding-right: 165px; font-size: .98rem; white-space: nowrap; overflow: hidden; border-bottom: 0; }
  .sidebar .brand .logo { width: 32px; height: 32px; font-size: 1.05rem; border-radius: 9px; }
  .sidebar .brand .logo.logo-white { width: auto; }
  .sidebar .brand .logo.logo-white img { height: 22px; max-width: 90px; }
  .sidebar nav {
    flex: none; display: flex; flex-wrap: nowrap; gap: .4rem; overflow-x: auto; overflow-y: hidden;
    padding: .1rem .75rem .65rem; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent);
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a {
    flex: 0 0 auto; white-space: nowrap; margin: 0; padding: .42rem .8rem; gap: .4rem; font-size: .85rem;
    border-radius: 999px; background: rgba(255,255,255,.08);
  }
  .sidebar nav a i { font-size: .95rem; }
  .sidebar nav a .badge { margin-left: .2rem !important; }
  /* the open page is always the first chip, so it is visible without scrolling */
  .sidebar nav a.active { background: #25d366; color: #fff; box-shadow: none; }

  /* white top bar (credits + account menu) moves up into the brand row: saves 60px */
  .topbar { position: absolute; top: 0; right: 0; height: 56px; background: transparent; border-bottom: 0; z-index: 1030; padding-left: 0 !important; padding-right: .5rem !important; }
  .topbar .user-btn { padding: .2rem .35rem; }
  .topbar .user-btn:hover, .topbar .user-btn[aria-expanded=true] { background: rgba(255,255,255,.12); border-color: transparent; }
  .topbar .user-btn .bi-chevron-down { color: #fff !important; }
  .topbar .avatar { background: #25d366; width: 32px; height: 32px; }
  .topbar .credit-top { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); padding: .2rem .6rem; font-size: .8rem; }
  .topbar .btn-warning { padding: .15rem .45rem; }
  .topbar .dropdown-menu { margin-top: .25rem !important; }

  /* --- login / sign-up: the green art part is short so the form is on the first screen --- */
  .login-wrap { min-height: 0; }
  .login-art { flex: none; padding: 1.1rem 1.25rem; }
  .login-art h1 { font-size: 1.35rem; margin: .5rem 0 .1rem; }
  .login-art .lead { font-size: .95rem; margin-bottom: 0; }
  .login-art ul { display: none; }
  .login-art .logo-lg { width: 44px; height: 44px; font-size: 1.4rem; border-radius: 12px; }
  .login-art .logo-lg.logo-white { width: auto; padding: 6px 10px; }
  .login-art .logo-lg.logo-white img { height: 32px; }
  .login-form { padding: 1.25rem 1.25rem 2rem; align-items: flex-start; }
}

@media (max-width: 576px) {
  main#page { padding: .85rem .75rem 2rem !important; }
  .page-head { margin-bottom: .9rem; gap: .5rem; }
  .page-head h3, .page-head h4 { font-size: 1.25rem; }
  .page-head .btn { padding: .35rem .7rem; font-size: .88rem; }
  .card-body { padding: .9rem; }

  /* KPI tiles: small icon in the corner, the label gets the full width */
  .kpi .card-body { position: relative; padding: .75rem .8rem; gap: 0 !important; }
  .kpi .kpi-icon { position: absolute; top: .6rem; right: .6rem; width: 28px; height: 28px; font-size: .9rem; border-radius: 8px; }
  .kpi .card-body > div:last-child { min-width: 0; }
  .kpi .card-body > div:last-child > .small:first-child { padding-right: 30px; line-height: 1.25; }
  .kpi-n { font-size: 1.25rem; }

  /* tables: one line per cell, scroll sideways; a shadow shows there is more to the right */
  .table-responsive {
    background:
      linear-gradient(to right, #fff 30%, rgba(255,255,255,0)) left center / 40px 100% no-repeat local,
      linear-gradient(to left, #fff 30%, rgba(255,255,255,0)) right center / 40px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(0,0,0,.16), transparent) left center / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.16), transparent) right center / 12px 100% no-repeat scroll;
  }
  .table-responsive > .table { font-size: .86rem; }
  .table-responsive > .table th { white-space: nowrap; }
  .table-responsive > .table td:first-child { min-width: 150px; }
  .table thead th { font-size: .7rem; }

  /* label / value tables (API & tokens, FTP details ...): label above the value */
  .table tr:has(> th:first-child + td:last-child) > th,
  .table tr:has(> th:first-child + td:last-child) > td { display: block; width: auto !important; border: 0; padding: .2rem 0; }
  .table tr:has(> th:first-child + td:last-child) > th { padding-top: .6rem; font-size: .8rem; color: var(--muted); }
  .table tr:has(> th:first-child + td:last-child) { display: block; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }

  /* dialogs use the whole width; long codes and tokens wrap */
  .modal-dialog { margin: .4rem; }
  .modal-body { padding: .9rem; }
  .modal-footer { padding: .5rem .75rem; }
  .pair-code .code-big { font-size: 1.6rem; letter-spacing: .14em; padding: .5rem .75rem; }
  .qr-box { min-height: 240px; }
  .qr-box img { width: 240px; height: 240px; }
  .link-tabs .nav-link { padding: .5rem .4rem; font-size: .9rem; }

  /* forms: 16px text so phones do not zoom in on focus; bigger tap targets */
  .form-control, .form-select, .input-group .form-control { font-size: 16px; }
  .form-control-sm, .form-select-sm { font-size: 15px; }
  .act .btn { width: 36px; height: 34px; }
  .dropdown-item { padding: .6rem .75rem; }
  .chip { padding: .35rem .75rem; }

  .send-tabs { gap: .25rem; }
  .send-tabs .nav-link { white-space: nowrap; padding: .4rem .75rem; }
  .preview { max-width: 100%; }
  pre.code { font-size: .72rem; }
  .toast-container { left: 0; right: 0; padding: .5rem !important; }
  .toast-container .toast { width: 100%; }
}
