/* ============================================================================
   OBAY.PMS — PlantEdge Local Portal Design System
   Canonical Slate-Navy (#081824 -> #194563) + Antique Bronze (#937039 -> #d6ba84)
   Desaturated Sage / Ochre / Terracotta semantics · Light & Dark parity
   Zero blur filters · GPU-composited motion · Strict CSP ('self' only)
   ============================================================================ */

/* ── 0. Local Cairo Fonts (Arabic + Latin) ────────────────────────────────── */
@font-face {
    font-family: 'Cairo';
    src: url('/fonts/cairo-arabic-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('/fonts/cairo-arabic-600.woff2') format('woff2');
    font-weight: 500 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('/fonts/cairo-arabic-700.woff2') format('woff2');
    font-weight: 700 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('/fonts/cairo-latin-400.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('/fonts/cairo-latin-600.woff2') format('woff2');
    font-weight: 500 600;
    font-style: normal;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('/fonts/cairo-latin-700.woff2') format('woff2');
    font-weight: 700 900;
    font-style: normal;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    font-display: swap;
}

/* ── 1. Canonical Design Tokens ───────────────────────────────────────────── */
:root {
    /* Slate-Navy Primary Scale */
    --pe-slate-950: #081824;
    --pe-slate-900: #0d2435;
    --pe-slate-800: #12334a;
    --pe-slate-700: #194563;
    --pe-slate-600: #2b5d7d;
    --pe-slate-500: #467899;
    --pe-slate-300: #8fb4cc;
    --pe-slate-200: #bed6e6;
    --pe-slate-100: #dcebf5;
    --pe-slate-50: #eff6fb;

    /* Antique Bronze Secondary Scale */
    --pe-bronze-700: #7c5c2c;
    --pe-bronze-600: #937039;
    --pe-bronze-500: #b08948;
    --pe-bronze-400: #c5a162;
    --pe-bronze-300: #d6ba84;
    --pe-bronze-100: #f6ecda;
    --pe-bronze-50: #fbf6ec;

    /* Desaturated Semantic Scales */
    --pe-sage-700: #275443;
    --pe-sage-600: #356e58;
    --pe-sage-500: #4a8a71;
    --pe-sage-400: #6ea890;
    --pe-sage-bg: rgba(53, 110, 88, 0.10);
    --pe-sage-border: rgba(53, 110, 88, 0.28);

    --pe-ochre-700: #7a5820;
    --pe-ochre-600: #8f692a;
    --pe-ochre-500: #a87e3a;
    --pe-ochre-400: #c59b52;
    --pe-ochre-bg: rgba(168, 126, 58, 0.12);
    --pe-ochre-border: rgba(168, 126, 58, 0.30);

    --pe-terra-700: #7e3737;
    --pe-terra-600: #934444;
    --pe-terra-500: #a65252;
    --pe-terra-400: #d49898;
    --pe-terra-bg: rgba(166, 82, 82, 0.10);
    --pe-terra-border: rgba(166, 82, 82, 0.28);

    --pe-navy-bg: rgba(25, 69, 99, 0.09);
    --pe-navy-border: rgba(25, 69, 99, 0.22);
    --pe-navy-fg: #12334a;

    --pe-bronze-bg: rgba(176, 137, 72, 0.13);
    --pe-bronze-border: rgba(176, 137, 72, 0.32);
    --pe-bronze-fg: #7c5c2c;

    --pe-neutral-bg: rgba(74, 94, 112, 0.10);
    --pe-neutral-border: rgba(74, 94, 112, 0.22);
    --pe-neutral-fg: #4a5e70;

    /* Light Surfaces */
    --bg-page: #f3f5f8;
    --bg-card: #ffffff;
    --bg-raised: #f5f7fa;
    --bg-hover: #edf2f6;
    --bg-topbar: #ffffff;
    --bg-input: #ffffff;

    /* Light Text Hierarchy */
    --text-primary: #102435;
    --text-secondary: #4a5e70;
    --text-muted: #6f8193;

    /* Light Borders & Elevation */
    --border-soft: rgba(16, 45, 68, 0.08);
    --border-strong: rgba(16, 45, 68, 0.16);
    --shadow-card: 0 4px 14px -4px rgba(13, 36, 53, 0.07);
    --shadow-hover: 0 12px 24px -8px rgba(13, 36, 53, 0.12);
    --shadow-pop: 0 14px 30px -8px rgba(8, 24, 36, 0.16);

    /* Typography */
    --font-sans: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
    --font-mono: 'IBM Plex Mono', 'Cairo', ui-monospace, SFMono-Regular, Consolas, monospace;

    /* Layout & Motion */
    --sidebar-width: 272px;
    --sidebar-collapsed: 76px;
    --topbar-height: 68px;
    --content-max: 1560px;
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);

    /* Legacy var bridge */
    --navy-950: var(--pe-slate-950);
    --navy-900: var(--pe-slate-900);
    --navy-800: var(--pe-slate-800);
    --navy-700: var(--pe-slate-700);
    --navy-600: var(--pe-slate-600);
    --navy-100: var(--pe-slate-100);
    --navy-50: var(--pe-slate-50);
    --gold: var(--pe-bronze-400);
    --gold-light: var(--pe-bronze-300);
    --gold-muted: var(--pe-bronze-700);
    --text: var(--text-primary);
    --muted: var(--text-muted);
    --border: var(--border-strong);
    --surface: var(--bg-page);
    --green: var(--pe-sage-600);
    --green-bg: var(--pe-sage-bg);
    --green-border: var(--pe-sage-border);
}

/* ── Dark Mode Tokens ─────────────────────────────────────────────────────── */
html[data-bs-theme="dark"],
html.dark {
    color-scheme: dark;
    --bg-page: #0a141d;
    --bg-card: #101e2b;
    --bg-raised: #162838;
    --bg-hover: #1c3246;
    --bg-topbar: #0d1a26;
    --bg-input: #0e1c28;

    --text-primary: #ecf1f6;
    --text-secondary: #9bb0c2;
    --text-muted: #708699;

    --border-soft: rgba(164, 194, 218, 0.10);
    --border-strong: rgba(164, 194, 218, 0.18);
    --shadow-card: 0 6px 18px -6px rgba(0, 0, 0, 0.38);
    --shadow-hover: 0 14px 28px -8px rgba(0, 0, 0, 0.52);
    --shadow-pop: 0 18px 36px -8px rgba(0, 0, 0, 0.62);

    --pe-sage-700: #8ec5ae;
    --pe-sage-600: #6ea890;
    --pe-sage-bg: rgba(110, 168, 144, 0.15);
    --pe-sage-border: rgba(110, 168, 144, 0.34);

    --pe-ochre-700: #e2c286;
    --pe-ochre-600: #c5a162;
    --pe-ochre-bg: rgba(197, 161, 98, 0.16);
    --pe-ochre-border: rgba(197, 161, 98, 0.35);

    --pe-terra-700: #e3adad;
    --pe-terra-600: #d49898;
    --pe-terra-bg: rgba(212, 152, 152, 0.15);
    --pe-terra-border: rgba(212, 152, 152, 0.34);

    --pe-navy-bg: rgba(99, 150, 184, 0.16);
    --pe-navy-border: rgba(157, 194, 220, 0.28);
    --pe-navy-fg: #9dc2dc;

    --pe-bronze-bg: rgba(197, 161, 98, 0.16);
    --pe-bronze-border: rgba(197, 161, 98, 0.36);
    --pe-bronze-fg: #e2c48c;

    --pe-neutral-bg: rgba(155, 176, 194, 0.13);
    --pe-neutral-border: rgba(155, 176, 194, 0.26);
    --pe-neutral-fg: #b8cad9;
}

/* ── 2. Base Reset & Typography ───────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    overflow-x: clip;
    scrollbar-gutter: stable;
    background-color: var(--bg-page);
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--bg-page);
    background-image:
        radial-gradient(640px circle at 84% 6%, rgba(176, 137, 72, 0.06), transparent 65%),
        radial-gradient(720px circle at 14% 12%, rgba(25, 69, 99, 0.07), transparent 65%);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-feature-settings: 'ss01';
    font-size: 14px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

html[data-bs-theme="dark"] body,
html.dark body {
    background-image:
        radial-gradient(640px circle at 84% 6%, rgba(176, 137, 72, 0.08), transparent 65%),
        radial-gradient(720px circle at 14% 12%, rgba(43, 93, 125, 0.11), transparent 65%);
}

[dir="rtl"] * {
    letter-spacing: 0 !important;
}

::selection {
    background-color: rgba(197, 161, 98, 0.34);
    color: var(--text-primary);
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

h1, h2, h3, h4, p {
    margin: 0;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 2px solid rgba(176, 137, 72, 0.65);
    outline-offset: 2px;
}

bdi[dir="ltr"],
.dir-ltr,
.pe-mono,
.edge-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    direction: ltr;
    unicode-bidi: isolate;
}

.pe-num,
.edge-number {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    direction: ltr;
    unicode-bidi: isolate;
}

[dir="rtl"] .icon-dir {
    transform: scaleX(-1);
}

/* Slim Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: rgba(74, 94, 112, 0.28);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background-color: rgba(74, 94, 112, 0.48);
}
html[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background-color: rgba(155, 176, 194, 0.22);
}

/* ── 3. Circular Theme Reveal (View Transitions API) ──────────────────────── */
::view-transition-old(root),
::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
}

::view-transition-old(root) {
    z-index: 1;
}

::view-transition-new(root) {
    z-index: 9999;
}

html.pe-theme-vt-active,
html.pe-theme-vt-active * {
    transition: none !important;
}

@keyframes peThemeIconSpin {
    from {
        transform: rotate(-90deg) scale(0.7);
        opacity: 0.4;
    }
    to {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
}

.pe-theme-icon-pop {
    animation: peThemeIconSpin 360ms var(--ease-bounce);
}

/* ── 4. App Shell: Full-Height Fixed Sidebar + Sticky Opaque Topbar ───────── */
.pe-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    min-width: 0;
}

