/* *********************************************** */
/* ** NRS new member view: layout and components * */
/* *********************************************** */
/*
   The new member layout (top bar, side menu, phone tab bar, search)
   and the components Home uses (cards, status pills, checklist,
   shortcut tiles). Colors come from nrs-site-colors.css.

   Everything here is scoped to body.hg, which only the new view
   sets (see inc-hg-shell.php), so classic pages are untouched.
*/

body.hg {
    padding-top: 0;
    margin: 0;
    background: var(--site-bg);
    color: var(--site-text);
    font-family: var(--site-font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
body.hg h1, body.hg h2, body.hg h3, body.hg h4, body.hg h5,
body.hg .h1, body.hg .h2, body.hg .h3, body.hg .h4 {
    font-family: var(--site-font);
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--site-text);
}
body.hg a { color: var(--site-red-dark); }
body.hg a:hover, body.hg a:focus { color: var(--site-red); }
body.hg :focus-visible { outline: 3px solid var(--site-blue); outline-offset: 2px; }
body.hg .btn-primary, body.hg button[type='submit']:not(.btn):not([class*='stripe']) {
    background-color: var(--site-red); border-color: var(--site-red); color: var(--site-on-accent); font-weight: 700;
}
body.hg .btn-primary:hover, body.hg .btn-primary:focus,
body.hg button[type='submit']:not(.btn):not([class*='stripe']):hover {
    background-color: var(--site-red-dark); border-color: var(--site-red-dark); color: var(--site-on-accent);
}
body.hg .panel { background: var(--site-surface); }

.hg-skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--site-surface); padding: 8px 12px; border-radius: var(--site-radius); }
.hg-skip:focus { left: 8px; }
.hg-icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- top bar ---------- */
.hg-top {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px;
    background: var(--site-surface);
    border-bottom: 1px solid var(--site-border);
    padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.hg-brand { display: block; flex: none; }
.hg-brand img { display: block; height: 34px; width: auto; }
.hg-search {
    flex: 1; min-width: 0; max-width: 560px;
    display: flex; align-items: center; gap: 8px;
    background: var(--site-bg); border: 1px solid var(--site-border); border-radius: var(--site-radius);
    padding: 7px 10px; color: var(--site-muted); font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.hg-search kbd { margin-left: auto; font: inherit; font-size: 11px; border: 1px solid var(--site-border); border-radius: 4px; padding: 0 5px; background: none; color: var(--site-muted); box-shadow: none; }
.hg-top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.hg-account { position: relative; }
.hg-account > summary { list-style: none; cursor: pointer; }
.hg-account > summary::-webkit-details-marker { display: none; }
.hg-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--site-ink); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.hg-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
    width: 260px; background: var(--site-surface); border: 1px solid var(--site-border);
    border-radius: var(--site-radius); box-shadow: var(--site-shadow); padding: 8px;
    display: flex; flex-direction: column;
}
.hg-menu .hg-menu-name { padding: 6px 10px 10px; border-bottom: 1px solid var(--site-border-soft); margin-bottom: 6px; font-weight: 700; }
.hg-menu .hg-menu-name small { display: block; font-weight: 400; color: var(--site-muted); }
.hg-menu a { display: block; padding: 8px 10px; border-radius: var(--site-radius); color: var(--site-text); text-decoration: none; }
.hg-menu a:hover, .hg-menu a:focus { background: var(--site-surface-2); color: var(--site-text); }
.hg-menu .hg-langs { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px 10px; border-top: 1px solid var(--site-border-soft); border-bottom: 1px solid var(--site-border-soft); margin: 6px 0; }
.hg-menu .hg-langs a { padding: 2px 8px; font-size: 14px; }
.hg-menu .hg-langs a[aria-current] { background: var(--site-ink); color: #fff; }

/* ---------- body: side menu + content ---------- */
.hg-body { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: calc(100vh - 57px); }
.hg-rail {
    background: var(--site-surface); border-right: 1px solid var(--site-border);
    padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: 57px; align-self: start; max-height: calc(100vh - 57px); overflow-y: auto;
}
.hg-rail a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--site-radius);
    font-weight: 700; font-size: 15px; color: var(--site-muted); text-decoration: none;
}
.hg-rail a:hover, .hg-rail a:focus { background: var(--site-surface-2); color: var(--site-text); }
.hg-rail a[aria-current="page"] { background: var(--site-surface-2); color: var(--site-text); box-shadow: inset 3px 0 0 var(--site-red); }
.hg-rail .hg-rail-head { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--site-muted); padding: 16px 12px 4px; }
.hg-rail .hg-rail-more a { font-weight: 500; font-size: 14px; padding: 6px 12px; }

