/**
 * /mdr-content/css/members.css — member-area palette and components (area layer)
 *
 * The area file (third CSS layer) for the member section: plain, calm, grounded. Loads
 * LAST (essential -> structure -> members), so it wins the cascade. It defines the
 * member --m-* palette (a muted green signature) and maps it onto the shared semantic
 * --c-* colour contract, so the colourless .s-* building blocks (card, field, button,
 * message, status, shell) render in member colours — same FORM as admin/frontend, own
 * COLOUR — and adds only the member-specific pieces structure.css does not carry.
 *
 * Provides: base body/link styling; the member header (.m-header / .m-header-inner /
 * -brand / -logo / -titles / -name / -page / -user) plus the two-row NEW header mode
 * (.m-hd-* row, search bar, .m-menu-* profile menu); page frame (.m-main, .m-footer);
 * cards and forms (.m-card, .m-field, .m-btn and its -plain/-danger variants, .m-links);
 * message boxes (.m-msg with -error/-ok); the 2FA setup blocks (.m-2fa-qr / -secret /
 * -codes); small helpers (.m-muted, .m-mt); and the member colours for the shared
 * slide-out nav rail (.s-shell-rail / .s-rail-* whose geometry comes from structure.css).
 *
 * @package    TaNaSi-MDR
 * @author     Keylam Folker
 * @co-author  Claude (Anthropic)
 * @copyright  2026 TaNaSi
 * @license    proprietary — see RULES.md
 * @link       https://ta-na-si.eu
 * @since      1.0.0
 */

:root {
    --m-bg:        #eef4ee;   
    --m-card:      #ffffff;
    --m-ink:       #2b2b29;   /* near-black body ink, softened */
    --m-muted:     #6f6c66;
    --m-line:      #e2ded7;
    --m-accent:    #3a5a40;   /* muted green — grounded, not loud (the member signature colour) */
    --m-accent-dk: #2c4632;
    --m-error-bg:  #fdecec;
    --m-error:     #b3382c;
    --m-ok-bg:     #e8f3ea;
    --m-ok:        #2f6b3c;
    --m-radius:    10px;

    /* ── Semantic variable contract ─────────────────────────────────────────
     * structure.css shapes elements colourlessly and reads ONLY these --c-* names.
     * Here the member area fills them with ITS colours (muted green). That way the
     * shared .s-* building blocks (card, field, button, message, status, shell)
     * render green in the member area — same FORM as admin/frontend, own COLOUR. */
    --c-accent:      var(--m-accent);     /* muted green */
    --c-accent-dk:   var(--m-accent-dk);
    --c-accent-soft: rgba(58, 90, 64, .12);
    --c-on-accent:   #fff;
    --c-bg:          var(--m-bg);
    --c-card:        var(--m-card);
    --c-ink:         var(--m-ink);
    --c-muted:       var(--m-muted);
    --c-line:        var(--m-line);
    --c-danger:      var(--m-error);
    --c-danger-dk:   var(--m-error);
    --c-ok:          var(--m-ok);
    --c-ok-bg:       var(--m-ok-bg);
    --c-ok-line:     var(--m-ok);
    --c-error:       var(--m-error);
    --c-error-bg:    var(--m-error-bg);
    --c-error-line:  var(--m-error);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--m-bg);
    color: var(--m-ink);
    font-family: var(--font-sans);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--m-accent); }
a:hover { color: var(--m-accent-dk); }

/* ── Page frame ───────────────────────────────────────────────────────────────
   The sticky-footer geometry now lives shared in structure.css (.s-shell +
   .s-shell-main). Member views use class="s-shell" on the wrapper and .s-shell-main
   on the <main>. Only the member-specific properties (colours, header) remain here. */

