/* Path: assets/nav.css
 * Version: 1.0.11
 * Last Modified: 2026-10-13
 * Changelog:
 * - 1.0.11 (2026-10-13): One :root custom property --wqd-nav-control-size (44px) for the nav control floor, shared with system-status.php (gate nits, card 3.59.34).
 * - 1.0.10 (2026-10-12, Card 3.59.32 v1.1, backlog #70): .menu-item focus-visible ring (drawn inside, .menu-items clips overflow) and a distinct teal current-page item incl. hover.
 * - 1.0.9 (2026-10-11, release 3.59.31, backlog #47): .menu-item transition narrowed from "all" to opacity, transform, box-shadow, background.
 * - 1.0.8 (2026-09-30, Card 3.59.22 amendment v2e): Scope last-update wrapping, preserve manual subtitle segments, and wrap narrow-screen header actions.
 * - 1.0.7 (2026-09-30, Card 3.59.22 amendment v2c): Apply explicit page-header layout hooks.
 * - 1.0.6 (2026-09-30, Card 3.59.22 amendment v2b): Allow header titles and action groups to share or wrap rows without overflow.
 * - 1.0.5 (2026-09-30, Card 3.59.22 amendment v2): Hide bar labels below 1024px and protect header text from nav compression.
 * - 1.0.4 (2026-09-30, Card 3.59.22): Place the bar cleanly in page headers with dark and light tones.
 * - 1.0.3 (2026-09-30): Delay hidden menu visibility until collapse and reveal for keyboard-visible focus.
 * - 1.0.2 (2026-09-30): Fix PIN input contrast, keyboard menu reveal, and mobile/current-item navigation styles.
 * - 1.0.1 (2026-09-30): Make linked stylesheet valid CSS and reset legacy nav positioning for the bar.
 * - 1.0.0 (2026-09-30, Card 3.59.20): Move kiosk rules and add shared navigation bar styles.
 */