.hg-main {
    min-width: 0;
    padding: 24px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
}
@media (min-width: 900px) { .hg-main { padding-left: 32px; padding-right: 32px; } }

/* ---------- phone tab bar ---------- */
.hg-tabs { display: none; }
@media (max-width: 767px) {
    .hg-body { grid-template-columns: minmax(0, 1fr); }
    .hg-rail { display: none; }
    .hg-search span.hg-long, .hg-search kbd { display: none; }
    .hg-brand img { height: 28px; }
    .hg-main { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
    .hg-tabs {
        display: grid; grid-template-columns: repeat(5, 1fr);
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
        background: var(--site-surface); border-top: 1px solid var(--site-border);
        padding: 6px max(4px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
    }
    .hg-tabs a, .hg-tabs button {
        display: flex; flex-direction: column; align-items: center; gap: 2px;
        border: 0; background: none; font: inherit; font-size: 11px; font-weight: 700;
        color: var(--site-muted); text-decoration: none; padding: 4px 0; min-height: 44px; cursor: pointer;
    }
    .hg-tabs [aria-current="page"] { color: var(--site-red-dark); }
}

/* ---------- search ---------- */
.hg-palette {
    position: fixed; inset: 0; z-index: 60; background: rgba(18,20,24,.5);
    display: flex; justify-content: center; align-items: flex-start;
    padding: 10vh max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
}
.hg-palette[hidden] { display: none; }
.hg-pal { width: 100%; max-width: 560px; background: var(--site-surface); border: 1px solid var(--site-border); border-radius: var(--site-radius); box-shadow: var(--site-shadow); overflow: hidden; }
.hg-pal input { width: 100%; border: 0; border-bottom: 1px solid var(--site-border); padding: 14px 16px; font: inherit; font-size: 17px; background: var(--site-surface); color: var(--site-text); outline: none; }
.hg-pal ul { list-style: none; margin: 0; padding: 6px; max-height: 55vh; overflow: auto; }
.hg-pal li a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border-radius: var(--site-radius); color: var(--site-text); text-decoration: none; }
.hg-pal li a small { color: var(--site-muted); font-size: 13px; text-align: right; }
.hg-pal li.on a, .hg-pal li a:hover { background: var(--site-surface-2); }
.hg-pal .hg-pal-foot { font-size: 13px; color: var(--site-muted); padding: 8px 16px; border-top: 1px solid var(--site-border); }

.hg-toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; background: var(--site-ink); color: #fff; padding: 10px 16px; border-radius: var(--site-radius); font-weight: 700; box-shadow: var(--site-shadow); }
.hg-toast[hidden] { display: none; }
@media (min-width: 768px) { .hg-toast { bottom: 24px; } }

/* ---------- page components ---------- */
.hg-page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 18px; }
.hg-page-head h1 { font-size: 30px; margin: 0; }
.hg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hg-chip { display: inline-flex; align-items: center; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--site-idle-soft); color: var(--site-idle); white-space: nowrap; }
.hg-chip.ok   { background: var(--site-ok-soft);   color: var(--site-ok); }
.hg-chip.warn { background: var(--site-warn-soft); color: var(--site-warn); }
.hg-chip.bad  { background: var(--site-bad-soft);  color: var(--site-bad); }
.hg-chip.role { background: var(--site-ink); color: #fff; }

.hg-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.hg-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (max-width: 1023px) { .hg-grid { grid-template-columns: minmax(0, 1fr); } }

.hg-card { background: var(--site-surface); border: 1px solid var(--site-border); border-radius: var(--site-radius); padding: 18px; min-width: 0; }
.hg-card > h2 {
    margin: 0 0 12px; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
    color: var(--site-muted); display: flex; justify-content: space-between; gap: 8px;
}
.hg-card > h2 a { text-transform: none; letter-spacing: 0; font-weight: 700; }
.hg-card p { margin: 0 0 8px; }
.hg-muted { color: var(--site-muted); font-size: 14px; }

.hg-next { background: #121418; color: #f4f4ef; border-color: #121418; }
.hg-next .hg-next-top { display: flex; justify-content: space-between; gap: 12px; }
.hg-next .hg-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(244,244,239,.65); }
.hg-next h2.hg-ev { margin: 2px 0 0; font-size: 28px; line-height: 1.1; color: #f4f4ef; text-transform: none; letter-spacing: -0.02em; font-weight: 900; display: block; }
.hg-next h2.hg-ev a { color: inherit; text-decoration: none; }
.hg-next .hg-meta { color: rgba(244,244,239,.75); font-size: 15px; margin-top: 4px; }
.hg-count { text-align: right; flex: none; }
.hg-count b { display: block; font-size: 42px; font-weight: 900; line-height: .95; letter-spacing: -0.02em; color: #fff; font-variant-numeric: tabular-nums; }
.hg-count span { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: rgba(244,244,239,.7); }
.hg-plate { display: inline-block; margin-top: 10px; background: #fff; color: #121418; font-weight: 900; font-size: 17px; padding: 1px 10px; border-radius: 5px; border: 2px solid #cf2029; }
.hg-next .hg-roles { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.hg-next .hg-roles .hg-chip { background: rgba(244,244,239,.14); color: #f4f4ef; }
.hg-ready { margin-top: 14px; }
.hg-ready .hg-bar { height: 8px; background: rgba(255,255,255,.16); border-radius: 4px; overflow: hidden; }
.hg-ready .hg-bar i { display: block; height: 100%; background: #cf2029; border-radius: 4px; }
.hg-ready .hg-lbl { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin-top: 6px; color: rgba(244,244,239,.85); }

.hg-check { list-style: none; margin: 0; padding: 0; }
.hg-check li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--site-border-soft); }
.hg-check li:first-child { border-top: 0; }
.hg-st { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 900; }
.hg-st.ok { background: var(--site-ok-soft); color: var(--site-ok); }
.hg-st.warn { background: var(--site-warn-soft); color: var(--site-warn); }
.hg-st.bad { background: var(--site-bad-soft); color: var(--site-bad); }
.hg-st.idle { background: var(--site-idle-soft); color: var(--site-idle); }
.hg-check .hg-t { font-weight: 700; font-size: 15px; }
.hg-check .hg-d { font-size: 14px; color: var(--site-muted); }
.hg-sub { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--site-muted); margin: 14px 0 2px; }
.hg-sub:first-child { margin-top: 0; }

.hg-btn, a.hg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 36px; padding: 6px 14px; border-radius: var(--site-radius);
    border: 1px solid var(--site-border); background: var(--site-surface); color: var(--site-text);
    font: inherit; font-size: 14px; font-weight: 700; white-space: nowrap; text-decoration: none; cursor: pointer;
}
.hg-btn:hover, a.hg-btn:hover { border-color: var(--site-text); color: var(--site-text); }
.hg-btn svg { width: 16px; height: 16px; flex: none; }
.hg-btn.red, a.hg-btn.red { background: var(--site-red); border-color: var(--site-red); color: #fff; }
.hg-btn.red:hover, a.hg-btn.red:hover { background: var(--site-red-dark); border-color: var(--site-red-dark); color: #fff; }

.hg-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.hg-q { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--site-border); background: var(--site-surface-2); border-radius: var(--site-radius); color: var(--site-text); text-decoration: none; font-weight: 700; font-size: 14px; min-height: 80px; }
.hg-q:hover, .hg-q:focus { border-color: var(--site-red); color: var(--site-text); }
.hg-q .hg-icon { color: var(--site-red); }
.hg-q small { font-weight: 500; color: var(--site-muted); font-size: 13px; }

.hg-fix { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--site-radius); background: var(--site-warn-soft); }
.hg-fix + .hg-fix { margin-top: 8px; }
.hg-fix .hg-t { font-weight: 700; }
.hg-sizes { display: flex; flex-wrap: wrap; gap: 6px; }
.hg-sizes button { min-width: 44px; min-height: 36px; border: 1px solid var(--site-border); background: var(--site-surface); border-radius: var(--site-radius); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.hg-sizes button:hover { border-color: var(--site-text); }
.hg-fix select, .hg-fix input[type='text'] { font: inherit; font-size: 15px; padding: 6px 8px; border-radius: var(--site-radius); border: 1px solid var(--site-border); background: var(--site-surface); color: var(--site-text); max-width: 100%; }
.hg-fix form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0; }

.hg-cred { display: flex; flex-direction: column; gap: 8px; }
.hg-credrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--site-radius); background: var(--site-surface-2); border: 1px solid var(--site-border-soft); }
.hg-credrow .hg-t { font-weight: 700; font-size: 15px; }
.hg-credrow .hg-d { font-size: 13px; color: var(--site-muted); }

.hg-evrow { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--site-border-soft); }
.hg-evrow:first-child { border-top: 0; }
.hg-date { text-align: center; border: 1px solid var(--site-border); border-radius: var(--site-radius); padding: 4px 0; line-height: 1.1; background: var(--site-surface); }
.hg-date b { display: block; font-size: 22px; font-weight: 900; }
.hg-date span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--site-red-dark); }
.hg-evrow .hg-t { font-weight: 700; font-size: 15px; }
.hg-evrow .hg-d { font-size: 13px; color: var(--site-muted); }
.hg-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 520px) {
    .hg-evrow { grid-template-columns: 54px minmax(0, 1fr); }
    .hg-evrow .hg-acts { grid-column: 2; justify-content: flex-start; }
}

