/* 04-mobile.css — Phones and tablets: the menu as a drawer, stacked tables (same pattern as MPR One Office).
   Part of the portal stylesheet; index.html loads the parts in order (01 to 12), so the cascade is
   the same as one file. */

/* ---------- Mobile (same breakpoint and pattern as MPR One Office) ---------- */
.mobile-appbar, .mobile-nav-close, .mobile-nav-scrim { display: none; }

@media (max-width: 1100px) {
  :root { --mobile-appbar-height: 62px; }
  body { display: block; }
  .mobile-appbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: calc(var(--mobile-appbar-height) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 14px 0;
    background: var(--glass-strong);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
  }
  .mobile-nav-toggle { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer; }
  .mobile-nav-toggle svg { width: 20px; height: 20px; }
  .mobile-appbar-context { display: grid; min-width: 0; gap: 1px; }
  .mobile-appbar-context strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-appbar-context small { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: min(320px, 86vw);
    height: 100dvh;
    padding-top: calc(20px + env(safe-area-inset-top));
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-float);
  }
  body.mobile-nav-open .sidebar { transform: translateX(0); }
  .mobile-nav-close { display: grid; place-items: center; position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
  .mobile-nav-scrim { position: fixed; inset: 0; z-index: 50; border: 0; background: rgba(17, 20, 24, 0.4); }
  body.mobile-nav-open .mobile-nav-scrim { display: block; }
  .sidebar-logo img { width: 180px; }
  :root { --gutter: 16px; }
  main { padding: 0 var(--gutter) 40px; }
  /* relative (not static): its z-index keeps the notifications panel above the page. */
  .topbar { position: relative; margin: 0 calc(-1 * var(--gutter)) var(--space-4); padding: var(--space-4); flex-wrap: wrap; background: transparent; backdrop-filter: none; }
  .topbar-titles h1 { font-size: 22px; }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .topbar-titles { display: none; }
  .topbar { padding-bottom: 4px; border-bottom: 0; }
  .topbar-tools { margin-left: auto; }
  .panel, .card { padding: var(--space-4); }
  .attachment img { width: 150px; height: 112px; }
  .page-actions { justify-content: flex-start; }
  /* Tables become stacked cards. */
  .table-wrap { border: 0; background: none; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; padding: 6px 0; }
  td { border: 0; padding: 4px 12px; display: flex; gap: 12px; justify-content: space-between; align-items: center; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex-shrink: 0; }
  td[data-label=""]::before { content: none; }
}
