/* Shared tool layout (includes/layout.php): design tokens, sidebar, top bar, command palette, account menu.
   Look: neutral greys, 1px hairlines, one blue accent, status as a dot plus a word.
   Theme: <html data-theme="light|dark"> when the visitor picked one, otherwise the system setting. */

:root {
    --bg: #ffffff; --sub: #fafafa; --hover: #f2f2f2; --sel: #ebebeb; --line: #ebebeb; --line2: #dedede;
    --ink: #171717; --dim: #666666; --faint: #8f8f8f; --accent: #0a6cf0; --accent-bg: #ebf3ff;
    --ok: #18794e; --ok-bg: #e9f8ef; --warn: #a35200; --warn-bg: #fff4e0; --bad: #cd2b31; --bad-bg: #fdecec;
    --pri: #171717; --pri-ink: #ffffff; --scrim: rgba(250, 250, 250, .72);
    --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .10);
    --k: #8a3ffc; --s: #18794e; --n: #a35200;
    --f-sans: "Geist", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --f-mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;
    --side-w: 232px; --bar-h: 48px; --radius: 8px;
    color-scheme: light;

    /* aliases for older tool CSS */
    --bg-main: var(--bg); --bg-card: var(--bg); --bg-hover: var(--hover);
    --text-main: var(--ink); --text-secondary: var(--dim); --text-muted: var(--faint);
    --primary-color: var(--accent); --primary-dark: var(--accent); --border-color: var(--line2);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0a0a0a; --sub: #0f0f0f; --hover: #1a1a1a; --sel: #1f1f1f; --line: #1f1f1f; --line2: #2e2e2e;
        --ink: #ededed; --dim: #a1a1a1; --faint: #6f6f6f; --accent: #4c95ff; --accent-bg: #0d2140;
        --ok: #3fcf8e; --ok-bg: #0c2a1c; --warn: #f5a524; --warn-bg: #2e2006; --bad: #ff6166; --bad-bg: #331314;
        --pri: #ededed; --pri-ink: #0a0a0a; --scrim: rgba(0, 0, 0, .6);
        --shadow: 0 0 0 1px #2e2e2e, 0 16px 40px rgba(0, 0, 0, .6);
        --k: #b794ff; --s: #3fcf8e; --n: #f5a524;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0a0a0a; --sub: #0f0f0f; --hover: #1a1a1a; --sel: #1f1f1f; --line: #1f1f1f; --line2: #2e2e2e;
    --ink: #ededed; --dim: #a1a1a1; --faint: #6f6f6f; --accent: #4c95ff; --accent-bg: #0d2140;
    --ok: #3fcf8e; --ok-bg: #0c2a1c; --warn: #f5a524; --warn-bg: #2e2006; --bad: #ff6166; --bad-bg: #331314;
    --pri: #ededed; --pri-ink: #0a0a0a; --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 0 0 1px #2e2e2e, 0 16px 40px rgba(0, 0, 0, .6);
    --k: #b794ff; --s: #3fcf8e; --n: #f5a524;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--f-sans);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.lay-i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.lay-kbd {
    font-family: var(--f-sans); font-size: 11px; color: var(--dim);
    border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px;
    padding: 0 5px; line-height: 16px; background: var(--bg); white-space: nowrap;
}
.lay-mono { font-family: var(--f-mono); font-size: 12px; }
.lay-faint { color: var(--faint); }
.lay-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); flex: none; }
.lay-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }

.lay-skip { position: absolute; left: -9999px; top: 8px; z-index: 1000; padding: 6px 10px; background: var(--pri); color: var(--pri-ink); border-radius: 6px; }
.lay-skip:focus { left: 8px; }

