/* ARATA — telefono „programėlės“ sluoksnis (administracija, treneris, tėvai)
   Įjungiamas tik ekranuose iki 900 px. Kompiuteryje niekas nesikeičia. */

.appbar, .tabbar { display: none; }

@media (max-width: 900px) {
  :root { --app-top: calc(56px + env(safe-area-inset-top, 0px)); --app-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }

  /* „clip“ (ne „hidden“): iPhone tada nepaverčia puslapio atskira slinkimo dėže,
     ir apatinė juosta lieka prilipusi prie ekrano apačios */
  html, body { overflow-x: clip; max-width: 100%; }
  @supports not (overflow-x: clip) { body { overflow-x: hidden; } }
  body { padding-top: var(--app-top) !important; padding-bottom: var(--app-bottom) !important; -webkit-tap-highlight-color: transparent; }

  /* Senas plaukiojantis meniu mygtukas — nebereikalingas */
  .mobile-menu-btn { display: none !important; }

  /* ---------- Viršutinė juosta ---------- */
  .appbar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 95;
    height: var(--app-top); padding: env(safe-area-inset-top, 0px) 12px 0 14px;
    background: rgba(255,255,255,0.92); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid rgba(13,13,13,0.08);
  }
  .appbar-logo { height: 26px; width: auto; flex-shrink: 0; display: block; }
  .appbar-title { flex: 1; min-width: 0; font-family: 'Space Grotesk', 'Inter', sans-serif; font-weight: 700; font-size: 17px; color: #0D0D0D;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .appbar-sub { display: block; font-family: 'Inter', sans-serif; font-weight: 500; font-size: 11px; color: rgba(58,56,53,0.55); letter-spacing: 0.3px; text-transform: uppercase; margin-bottom: -2px; }
  .appbar-btn { width: 40px; height: 40px; border-radius: 12px; border: none; background: transparent; color: #0D0D0D;
    display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
  .appbar-btn:active { background: rgba(13,13,13,0.06); }

  /* ---------- Apatinė juosta ---------- */
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    height: var(--app-bottom); padding: 4px 4px env(safe-area-inset-bottom, 0px);
    background: rgba(255,255,255,0.94); -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid rgba(13,13,13,0.08);
  }
  .tabbar a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    text-decoration: none; color: rgba(58,56,53,0.55); font-family: 'Inter', sans-serif; font-size: 10.5px; font-weight: 600;
    border-radius: 10px; position: relative; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a span.lbl { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
  .tabbar a.on { color: #B32025; }
  .tabbar a:active { background: rgba(13,13,13,0.05); }
  .tabbar .dot { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
    background: #B32025; color: #fff; font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

  /* Šoninis meniu — virš juostų */
  .sidebar { z-index: 120 !important; padding-top: calc(22px + env(safe-area-inset-top, 0px)) !important; padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important; height: 100% !important; width: 280px !important; left: -290px; }
  .sidebar.open { left: 0 !important; box-shadow: 0 0 40px rgba(13,13,13,0.25); }
  .sidebar-overlay.open { z-index: 110 !important; }
  .sidebar-item { padding: 11px 12px !important; font-size: 15px !important; }

  /* ---------- Turinys: niekas neišlenda už ekrano ---------- */
  main, .main, .main-col { min-width: 0 !important; max-width: 100%; }
  main { padding: 14px 14px 24px !important; }
  img, video, canvas, iframe { max-width: 100%; }

  /* Puslapio antraštė: pavadinimas jau viršutinėje juostoje */
  .page-header, .page-head, .welcome { padding-left: 0 !important; min-height: 0 !important; flex-wrap: wrap; gap: 10px; }
  .page-header > div:first-child, .page-head > div:first-child { padding-left: 0 !important; min-height: 0 !important; }
  .page-header h1, .page-head h1, .welcome h1 { font-size: 21px !important; }
  .page-header > *, .page-head > * { min-width: 0; max-width: 100%; }
  .app-dup { display: none !important; }
  .page-header .head-actions, .page-head .head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .page-header button, .page-head button, .page-head a.btn { white-space: normal; }

  /* Kortelių eilės — po dvi */
  .kpi-row, .kpi-row.six, .kpi-row.five, .stat-row, .kpis, .mini-overview-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .kpi-card, .kpi, .stat-box { padding: 12px !important; gap: 10px !important; min-width: 0; }
  .kpi-card .kpi-icon, .kpi .kpi-icon { width: 30px !important; height: 30px !important; }
  .kpi-value, .stat-box .num { font-size: 19px !important; }
  .kpi-label, .stat-box .label { font-size: 11.5px !important; }
  .card, .rs-card, .info-card { padding: 14px !important; border-radius: 14px !important; }

  /* Paieškos / filtrų eilės — laužiasi */
  .toolbar, .filters, .filter-row, .actions-row { flex-wrap: wrap !important; }
  .toolbar > *, .filters > *, .filter-row > * { flex: 1 1 140px; min-width: 0; }
  .tabs, .chips, .pill-row { overflow-x: auto; flex-wrap: nowrap !important; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }

  /* Lentelės — slenkamos į šoną savo dėžutėje */
  .app-table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .app-table-scroll > table { min-width: 560px; }

  /* Formos — patogios pirštui, iOS nedidina (16px) */
  input:not([type=checkbox]):not([type=radio]), select, textarea { font-size: 16px !important; max-width: 100%; }

  /* Iššokantys langai — per visą ekraną */
  .modal, .wizard-modal, .preview-modal { max-width: 100% !important; }
}

/* Programėlė paleista iš pradžios ekrano */
@media (display-mode: standalone) and (max-width: 900px) {
  body { overscroll-behavior-y: none; }
}