.hg-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 15px; }
.hg-sw { width: 44px; height: 26px; border-radius: 13px; border: 0; background: var(--site-idle-soft); position: relative; flex: none; padding: 0; cursor: pointer; }
.hg-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .2s; }
.hg-sw[aria-checked="true"] { background: var(--site-ok); }
.hg-sw[aria-checked="true"]::after { left: 21px; }

.hg-assign { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.hg-assign div { background: var(--site-surface-2); border-radius: var(--site-radius); padding: 10px 12px; }
.hg-assign small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--site-muted); }
.hg-assign b { font-size: 15px; }

.hg-tbl { overflow-x: auto; }
.hg-tbl table { border-collapse: collapse; width: 100%; font-size: 14px; }
.hg-tbl th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--site-muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--site-border); }
.hg-tbl td { padding: 9px 8px; border-bottom: 1px solid var(--site-border-soft); white-space: nowrap; }

.hg-switch-note { margin-top: 28px; font-size: 14px; color: var(--site-muted); }

@media (prefers-reduced-motion: reduce) { body.hg * { transition: none !important; animation: none !important; } }
@media print { .hg-top, .hg-rail, .hg-tabs { display: none !important; } .hg-body { display: block; } }

/* ---------- MEMBER / ADMIN switch (admins only) ----------
   The same button sits in the same spot on both sides: it says which
   side you're on, and a click takes you to the other one. */