/* ---------- app frame ---------- */
.lay-shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.lay-side {
    position: sticky; top: 0; height: 100vh; overflow: hidden;
    background: var(--sub); border-right: 1px solid var(--line);
    padding: 10px 8px; display: flex; flex-direction: column; gap: 12px; z-index: 40;
}
.lay-side-head { display: flex; align-items: center; gap: 4px; }
.lay-ws { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-weight: 600; color: var(--ink); min-width: 0; }
.lay-ws:hover { background: var(--hover); text-decoration: none; }
.lay-logo { width: 20px; height: 20px; border-radius: 5px; background: var(--ink); color: var(--bg); display: grid; place-items: center; flex: none; }
.lay-logo svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linejoin: round; }
.lay-ws-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lay-icon-btn.lay-side-close, .lay-icon-btn.lay-menu-btn, .lay-icon-btn.lay-palette-btn { display: none; }

.lay-search {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; cursor: pointer;
    border: 1px solid var(--line2); background: var(--bg); border-radius: 6px; color: var(--faint); text-align: left;
}
.lay-search:hover { border-color: var(--faint); }
.lay-search span { flex: 1; }

.lay-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 14px; margin: 0 -8px; padding: 0 8px 8px; scrollbar-width: thin; }
.lay-grp { display: grid; gap: 1px; }
.lay-grp h6 { margin: 0 0 3px; padding: 0 8px; font-size: 11.5px; font-weight: 500; color: var(--faint); }
.lay-item { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 6px; color: var(--dim); min-width: 0; }
.lay-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lay-item:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.lay-item.on { background: var(--sel); color: var(--ink); font-weight: 500; }