/* .m-header: the member-area top bar (logo/brand left, user links right). */
.m-header {
    border-bottom: 1px solid var(--m-line);
    background: var(--m-card);
}
.m-header-inner {
    /* Edge-flush like the frontend header (nav.site-header: max-width:100%,
       fixed padding) — the logo sits at the edge, NOT centred on --w-page.
       The <main> below it stays centred. */
    max-width: 100%;
    padding: 0.9rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* ── Header structure (left: logo + brand + page name; right: user info) ──────
   Borrows the frontend elements (left) and the tools elements (right), but stays
   in member colours on a light surface. Logo and title sizes match the frontend. */
.m-header-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
}
.m-header-logo { width: 84px; height: 84px; border-radius: 50%; object-fit: contain; flex-shrink: 0; }
.m-header-titles { display: flex; flex-direction: column; line-height: 1.25; font-family: var(--font-display); }
/* Title size as in the frontend: there .brand-name (1.12em) sits in .nav-brand a
   with font-size: clamp(1.5rem,1.6vw+.6rem,2.2rem). Reproduce that fluid base on
   the title here so the member title has the same size as in the frontend. */
.m-header-name { font-size: clamp(1.5rem, 1.6vw + .6rem, 2.2rem); font-weight: 600; color: var(--m-ink); }
.m-header-name span { color: var(--m-accent); font-weight: 500; font-size: 0.88em; }
.m-header-page {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(.94rem, .9vw + .35rem, 1.2rem);
    letter-spacing: .4px;
    color: var(--m-muted);
    margin-top: 2px;
}

/* Right zone: the signed-in name + links (Archive / Sign out). */
.m-header-user {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: var(--fs-md);
    white-space: nowrap;
}
.m-header-user .m-user-name { color: var(--m-muted); }
.m-header-user a { text-decoration: none; }

@media (max-width: 599px) {
    .m-header-logo { width: 56px; height: 56px; }
}

.m-main {
    width: 100%;
    max-width: var(--w-page);
    margin: 0 auto;
    padding: 2rem 1.25rem;
}

.m-footer {
    border-top: 1px solid var(--m-line);
    background: var(--m-card);
    color: var(--m-muted);
    font-size: var(--fs-sm);
    text-align: center;
    padding: 1.2rem;
}
/* Gold padlock icon (icon-lock.svg, own colours) before "Protected Area" — same mark as the admin footer. */
.m-footer svg { width: 1.1em; height: 1.1em; vertical-align: -0.18em; margin-inline-end: .35em; }
/* The software-attribution link in the member's muted green — and hold that colour when VISITED, so the
   central --c-link-visited (#551a8b) token cannot override it into a clashing purple. */
.m-footer a, .m-footer a:visited { color: var(--m-accent); text-decoration: none; }
.m-footer a:hover { color: var(--m-accent-dk); text-decoration: underline; }

/* ── Cards / forms ────────────────────────────────────────────────────────────
   .m-card: the centred content panel (login, profile, 2FA); .m-field wraps one
   labelled input; .m-btn is the primary action button. Member-coloured variants
   of the same box/field/button forms the shared .s-* blocks provide. */
.m-card {
    background: var(--m-card);
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    padding: 1.6rem;
    max-width: 440px;
    margin: 1rem auto;
}
.m-card h1 {
    margin: 0 0 0.3rem;
    font-size: 1.35rem;
}
.m-card .m-sub {
    margin: 0 0 1.4rem;
    color: var(--m-muted);
    font-size: 0.92rem;
}

.m-field { margin-bottom: 1rem; }
.m-field label {
    display: block;
    font-size: var(--fs-sm);
    color: var(--m-muted);
    margin-bottom: 0.3rem;
}
.m-field input,
.m-field textarea,
.m-field select {
    width: 100%;
    padding: 0.65rem 0.7rem;
    font-size: var(--fs-body);
    border: 1px solid var(--m-line);
    border-radius: 8px;
    background: #fcfbf9;
    color: var(--m-ink);
}
.m-field textarea { resize: vertical; font-family: inherit; }
.m-field input:focus,
.m-field textarea:focus,
.m-field select:focus {
    outline: none;
    border-color: var(--m-accent);
    box-shadow: 0 0 0 3px rgba(58, 90, 64, 0.12);
}