:root { --wqd-nav-control-size: 44px; }
        .vertical-menu-container {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 9999;
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 0.5rem;
            /* Hidden by default, show on hover */
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        /* Hover zone to trigger menu visibility */
        .menu-hover-zone {
            position: fixed;
            top: 0;
            right: 0;
            width: 120px;
            height: 120px;
            z-index: 9998;
        }

        .menu-hover-zone:hover + .vertical-menu-container,
        .vertical-menu-container:hover,
        .vertical-menu-container:has(:focus-visible),
        .vertical-menu-container:has(.menu-items.active) {
            opacity: 1;
        }

        .menu-toggle {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #3b82f6, #1e40af);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
            cursor: pointer;
            transition: all 0.3s ease;
            border: none;
        }

        .menu-toggle:hover {
            transform: scale(1.05);
            box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
        }

        .menu-toggle.active {
            background: linear-gradient(135deg, #ef4444, #dc2626);
        }

        .menu-toggle svg {
            transition: transform 0.3s ease;
        }

        .menu-toggle.active svg {
            transform: rotate(90deg);
        }

        .menu-items {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            max-height: 0;
            overflow: hidden;
            visibility: hidden;
            transition: max-height 0.3s ease, visibility 0s linear 0.3s;
        }

        .menu-items.active {
            max-height: 400px;
            visibility: visible;
            transition-delay: 0s;
        }

        .menu-item {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem 1.25rem;
            background: linear-gradient(135deg, #1e293b, #334155);
            border-radius: 12px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
            cursor: pointer;
            transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
            text-decoration: none;
            color: white;
            min-width: 200px;
            opacity: 0;
            transform: translateX(20px);
        }

        .menu-items.active .menu-item {
            opacity: 1;
            transform: translateX(0);
        }

        .menu-items.active .menu-item:nth-child(1) { transition-delay: 0.05s; }
        .menu-items.active .menu-item:nth-child(2) { transition-delay: 0.1s; }
        .menu-items.active .menu-item:nth-child(3) { transition-delay: 0.15s; }
        .menu-items.active .menu-item:nth-child(4) { transition-delay: 0.2s; }
        .menu-items.active .menu-item:nth-child(5) { transition-delay: 0.25s; }

        .menu-item:hover {
            background: linear-gradient(135deg, #3b82f6, #1e40af);
            box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
            transform: translateX(-5px);
        }

        /* .menu-items has overflow:hidden, so the ring is drawn INSIDE the item (negative offset) */
        .menu-item:focus-visible {
            outline: 3px solid #fbbf24;
            outline-offset: -3px;
        }

        .menu-item[aria-current="page"] {
            cursor: default;
            background: linear-gradient(135deg, #0f766e, #115e59);
            box-shadow: inset 4px 0 0 #5eead4, 0 4px 15px rgba(0, 0, 0, 0.3);
        }

        .menu-item[aria-current="page"]:hover {
            background: linear-gradient(135deg, #0f766e, #115e59);
            box-shadow: inset 4px 0 0 #5eead4, 0 4px 15px rgba(0, 0, 0, 0.3);
            transform: translateX(0);
        }

        .menu-item-icon {
            font-size: 24px;
            flex-shrink: 0;
        }

        .menu-item-label {
            font-size: 16px;
            font-family: 'Sarabun', sans-serif;
            font-weight: 600;
            white-space: nowrap;
        }
        .pin-modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 10000;
            justify-content: center;
            align-items: center;
        }

        .pin-modal-overlay.active {
            display: flex;
        }

        .pin-modal {
            background: white;
            padding: 2rem;
            border-radius: 1rem;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
            max-width: 400px;
            width: 90%;
        }

        .pin-modal h2 {
            font-size: 1.5rem;
            font-weight: 700;
            color: #1e293b;
            margin: 0 0 1rem 0;
            text-align: center;
        }

        .pin-modal p {
            color: #64748b;
            margin: 0 0 1.5rem 0;
            text-align: center;
        }

        .pin-input-single {
            width: 100%;
            padding: 15px 20px;
            font-size: 24px;
            font-family: 'Courier New', monospace;
            text-align: center;
            letter-spacing: 8px;
            border: 2px solid #cbd5e1;
            border-radius: 12px;
            outline: none;
            transition: border-color 0.2s;
            color: #1e293b;
            background: white;
        }
        .pin-input-single:focus {
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
        }
        .pin-input-container {
            display: flex;
            gap: 0.5rem;
            justify-content: center;
            margin-bottom: 1.5rem;
        }

        .pin-digit {
            width: 50px;
            height: 60px;
            font-size: 2rem;
            text-align: center;
            border: 2px solid #e2e8f0;
            border-radius: 0.5rem;
            font-family: 'Sarabun', monospace;
            font-weight: 600;
            transition: all 0.2s ease;
            color: #1e293b;
            background: white;
            -webkit-text-security: disc;
        }

        .pin-digit:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .pin-error {
            color: #ef4444;
            text-align: center;
            margin-bottom: 1rem;
            font-size: 0.875rem;
            min-height: 1.25rem;
        }

        .pin-buttons {
            display: flex;
            gap: 0.5rem;
        }

        .pin-button {
            flex: 1;
            padding: 0.75rem;
            border-radius: 0.5rem;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            border: none;
            font-family: 'Sarabun', sans-serif;
        }

        .pin-button-submit {
            background: linear-gradient(135deg, #3b82f6, #1e40af);
            color: white;
        }

        .pin-button-submit:hover {
            box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
        }

        .pin-button-cancel {
            background: #f1f5f9;
            color: #64748b;
        }

        .pin-button-cancel:hover {
            background: #e2e8f0;
        }
.wqd-header-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}
.wqd-header-title { flex: 1 1 0; min-width: min-content; }
@media (min-width: 640px) {
    .wqd-header-title h1 { white-space: nowrap; }
}
.wqd-header-title p { white-space: normal; }
.wqd-header-actions {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}
.wqd-header-actions #last-update { white-space: nowrap; }
.wqd-nowrap { white-space: nowrap; }
.wqd-nav-bar:not(.visible) {
    position: relative; z-index: 20; display: flex; justify-content: flex-end;
    align-items: center; flex-wrap: wrap; gap: 0.5rem; margin: 0; max-width: 100%;
    top: auto; right: auto; bottom: auto; left: auto; width: auto; transform: none;
    transition: none;
}
.wqd-nav-bar .wqd-nav-item {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-height: var(--wqd-nav-control-size); padding: 0.5rem 0.85rem; border-radius: 0.6rem;
    background: #1e293b; color: #fff; text-decoration: none;
    font-family: 'Sarabun', sans-serif; font-weight: 600; white-space: nowrap;
}
.wqd-nav-tone-dark .wqd-nav-item { background: rgba(255, 255, 255, 0.14); color: #fff; }
.wqd-nav-tone-dark .wqd-nav-item:hover { background: rgba(255, 255, 255, 0.24); }
.wqd-nav-tone-dark .wqd-nav-item[aria-current="page"] { background: #fff; color: #1e293b; cursor: default; }
.wqd-nav-tone-light .wqd-nav-item { background: #1e293b; color: #fff; }
.wqd-nav-tone-light .wqd-nav-item:hover { background: #334155; }
.wqd-nav-tone-light .wqd-nav-item[aria-current="page"] { background: #2563eb; color: #fff; cursor: default; }
.wqd-nav-bar .menu-item-icon { font-size: 1.2rem; }
.wqd-nav-bar .menu-item-label { font-size: 0.875rem; }
@media (max-width: 639px) {
    .wqd-header-actions { flex-basis: 100%; }
    .wqd-nav-bar:not(.visible) { gap: 0.35rem; }
    .wqd-nav-bar .wqd-nav-item { width: var(--wqd-nav-control-size); min-width: var(--wqd-nav-control-size); padding: 0.4rem; }
    .wqd-nav-bar .menu-item-label { display: none; }
}
@media (max-width: 1023px) {
    .wqd-nav-bar .menu-item-label { display: none; }
}
@media print { .wqd-nav, .menu-hover-zone { display: none !important; } }