.lay-side-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.lay-ghb { display: block; }   /* the full-width Games Hub banner (includes/games-hub-banner.php) */
.lay-me {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px;
    background: none; cursor: pointer; text-align: left; color: var(--dim);
}
.lay-me:hover, .lay-me[aria-expanded="true"] { background: var(--hover); }
.lay-me-txt { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.lay-me-txt b { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lay-me-txt span { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lay-me-chev { transform: rotate(180deg); color: var(--faint); }
.lay-av {
    width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
    background: linear-gradient(135deg, #7aa7ff, #b58cff); color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
}
.lay-av-lg { width: 32px; height: 32px; font-size: 12px; }
/* account avatar drawn by assets/layout/account-avatar.js (the Games Hub character); the initials stay underneath it */
.lay-av.has-avatar, .adm-av.has-avatar { overflow: hidden; padding: 0; background: #f0d49f; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.lay-av.has-avatar > svg, .adm-av.has-avatar > svg { display: block; width: 100%; height: 100%; }

.lay-body { min-width: 0; display: flex; flex-direction: column; }
.lay-bar {
    position: sticky; top: 0; z-index: 30; height: var(--bar-h); flex: none;
    display: flex; align-items: center; gap: 6px; padding: 0 16px 0 24px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--line);
}
.lay-crumb { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--dim); }
.lay-crumb-sep { color: var(--line2); }
.lay-title { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lay-sp { flex: 1; }

.lay-btn {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 6px;
    border: 1px solid var(--line2); background: var(--bg); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.lay-btn:hover { background: var(--hover); }
.lay-btn-ghost { border-color: transparent; background: none; color: var(--dim); }
.lay-btn-ghost:hover { color: var(--ink); }
.lay-btn[aria-pressed="true"] { background: var(--sel); color: var(--ink); }
.lay-icon-btn {
    display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px;
    background: none; color: var(--dim); cursor: pointer; flex: none;
}
.lay-icon-btn:hover { background: var(--hover); color: var(--ink); }

/* theme toggle shows the icon of the theme you would switch to */
.lay-moon { display: block; }
.lay-sun { display: none; }
:root[data-theme="dark"] .lay-sun { display: block; }
:root[data-theme="dark"] .lay-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .lay-sun { display: block; }
    :root:not([data-theme]) .lay-moon { display: none; }
}

.lay-main { flex: 1; min-width: 0; outline: none; }
.lay-content { padding: 28px 32px 56px; }
.lay-wide .lay-content { padding: 0; }   /* layout_start(['wide' => true]): the page sizes itself */

/* ---------- account menu ---------- */
.lay-menu {
    position: fixed; z-index: 120; width: 264px; padding: 6px;
    background: var(--bg); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow);
}
.lay-menu-head { display: flex; gap: 10px; padding: 8px 8px 10px; }
.lay-menu-id { display: grid; gap: 2px; min-width: 0; }
.lay-menu-id b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lay-menu-id .lay-faint { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.lay-role { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.lay-menu-usage { display: flex; justify-content: space-between; padding: 8px; margin: 0 2px 4px; border: 1px solid var(--line); border-radius: 6px; color: var(--dim); font-size: 12px; }
.lay-menu-sec { display: grid; gap: 1px; padding: 4px 0; border-top: 1px solid var(--line); }
.lay-menu-item {
    display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px;
    background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.lay-menu-item:hover, .lay-menu-item:focus-visible { background: var(--hover); text-decoration: none; }
.lay-menu-item .lay-i { color: var(--dim); }
.lay-menu-item span { flex: 1; }
.lay-menu-item .lay-r { color: var(--faint); width: 14px; height: 14px; }
.lay-danger, .lay-danger .lay-i { color: var(--bad) !important; }

/* ---------- command palette ---------- */
.lay-pal-scrim {
    position: fixed; inset: 0; z-index: 200; background: var(--scrim);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    display: flex; justify-content: center; align-items: flex-start; padding: 92px 16px 16px;
}
.lay-pal {
    width: 600px; max-width: 100%; max-height: calc(100vh - 120px); display: flex; flex-direction: column;
    background: var(--bg); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.lay-pal-in { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); color: var(--faint); flex: none; }
.lay-pal-in input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 0; outline: none; box-shadow: none; background: none; color: var(--ink); font: inherit; font-size: 15px; }
.lay-pal-in input::placeholder { color: var(--faint); }
.lay-pal-list { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.lay-pal-list h6 { margin: 6px 10px 4px; font-size: 11.5px; font-weight: 500; color: var(--faint); }
.lay-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--dim); cursor: pointer; }
.lay-opt b { color: var(--ink); font-weight: 500; white-space: nowrap; }
.lay-opt .lay-opt-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--faint); min-width: 0; }
.lay-opt.on { background: var(--sel); }
.lay-opt .lay-opt-r { margin-left: auto; font-size: 12px; color: var(--faint); display: flex; gap: 4px; align-items: center; flex: none; padding-left: 8px; }
.lay-opt mark { background: none; color: var(--accent); font-weight: 600; }
.lay-pal-empty { padding: 22px 12px; text-align: center; color: var(--faint); }
.lay-pal-foot { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--sub); color: var(--faint); font-size: 12px; flex: none; }
.lay-pal-foot span { display: inline-flex; gap: 4px; align-items: center; }

/* ---------- impersonation banner ---------- */
.lay-app .impersonation-indicator {
    position: fixed; right: 16px; bottom: 16px; z-index: 150; display: flex; align-items: center; gap: 10px;
    max-width: min(360px, calc(100vw - 32px)); padding: 10px 12px; border-radius: 8px;
    background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); box-shadow: var(--shadow);
}
.lay-app .impersonation-indicator strong, .lay-app .impersonation-indicator small { display: block; }
.lay-app .impersonation-indicator small { opacity: .8; }
.lay-app .impersonation-icon { width: 24px; height: 24px; flex: none; }
.lay-app .impersonation-indicator a { margin-left: auto; padding: 4px 9px; border-radius: 6px; border: 1px solid currentColor; color: inherit; font-weight: 600; }