.hg-side-form { margin: 0; display: flex; }
.hg-side-switch, body.hg a.hg-side-switch {
    display: inline-flex; flex-direction: column; align-items: flex-start; justify-content: center;
    min-height: 40px; padding: 4px 12px; border-radius: 6px; border: 0; cursor: pointer;
    text-decoration: none; line-height: 1.15; font: inherit; text-align: left; white-space: nowrap;
}
.hg-side-switch .hg-side-now { font-weight: 900; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; }
.hg-side-switch .hg-side-to { display: flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; opacity: .85; }
.hg-side-switch .hg-side-to .hg-icon { width: 12px; height: 12px; }
.hg-side-switch.is-member, body.hg a.hg-side-switch.is-member { background: var(--site-ink); color: #fff; }
.hg-side-switch.is-member:hover, body.hg a.hg-side-switch.is-member:hover,
body.hg a.hg-side-switch.is-member:focus { background: #000; color: #fff; }
.hg-side-switch.is-admin { background: var(--site-red); color: #fff; }
.hg-side-switch.is-admin:hover, .hg-side-switch.is-admin:focus { background: var(--site-red-dark); color: #fff; }

/* ---------- owner testing: the striped switch-back button (inc-owner-test.php) ---------- */
.hg-top-right .nrs-test-switch, body.hg a.nrs-test-switch {
    display: inline-flex; flex-direction: column; justify-content: center; min-height: 40px; padding: 4px 10px;
    border-radius: 6px; text-decoration: none; line-height: 1.15; white-space: nowrap; max-width: 220px;
    background: repeating-linear-gradient(-45deg, #f5c400 0 10px, #121418 10px 20px);
}
.nrs-test-switch span { background: #f5c400; color: #121418; padding: 0 4px; border-radius: 2px; align-self: flex-start; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.nrs-test-switch .nrs-test-now { font-weight: 900; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.nrs-test-switch .nrs-test-to { font-size: 11px; font-weight: 700; margin-top: 2px; }
@media (max-width: 767px) { .hg-top-right .nrs-test-switch { max-width: 120px; } }
@media (max-width: 767px) {
    /* room for the MEMBER / ADMIN switch: search becomes a button */
    .hg-top:has(.hg-side-switch) .hg-search { flex: none; width: 40px; height: 38px; justify-content: center; padding: 0; margin-left: auto; }
    .hg-top:has(.hg-side-switch) .hg-search span { display: none; }
    .hg-top:has(.hg-side-switch) .hg-top-right { margin-left: 0; }
    .hg-side-switch, body.hg a.hg-side-switch { padding: 4px 9px; }
}