.pe-shell.is-guest {
    flex-direction: column;
}

/* Deep Slate-Navy Sidebar (272px) */
.pe-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: var(--sidebar-width);
    background: linear-gradient(185deg, #0e283b 0%, #0a1f2e 58%, #081824 100%);
    border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 4px 0 24px -6px rgba(4, 16, 26, 0.28);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: width 260ms var(--ease-spring), transform 260ms var(--ease-spring);
    overflow: hidden;
    color: #cde0ee;
}

.pe-sidebar-head {
    height: var(--topbar-height);
    padding-inline: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.pe-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.pe-brand-squircle {
    width: 40px;
    height: 40px;
    border-radius: 14px 14px 14px 4px;
    background: linear-gradient(135deg, var(--pe-bronze-400) 0%, var(--pe-bronze-500) 58%, var(--pe-bronze-600) 100%);
    color: #081824;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 10px 20px -10px rgba(197, 161, 98, 0.65);
}

.pe-brand-squircle svg {
    width: 22px;
    height: 22px;
}

.pe-brand-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    direction: ltr;
    text-align: left;
}

.pe-brand-title {
    font-size: 15px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.15;
    white-space: nowrap;
}

.pe-brand-dot {
    color: var(--pe-bronze-300);
}

.pe-brand-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    color: #8fb4cc;
    margin-top: 2px;
    white-space: nowrap;
}

.pe-brand-pill {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(197, 161, 98, 0.14);
    border: 1px solid rgba(197, 161, 98, 0.34);
    color: var(--pe-bronze-300);
    flex-shrink: 0;
}

/* Sidebar Quick Filter */
.pe-sidebar-filter {
    padding: 12px 14px 8px;
    flex-shrink: 0;
}

.pe-sidebar-filter-box {
    position: relative;
    display: flex;
    align-items: center;
    height: 36px;
    padding-inline: 10px;
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid rgba(255, 255, 255, 0.09);
    transition: border-color 180ms ease, background-color 180ms ease;
}

.pe-sidebar-filter-box:focus-within {
    border-color: rgba(197, 161, 98, 0.58);
    background: rgba(255, 255, 255, 0.085);
}

.pe-sidebar-filter-ico {
    width: 15px;
    height: 15px;
    color: #7ea5c1;
    flex-shrink: 0;
    margin-inline-end: 8px;
}

.pe-sidebar-filter-input {
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    color: #eef5fa;
    font-size: 12.5px;
    font-weight: 600;
    outline: none;
    padding-inline-end: 26px;
}

.pe-sidebar-filter-input::placeholder {
    color: #7b9db6;
    font-weight: 500;
}

.pe-sidebar-keycap {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    min-width: 20px;
    padding-inline: 5px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #9dc0d8;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.pe-sidebar-filter-clear {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: #d8e7f2;
    font-size: 13px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pe-sidebar-filter-clear:hover {
    background: rgba(197, 161, 98, 0.25);
    color: #ffffff;
}

/* Sidebar Scroll Nav + Dual Floating Gliding Pills */
.pe-sidebar-nav {
    position: relative;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    padding: 6px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pe-sidebar-nav::-webkit-scrollbar {
    display: none;
}

.pe-nav-hover-glide {
    position: absolute;
    top: 0;
    inset-inline: 12px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.065);
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    transition: transform 240ms var(--ease-spring), height 200ms var(--ease-spring), opacity 180ms ease;
    will-change: transform, opacity;
    z-index: 0;
}

.pe-nav-active-glide {
    position: absolute;
    top: 0;
    inset-inline: 12px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(100deg, rgba(176, 137, 72, 0.22) 0%, rgba(70, 120, 153, 0.16) 100%);
    border: 1px solid rgba(197, 161, 98, 0.38);
    box-shadow: 0 10px 22px -10px rgba(0, 0, 0, 0.44);
    pointer-events: none;
    opacity: 0;
    transform: translate3d(0, 0, 0);
    transition: transform 420ms cubic-bezier(0.34, 1.32, 0.64, 1), height 240ms var(--ease-spring), opacity 200ms ease;
    will-change: transform;
    z-index: 1;
}

.pe-nav-active-glide::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 7px;
    bottom: 7px;
    width: 3.5px;
    border-radius: 99px;
    background: linear-gradient(180deg, var(--pe-bronze-300) 0%, var(--pe-bronze-500) 100%);
}

.pe-sidebar-section {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-top: 4px;
}

.pe-sidebar-section:first-of-type {
    margin-top: 0;
}

.pe-sidebar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 3px;
    font-size: 10.5px;
    font-weight: 800;
    color: #7ea5c1;
    user-select: none;
}

.pe-sidebar-group::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
}

.pe-sidebar-link {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 12px;
    color: #bdd4e5;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
    background: transparent;
    transition: color 160ms ease;
}

.pe-sidebar-link svg {
    width: 19px;
    height: 19px;
    flex-shrink: 0;
    color: #82aac6;
    transition: color 160ms ease, transform 200ms var(--ease-spring);
}

.pe-sidebar-link:hover {
    color: #ffffff;
}

.pe-sidebar-link:hover svg {
    color: var(--pe-bronze-300);
}

.pe-sidebar-link.edge-sidebar-active {
    color: #ffffff;
    font-weight: 700;
}

.pe-sidebar-link.edge-sidebar-active svg {
    color: var(--pe-bronze-300);
}

/* Fallback active styling before JS positions gliding pill */
.pe-sidebar:not(.is-glide-ready) .pe-sidebar-link.edge-sidebar-active {
    background: linear-gradient(100deg, rgba(176, 137, 72, 0.22) 0%, rgba(70, 120, 153, 0.16) 100%);
    border-color: rgba(197, 161, 98, 0.36);
}

.pe-sidebar-empty {
    position: relative;
    z-index: 2;
    padding: 20px 12px;
    text-align: center;
    font-size: 12px;
    color: #87abc5;
}

/* Sidebar Bottom Compact Status Card */
.pe-sidebar-footer {
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.pe-sidebar-status-card {
    padding: 11px 13px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pe-sidebar-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 700;
    color: #d6e6f2;
}

.pe-sidebar-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pe-sage-400);
    flex-shrink: 0;
}

.pe-sidebar-status-bar {
    height: 5px;
    width: 100%;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.09);
    overflow: hidden;
    display: flex;
    gap: 2px;
}

.pe-sidebar-status-seg-sage {
    flex: 4;
    background: linear-gradient(90deg, var(--pe-sage-500), var(--pe-sage-400));
    border-radius: 999px;
}

.pe-sidebar-status-seg-bronze {
    flex: 1;
    background: linear-gradient(90deg, var(--pe-bronze-500), var(--pe-bronze-300));
    border-radius: 999px;
}

/* Collapsed Desktop Sidebar */
.pe-sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.pe-sidebar.collapsed .pe-brand-copy,
.pe-sidebar.collapsed .pe-brand-pill,
.pe-sidebar.collapsed .pe-sidebar-filter,
.pe-sidebar.collapsed .pe-sidebar-group,
.pe-sidebar.collapsed .edge-sidebar-text,
.pe-sidebar.collapsed .pe-sidebar-status-label,
.pe-sidebar.collapsed .pe-sidebar-status-bar {
    display: none;
}

.pe-sidebar.collapsed .pe-sidebar-head {
    justify-content: center;
    padding-inline: 0;
}

.pe-sidebar.collapsed .pe-sidebar-link {
    justify-content: center;
    padding-inline: 0;
}

.pe-sidebar.collapsed .pe-nav-hover-glide,
.pe-sidebar.collapsed .pe-nav-active-glide {
    inset-inline: 10px;
}

.pe-sidebar.collapsed .pe-sidebar-status-card {
    padding: 10px;
    align-items: center;
}

.pe-sidebar-backdrop {
    display: none;
}

/* Main Column Wrapper */
.pe-main-wrap {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 100vh;
    padding-inline-start: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    transition: padding-inline-start 260ms var(--ease-spring);
}

body.pe-sidebar-collapsed .pe-main-wrap {
    padding-inline-start: var(--sidebar-collapsed);
}

.pe-shell.is-guest .pe-main-wrap {
    padding-inline-start: 0;
}

/* Sticky 68px Opaque Topbar (ZERO backdrop-filter) */
.pe-topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background-color: var(--bg-topbar);
    border-bottom: 1px solid var(--border-soft);
    padding-inline: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 40;
    flex-shrink: 0;
}

.pe-topbar-start {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.pe-topbar-end {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pe-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--bg-raised);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 220ms var(--ease-bounce), border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.pe-icon-btn svg {
    width: 18px;
    height: 18px;
}

.pe-icon-btn:hover {
    transform: translateY(-1.5px);
    border-color: rgba(176, 137, 72, 0.45);
    color: var(--pe-bronze-600);
    background: var(--bg-card);
}

html[data-bs-theme="dark"] .pe-icon-btn:hover {
    color: var(--pe-bronze-300);
}

.pe-theme-btn:hover {
    transform: translateY(-2px) rotate(-4deg);
}

.pe-theme-ico-sun {
    display: none;
}

html[data-bs-theme="dark"] .pe-theme-ico-sun {
    display: block;
}

html[data-bs-theme="dark"] .pe-theme-ico-moon {
    display: none;
}

.pe-org-badge {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.pe-org-emblem {
    width: 38px;
    height: 38px;
    border-radius: 12px 12px 4px 12px;
    background: linear-gradient(135deg, var(--pe-slate-800), var(--pe-slate-600));
    color: #f4f7fa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 8px 18px -8px rgba(18, 51, 74, 0.45);
}

.pe-org-emblem svg {
    width: 19px;
    height: 19px;
}

.pe-org-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pe-org-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pe-org-sub {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Topbar Controls */
.pe-lang-form,
.pe-logout-form {
    margin: 0;
    display: inline-flex;
}

.pe-topbar-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding-inline: 13px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--bg-raised);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, transform 200ms var(--ease-spring);
}

.pe-topbar-pill svg {
    width: 15px;
    height: 15px;
    color: var(--text-secondary);
}

.pe-topbar-pill:hover {
    border-color: rgba(176, 137, 72, 0.45);
    background: var(--bg-card);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.pe-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding-inline: 12px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: var(--bg-raised);
    font-size: 12.5px;
    color: var(--text-primary);
    white-space: nowrap;
}

.pe-user-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pe-sage-500);
    flex-shrink: 0;
}