/* ---------- cookie banner from includes/gdpr.php, restyled to the tokens ---------- */
.lay-app .gdpr-banner {
    top: auto !important; bottom: 16px !important; right: 16px !important; left: auto !important;
    width: min(420px, calc(100vw - 32px)) !important; max-width: none !important; transform: none !important;
    background: var(--bg) !important; color: var(--ink) !important; border: 1px solid var(--line2) !important;
    border-radius: 10px !important; box-shadow: var(--shadow) !important; padding: 14px 16px !important;
}
.lay-app .gdpr-banner .gdpr-content { display: grid !important; gap: 12px !important; }
.lay-app .gdpr-banner .gdpr-text strong { color: var(--ink) !important; font-size: 13px !important; font-weight: 600 !important; }
.lay-app .gdpr-banner .gdpr-text p { color: var(--dim) !important; font-size: 12.5px !important; margin: 4px 0 0 !important; line-height: 1.5 !important; }
.lay-app .gdpr-banner .gdpr-text a { color: var(--accent) !important; }
.lay-app .gdpr-banner .gdpr-buttons { display: flex !important; gap: 8px !important; }
.lay-app .gdpr-banner .gdpr-btn {
    flex: 1 !important; min-width: 0 !important; height: 32px !important; padding: 0 12px !important; border-radius: 6px !important;
    font: inherit !important; font-weight: 500 !important; box-shadow: none !important; cursor: pointer;
    background: var(--bg) !important; color: var(--ink) !important; border: 1px solid var(--line2) !important;
}
.lay-app .gdpr-banner .gdpr-btn-accept { background: var(--pri) !important; color: var(--pri-ink) !important; border-color: var(--pri) !important; }

/* ---------- cursors ----------
   No native special cursors (no cell, crosshair, grab, move, help, wait, not-allowed...): elements use default or
   pointer, disabled controls default plus dimming. Where a special cursor really helps (drag handles, panning,
   resizers, connection points) use these, drawn in the theme ink with a hotspot, falling back to the arrow:
   cursor: var(--cur-grab, default). Names: grab, grabbing, move, nwse, nesw, crosshair.
   tests/no_native_ui.mjs fails on a native one. */