.m-btn {
    display: inline-block;
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: var(--fs-body);
    font-weight: 600;
    border: none;
    border-radius: 8px;
    background: var(--m-accent);
    color: #fff;
    cursor: pointer;
    transition: background 0.15s ease;
}
.m-btn:hover { background: var(--m-accent-dk); }

.m-links {
    margin-top: 1.2rem;
    font-size: 0.88rem;
    text-align: center;
}
.m-links a { display: inline-block; margin: 0.2rem 0.5rem; }

/* ── Messages ─────────────────────────────────────────────────────────────────
   .m-msg is the base notice box; -error (red) and -ok (green) are the two states. */
.m-msg {
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    font-size: var(--fs-md);
    margin-bottom: 1.1rem;
}
.m-msg-error { background: var(--m-error-bg); color: var(--m-error); border: 1px solid var(--m-error); }
.m-msg-ok    { background: var(--m-ok-bg);    color: var(--m-ok);    border: 1px solid var(--m-ok); }

/* Secondary / danger variants of the button — for the 2FA section (several
   stacked actions: neutral "cancel/regenerate" + red "turn off"). */
.m-btn-plain  { background: transparent; color: var(--m-accent); border: 1px solid var(--m-accent); }
.m-btn-plain:hover  { background: rgba(58,90,64,0.08); }
.m-btn-danger { background: var(--m-error); }
.m-btn-danger:hover { background: var(--m-error); filter: brightness(0.9); }

/* ── 2FA setup (QR code, plaintext secret key, recovery codes) ────────────────
   .m-2fa-qr holds the scannable SVG; .m-2fa-secret shows the manual-entry key in
   monospace; .m-2fa-codes lists the one-time recovery codes in two columns. */
.m-2fa-qr { margin: 0.4rem 0 0.8rem; }
.m-2fa-qr svg { width: 180px; height: auto; max-width: 100%; }
.m-2fa-secret {
    font-family: var(--font-mono);
    font-size: var(--fs-body);
    letter-spacing: 0.05em;
    word-break: break-all;
    background: #f4f2ee;
    padding: 0.5rem 0.7rem;
    border-radius: 6px;
    margin: 0.2rem 0 1rem;
}
.m-2fa-codes {
    list-style: none;
    padding: 0.6rem 0.8rem;
    margin: 0.3rem 0 1rem;
    background: #f4f2ee;
    border-radius: 6px;
    columns: 2;
    font-family: var(--font-mono);
    font-size: var(--fs-lead);
    letter-spacing: 0.04em;
}
.m-2fa-codes li { padding: 0.15rem 0; }

/* ── Small helpers ────────────────────────────────────────────────────────────
   .m-muted paints text in the muted ink; .m-mt adds a top margin. */
.m-muted  { color: var(--m-muted); }
.m-mt     { margin-top: 1rem; }

/* ── m-hd-*: member-header NEW mode ───────────────────────────────────────────
   Modelled on the admin-tools header, in member colours: top-right row "← Archive"
   + profile menu, bottom row search bar + hamburger (links live DIRECTLY in the
   menu — the member area has no admin-style nesting). The open/close geometry
   comes from structure.css (.s-menu / .s-menu-anchor + menu-modal-toggle.js);
   only the colours are set here. */