.pe-role-chip {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.pe-role-chip.is-admin {
    background: var(--pe-bronze-bg);
    border-color: var(--pe-bronze-border);
    color: var(--pe-bronze-fg);
}

.pe-role-chip.is-viewer {
    background: var(--pe-navy-bg);
    border-color: var(--pe-navy-border);
    color: var(--pe-navy-fg);
}

.pe-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding-inline: 13px;
    border-radius: 12px;
    border: 1px solid var(--pe-terra-border);
    background: var(--pe-terra-bg);
    color: var(--pe-terra-700);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
    transition: background-color 180ms ease, transform 200ms var(--ease-spring);
}

.pe-logout-btn svg {
    width: 15px;
    height: 15px;
}

.pe-logout-btn:hover {
    background: var(--pe-terra-500);
    color: #ffffff;
    border-color: transparent;
    transform: translateY(-1px);
}

/* Main Content Area */
.pe-content {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding: 22px 26px 36px;
    min-width: 0;
}

.pe-shell.is-guest .pe-content {
    max-width: none;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Minimal Single-Line Footer */
.pe-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-topbar);
    padding: 13px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.pe-footer-copy {
    font-weight: 600;
}

.pe-footer-ver {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-secondary);
}

/* ── 5. Page Workspace & Entrance Animation ───────────────────────────────── */
.pe-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

.pe-anim-in {
    animation: peRiseIn 200ms var(--ease-smooth) both;
}

@keyframes peRiseIn {
    from {
        opacity: 0;
        transform: translate3d(0, 8px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* ── 6. Executive Wave Hero Ribbon (.pe-hero) ─────────────────────────────── */
.pe-hero {
    position: relative;
    border-radius: 24px;
    padding: 24px 28px;
    background:
        radial-gradient(520px 260px at 88% 0%, rgba(197, 161, 98, 0.22) 0%, rgba(197, 161, 98, 0.09) 34%, rgba(197, 161, 98, 0.02) 60%, rgba(197, 161, 98, 0) 78%),
        radial-gradient(540px 280px at 12% 100%, rgba(70, 120, 153, 0.22) 0%, rgba(70, 120, 153, 0.08) 40%, rgba(70, 120, 153, 0) 76%),
        linear-gradient(130deg, #0b1e2d 0%, #102b40 48%, #163750 100%);
    color: #f4f7fa;
    overflow: hidden;
    box-shadow: 0 20px 42px -18px rgba(8, 24, 36, 0.45);
}

.pe-hero-wave {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.pe-wave-drift {
    animation: peWaveDrift 16s linear infinite;
    will-change: transform;
}

.pe-wave-drift-slow {
    animation: peWaveDrift 24s linear infinite reverse;
    will-change: transform;
}

@keyframes peWaveDrift {
    from {
        transform: translate3d(0, 0, 0);
    }
    to {
        transform: translate3d(-450px, 0, 0);
    }
}

.pe-hero-inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
}

.pe-hero-text {
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
    flex: 1 1 320px;
}

.pe-hero-eyebrow-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pe-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    width: fit-content;
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--pe-bronze-300);
    font-size: 12px;
    font-weight: 700;
}

.pe-hero-eyebrow svg {
    width: 14px;
    height: 14px;
}

.pe-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    background: rgba(6, 22, 35, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #cfe6f7;
    font-size: 12px;
    font-weight: 700;
}

.pe-hero-title {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.25;
    color: #ffffff;
}

.pe-hero-subtitle {
    font-size: 13.5px;
    font-weight: 500;
    color: #c2dcf0;
    max-width: 720px;
}

.pe-hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

/* Compact Hero Variant (keeps wave signature, surfaces workspace above the fold) */
.pe-hero.is-compact {
    padding: 18px 24px;
    border-radius: 20px;
}

.pe-hero.is-compact .pe-hero-text {
    gap: 4px;
}

.pe-hero.is-compact .pe-hero-title {
    font-size: 22px;
}

.pe-hero.is-compact .pe-hero-subtitle {
    font-size: 12.5px;
}

/* ── 7. Sculpted KPI Cards (.pe-kpi-grid / .pe-kpi-card) ──────────────────── */
.pe-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    perspective: 1100px;
}

.pe-kpi-grid.is-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pe-kpi-grid.is-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Compact Interactive KPI Strip (tight height, high-signal, clickable quick-filters) */
.pe-kpi-grid.is-compact {
    gap: 12px;
}

.pe-kpi-grid.is-compact .pe-kpi-card {
    padding: 13px 16px;
    border-radius: 16px;
    gap: 6px;
    text-decoration: none;
    color: inherit;
}

.pe-kpi-grid.is-compact .pe-kpi-card.is-selected {
    border-color: var(--kpi-border);
    box-shadow: 0 0 0 2px rgba(176, 137, 72, 0.22), var(--shadow-card);
}

.pe-kpi-grid.is-compact .pe-kpi-ico {
    width: 34px;
    height: 34px;
    border-radius: 11px 11px 4px 11px;
}

.pe-kpi-grid.is-compact .pe-kpi-ico svg {
    width: 17px;
    height: 17px;
}

.pe-kpi-grid.is-compact .pe-kpi-val {
    font-size: 24px;
    line-height: 1.1;
}

.pe-kpi-grid.is-compact .pe-kpi-label {
    font-size: 12px;
}

.pe-kpi-grid.is-compact .pe-kpi-foot {
    font-size: 11px;
    padding-top: 2px;
}

/* Unified Workspace Card (Header + Segmented Tabs + Single-Row Command Bar + Table) */
.pe-workspace-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
}

.pe-workspace-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pe-workspace-count {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    color: var(--text-secondary);
}

.pe-help-trigger {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: var(--bg-raised);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.pe-help-trigger:hover,
.pe-help-trigger.is-active {
    border-color: rgba(176, 137, 72, 0.5);
    background: var(--pe-bronze-bg);
    color: var(--pe-bronze-fg);
}

.pe-help-drawer {
    padding: 12px 18px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.pe-help-drawer p {
    margin: 0;
    max-width: 780px;
}

/* Segmented Quick-Status Tabs (works identically on <a> and <button>) */
.pe-seg-tabs {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border-radius: 12px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
}

.pe-seg-tab {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.pe-seg-tab:hover {
    color: var(--text-primary);
    background: rgba(16, 45, 68, 0.05);
}

html[data-bs-theme="dark"] .pe-seg-tab:hover {
    background: rgba(164, 194, 218, 0.08);
}

.pe-seg-tab.is-active {
    background: var(--bg-card);
    border-color: var(--border-soft);
    color: var(--pe-slate-900);
    box-shadow: 0 2px 6px rgba(8, 24, 36, 0.08);
}

html[data-bs-theme="dark"] .pe-seg-tab.is-active {
    background: var(--pe-slate-800);
    border-color: rgba(197, 161, 98, 0.32);
    color: #ecf1f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.pe-seg-tab:focus-visible {
    outline: 2px solid rgba(176, 137, 72, 0.65);
    outline-offset: 1px;
}

/* Integrated Single-Row Command Filter Bar */
.pe-cmd-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--bg-card);
    flex-wrap: nowrap;
}

.pe-cmd-bar .pe-search-pill {
    flex: 1 1 220px;
    min-width: 170px;
    height: 38px;
}

.pe-cmd-select {
    flex: 0 1 175px;
    min-width: 130px;
    height: 38px;
    padding-inline: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: var(--bg-raised);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 600;
}

.pe-cmd-select:focus {
    outline: none;
    border-color: var(--pe-bronze-500);
    background: var(--bg-card);
}

.pe-date-toggle {
    height: 38px;
    padding-inline: 12px;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.pe-date-toggle svg {
    width: 15px;
    height: 15px;
}

.pe-date-toggle.is-active,
.pe-date-toggle.has-value {
    border-color: var(--pe-bronze-border);
    background: var(--pe-bronze-bg);
    color: var(--pe-bronze-fg);
}

.pe-cmd-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.pe-cmd-actions .pe-btn {
    height: 38px;
    padding-inline: 14px;
}

/* Collapsible Date Tray inside Workspace Card */
.pe-date-tray {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 11px 18px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-soft);
}

.pe-date-tray .pe-filter-field {
    flex: 0 1 190px;
    min-width: 155px;
}

.pe-date-tray .pe-input {
    height: 36px;
    background: var(--bg-card);
}

/* Integrated Filter Chips Strip inside Workspace Card */
.pe-workspace-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 18px;
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-soft);
}

/* Inline Source Meta Row (Table Name + Quiet Mapping Tag) */
.pe-source-head {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.pe-map-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--pe-navy-bg);
    border: 1px solid var(--pe-navy-border);
    color: var(--pe-navy-fg);
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: isolate;
}

/* Inline Status Detail Subline (replaces noisy dedicated note column) */
.pe-status-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.pe-status-detail.is-danger {
    color: var(--pe-terra-700);
    font-weight: 700;
    white-space: normal;
}

html[data-bs-theme="dark"] .pe-status-detail.is-danger {
    color: #e6a8a8;
}

@media (max-width: 1024px) {
    .pe-cmd-bar {
        flex-wrap: wrap;
    }
    .pe-cmd-bar .pe-search-pill {
        flex: 1 1 100%;
    }
    .pe-cmd-select {
        flex: 1 1 160px;
    }
}