:root {
    --cur-grab: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 13V8.5a1.5 1.5 0 0 1 3 0V11V6.5a1.5 1.5 0 0 1 3 0V11V7.5a1.5 1.5 0 0 1 3 0V11.5V9.5a1.5 1.5 0 0 1 3 0V15c0 3.5-2.5 6-6 6h-1c-3 0-4.5-1.5-5.5-3.5L4.3 13.8a1.4 1.4 0 0 1 2.2-1.7z' fill='%23ffffff' stroke='%23171717' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
    --cur-grabbing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 13v-1.5a1.5 1.5 0 0 1 3 0v.5v-1.5a1.5 1.5 0 0 1 3 0v1.5v-1.5a1.5 1.5 0 0 1 3 0v1.5v-.5a1.5 1.5 0 0 1 3 0V15c0 3.5-2.5 6-6 6h-1c-3 0-4.5-1.5-5.5-3.5L4.3 13.8a1.4 1.4 0 0 1 2.2-1.7z' fill='%23ffffff' stroke='%23171717' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 13, default;
    --cur-move: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3.5 3.5h-2.25v5.25h5.25V8.5L22 12l-3.5 3.5v-2.25h-5.25v5.25h2.25L12 22l-3.5-3.5h2.25v-5.25H5.5v2.25L2 12l3.5-3.5v2.25h5.25V5.5H8.5z' fill='%23ffffff' stroke='%23171717' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
    --cur-nwse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M2 12l4.5-4.5v3h11v-3L22 12l-4.5 4.5v-3h-11v3z' transform='rotate(45 12 12)' fill='%23ffffff' stroke='%23171717' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
    --cur-nesw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M2 12l4.5-4.5v3h11v-3L22 12l-4.5 4.5v-3h-11v3z' transform='rotate(-45 12 12)' fill='%23ffffff' stroke='%23171717' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
    --cur-crosshair: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-linecap='round'%3E%3Cpath d='M12 3v6M12 15v6M3 12h6M15 12h6' stroke='%23ffffff' stroke-width='4'/%3E%3Cpath d='M12 3v6M12 15v6M3 12h6M15 12h6' stroke='%23171717' stroke-width='1.75'/%3E%3Ccircle cx='12' cy='12' r='1.6' fill='%23171717' stroke='%23ffffff' stroke-width='1'/%3E%3C/svg%3E") 12 12, default;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --cur-grab: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 13V8.5a1.5 1.5 0 0 1 3 0V11V6.5a1.5 1.5 0 0 1 3 0V11V7.5a1.5 1.5 0 0 1 3 0V11.5V9.5a1.5 1.5 0 0 1 3 0V15c0 3.5-2.5 6-6 6h-1c-3 0-4.5-1.5-5.5-3.5L4.3 13.8a1.4 1.4 0 0 1 2.2-1.7z' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
        --cur-grabbing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 13v-1.5a1.5 1.5 0 0 1 3 0v.5v-1.5a1.5 1.5 0 0 1 3 0v1.5v-1.5a1.5 1.5 0 0 1 3 0v1.5v-.5a1.5 1.5 0 0 1 3 0V15c0 3.5-2.5 6-6 6h-1c-3 0-4.5-1.5-5.5-3.5L4.3 13.8a1.4 1.4 0 0 1 2.2-1.7z' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 13, default;
        --cur-move: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3.5 3.5h-2.25v5.25h5.25V8.5L22 12l-3.5 3.5v-2.25h-5.25v5.25h2.25L12 22l-3.5-3.5h2.25v-5.25H5.5v2.25L2 12l3.5-3.5v2.25h5.25V5.5H8.5z' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
        --cur-nwse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M2 12l4.5-4.5v3h11v-3L22 12l-4.5 4.5v-3h-11v3z' transform='rotate(45 12 12)' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
        --cur-nesw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M2 12l4.5-4.5v3h11v-3L22 12l-4.5 4.5v-3h-11v3z' transform='rotate(-45 12 12)' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
        --cur-crosshair: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-linecap='round'%3E%3Cpath d='M12 3v6M12 15v6M3 12h6M15 12h6' stroke='%230a0a0a' stroke-width='4'/%3E%3Cpath d='M12 3v6M12 15v6M3 12h6M15 12h6' stroke='%23ededed' stroke-width='1.75'/%3E%3Ccircle cx='12' cy='12' r='1.6' fill='%23ededed' stroke='%230a0a0a' stroke-width='1'/%3E%3C/svg%3E") 12 12, default;
    }
}
:root[data-theme="dark"] {
    --cur-grab: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 13V8.5a1.5 1.5 0 0 1 3 0V11V6.5a1.5 1.5 0 0 1 3 0V11V7.5a1.5 1.5 0 0 1 3 0V11.5V9.5a1.5 1.5 0 0 1 3 0V15c0 3.5-2.5 6-6 6h-1c-3 0-4.5-1.5-5.5-3.5L4.3 13.8a1.4 1.4 0 0 1 2.2-1.7z' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
    --cur-grabbing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M7 13v-1.5a1.5 1.5 0 0 1 3 0v.5v-1.5a1.5 1.5 0 0 1 3 0v1.5v-1.5a1.5 1.5 0 0 1 3 0v1.5v-.5a1.5 1.5 0 0 1 3 0V15c0 3.5-2.5 6-6 6h-1c-3 0-4.5-1.5-5.5-3.5L4.3 13.8a1.4 1.4 0 0 1 2.2-1.7z' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 13, default;
    --cur-move: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l3.5 3.5h-2.25v5.25h5.25V8.5L22 12l-3.5 3.5v-2.25h-5.25v5.25h2.25L12 22l-3.5-3.5h2.25v-5.25H5.5v2.25L2 12l3.5-3.5v2.25h5.25V5.5H8.5z' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
    --cur-nwse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M2 12l4.5-4.5v3h11v-3L22 12l-4.5 4.5v-3h-11v3z' transform='rotate(45 12 12)' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
    --cur-nesw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M2 12l4.5-4.5v3h11v-3L22 12l-4.5 4.5v-3h-11v3z' transform='rotate(-45 12 12)' fill='%230a0a0a' stroke='%23ededed' stroke-width='1.5' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E") 12 12, default;
    --cur-crosshair: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke-linecap='round'%3E%3Cpath d='M12 3v6M12 15v6M3 12h6M15 12h6' stroke='%230a0a0a' stroke-width='4'/%3E%3Cpath d='M12 3v6M12 15v6M3 12h6M15 12h6' stroke='%23ededed' stroke-width='1.75'/%3E%3Ccircle cx='12' cy='12' r='1.6' fill='%23ededed' stroke='%230a0a0a' stroke-width='1'/%3E%3C/svg%3E") 12 12, default;
}