.m-hd-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.m-hd-top, .m-hd-bottom { display: flex; align-items: center; gap: 10px; }
.m-hd-archive { text-decoration: none; font-weight: 600; color: var(--m-accent); white-space: nowrap; }
.m-hd-archive:hover { color: var(--m-accent-dk); }
.m-hd-btn { border: 1px solid var(--c-line); background: var(--c-card); border-radius: 10px; padding: 4px 8px; cursor: pointer; line-height: 1; color: var(--m-ink); }
.m-hd-btn:hover { background: var(--c-accent-soft); }
.m-hd-btn svg, .m-hd-btn img { height: 26px; width: auto; vertical-align: middle; }
.m-hd-search { display: flex; align-items: center; border: 1px solid var(--c-line); border-radius: 999px; overflow: hidden; background: var(--c-card); }
.m-hd-search select { border: 0; background: var(--c-accent-soft); color: var(--m-ink); font-size: var(--fs-sm); padding: 8px 10px; }
.m-hd-search input[type="search"] { border: 0; padding: 8px 12px; font-size: var(--fs-md); min-width: 600px; color: var(--m-ink); background: transparent; }
.m-hd-search input:focus, .m-hd-search select:focus { outline: none; }
.m-hd-search button { border: 0; background: var(--m-accent); color: #fff; font-weight: 700; font-size: var(--fs-sm); padding: 8px 16px; cursor: pointer; }
.m-hd-search button:hover { background: var(--m-accent-dk); }
.m-hd-menu { min-width: 230px; }
.m-menu-user { display: flex; gap: 10px; align-items: center; padding: 10px 12px; text-decoration: none; border-bottom: 1px solid var(--c-line); }
.m-menu-user .avatar svg { width: 40px; height: 40px; border-radius: 50%; }
.m-menu-user .who { display: flex; flex-direction: column; line-height: 1.3; }
.m-menu-user .name { font-weight: 700; color: var(--m-ink); }
.m-menu-user .group { font-size: var(--fs-xs); color: var(--m-muted); }
.m-menu-item { display: flex; gap: 8px; align-items: center; padding: 9px 12px; text-decoration: none; color: var(--m-ink); font-size: var(--fs-md); }
.m-menu-item:hover { background: var(--c-accent-soft); color: var(--m-ink); }
.m-menu-item svg, .m-menu-item img { height: 20px; width: auto; }
@media (max-width: 700px) {
    .m-header-2row .m-header-inner { flex-wrap: wrap; }
    .m-hd-right { align-items: stretch; width: 100%; }
    .m-hd-top { justify-content: flex-end; }
    .m-hd-bottom { flex-wrap: wrap; }
    .m-hd-search { flex: 1 1 auto; }
    .m-hd-search input[type="search"] { min-width: 0; flex: 1; }
}

/* Slide-out menu (member nav rail, LIKE the admin tools): geometry is shared from
   structure.css (.s-shell-rail / .s-rail-*) — only the member colours are set here. */
.s-shell-rail { background: var(--c-card); border-inline-start: 1px solid var(--c-line); padding: 14px 10px; }
.s-rail-link { padding: 6px 12px; margin-bottom: 2px; border-radius: 10px; text-decoration: none; color: var(--m-ink); white-space: normal; }
.s-rail-link:hover { background: var(--c-accent-soft); }
.s-rail-link.active { background: var(--m-accent); color: #fff; }
.s-rail-icon { font-size: 1.6rem; width: 32px; text-align: center; flex: 0 0 auto; }
.s-rail-label { font-size: var(--fs-md); font-weight: 600; line-height: 1.2; }
.shell-narrow .s-rail-link { justify-content: center; padding: 6px 0; }
@media (max-width: 900px) {
    .s-rail-link { justify-content: center; padding: 6px 0; }
}

/* Rail sub-entries (tool quick-jumps; geometry from structure.css) — member colours. */
.s-rail-sub { border-top-color: var(--c-line); }
.s-rail-sub a { color: var(--m-ink); }
.s-rail-sub a:hover { background: var(--c-accent-soft); }
.s-rail-sub a.active { background: var(--m-accent); color: #fff; }
.s-rail-sub-badge { color: var(--m-muted); }
.s-rail-sub a.active .s-rail-sub-badge { color: #fff; }