.pe-kpi-card {
    --kpi-accent: linear-gradient(90deg, #12334a, #2b5d7d);
    --kpi-ico-bg: linear-gradient(135deg, #12334a, #2b5d7d);
    --kpi-spark: #2b5d7d;
    --kpi-border: rgba(43, 93, 125, 0.34);

    position: relative;
    border-radius: 22px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 11px;
    transition: transform 240ms var(--ease-spring), border-color 200ms ease, box-shadow 220ms ease;
    will-change: transform;
}

.pe-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline: 22px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--kpi-accent);
}

.pe-kpi-card:hover {
    border-color: var(--kpi-border);
    box-shadow: var(--shadow-pop);
    z-index: 4;
}

.pe-kpi-card:hover .pe-kpi-ico {
    transform: translate3d(0, -5px, 0) scale(1.06);
    box-shadow: 0 14px 24px -10px rgba(8, 24, 36, 0.44);
}

.pe-kpi-card.is-navy {
    --kpi-accent: linear-gradient(90deg, #12334a, #2b5d7d);
    --kpi-ico-bg: linear-gradient(135deg, #12334a, #2b5d7d);
    --kpi-spark: #467899;
    --kpi-border: rgba(43, 93, 125, 0.38);
}

.pe-kpi-card.is-bronze {
    --kpi-accent: linear-gradient(90deg, #937039, #c5a162);
    --kpi-ico-bg: linear-gradient(135deg, #937039, #b08948);
    --kpi-spark: #b08948;
    --kpi-border: rgba(176, 137, 72, 0.40);
}

.pe-kpi-card.is-sage {
    --kpi-accent: linear-gradient(90deg, #356e58, #4a8a71);
    --kpi-ico-bg: linear-gradient(135deg, #356e58, #4a8a71);
    --kpi-spark: #4a8a71;
    --kpi-border: rgba(74, 138, 113, 0.40);
}

.pe-kpi-card.is-ochre {
    --kpi-accent: linear-gradient(90deg, #8f692a, #c59b52);
    --kpi-ico-bg: linear-gradient(135deg, #8f692a, #a87e3a);
    --kpi-spark: #a87e3a;
    --kpi-border: rgba(168, 126, 58, 0.40);
}

.pe-kpi-card.is-danger {
    --kpi-accent: linear-gradient(90deg, #8e3f3f, #b96060);
    --kpi-ico-bg: linear-gradient(135deg, #8e3f3f, #a65252);
    --kpi-spark: #a65252;
    --kpi-border: rgba(166, 82, 82, 0.40);
}

.pe-kpi-card.is-slate {
    --kpi-accent: linear-gradient(90deg, #3c4f61, #5a7085);
    --kpi-ico-bg: linear-gradient(135deg, #3c4f61, #5a7085);
    --kpi-spark: #5a7085;
    --kpi-border: rgba(90, 112, 133, 0.38);
}

.pe-kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.pe-kpi-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
}

.pe-kpi-ico {
    width: 44px;
    height: 44px;
    border-radius: 15px 15px 5px 15px;
    background: var(--kpi-ico-bg);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 10px 18px -10px rgba(8, 24, 36, 0.38);
    transition: transform 280ms var(--ease-spring), box-shadow 220ms var(--ease-smooth);
    will-change: transform;
}

.pe-kpi-ico svg {
    width: 21px;
    height: 21px;
}

.pe-kpi-mid {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

.pe-kpi-val {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary);
}

.pe-kpi-val.is-sm {
    font-size: 20px;
}

.pe-kpi-unit {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-inline-start: 4px;
}

.pe-kpi-spark {
    width: 78px;
    height: 30px;
    overflow: visible;
    flex-shrink: 0;
}

.pe-kpi-spark path {
    fill: none;
    stroke: var(--kpi-spark);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 160;
    stroke-dashoffset: 0;
    animation: peSparkIn 820ms var(--ease-spring) both;
}

@keyframes peSparkIn {
    from { stroke-dashoffset: 160; }
    to { stroke-dashoffset: 0; }
}

.pe-kpi-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: auto;
}

.pe-kpi-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── 8. Buttons (.pe-btn) ─────────────────────────────────────────────────── */
.pe-btn {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 40px;
    padding-inline: 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    transition: transform 200ms var(--ease-spring), background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 180ms ease;
}

.pe-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.pe-btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    transform: none !important;
}

/* Antique Bronze Primary CTA with hover light sweep */
.pe-btn.is-primary {
    background: linear-gradient(135deg, var(--pe-bronze-400) 0%, var(--pe-bronze-500) 65%, var(--pe-bronze-600) 100%);
    color: #0b1c29;
    font-weight: 800;
    box-shadow: 0 10px 22px -10px rgba(176, 137, 72, 0.58);
}

.pe-btn.is-primary::after {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.36), transparent);
    transition: inset-inline-start 560ms var(--ease-smooth);
    pointer-events: none;
}

.pe-btn.is-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -10px rgba(176, 137, 72, 0.72);
}

.pe-btn.is-primary:hover:not(:disabled)::after {
    inset-inline-start: 130%;
}

/* Slate-Navy Button */
.pe-btn.is-navy {
    background: linear-gradient(135deg, var(--pe-slate-800) 0%, var(--pe-slate-700) 100%);
    color: #ffffff;
    box-shadow: 0 8px 18px -10px rgba(18, 51, 74, 0.55);
}

.pe-btn.is-navy:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--pe-slate-700) 0%, var(--pe-slate-600) 100%);
    transform: translateY(-1.5px);
}

/* Translucent Hero Glass Button (no blur) */
.pe-btn.is-glass {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.pe-btn.is-glass:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(197, 161, 98, 0.65);
    transform: translateY(-1.5px);
}

/* Neutral Ghost Button */
.pe-btn.is-ghost {
    background: var(--bg-raised);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.pe-btn.is-ghost:hover:not(:disabled) {
    background: var(--bg-card);
    border-color: rgba(176, 137, 72, 0.48);
    color: var(--text-primary);
    transform: translateY(-1px);
}

/* Muted Terracotta Danger Button */
.pe-btn.is-danger {
    background: var(--pe-terra-bg);
    border-color: var(--pe-terra-border);
    color: var(--pe-terra-700);
}

.pe-btn.is-danger:hover:not(:disabled) {
    background: var(--pe-terra-500);
    border-color: transparent;
    color: #ffffff;
    transform: translateY(-1px);
}

.pe-btn.is-sm {
    height: 33px;
    padding-inline: 12px;
    font-size: 12px;
    border-radius: 9px;
}

.pe-btn.is-xs {
    height: 28px;
    padding-inline: 10px;
    font-size: 11.5px;
    border-radius: 8px;
}

.pe-btn.is-block {
    width: 100%;
}

/* ── 9. Semantic Badges (.pe-badge + Legacy .edge-badge Bridge) ───────────── */
.pe-badge,
.edge-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.4;
    border: 1px solid var(--pe-neutral-border);
    background: var(--pe-neutral-bg);
    color: var(--pe-neutral-fg);
    white-space: nowrap;
}

.pe-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.pe-badge.is-navy,
.edge-badge-info {
    background: var(--pe-navy-bg);
    border-color: var(--pe-navy-border);
    color: var(--pe-navy-fg);
}

.pe-badge.is-bronze,
.edge-badge-required {
    background: var(--pe-bronze-bg);
    border-color: var(--pe-bronze-border);
    color: var(--pe-bronze-fg);
}

.pe-badge.is-sage,
.edge-badge-success {
    background: var(--pe-sage-bg);
    border-color: var(--pe-sage-border);
    color: var(--pe-sage-700);
}

.pe-badge.is-ochre,
.edge-badge-warning {
    background: var(--pe-ochre-bg);
    border-color: var(--pe-ochre-border);
    color: var(--pe-ochre-700);
}

.pe-badge.is-danger,
.edge-badge-danger {
    background: var(--pe-terra-bg);
    border-color: var(--pe-terra-border);
    color: var(--pe-terra-700);
}

.pe-badge.is-slate,
.edge-badge-neutral {
    background: var(--pe-neutral-bg);
    border-color: var(--pe-neutral-border);
    color: var(--pe-neutral-fg);
}

/* ── 10. Sculpted Cards, Grids & Section Headers ──────────────────────────── */
.pe-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.pe-section-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
}

.pe-section-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.pe-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    min-width: 0;
}

.pe-card.is-interactive {
    transition: transform 220ms var(--ease-spring), border-color 180ms ease, box-shadow 220ms ease;
}

.pe-card.is-interactive:hover {
    transform: translateY(-2px);
    border-color: rgba(176, 137, 72, 0.42);
    box-shadow: var(--shadow-hover);
}

.pe-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    min-height: 58px;
}

.pe-card-title {
    font-size: 15.5px;
    font-weight: 800;
    color: var(--text-primary);
}

.pe-card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.pe-card-body {
    padding: 20px;
}

.pe-card-body.is-flush {
    padding: 0;
}

.pe-card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-raised);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.pe-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.pe-card-grid.is-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pe-card-grid.is-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pe-split {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

/* ── 11. Unified Command Filter Toolbar & Chips ───────────────────────────── */
.pe-toolbar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    box-shadow: var(--shadow-card);
}

.pe-toolbar-inside {
    border: 0;
    border-bottom: 1px solid var(--border-soft);
    border-radius: 0;
    box-shadow: none;
    background: var(--bg-raised);
}

.pe-search-pill {
    flex: 0 0 auto;
    min-width: 200px;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding-inline: 12px;
    border-radius: 12px;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.pe-toolbar > .pe-search-pill,
.pe-row > .pe-search-pill {
    flex: 1 1 240px;
}

.pe-filter-field > .pe-search-pill,
.pe-field > .pe-search-pill {
    flex: 0 0 auto;
    height: 40px;
    width: 100%;
}

.pe-filter-field:has(> .pe-search-pill) {
    flex: 1 1 240px;
}

.pe-search-pill:focus-within {
    border-color: var(--pe-bronze-500);
    background: var(--bg-input);
    box-shadow: 0 0 0 3px rgba(176, 137, 72, 0.16);
}

.pe-search-pill svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.pe-search-input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    outline: none;
}