/* ---------- phone and narrow screens: sidebar behind a menu button ---------- */
@media (max-width: 860px) {
    .lay-shell { grid-template-columns: minmax(0, 1fr); }
    .lay-side {
        position: fixed; left: 0; top: 0; bottom: 0; height: auto; width: min(280px, 86vw);
        transform: translateX(-102%); transition: transform .2s ease; box-shadow: none; z-index: 110;
    }
    body.lay-side-open .lay-side { transform: none; box-shadow: var(--shadow); }
    .lay-scrim { position: fixed; inset: 0; z-index: 105; background: var(--scrim); }
    .lay-icon-btn.lay-side-close, .lay-icon-btn.lay-menu-btn, .lay-icon-btn.lay-palette-btn { display: inline-grid; }
    .lay-bar { padding: 0 8px 0 8px; }
    .lay-content { padding: 20px 16px 48px; }
    .lay-crumb-grp, .lay-crumb-sep { display: none; }
    .lay-hide-sm { display: none; }
    .lay-pal-scrim { padding-top: 56px; }
    .lay-pal-foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .lay-side { transition: none; }
}

/* ---------- motion tokens (used by assets/layout/motion.css and motion.js) ----------
   Three durations and three curves. Reduced motion, and html.lay-motion-off (set by tests or motion.js), cut every
   duration to zero, so anything built on the tokens becomes an instant change. */
:root {
    --mo-fast: 120ms; --mo-base: 200ms; --mo-slow: 320ms;
    --mo-ease: cubic-bezier(.2, 0, 0, 1);          /* standard: between two resting states */
    --mo-ease-out: cubic-bezier(0, 0, .2, 1);      /* enter / decelerate: things arriving */
    --mo-ease-in: cubic-bezier(.4, 0, 1, 1);       /* exit / accelerate: things leaving */
    --mo-stagger: 24ms;
}
@media (prefers-reduced-motion: reduce) {
    :root { --mo-fast: 0ms; --mo-base: 0ms; --mo-slow: 0ms; --mo-stagger: 0ms; }
}
html.lay-motion-off { --mo-fast: 0ms; --mo-base: 0ms; --mo-slow: 0ms; --mo-stagger: 0ms; }

/* ---------- hover tooltip (assets/tooltip.js, loaded on every layout page through includes/gdpr.php) ----------
   One fixed layer in the body: tooltip.js fills it with the target's data-tooltip or title text (it moves a title into
   data-native-title on first hover, so the browser's own tooltip never shows beside it) and places it with transform.
   Fixed and pointer-events none, so it never widens the page or catches the pointer; inverse colours in both themes;
   it only fades, on the motion tokens (instant under reduced motion or html.lay-motion-off). */
.app-tooltip-layer {
    position: fixed; left: 0; top: 0; z-index: 2147483000; pointer-events: none;
    width: max-content; max-width: min(320px, calc(100vw - 16px));
    padding: 5px 8px; border-radius: 6px;
    background: var(--pri); color: var(--pri-ink); box-shadow: var(--shadow);
    font: 500 12px/1.4 var(--f-sans); text-align: center; white-space: normal; overflow-wrap: anywhere;
    opacity: 0; transform: translate3d(-9999px, -9999px, 0);
    transition: opacity var(--mo-fast) var(--mo-ease-in);
}
.app-tooltip-layer.is-visible { opacity: 1; transition-timing-function: var(--mo-ease-out); }
.app-tooltip-layer:empty { display: none; }
.app-tooltip-layer::after {
    content: ""; position: absolute; left: var(--tooltip-arrow-left, 50%); width: 8px; height: 8px;
    background: inherit; border-radius: 1px; transform: translateX(-50%) rotate(45deg);
}
.app-tooltip-layer[data-placement="top"]::after { bottom: -4px; }
.app-tooltip-layer[data-placement="bottom"]::after { top: -4px; }
