/* =============================================================================
   Skycentrix — mobile agent home (Views.mobile)
   A purpose-built, touch-first field-agent landing screen. This is deliberately
   NOT the desktop suite restyled: when the mobile home is mounted, app.js adds
   `mobile-home-active` to <body>, and the rules below take over the shell —
   hiding the desktop sidebar / topbar / bottom-nav and going full-bleed.

   SCOPING: everything either lives under `.mobile-home` or under
   `body.mobile-home-active`, both of which are present ONLY while this view is on
   screen. The desktop layout is therefore never affected.
   ========================================================================== */

/* ---- Take over the shell while the mobile home is mounted ---------------- */
body.mobile-home-active .sidebar,
body.mobile-home-active .topbar,
body.mobile-home-active #mobileNav,
body.mobile-home-active .nav-backdrop { display: none !important; }

body.mobile-home-active .app { display: block; min-height: 100dvh; }
body.mobile-home-active .main { display: block; }
body.mobile-home-active .content { padding: 0; }

/* ---- Page wrapper -------------------------------------------------------- */
.mobile-home {
  --mh-pad: 18px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(27,159,221,.20), transparent 60%),
    var(--bg);
  color: var(--text);
  padding:
    calc(env(safe-area-inset-top, 0px) + 14px)
    calc(env(safe-area-inset-right, 0px) + var(--mh-pad))
    calc(env(safe-area-inset-bottom, 0px) + 22px)
    calc(env(safe-area-inset-left, 0px) + var(--mh-pad));
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Header ------------------------------------------------------------- */
.mh-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
}
.mh-hello { font-size: 13px; color: var(--text-3); font-weight: 600; }
.mh-name { font-size: 25px; font-weight: 800; letter-spacing: -.3px; line-height: 1.15; margin-top: 2px; }
.mh-meta { display: flex; align-items: center; gap: 7px; margin-top: 6px; font-size: 12.5px; color: var(--text-2); flex-wrap: wrap; }
.mh-role {
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 700;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .4px;
}
.mh-dot { color: var(--text-3); }
.mh-loc { color: var(--text-2); }

.mh-avatar {
  position: relative; flex: 0 0 auto;
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text); font-weight: 800; font-size: 15px;
  display: grid; place-items: center; cursor: pointer;
}
.mh-avatar:active { transform: scale(.95); }
.mh-avatar-badge {
  position: absolute; top: 2px; right: 2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg);
}

/* ---- Scan — the hero action -------------------------------------------- */
.mh-scan {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 64px;
  padding: 14px 16px; margin-bottom: 24px;
  border: none; border-radius: 18px; cursor: pointer;
  color: #fff; text-align: left;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 10px 26px rgba(27,159,221,.40);
  transition: transform .08s ease, box-shadow .12s ease;
}
.mh-scan:active { transform: translateY(1px) scale(.995); box-shadow: 0 6px 16px rgba(27,159,221,.40); }
.mh-scan-ico {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 13px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
}
.mh-scan-ico svg { width: 26px; height: 26px; }
.mh-scan-text { display: flex; flex-direction: column; line-height: 1.25; }
.mh-scan-text b { font-size: 18px; font-weight: 800; }
.mh-scan-text small { font-size: 12px; opacity: .85; margin-top: 1px; }

/* ---- Section label ------------------------------------------------------ */
.mh-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-3); font-weight: 700; margin: 0 2px 12px;
}

/* ---- Tile grid ---------------------------------------------------------- */
.mh-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
}
.mh-grid-empty { display: block; }

.mh-tile {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 118px;
  padding: 15px;
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text);
  text-align: left; text-decoration: none;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}
.mh-tile:active { transform: scale(.97); background: var(--surface-2); border-color: var(--border); }

.mh-tile-ico {
  width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  font-size: 22px; line-height: 1;
  background: var(--surface-3); color: var(--text);
  margin-bottom: 11px;
}
.mh-tile-emoji { background: var(--surface-3); }
/* The tiles now draw flat line icons, which take the accent wash's colour via
   currentColor instead of carrying their own. */
.mh-tile-ico svg { width: 24px; height: 24px; }
/* accent washes for the leading tiles */
.mh-tile-ico.acc-brand  { background: var(--brand-soft);  color: var(--brand-ink); }
.mh-tile-ico.acc-accent { background: var(--accent-soft); color: var(--accent-ink); }
.mh-tile-ico.acc-info   { background: var(--info-soft);   color: var(--info-ink); }
.mh-tile-ico.acc-purple { background: var(--purple-soft); color: var(--purple-ink); }
.mh-tile-ico.acc-warn   { background: var(--warn-soft);   color: var(--warn-ink); }
.mh-tile-ico.acc-grey   { background: var(--surface-3);   color: var(--text-2); }

.mh-tile-title { font-size: 15px; font-weight: 700; line-height: 1.2; }
.mh-tile-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.3; }

.mh-tile-count {
  position: absolute; top: 13px; right: 13px;
  min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 999px;
  background: var(--danger-fill); color: #fff;
  font-size: 12.5px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(239,68,68,.5);
}

/* ---- Skeleton (pre-tiles) ---------------------------------------------- */
.mh-tile-skel { pointer-events: none; }
.mh-skel-ico { width: 46px; height: 46px; border-radius: 13px; background: var(--surface-2); margin-bottom: 11px; }
.mh-skel-line { height: 13px; width: 70%; border-radius: 6px; background: var(--surface-2); }
.mh-tile-skel { animation: mh-pulse 1.3s ease-in-out infinite; }
@keyframes mh-pulse { 0%,100% { opacity: .55; } 50% { opacity: .9; } }

/* ---- Empty state -------------------------------------------------------- */
.mh-empty {
  text-align: center; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 18px; padding: 34px 20px;
}
.mh-empty-ico { font-size: 38px; margin-bottom: 8px; }
.mh-empty-link { display: inline-block; margin-top: 12px; color: var(--brand); font-weight: 700; text-decoration: none; }

/* ---- Footer ------------------------------------------------------------- */
.mh-foot {
  margin-top: auto; padding-top: 26px;
  display: flex; flex-direction: column; gap: 10px;
}
.mh-foot-link {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 50px; padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text); font-weight: 600; font-size: 14.5px;
  text-decoration: none; cursor: pointer; width: 100%;
  -webkit-appearance: none; appearance: none;
}
.mh-foot-link:active { background: var(--surface-2); }
.mh-foot-link svg { width: 19px; height: 19px; opacity: .7; }
.mh-foot-link.danger { color: var(--danger); }
.mh-foot-link.danger svg { opacity: .8; }
.mh-foot-brand {
  text-align: center; font-size: 11px; color: var(--text-3);
  margin-top: 6px; letter-spacing: .3px;
}

/* ---- Tighten the 2-col grid to a single column on very small phones ------ */
@media (max-width: 360px) {
  .mh-grid { grid-template-columns: 1fr; }
  .mh-name { font-size: 22px; }
}

/* ---- Slightly roomier on tablets / wide phones (home still full-bleed) --- */
@media (min-width: 600px) {
  .mobile-home { --mh-pad: 28px; max-width: 760px; margin: 0 auto; }
  .mh-grid { grid-template-columns: repeat(3, 1fr); }
}