.pe-search-input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.pe-filter-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.pe-filter-field label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-secondary);
}

.pe-filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pe-filter-chips {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pe-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 30px;
    padding-inline: 11px;
    border-radius: 999px;
    background: var(--pe-bronze-bg);
    border: 1px solid var(--pe-bronze-border);
    color: var(--pe-bronze-fg);
    font-size: 12px;
    font-weight: 700;
}

.pe-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: rgba(176, 137, 72, 0.22);
    color: inherit;
    font-size: 12px;
    line-height: 1;
}

.pe-chip-clear {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 3px;
    padding-inline: 4px;
}

.pe-chip-clear:hover {
    color: var(--pe-bronze-600);
}

/* ── 12. Clean Data Tables (.pe-table-wrap / .pe-table) ───────────────────── */
.pe-table-wrap {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
}

.pe-table,
.edge-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.pe-table thead th,
.edge-table thead th {
    padding: 11px 10px;
    text-align: start;
    font-size: 11.5px;
    font-weight: 800;
    color: var(--text-secondary);
    background: var(--bg-raised);
    border-bottom: 1.5px solid var(--border-strong);
    white-space: nowrap;
    vertical-align: middle;
}

[dir="rtl"] .pe-table thead th:first-child,
[dir="rtl"] .edge-table thead th:first-child,
[dir="rtl"] .pe-table tbody td:first-child,
[dir="rtl"] .edge-table tbody td:first-child {
    padding-right: 16px;
}

[dir="rtl"] .pe-table thead th:last-child,
[dir="rtl"] .edge-table thead th:last-child,
[dir="rtl"] .pe-table tbody td:last-child,
[dir="rtl"] .edge-table tbody td:last-child {
    padding-left: 16px;
}

[dir="ltr"] .pe-table thead th:first-child,
[dir="ltr"] .edge-table thead th:first-child,
[dir="ltr"] .pe-table tbody td:first-child,
[dir="ltr"] .edge-table tbody td:first-child {
    padding-left: 16px;
}

[dir="ltr"] .pe-table thead th:last-child,
[dir="ltr"] .edge-table thead th:last-child,
[dir="ltr"] .pe-table tbody td:last-child,
[dir="ltr"] .edge-table tbody td:last-child {
    padding-right: 16px;
}

.pe-table tbody td,
.edge-table tbody td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-primary);
    vertical-align: middle;
    line-height: 1.45;
}

/* Global RTL / LTR column-header-to-cell alignment lock:
   Never let direction:ltr on td.dir-ltr, td.pe-num, .pe-utc, or .pe-table-sub
   flip text-align:start to the opposite side of its column header. */
[dir="rtl"] .pe-table thead th,
[dir="rtl"] .edge-table thead th,
[dir="rtl"] .pe-table tbody td,
[dir="rtl"] .edge-table tbody td,
[dir="rtl"] .pe-table tbody td.dir-ltr,
[dir="rtl"] .pe-table tbody td.pe-num,
[dir="rtl"] .pe-table tbody td.edge-number,
[dir="rtl"] .pe-table tbody td.pe-mono,
[dir="rtl"] .edge-table tbody td.dir-ltr,
[dir="rtl"] .edge-table tbody td.pe-num,
[dir="rtl"] .edge-table tbody td.edge-number,
[dir="rtl"] .edge-table tbody td.pe-mono,
[dir="rtl"] .pe-table-sub,
[dir="rtl"] .pe-utc,
[dir="rtl"] .edge-utc-sub,
[dir="rtl"] .pe-kv-val {
    text-align: right;
}

[dir="ltr"] .pe-table thead th,
[dir="ltr"] .edge-table thead th,
[dir="ltr"] .pe-table tbody td,
[dir="ltr"] .edge-table tbody td,
[dir="ltr"] .pe-table tbody td.dir-ltr,
[dir="ltr"] .pe-table tbody td.pe-num,
[dir="ltr"] .pe-table tbody td.edge-number,
[dir="ltr"] .pe-table tbody td.pe-mono,
[dir="ltr"] .edge-table tbody td.dir-ltr,
[dir="ltr"] .edge-table tbody td.pe-num,
[dir="ltr"] .edge-table tbody td.edge-number,
[dir="ltr"] .edge-table tbody td.pe-mono,
[dir="ltr"] .pe-table-sub,
[dir="ltr"] .pe-utc,
[dir="ltr"] .edge-utc-sub,
[dir="ltr"] .pe-kv-val {
    text-align: left;
}

.pe-table tbody tr:nth-child(even) td,
.edge-table tbody tr:nth-child(even) td {
    background: rgba(16, 45, 68, 0.018);
}

html[data-bs-theme="dark"] .pe-table tbody tr:nth-child(even) td,
html[data-bs-theme="dark"] .edge-table tbody tr:nth-child(even) td {
    background: rgba(164, 194, 218, 0.024);
}

.pe-table tbody tr:last-child td,
.edge-table tbody tr:last-child td {
    border-bottom: 0;
}

.pe-table tbody tr,
.edge-table tbody tr {
    transition: background-color 140ms ease;
}

.pe-table tbody tr:hover td,
.edge-table tbody tr:hover td {
    background: var(--bg-hover);
}

.pe-table tbody tr:hover td:first-child,
.edge-table tbody tr:hover td:first-child {
    box-shadow: inset 3px 0 0 var(--pe-bronze-500);
}

[dir="rtl"] .pe-table tbody tr:hover td:first-child,
[dir="rtl"] .edge-table tbody tr:hover td:first-child {
    box-shadow: inset -3px 0 0 var(--pe-bronze-500);
}

.pe-table tbody tr.pe-table-total td,
.edge-table tbody tr.edge-total-row td {
    background: var(--bg-raised);
    font-weight: 800;
}

.pe-table-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    white-space: nowrap;
}

.pe-col-nowrap {
    white-space: nowrap;
}

.pe-col-actions {
    text-align: end;
    white-space: nowrap;
    width: 1%;
}

.pe-table thead th.pe-col-actions,
.pe-table tbody td.pe-col-actions,
.edge-table thead th.pe-col-actions,
.edge-table tbody td.pe-col-actions {
    text-align: end;
}

[dir="rtl"] .pe-table thead th.pe-col-actions,
[dir="rtl"] .pe-table tbody td.pe-col-actions,
[dir="rtl"] .edge-table thead th.pe-col-actions,
[dir="rtl"] .edge-table tbody td.pe-col-actions {
    text-align: left;
}

[dir="ltr"] .pe-table thead th.pe-col-actions,
[dir="ltr"] .pe-table tbody td.pe-col-actions,
[dir="ltr"] .edge-table thead th.pe-col-actions,
[dir="ltr"] .edge-table tbody td.pe-col-actions {
    text-align: right;
}

/* Structured Source Cell (table name + compact single-line mono key) */
.pe-source-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 170px;
    max-width: 245px;
}

.pe-source-table {
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    line-height: 1.25;
}

.pe-source-key {
    display: inline-block;
    max-width: 100%;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    direction: ltr;
    unicode-bidi: isolate;
}

/* Structured Type / Primary Label Cell */
.pe-cell-primary {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Structured Status Note Cell */
.pe-note-cell {
    min-width: 135px;
    max-width: 215px;
}

.pe-note-line {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
    text-align: start;
}

.pe-note-dot {
    width: 6px;
    height: 6px;
    margin-top: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--pe-slate-400);
}

.pe-note-dot.is-sage {
    background: var(--pe-sage-500);
}

.pe-note-dot.is-bronze {
    background: var(--pe-bronze-500);
}

/* Dual Kuwait / UTC Timestamp Cell (never wraps KWT/UTC onto extra lines) */
.pe-time-cell,
.pe-table td:has(> .pe-utc),
.pe-table td:has(> small.pe-utc) {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.pe-time-kwt {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: isolate;
}

.pe-time-cell .pe-utc {
    font-size: 10.5px;
}

.pe-tz-tag {
    font-size: 9.5px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 4px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
    letter-spacing: 0;
}

.pe-row-action {
    white-space: nowrap;
    gap: 4px;
    padding-inline: 10px;
}

.pe-row-action svg {
    width: 13px;
    height: 13px;
    opacity: 0.75;
    transition: transform 180ms var(--ease-spring);
}

[dir="rtl"] .pe-row-action .pe-dir-ico {
    transform: scaleX(-1);
}

.pe-row-action:hover svg {
    transform: translateX(2px);
}

[dir="rtl"] .pe-row-action:hover .pe-dir-ico {
    transform: scaleX(-1) translateX(2px);
}

.pe-table-actions,
.edge-table-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.pe-link,
.edge-link {
    color: var(--pe-slate-600);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(43, 93, 125, 0.35);
    text-underline-offset: 3px;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}

.pe-link:hover,
.edge-link:hover {
    color: var(--pe-bronze-600);
    text-decoration-color: var(--pe-bronze-500);
}

html[data-bs-theme="dark"] .pe-link,
html[data-bs-theme="dark"] .edge-link {
    color: #8bb8d6;
    text-decoration-color: rgba(139, 184, 214, 0.38);
}

html[data-bs-theme="dark"] .pe-link:hover,
html[data-bs-theme="dark"] .edge-link:hover {
    color: var(--pe-bronze-300);
    text-decoration-color: var(--pe-bronze-300);
}

/* ── 13. Key-Value Metadata Grid (.pe-kv-grid) ────────────────────────────── */
.pe-kv-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.pe-kv-grid.is-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pe-kv-grid.is-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pe-kv-item {
    padding: 13px 15px;
    border-radius: 14px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}

.pe-kv-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.pe-kv-value {
    margin: 0;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    overflow-wrap: anywhere;
    min-width: 0;
}

.pe-kv-value .pe-code,
.pe-kv-val .pe-code {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pe-code-truncate {
    display: inline-block;
    max-width: 215px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.pe-table-sub.is-wrap {
    white-space: normal;
    overflow-wrap: anywhere;
}

.pe-evidence-text {
    unicode-bidi: plaintext;
}

/* ── 14. Form Cards, Controls, Toggles & Segmented Tabs ───────────────────── */
.pe-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pe-form-section {
    padding: 18px 20px;
    border-radius: 16px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pe-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
}

.pe-form-grid.is-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pe-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.pe-field.is-full {
    grid-column: 1 / -1;
}

.pe-label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-primary);
}

.pe-control,
.pe-input,
.pe-select {
    height: 41px;
    width: 100%;
    padding: 0 13px;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    outline: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

textarea.pe-control {
    height: auto;
    min-height: 88px;
    padding: 10px 13px;
    resize: vertical;
}

.pe-control:focus,
.pe-input:focus,
.pe-select:focus {
    border-color: var(--pe-bronze-500);
    box-shadow: 0 0 0 3px rgba(176, 137, 72, 0.16);
}

.pe-control::placeholder,
.pe-input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.pe-control[readonly],
.pe-control:disabled,
.pe-input-locked {
    background: var(--bg-raised);
    color: var(--text-secondary);
    cursor: default;
}

.pe-input-group {
    display: flex;
    align-items: stretch;
    gap: 8px;
}

.pe-input-group .pe-control,
.pe-input-group .pe-input {
    flex: 1 1 auto;
    min-width: 0;
}

.pe-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.pe-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
}

/* Sliding Toggle Switch (.pe-toggle) */
.pe-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 13px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    cursor: pointer;
    user-select: none;
    transition: border-color 160ms ease;
}

