/* 🧭 Group portal: the consolidated menu (js/gnav.js) — a slim rail of parents on a computer, a sticky footer on a phone, the parent
   pop-ups — and the modern look of lists: tables as cards on a phone, roomy tables with a sticky header on a computer.
   Colours come from the design tokens (../app/css/tokens.css → ds.css → --card / --line / --accent …), light and dark. */

/* ---------- the rail (over 900 px) ---------- */
body.grp.gn-on #side { width: 92px; padding: 8px 6px; gap: 4px; align-items: stretch; overflow-y: auto; scrollbar-width: thin; }
body.grp.gn-on #side .gn-r { flex-direction: column; justify-content: center; gap: 3px; min-height: 62px; padding: 8px 4px; border-radius: 14px; text-align: center; color: var(--ink); }
body.grp.gn-on #side .gn-r .ic { width: auto; font-size: 1.35rem; line-height: 1; display: inline-grid; place-items: center; width: 40px; height: 32px; border-radius: 999px; transition: background var(--ds-dur-1, .12s); }
body.grp.gn-on #side .gn-r .lb { font-size: .72rem; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; max-width: 100%; }
body.grp.gn-on #side .gn-r:hover { background: transparent; } body.grp.gn-on #side .gn-r:hover .ic { background: var(--soft); }
body.grp.gn-on #side .gn-r.on { background: transparent; color: var(--accent); } body.grp.gn-on #side .gn-r.on .ic { background: var(--accent-soft); }
body.grp.gn-on #side .gn-r .badge { position: absolute; top: 4px; right: 10px; font-size: .66rem; min-width: 18px; padding: 1px 5px; }
body.grp.gn-on #side .gn-grow { flex: 1; min-height: 8px; }
body.grp.gn-on #side .gn-lockr { margin: 0; width: 100%; background: var(--top); color: #fff; min-height: 58px; box-shadow: none; }
body.grp.gn-on #side .gn-lockr .ic { background: transparent !important; }
body.grp.gn-on #menuBtn { display: none !important; }

/* ---------- the footer (phone and small tablet) ---------- */
#gnFoot { display: none; }
@media (max-width: 900px) {
  body.grp.gn-on #gnFoot { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--card) 94%, transparent); border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -12px rgb(0 0 0 / .25); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  body.grp.gn-on { --gn-foot-h: 64px; }
  body.grp.gn-on main { padding-bottom: calc(var(--gn-foot-h) + env(safe-area-inset-bottom)); }
  body.grp.gn-on[data-page="lock"] #gnFoot { display: none; }
  body.grp.gn-on[data-page="lock"] main { padding-bottom: 0; }
  body.grp.gn-on #toasts { bottom: calc(var(--gn-foot-h) + 10px); }
}
#gnFoot .gn-f { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; border: 0; background: none; color: var(--muted); border-radius: 14px; padding: 4px 2px; font: inherit; min-width: 0; }
#gnFoot .gn-f .ic { font-size: 1.3rem; line-height: 1; display: inline-grid; place-items: center; width: 48px; height: 30px; border-radius: 999px; transition: background var(--ds-dur-1, .12s); }
#gnFoot .gn-f .lb { font-size: .7rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#gnFoot .gn-f.on { color: var(--accent); } #gnFoot .gn-f.on .ic { background: var(--accent-soft); }
#gnFoot .gn-f:active .ic { background: var(--soft); }
#gnFoot .gn-f .badge { position: absolute; top: 2px; left: calc(50% + 8px); font-size: .64rem; min-width: 17px; padding: 1px 5px; }

/* ---------- a parent's pop-up: its actions as boxes ---------- */
.modal.gn-pop .sheet { width: min(720px, 100%); }
.modal.gn-pop.wide .sheet { width: min(940px, 100%); }
.gn-sub { margin: -4px 0 12px; }
.gn-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.gn-act { position: relative; display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 12px 14px; text-align: left; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; min-width: 0; box-shadow: var(--shadow); transition: border-color var(--ds-dur-1, .12s), transform var(--ds-dur-1, .12s); }
.gn-act:hover { border-color: var(--c, var(--accent)); transform: translateY(-1px); }
.gn-act.on { border-color: var(--accent); background: var(--accent-soft); }
.gn-act .ic { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; font-size: 1.35rem; background: color-mix(in srgb, var(--c, var(--accent)) 13%, var(--card)); }
.gn-act .tx { flex: 1; min-width: 0; display: grid; gap: 2px; } .gn-act b { font-size: .98rem; } .gn-act small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.gn-act .badge { flex: none; }
.gn-find { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--soft); color: var(--muted); font: inherit; text-align: left; }
.gn-find span:first-child { font-size: 1.2rem; }
.gn-lock { margin-top: 14px; min-height: 50px; }
@media (max-width: 640px) { .gn-acts { grid-template-columns: 1fr; gap: 8px; } .gn-act { min-height: 60px; padding: 10px 12px; } .gn-act .ic { width: 40px; height: 40px; } }

/* ---------- the top bar is slimmer: the period sits on each page, the menu in the rail / footer ---------- */
@media (max-width: 600px) { body.grp.gn-on #periodChip { display: none; } }

/* ---------- modern tables (computer): roomy rows, sticky header, numbers on the right, no zebra ---------- */
body.grp .tbl-wrap { border-radius: 16px; box-shadow: var(--shadow); }
body.grp .tbl th { font-size: .72rem; letter-spacing: .06em; font-weight: 700; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); z-index: 1; }
body.grp .tbl td { padding: 13px 14px; border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
body.grp .tbl tbody tr:first-child td { border-top: 0; }
body.grp .tbl td.r, body.grp .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.grp .tbl tbody tr { transition: background var(--ds-dur-1, .12s); }
body.grp .tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }

/* ---------- on a phone a table becomes cards: the first cell is the title, the rest are label · value lines ---------- */
@media (max-width: 640px) {
  body.grp .tbl-wrap:not(.no-cards) { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  body.grp .tbl-wrap:not(.no-cards) .tbl tbody { display: grid; gap: 8px; }
  body.grp .tbl-wrap:not(.no-cards) .tbl tr { border: 1px solid var(--line); border-radius: 16px; background: var(--card); padding: 10px 2px 8px; box-shadow: var(--shadow); }
  body.grp .tbl-wrap:not(.no-cards) .tbl td { padding: 3px 12px; border: 0; font-size: .9rem; }
  body.grp .tbl-wrap:not(.no-cards) .tbl td:first-child { font-size: 1rem; font-weight: 700; justify-content: flex-start; text-align: left; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
  body.grp .tbl-wrap:not(.no-cards) .tbl td:first-child::before { content: none; }
  body.grp .tbl-wrap:not(.no-cards) .tbl td:empty { display: none; }
  body.grp .tbl-wrap:not(.no-cards) .tbl tr.tot, body.grp .tbl-wrap:not(.no-cards) .tbl tr.sub { background: var(--accent-soft); }
  body.grp .tbl-wrap:not(.no-cards) .tbl tbody tr:hover td { background: transparent; }
}
