/* ===================== Mobile app experience (≤ 900px) ===================== */
.m-only{display:none}
@media (max-width:900px){
  .m-only{display:revert}
  html{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}
  body{font-size:14.5px;background:var(--bg)!important;background-attachment:scroll!important;overscroll-behavior-y:contain}
  /* lighter: drop heavy decorative layers on phones */
  .orbits,.wm-globe,.hero-ring{display:none!important}
  .topbar,.ov,.hs,.vhead.hero .btn,.lh-feat li{backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
  .hero-globe,.lh-globe,.lh-orbit{animation:none!important}
  .kpi:hover,.pcard:hover,.lt-tpl:hover{transform:none}
  #view.enter>*{animation-duration:.22s}

  /* ---- app bar ---- */
  .topbar{position:sticky;top:0;min-height:0;padding:calc(8px + env(safe-area-inset-top,0px)) 12px 8px;gap:6px;background:var(--surface);box-shadow:0 1px 0 var(--line)}
  body{padding-top:0}
  .topbar .menu-btn,.topbar [data-act="theme"],.topbar [data-act="showKeys"],.topbar .side-tog,.topbar .today{display:none!important}
  .topbar .grow{gap:8px}
  .tb-logo{height:34px}
  .topbar .searchbtn{margin-inline-start:auto;width:40px;height:40px;padding:0;justify-content:center;border-radius:12px;font-size:17px}
  .topbar .iconbtn{width:40px;height:40px;border-radius:12px;border:0;background:var(--surface-2);font-size:17px}
  .badge{top:-3px;inset-inline-end:-3px}

  /* ---- content ---- */
  main{padding:12px 12px calc(96px + env(safe-area-inset-bottom,0px));gap:12px}
  #view{gap:12px}
  .app-foot{display:none}
  .vhead{gap:8px;align-items:center}
  .vhead h2{font-size:20px}
  .vhead>div:first-child>p{display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;font-size:12.5px}
  .vic{width:34px;height:34px;font-size:16px;border-radius:10px;margin-inline-end:8px}
  .vhead:not(.hero)>.actions{width:100%;flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;margin:0 -12px;padding:2px 12px 4px;width:calc(100% + 24px)}
  .vhead:not(.hero)>.actions::-webkit-scrollbar{display:none}
  .vhead:not(.hero)>.actions .btn{flex:none;border-radius:99px;padding:7px 14px;font-size:13px}
  .vhead:not(.hero)>.actions .btn.pri{order:-1}
  .panel{border-radius:16px}
  .panel-h{padding:12px 14px}
  .panel-b{padding:10px 14px}

  /* backup banner → slim strip */
  .offline.bkn{font-size:12.5px;padding:8px 12px!important;border-radius:12px;gap:8px!important;flex-wrap:nowrap!important}
  .offline.bkn .btn{padding:5px 10px;font-size:12px}

  /* segmented filters scroll sideways in one line */
  .seg{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;max-width:100%;border-radius:12px}
  .seg::-webkit-scrollbar{display:none}
  .seg button{flex:none;padding:7px 12px}
  .filters{gap:8px;padding:10px;border-radius:16px}
  .filters .fcount{font-size:12px}

  /* touch targets + no iOS zoom on focus */
  .btn{min-height:40px}
  .btn.sm{min-height:34px;padding:6px 12px}
  input,select,textarea,.lt-rt{font-size:16px!important}
  .fld input,.fld select{min-height:44px}

  /* KPIs: tight 2-column tiles */
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .kpi{padding:12px;border-radius:16px;gap:1px;min-height:0}
  .kpi span{font-size:12px;padding-inline-end:34px}
  .kpi b{font-size:22px}
  .kpi small{font-size:11px;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
  .kic{width:30px;height:30px;font-size:14px;border-radius:9px;top:10px;inset-inline-end:10px}

  /* dashboard hero compact */
  .vhead.hero{padding:18px 16px 16px;border-radius:20px;min-height:0}
  .vhead.hero h2{font-size:21px}
  .vhead.hero .actions{display:none}
  .hero-stats{gap:8px;margin-top:12px}
  .hs{flex:1 1 0;min-width:0;padding:8px 10px;border-radius:12px}
  .hs b{font-size:19px}.hs small{font-size:10.5px;display:block;line-height:1.35}

  /* ---- list cards (tables) ---- */
  #view .tw.cards{background:none!important;border:0!important;box-shadow:none!important;overflow:visible!important}
  #view .tw.cards table{display:block}
  #view .tw.cards thead{display:none}
  #view .tw.cards tbody tr{background:var(--surface);border:1px solid var(--line);box-shadow:var(--shadow-s)}
  #view .tw.cards tbody tr:nth-child(even) td,#view .tw.cards tbody tr:hover td{background:none!important}
  #view .tw.cards td::before{content:attr(data-label);font-weight:500}
  #view .tw.cards td:not([data-label])::before,#view .tw.cards td[data-label=""]::before{display:none}
  #view .tw.cards td:empty{display:none!important}
  #view .tw.cards tbody{display:flex;flex-direction:column;gap:10px}
  #view .tw.cards tbody tr{display:grid!important;grid-template-columns:1fr 1fr;gap:6px 12px;margin:0!important;padding:12px 14px!important;border-radius:16px!important;position:relative;cursor:pointer;-webkit-user-select:none;user-select:none;transition:transform .08s}
  #view .tw.cards tbody tr:active{transform:scale(.99)}
  #view .tw.cards td{display:flex!important;flex-direction:column;align-items:flex-start!important;justify-content:flex-start!important;text-align:start!important;gap:0!important;padding:0!important;border:0!important;min-width:0;font-size:13.5px;line-height:1.45;overflow-wrap:anywhere}
  #view .tw.cards td+td{border:0!important}
  #view .tw.cards td::before{max-width:none!important;font-size:11px!important;margin-bottom:1px;color:var(--muted)}
  #view .tw.cards td .sub{font-size:11.5px}
  #view .tw.cards td.c-title{grid-column:1/-1;flex-direction:row!important;justify-content:space-between!important;align-items:flex-start!important;font-size:15px;padding-bottom:6px!important;border-bottom:1px solid var(--line)!important;margin-bottom:2px}
  #view .tw.cards td.c-title::before{display:none}
  #view .tw.cards td.c-title .c-st{margin-inline-start:auto;flex:none}
  #view .tw.cards td.c-wide{grid-column:1/-1}
  #view .tw.cards td.c-status{display:none!important}
  #view .tw.cards td.c-x{display:none!important}
  #view .tw.cards tr.open td.c-x{display:flex!important}
  #view .tw.cards td.c-act{grid-column:1/-1;flex-direction:row!important;flex-wrap:wrap;gap:6px!important;padding-top:8px!important;border-top:1px dashed var(--line)!important;margin-top:2px}
  #view .tw.cards td.c-act::before{display:none}
  #view .tw.cards td.c-act .actions{flex-wrap:wrap;gap:6px}
  #view .tw.cards td.c-act .btn{min-height:34px}
  #view .tw.cards .c-more{grid-column:1/-1;justify-self:center;background:none;border:0;color:var(--accent);font:inherit;font-size:12.5px;font-weight:600;padding:2px 10px;cursor:pointer}
  #view .tw.cards td .days{width:100%;min-width:0;max-width:none!important}
  #view .tw.cards td[colspan]{grid-column:1/-1;align-items:center!important}
  #view .tw.cards tr.more-row{display:block!important;background:none!important;border:0!important;box-shadow:none!important;padding:4px 0!important;cursor:default}

  /* ---- bottom tab bar ---- */
  .bnav{display:grid!important;grid-template-columns:repeat(5,1fr);align-items:end;padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px));background:color-mix(in srgb,var(--surface) 96%,transparent);border-top:1px solid var(--line);box-shadow:0 -8px 24px -16px rgba(10,26,66,.35)}
  .bnav button{position:relative;height:52px;justify-content:center;gap:2px!important;font-size:10.5px!important;font-weight:600;color:var(--muted)!important;border-radius:12px}
  .bnav button span{font-size:20px!important;line-height:1!important;filter:grayscale(.6);opacity:.75;transition:transform .15s}
  .bnav button[aria-current="page"]{color:var(--accent)!important}
  .bnav button[aria-current="page"] span{filter:none;opacity:1;transform:translateY(-1px)}
  .bnav button[aria-current="page"]::after{content:"";position:absolute;top:-6px;width:22px;height:3px;border-radius:0 0 4px 4px;background:var(--grad)}
  .bnav button.fab{height:58px}
  .bnav button.fab span{width:54px;height:54px;border-radius:18px;display:grid;place-items:center;background:var(--grad)!important;color:#fff!important;font-size:26px!important;filter:none;opacity:1;margin-top:-26px;box-shadow:0 10px 22px -8px rgba(21,101,216,.75),0 0 0 4px var(--surface)}
  .bnav .bn-badge{position:absolute;top:2px;inset-inline-end:calc(50% - 22px);background:#ef4444;color:#fff;border-radius:99px;font-size:9.5px;min-width:16px;height:16px;line-height:16px;padding:0 4px;font-weight:700}
  .totop{bottom:calc(92px + env(safe-area-inset-bottom,0px))!important}
  .toast{bottom:calc(88px + env(safe-area-inset-bottom,0px))!important}

  /* side drawer no longer used on phones */
  .side{display:none}

  /* ---- bottom sheets ---- */
  .sheet-ov{position:fixed;inset:0;z-index:70;background:rgba(5,13,36,.45);animation:ovIn .18s ease-out}
  .sheet{position:fixed;inset-inline:0;bottom:0;z-index:71;background:var(--surface);border-radius:24px 24px 0 0;max-height:88vh;overflow-y:auto;padding:8px 14px calc(16px + env(safe-area-inset-bottom,0px));animation:sheetIn .26s cubic-bezier(.2,.9,.3,1);box-shadow:0 -20px 50px -20px rgba(0,0,0,.4)}
  .sheet .grab{width:42px;height:5px;border-radius:9px;background:var(--line);margin:4px auto 10px}
  .sh-user{display:flex;align-items:center;gap:12px;padding:6px 4px 14px;border-bottom:1px solid var(--line);margin-bottom:8px}
  .sh-user .av{width:46px;height:46px;border-radius:15px;background:var(--grad);color:#fff;display:grid;place-items:center;font-family:var(--f-display);font-size:20px;font-weight:700;flex:none}
  .sh-user b{display:block;font-size:15.5px}.sh-user small{color:var(--muted);font-size:12px}
  .sh-user .grow{flex:1;min-width:0}
  .sh-g{font-size:11.5px;font-weight:700;color:var(--muted);letter-spacing:.03em;padding:12px 4px 6px}
  .sh-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
  .sh-it{position:relative;display:flex;flex-direction:column;align-items:center;gap:6px;background:none;border:0;padding:8px 2px;border-radius:14px;font:inherit;font-size:11.5px;font-weight:600;color:var(--fg);cursor:pointer;text-align:center;line-height:1.3}
  .sh-it i{font-style:normal;width:50px;height:50px;border-radius:16px;display:grid;place-items:center;font-size:22px;background:var(--surface-2)}
  .sh-it[aria-current="page"] i{background:var(--grad);box-shadow:0 8px 18px -8px rgba(21,101,216,.7)}
  .sh-it:active i{transform:scale(.94)}
  .sh-it .n{position:absolute;top:2px;inset-inline-end:8px;background:#ef4444;color:#fff;border-radius:99px;font-size:9.5px;min-width:17px;height:17px;line-height:17px;padding:0 4px;font-weight:700}
  .sh-row{display:flex;gap:8px;flex-wrap:wrap;padding-top:14px;margin-top:10px;border-top:1px solid var(--line)}
  .sh-row .btn{flex:1 1 40%;justify-content:center}
  .sh-new{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;padding-top:4px}
  .sh-new button{display:flex;align-items:center;gap:12px;background:var(--surface-2);border:0;border-radius:16px;padding:14px;font:inherit;font-weight:600;color:var(--fg);cursor:pointer;text-align:start}
  .sh-new button i{font-style:normal;width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:var(--surface);font-size:19px;flex:none}
  .sh-new button.pri{grid-column:1/-1;background:var(--grad);color:#fff}
  .sh-new button.pri i{background:rgba(255,255,255,.18)}
  .sh-title{font-family:var(--f-display);font-weight:600;font-size:16px;padding:0 4px 10px}

  /* ---- modals as full sheets ---- */
  .ov{padding:0!important;align-items:flex-end!important}
  .modal,.modal.sm,.modal.wide,.modal.xl{width:100%!important;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);border-radius:22px 22px 0 0!important;border:0}
  .m-h{padding:16px 16px 12px!important}
  .m-h h3{font-size:16.5px}
  .m-b{padding:14px 14px!important;gap:12px!important}
  .m-f{padding:10px 14px calc(10px + env(safe-area-inset-bottom,0px))!important;gap:8px!important;flex-wrap:nowrap!important;overflow-x:auto;scrollbar-width:none}
  .m-f::-webkit-scrollbar{display:none}
  .m-f .btn{flex:none}
  .m-f .btn.pri{flex:1 0 auto;justify-content:center}
  fieldset{grid-template-columns:1fr!important;padding:12px!important}
  .grid2{grid-template-columns:1fr!important}
  .dgrid{grid-template-columns:1fr 1fr!important;gap:10px 12px}
  .tl div{font-size:11.5px}
  body.lock{overflow:hidden}
  .cmd input{padding:14px 16px}
  .npanel{inset-inline:8px;width:auto;top:calc(60px + env(safe-area-inset-top,0px))}
  .lt-cols{grid-template-columns:1fr}

  /* tasks board → single column */
  .tcols{grid-template-columns:1fr}
}
@media (max-width:380px){.sh-grid{grid-template-columns:repeat(3,1fr)}.hs small{font-size:10px}}
@media (display-mode: standalone) and (max-width:900px){.topbar{padding-top:calc(10px + env(safe-area-inset-top,0px))}}
@media (max-width:900px){
  #toastRoot .toast{left:12px!important;right:12px!important;transform:none!important;max-width:none!important;animation:tInM .22s ease-out!important}
  @keyframes tInM{from{opacity:0;transform:translateY(10px)}}
}

/* v62: بلاطات الأرقام أصغر على الموبايل — تظهر أكتر في الشاشة */
@media (max-width:900px){
  .kpis{gap:8px!important}
  .kpi{padding:10px 12px!important;min-height:0!important;border-radius:14px!important}
  .kpi .kic{display:none!important}.kpi span{padding-inline-end:0!important}
  .kpi>span,.kpi>b+small{font-size:12px!important}
  .kpi b,.kpi .num{font-size:20px!important;line-height:1.25;margin:2px 0!important}
  .kpi small{font-size:11px!important;line-height:1.3;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
  .hubtabs{position:sticky;top:0;z-index:5;background:var(--bg);padding-top:4px}
}
@media (max-width:900px){.kpis{align-items:start}.kpi{height:auto!important;align-self:start}}
/* V123: on narrow phones the logo overflowed its slot and slid under the header icons (390px). Keep it inside its box. */
@media (max-width:420px){.topbar .grow{min-width:0;overflow:hidden}.topbar .tb-logo{max-width:112px;height:auto;max-height:30px;object-fit:contain}}