.pe-toggle:hover {
    border-color: rgba(176, 137, 72, 0.40);
}

.pe-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pe-toggle-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.pe-toggle-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

.pe-toggle-control {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.pe-toggle-control input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

.pe-toggle-track {
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #c4d0dc;
    border: 1px solid rgba(16, 45, 68, 0.14);
    transition: background-color 220ms var(--ease-spring), border-color 220ms ease;
}

html[data-bs-theme="dark"] .pe-toggle-track {
    background: #233b4f;
    border-color: rgba(164, 194, 218, 0.18);
}

.pe-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 5px rgba(8, 24, 36, 0.25);
    transition: transform 240ms var(--ease-bounce);
}

.pe-toggle-control input:checked + .pe-toggle-track {
    background: linear-gradient(135deg, var(--pe-bronze-400), var(--pe-bronze-600));
    border-color: transparent;
}

.pe-toggle-control input:checked + .pe-toggle-track::after {
    transform: translateX(18px);
}

.pe-toggle-control input:focus-visible + .pe-toggle-track {
    box-shadow: 0 0 0 3px rgba(176, 137, 72, 0.30);
}

/* Segmented Tabs (.pe-tabs / .pe-tab) */
.pe-tabs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 5px;
    border-radius: 14px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
}

.pe-tab,
.edge-mode-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding-inline: 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 700;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.pe-tab:hover:not(.is-active),
.edge-mode-tab:hover:not(.is-active) {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.pe-tab.is-active,
.edge-mode-tab.is-active {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--pe-bronze-border);
    box-shadow: var(--shadow-card);
}

/* ── 15. Semantic Alerts (.pe-alert + Legacy .edge-alert) ─────────────────── */
.pe-alert,
.edge-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 18px;
    border-radius: 15px;
    border: 1px solid var(--pe-terra-border);
    border-inline-start-width: 4px;
    background: var(--pe-terra-bg);
    color: var(--pe-terra-700);
    font-size: 13px;
    font-weight: 600;
}

.pe-alert:empty,
.edge-alert:empty {
    display: none;
}

.pe-alert.is-sage,
.edge-alert-success {
    border-color: var(--pe-sage-border);
    background: var(--pe-sage-bg);
    color: var(--pe-sage-700);
}

.pe-alert.is-ochre,
.edge-alert-warning {
    border-color: var(--pe-ochre-border);
    background: var(--pe-ochre-bg);
    color: var(--pe-ochre-700);
}

.pe-alert.is-navy {
    border-color: var(--pe-navy-border);
    background: var(--pe-navy-bg);
    color: var(--pe-navy-fg);
}

.pe-alert.is-bronze {
    border-color: var(--pe-bronze-border);
    background: var(--pe-bronze-bg);
    color: var(--pe-bronze-fg);
}

.pe-alert.is-danger {
    border-color: var(--pe-terra-border);
    background: var(--pe-terra-bg);
    color: var(--pe-terra-700);
}

.pe-alert-body {
    flex: 1 1 260px;
    min-width: 0;
}

.pe-alert-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.pe-alert-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
}

.pe-alert-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── 16. Stepper (.pe-stepper / .pe-step) ─────────────────────────────────── */
.pe-stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.pe-stepper.is-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pe-stepper.is-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.pe-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px 16px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
    transition: transform 200ms var(--ease-spring), border-color 180ms ease;
}

a.pe-step:hover {
    transform: translateY(-2px);
    border-color: var(--pe-bronze-400);
}

.pe-step-num {
    width: 28px;
    height: 28px;
    border-radius: 10px 10px 4px 10px;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pe-step.is-done {
    border-color: var(--pe-sage-border);
    background: var(--bg-card);
}

.pe-step.is-done .pe-step-num {
    background: linear-gradient(135deg, var(--pe-sage-600), var(--pe-sage-500));
    border-color: transparent;
    color: #ffffff;
}

.pe-step.is-current {
    border-color: var(--pe-bronze-border);
    background: var(--bg-card);
}

.pe-step.is-current .pe-step-num {
    background: linear-gradient(135deg, var(--pe-bronze-400), var(--pe-bronze-600));
    border-color: transparent;
    color: #0b1c29;
}

.pe-step.is-blocked {
    border-color: var(--pe-terra-border);
}

.pe-step.is-blocked .pe-step-num {
    background: var(--pe-terra-500);
    border-color: transparent;
    color: #ffffff;
}

.pe-step-body {
    min-width: 0;
}

.pe-step-title {
    display: block;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
}

.pe-step-desc {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.5;
}

/* ── 17. Architectural Empty State (.pe-empty) ────────────────────────────── */
.pe-empty {
    padding: 40px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.pe-empty-ico {
    width: 52px;
    height: 52px;
    border-radius: 16px 16px 6px 16px;
    background: var(--pe-navy-bg);
    border: 1px solid var(--pe-navy-border);
    color: var(--pe-navy-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.pe-empty-ico svg {
    width: 24px;
    height: 24px;
}

.pe-empty-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
}

.pe-empty-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    max-width: 460px;
}

.pe-empty-actions {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── 18. Code, UTC Sublines & Layout Utilities ────────────────────────────── */
.pe-code {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 7px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    direction: ltr;
    unicode-bidi: isolate;
}

.pe-code.is-wrap {
    white-space: normal;
    word-break: break-word;
}

.pe-pre {
    margin: 0;
    padding: 16px 18px;
    border-radius: 14px;
    background: #0a1b28;
    border: 1px solid rgba(164, 194, 218, 0.14);
    color: #d7e7f4;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.65;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
}

.pe-utc,
.edge-utc-sub {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    direction: ltr;
    unicode-bidi: isolate;
}

.pe-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pe-stack.is-sm {
    gap: 10px;
}

.pe-stack.is-lg {
    gap: 24px;
}

.pe-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.pe-row.is-between {
    justify-content: space-between;
}

.pe-row.is-end {
    justify-content: flex-end;
}

.pe-muted {
    color: var(--text-muted);
}

.pe-hidden,
.edge-field-hidden {
    display: none !important;
}

/* ── 19. Shared Partials: Pager, QuickHelp, Legacy Nav ────────────────────── */
.edge-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 13px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
}

.edge-pager-info {
    font-size: 12.5px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.edge-pager-info strong {
    color: var(--text-primary);
    font-weight: 800;
}

.edge-pager-pages {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.edge-pager-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding-inline: 11px;
    border-radius: 10px;
    border: 1px solid transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 700;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.edge-pager-link:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.edge-pager-link[aria-current="page"] {
    background: linear-gradient(135deg, var(--pe-slate-800), var(--pe-slate-700));
    border-color: transparent;
    color: #ffffff;
    pointer-events: none;
    box-shadow: 0 6px 14px -8px rgba(18, 51, 74, 0.55);
}

html[data-bs-theme="dark"] .edge-pager-link[aria-current="page"] {
    background: linear-gradient(135deg, var(--pe-bronze-400), var(--pe-bronze-600));
    color: #081824;
}

.edge-pager-nav {
    font-family: var(--font-sans);
    background: var(--bg-raised);
    border-color: var(--border-soft);
}

.edge-pager-nav.edge-disabled,
span.edge-pager-nav {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

.edge-pager-ellipsis {
    padding-inline: 4px;
    color: var(--text-muted);
    user-select: none;
}

/* Quick Help Accordion */
.edge-quick-help {
    border: 1px solid var(--pe-navy-border);
    border-radius: 16px;
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.edge-quick-help-summary {
    list-style: none;
    cursor: pointer;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 13px;
    color: var(--text-primary);
    user-select: none;
    transition: background-color 150ms ease;
}

.edge-quick-help-summary:hover {
    background: var(--bg-raised);
}

.edge-quick-help-summary::-webkit-details-marker {
    display: none;
}

.edge-quick-help-icon {
    width: 26px;
    height: 26px;
    border-radius: 9px 9px 3px 9px;
    background: linear-gradient(135deg, var(--pe-slate-800), var(--pe-slate-600));
    color: var(--pe-bronze-300);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}

.edge-quick-help-toggle {
    margin-inline-start: auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--pe-bronze-600);
}

html[data-bs-theme="dark"] .edge-quick-help-toggle {
    color: var(--pe-bronze-300);
}

.edge-quick-help-body {
    padding: 14px 18px 16px;
    border-top: 1px solid var(--border-soft);
    background: var(--bg-raised);
    font-size: 12.5px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Legacy Horizontal Nav Partial */
.edge-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    box-shadow: var(--shadow-card);
}

.edge-nav a {
    padding: 7px 13px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 700;
    transition: background-color 150ms ease, color 150ms ease;
}

.edge-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── 20. Connection Builder, Camera Preview & Legacy JS Hook Classes ──────── */
.edge-test-status {
    flex: 1 1 240px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 15px;
    border-radius: 13px;
    border: 1px solid var(--border-strong);
    background: var(--bg-card);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
}

.edge-test-status-idle {
    background: var(--bg-card);
    border-color: var(--border-strong);
    color: var(--text-muted);
}

.edge-test-status-loading {
    background: var(--pe-navy-bg);
    border-color: var(--pe-navy-border);
    color: var(--pe-navy-fg);
}

.edge-test-status-success {
    background: var(--pe-sage-bg);
    border-color: var(--pe-sage-border);
    color: var(--pe-sage-700);
}

.edge-test-status-warning {
    background: var(--pe-ochre-bg);
    border-color: var(--pe-ochre-border);
    color: var(--pe-ochre-700);
}

.edge-test-status-error {
    background: var(--pe-terra-bg);
    border-color: var(--pe-terra-border);
    color: var(--pe-terra-700);
}

.edge-test-meta {
    font-family: var(--font-mono);
    font-size: 11px;
    opacity: 0.88;
    direction: ltr;
    text-align: start;
}

.edge-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.edge-runbook-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.edge-diag-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.edge-diag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
}

.edge-onvif-results {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
}

.pe-preview-stage,
.edge-preview-stage {
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(135deg, #091a27, #0e2537);
    border: 1px solid rgba(164, 194, 218, 0.16);
    color: #ecf4fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pe-preview-bar,
.edge-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pe-preview-status,
.edge-preview-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 700;
}

.pe-preview-dot,
.edge-preview-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pe-sage-400);
    display: inline-block;
}

.pe-preview-media,
.edge-preview-media {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #040d14;
    border-radius: 12px;
    min-height: 240px;
    max-height: 440px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.pe-preview-img,
.edge-preview-img {
    max-width: 100%;
    max-height: 420px;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

/* Legacy Secondary Button (used by ONVIF dynamically created rows in site.js) */
.edge-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 12px;
    border-radius: 9px;
    border: 1px solid var(--border-strong);
    background: var(--bg-raised);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 700;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.edge-secondary-button:hover {
    border-color: var(--pe-bronze-500);
    background: var(--bg-card);
}

.edge-btn-xs {
    min-height: 28px;
    padding: 2px 10px;
    font-size: 11.5px;
}

/* ── 21. Split-Canvas Executive Login Page ────────────────────────────────── */
.pe-auth-wrap {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 480px);
    gap: 28px;
    align-items: stretch;
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    padding: 28px 28px 36px;
}

.pe-auth-showcase {
    position: relative;
    border-radius: 26px;
    padding: 42px 40px;
    background:
        radial-gradient(560px 300px at 88% 4%, rgba(197, 161, 98, 0.24) 0%, rgba(197, 161, 98, 0.09) 36%, transparent 74%),
        radial-gradient(560px 320px at 10% 96%, rgba(70, 120, 153, 0.24) 0%, rgba(70, 120, 153, 0.08) 42%, transparent 76%),
        linear-gradient(130deg, #0b1e2d 0%, #102b40 48%, #163750 100%);
    color: #f4f7fa;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    box-shadow: 0 24px 48px -20px rgba(8, 24, 36, 0.50);
}

.pe-auth-showcase-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pe-auth-showcase h1 {
    font-size: 36px;
    font-weight: 900;
    line-height: 1.28;
    color: #ffffff;
    max-width: 520px;
}

.pe-auth-showcase-desc {
    font-size: 14.5px;
    line-height: 1.85;
    color: #c5def0;
    max-width: 480px;
}

.pe-auth-pillars {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.pe-auth-pillar {
    padding: 14px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.065);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pe-auth-pillar-ico {
    width: 30px;
    height: 30px;
    border-radius: 10px 10px 4px 10px;
    background: rgba(197, 161, 98, 0.20);
    color: var(--pe-bronze-300);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pe-auth-pillar-ico svg {
    width: 16px;
    height: 16px;
}

.pe-auth-pillar strong {
    font-size: 12.5px;
    font-weight: 800;
    color: #ffffff;
}

.pe-auth-pillar span {
    font-size: 11.5px;
    color: #b4d1e6;
    line-height: 1.5;
}

.pe-auth-isolation {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-radius: 14px;
    background: rgba(6, 20, 32, 0.48);
    border: 1px solid rgba(197, 161, 98, 0.30);
    font-size: 12.5px;
    color: #d7e8f5;
}

.pe-auth-isolation svg {
    width: 18px;
    height: 18px;
    color: var(--pe-bronze-300);
    flex-shrink: 0;
}

.pe-auth-card-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
}

.pe-auth-card {
    position: relative;
    border-radius: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
}

.pe-auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline: 28px;
    height: 3.5px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--pe-bronze-600), var(--pe-bronze-300), var(--pe-bronze-500));
}

.pe-auth-card-body {
    padding: 34px 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pe-auth-card-head {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pe-auth-lock {
    width: 46px;
    height: 46px;
    border-radius: 15px 15px 5px 15px;
    background: linear-gradient(135deg, var(--pe-slate-800), var(--pe-slate-600));
    color: var(--pe-bronze-300);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    box-shadow: 0 10px 20px -10px rgba(18, 51, 74, 0.50);
}

.pe-auth-lock svg {
    width: 22px;
    height: 22px;
}

.pe-auth-card-eyebrow {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--pe-bronze-600);
}

html[data-bs-theme="dark"] .pe-auth-card-eyebrow {
    color: var(--pe-bronze-300);
}

.pe-auth-card-head h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.pe-auth-card-head p {
    font-size: 13px;
    color: var(--text-muted);
}

.pe-auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pe-code-input {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 8px;
    direction: ltr;
}

[dir="rtl"] .pe-code-input {
    letter-spacing: 8px !important;
}

.edge-security-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
}

.edge-security-note svg {
    width: 15px;
    height: 15px;
    color: var(--pe-bronze-500);
    flex-shrink: 0;
}

.pe-auth-footnote {
    font-size: 11.5px;
    color: var(--text-muted);
    text-align: center;
}

/* Error Page Card */
.pe-error-wrap {
    max-width: 640px;
    margin: 48px auto;
    padding-inline: 20px;
}

/* ── 22. Responsive Breakpoints ───────────────────────────────────────────── */
@media (max-width: 1200px) {
    .pe-kpi-grid,
    .edge-status-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pe-card-grid,
    .pe-card-grid.is-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pe-stepper {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .pe-split {
        grid-template-columns: 1fr;
    }
    .pe-auth-wrap {
        grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
    }
    .pe-auth-pillars {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .pe-main-wrap,
    body.pe-sidebar-collapsed .pe-main-wrap {
        padding-inline-start: 0;
    }

    .pe-sidebar {
        width: 272px !important;
        transform: translate3d(-105%, 0, 0);
    }

    [dir="rtl"] .pe-sidebar {
        transform: translate3d(105%, 0, 0);
    }

    .pe-sidebar.mobile-open,
    [dir="rtl"] .pe-sidebar.mobile-open {
        transform: translate3d(0, 0, 0);
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
    }

    .pe-sidebar.collapsed .pe-brand-copy,
    .pe-sidebar.collapsed .pe-brand-pill,
    .pe-sidebar.collapsed .pe-sidebar-filter,
    .pe-sidebar.collapsed .pe-sidebar-group,
    .pe-sidebar.collapsed .edge-sidebar-text,
    .pe-sidebar.collapsed .pe-sidebar-status-label,
    .pe-sidebar.collapsed .pe-sidebar-status-bar {
        display: revert;
    }

    .pe-sidebar.collapsed .pe-sidebar-head {
        justify-content: space-between;
        padding-inline: 16px;
    }

    .pe-sidebar.collapsed .pe-sidebar-link {
        justify-content: flex-start;
        padding-inline: 12px;
    }

    .pe-sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(6, 18, 28, 0.62);
        z-index: 45;
    }

    .pe-sidebar-backdrop.visible {
        display: block;
    }

    .pe-auth-wrap {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .pe-auth-showcase {
        padding: 28px 24px;
    }

    .pe-auth-showcase h1 {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .pe-topbar {
        padding-inline: 10px;
        gap: 8px;
    }

    .pe-topbar-start {
        gap: 8px;
        flex-shrink: 0;
    }

    .pe-topbar-end {
        gap: 6px;
        min-width: 0;
    }

    .pe-org-copy,
    .pe-user-pill,
    .pe-topbar-guide {
        display: none;
    }

    .pe-icon-btn,
    .pe-org-emblem {
        width: 36px;
        height: 36px;
    }

    .pe-topbar-pill {
        height: 36px;
        padding-inline: 10px;
        font-size: 12px;
    }

    .pe-logout-btn {
        height: 36px;
        padding-inline: 10px;
    }

    .pe-content {
        padding: 16px 14px 28px;
    }
}

@media (max-width: 540px) {
    .pe-logout-btn span {
        display: none;
    }

    .pe-logout-btn {
        width: 36px;
        padding-inline: 0;
        justify-content: center;
    }
}

@media (max-width: 768px) {

    .pe-hero {
        padding: 20px 18px;
        border-radius: 20px;
    }

    .pe-hero-title {
        font-size: 21px;
    }

    .pe-kpi-grid,
    .pe-kpi-grid.is-2,
    .pe-kpi-grid.is-3,
    .edge-status-grid,
    .pe-card-grid,
    .pe-card-grid.is-2,
    .pe-card-grid.is-4,
    .pe-kv-grid,
    .pe-kv-grid.is-2,
    .pe-kv-grid.is-4,
    .pe-form-grid,
    .pe-form-grid.is-3,
    .pe-stepper,
    .pe-stepper.is-2,
    .pe-stepper.is-3 {
        grid-template-columns: 1fr;
    }

    .edge-pager {
        flex-direction: column;
        align-items: stretch;
    }

    .edge-pager-pages {
        justify-content: center;
    }

    .pe-footer {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── 22b. Executive Operations Handbook & Guide (/edge/guide) ─────────────── */
.pe-guide-shell {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.pe-guide-toc {
    position: sticky;
    top: calc(var(--topbar-height) + 16px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pe-guide-toc-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 14px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pe-toc-hover-glide,
.pe-toc-active-glide {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 10px;
    pointer-events: none;
    opacity: 0;
    z-index: 0;
    will-change: transform, width, height, opacity;
}

.pe-toc-hover-glide {
    background: rgba(16, 45, 68, 0.055);
    transition:
        transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
        width 240ms cubic-bezier(0.16, 1, 0.3, 1),
        height 240ms cubic-bezier(0.16, 1, 0.3, 1),
        opacity 180ms ease;
}

html[data-bs-theme="dark"] .pe-toc-hover-glide {
    background: rgba(164, 194, 218, 0.085);
}

.pe-toc-active-glide {
    background: var(--pe-navy-bg);
    border: 1px solid rgba(176, 137, 72, 0.24);
    box-shadow: 0 4px 12px -6px rgba(8, 24, 36, 0.16);
    transition:
        transform 420ms cubic-bezier(0.34, 1.32, 0.64, 1),
        width 360ms cubic-bezier(0.22, 1, 0.36, 1),
        height 360ms cubic-bezier(0.22, 1, 0.36, 1),
        opacity 200ms ease,
        background-color 220ms ease,
        border-color 220ms ease;
}

.pe-toc-active-glide.is-sub {
    background: var(--pe-bronze-bg);
    border-color: var(--pe-bronze-border);
    border-radius: 8px;
}

.pe-toc-active-glide::after {
    content: '';
    position: absolute;
    inset-block: 6px;
    inset-inline-start: 0;
    width: 3.5px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--pe-bronze-400), var(--pe-bronze-600));
}

.pe-guide-toc-title {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-muted);
    padding: 2px 8px 6px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 2px;
}

.pe-guide-toc-link {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 180ms ease, background-color 150ms ease;
}

.pe-guide-toc-card:not(.is-glide-ready) .pe-guide-toc-link:hover {
    background: var(--bg-raised);
}

.pe-guide-toc-link:hover {
    color: var(--text-primary);
}

.pe-guide-toc-link.is-active {
    color: var(--pe-navy-fg);
}

.pe-guide-toc-card:not(.is-glide-ready) .pe-guide-toc-link.is-active {
    background: var(--pe-navy-bg);
    box-shadow: inset 3px 0 0 var(--pe-bronze-500);
}

[dir="rtl"] .pe-guide-toc-card:not(.is-glide-ready) .pe-guide-toc-link.is-active {
    box-shadow: inset -3px 0 0 var(--pe-bronze-500);
}

.pe-guide-toc-count {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--bg-raised);
    color: var(--text-muted);
    transition: background-color 180ms ease, color 180ms ease;
}

.pe-guide-toc-link.is-active .pe-guide-toc-count {
    background: var(--bg-card);
    color: var(--pe-navy-fg);
}

.pe-guide-toc-sublist {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-inline-start: 10px;
    margin-block: 2px 6px;
    border-inline-start: 2px solid var(--border-soft);
}

.pe-guide-toc-sub {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 180ms ease, background-color 150ms ease;
}

.pe-guide-toc-card:not(.is-glide-ready) .pe-guide-toc-sub:hover,
.pe-guide-toc-card:not(.is-glide-ready) .pe-guide-toc-sub.is-active {
    background: var(--pe-bronze-bg);
}

.pe-guide-toc-sub:hover,
.pe-guide-toc-sub.is-active {
    color: var(--pe-bronze-fg);
}

.pe-guide-toc-num {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    opacity: 0.8;
}

.pe-guide-quick-card {
    background: linear-gradient(145deg, #0d2435 0%, #14364e 100%);
    border: 1px solid rgba(197, 161, 98, 0.28);
    border-radius: 16px;
    padding: 14px;
    color: #ecf4fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pe-guide-quick-title {
    font-size: 12.5px;
    font-weight: 800;
    color: #ffffff;
}

.pe-guide-quick-desc {
    font-size: 11.5px;
    color: #bfd6e8;
    line-height: 1.5;
    margin: 0;
}

.pe-guide-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pe-guide-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.pe-guide-anchor {
    scroll-margin-top: 86px;
}

/* Connected 5-Stage Architecture Pipeline */
.pe-flow-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.pe-flow-node {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 13px 12px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: border-color 180ms ease, transform 200ms var(--ease-spring);
}

.pe-flow-node:hover {
    border-color: var(--pe-bronze-border);
    transform: translateY(-2px);
}

.pe-flow-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.pe-flow-num {
    width: 26px;
    height: 26px;
    border-radius: 9px 9px 3px 9px;
    background: linear-gradient(135deg, var(--pe-slate-800), var(--pe-slate-600));
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pe-flow-node.is-accent .pe-flow-num {
    background: linear-gradient(135deg, var(--pe-bronze-600), var(--pe-bronze-400));
}

.pe-flow-tag {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.pe-flow-title {
    font-size: 12.5px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
}

.pe-flow-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Screen Directory Cards (2-Column Grid) */
.pe-screen-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.pe-screen-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 13px 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 180ms ease, background-color 180ms ease;
}

.pe-screen-card:hover {
    border-color: var(--pe-bronze-border);
    background: var(--bg-card);
}

.pe-screen-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.pe-screen-name {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
}

.pe-screen-route {
    display: inline-block;
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.pe-screen-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    flex: 1 1 auto;
}

.pe-screen-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-soft);
}

/* Interactive SOP Cards & Timeline Checklists */
.pe-sop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.pe-sop-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pe-sop-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    overflow: hidden;
    scroll-margin-top: 86px;
    transition: border-color 200ms ease, box-shadow 200ms ease;
}

.pe-sop-card[open] {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card);
}

.pe-sop-card.is-highlighted {
    border-color: var(--pe-bronze-500);
    box-shadow: 0 0 0 3px rgba(176, 137, 72, 0.20), var(--shadow-pop);
}

.pe-sop-summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    user-select: none;
    transition: background-color 150ms ease;
}

.pe-sop-summary::-webkit-details-marker {
    display: none;
}

.pe-sop-summary:hover {
    background: var(--bg-raised);
}

.pe-sop-card[open] > .pe-sop-summary {
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border-soft);
}

.pe-sop-lead {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.pe-sop-badge {
    width: 34px;
    height: 34px;
    border-radius: 11px 11px 4px 11px;
    background: linear-gradient(135deg, var(--pe-slate-800), var(--pe-slate-600));
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 12.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pe-sop-badge.is-support {
    background: linear-gradient(135deg, var(--pe-sage-600), var(--pe-sage-500));
}

.pe-sop-badge.is-bronze {
    background: linear-gradient(135deg, var(--pe-bronze-600), var(--pe-bronze-400));
}

.pe-sop-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.pe-sop-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
}

.pe-sop-meta {
    font-size: 11.5px;
    color: var(--text-muted);
}

.pe-sop-end {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pe-sop-chevron {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: transform 200ms var(--ease-spring);
}

.pe-sop-card[open] .pe-sop-chevron {
    transform: rotate(180deg);
    color: var(--pe-bronze-600);
}

.pe-sop-body {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pe-sop-progress-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
}

.pe-sop-progress-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

.pe-sop-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pe-sop-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 12px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    transition: border-color 160ms ease, background-color 160ms ease;
}

.pe-sop-step.is-checked {
    border-color: var(--pe-sage-border);
    background: var(--pe-sage-bg);
}

.pe-sop-step-num {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-strong);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.pe-sop-check {
    width: 19px;
    height: 19px;
    margin-top: 2px;
    accent-color: var(--pe-sage-600);
    cursor: pointer;
    flex-shrink: 0;
}

.pe-sop-step-body {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pe-sop-step-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.35;
}

.pe-sop-step.is-checked .pe-sop-step-title {
    text-decoration: line-through;
    opacity: 0.78;
}

.pe-sop-step-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0;
}

.pe-sop-step-cta {
    flex-shrink: 0;
    align-self: center;
}

/* Structured Runbook Cards (Symptom -> Diagnosis -> Fix) */
.pe-runbook-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.pe-runbook-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0;
}

.pe-runbook-box {
    padding: 10px 12px;
    border-radius: 11px;
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
}

.pe-runbook-box.is-fix {
    background: var(--pe-sage-bg);
    border-color: var(--pe-sage-border);
    color: var(--text-primary);
}

.pe-runbook-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.pe-runbook-box.is-fix .pe-runbook-label {
    color: var(--pe-sage-700);
}

html[data-bs-theme="dark"] .pe-runbook-box.is-fix .pe-runbook-label {
    color: #8cc4ac;
}

.pe-runbook-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 6px;
}

/* Glossary 2-Column Definition Cards */
.pe-glossary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.pe-glossary-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-soft);
    border-radius: 13px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pe-glossary-card p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
}

@media (max-width: 1180px) {
    .pe-guide-shell {
        grid-template-columns: 1fr;
    }
    .pe-guide-toc {
        position: static;
    }
    .pe-guide-toc-sublist,
    .pe-guide-quick-card {
        display: none;
    }
    .pe-guide-toc-card {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 10px;
    }
    .pe-guide-toc-title {
        display: none;
    }
    .pe-flow-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .pe-flow-grid,
    .pe-screen-grid,
    .pe-glossary-grid {
        grid-template-columns: 1fr;
    }
    .pe-sop-step {
        flex-wrap: wrap;
    }
}

/* ── 23. Accessibility: Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .pe-wave-drift,
    .pe-wave-drift-slow {
        animation: none !important;
    }
}
