/* ===================================================================
   THEWORKLAND — Design system
   Minimal, neutral surfaces, one accent, hairline borders.
   Light and dark share the same components; only tokens change.
   Toggle: <html class="dark"> (see includes/ui_head.php).
=================================================================== */

:root {
    /* Surfaces */
    --bg:         #f6f6fb;
    --bg-elev:    #ffffff;
    --bg-subtle:  #f1f1f8;
    --bg-hover:   #f1f1f8;
    --bg-active:  #e4e4ef;

    /* Text */
    --fg:   #09090b;
    --fg-2: #3f3f46;
    --fg-3: #71717a;
    --fg-4: #a1a1aa;

    /* Lines */
    --line:        #e6e6f0;
    --line-strong: #d3d3e2;

    /* Accent (violet, restrained) */
    --accent:       #7c3aed;
    --accent-hover: #6d28d9;
    --accent-text:  #6d28d9;
    --accent-soft:  rgba(124, 58, 237, .08);
    --accent-ring:  rgba(124, 58, 237, .25);

    /* Semantic */
    --ok:          #15803d;  --ok-soft:     rgba(22, 163, 74, .10);
    --warn:        #b45309;  --warn-soft:   rgba(217, 119, 6, .10);
    --danger:      #b91c1c;  --danger-soft: rgba(220, 38, 38, .08);
    --info:        #1d4ed8;  --info-soft:   rgba(37, 99, 235, .08);

    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.06);
    --shadow-lg: 0 12px 32px rgba(0,0,0,.10);

    --radius:    8px;
    --radius-lg: 12px;

    /* Shell */
    --ent-w: 240px;
    --ent-w-collapsed: 64px;
    --ent-topbar-h: 60px;

    /* Legacy aliases (older markup/JS reads these) */
    --ink-1: var(--fg); --ink-2: var(--fg-2); --ink-3: var(--fg-3); --ink-4: var(--fg-4);
    --accent-1: var(--accent-text); --accent-2: var(--accent); --accent-3: var(--accent-hover);
    --accent-4: var(--accent-hover); --accent-5: var(--accent-hover);
    --cyan-1: var(--accent-text); --cyan-2: var(--accent); --cyan-3: var(--accent-hover);
    --rose-1: var(--danger);
    --space-0: var(--bg); --space-1: var(--bg-elev); --space-2: var(--bg-subtle); --space-3: var(--bg-active);
    --panel: var(--bg-elev); --panel-solid: var(--bg-elev);
    --gold-1: var(--accent-text); --gold-2: var(--accent); --gold-3: var(--accent-hover);
    --blue-1: var(--accent-text); --blue-2: var(--accent); --blue-3: var(--bg-active);
    --ent-bg-1: var(--bg-elev); --ent-bg-2: var(--bg-elev); --ent-bg-solid: var(--bg-elev);
    --ent-border: var(--line);
    --ent-text: var(--fg); --ent-text-soft: var(--fg-3); --ent-text-mute: var(--fg-4);
    --ent-accent: var(--accent); --ent-accent-2: var(--accent); --ent-accent-3: var(--accent);
    --glow-indigo: none; --glow-cyan: none;
}

html.dark {
    --bg:         #0b0d1a;
    --bg-elev:    #12152a;
    --bg-subtle:  #181c34;
    --bg-hover:   #1d2240;
    --bg-active:  #262c4f;

    --fg:   #eef0ff;
    --fg-2: #c7cbe6;
    --fg-3: #9399bf;
    --fg-4: #646a90;

    --line:        rgba(150, 160, 255, .12);
    --line-strong: rgba(150, 160, 255, .22);

    --accent:       #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-text:  #b4a1ff;
    --accent-soft:  rgba(139, 92, 246, .16);
    --accent-ring:  rgba(139, 92, 246, .38);

    --ok:          #4ade80;  --ok-soft:     rgba(74, 222, 128, .12);
    --warn:        #fbbf24;  --warn-soft:   rgba(251, 191, 36, .12);
    --danger:      #fb7185;  --danger-soft: rgba(251, 113, 133, .12);
    --info:        #60a5fa;  --info-soft:   rgba(96, 165, 250, .12);

    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,.35);
    --shadow-lg: 0 14px 36px rgba(0,0,0,.5);
}

/* ---------- Global ---------- */
html { color-scheme: light; }
html.dark { color-scheme: dark; }
html { background: var(--bg); }
body { background: transparent; }
html, body {
    color: var(--fg);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01';
}
body.astro-galaxy { position: relative; min-height: 100vh; overflow-x: hidden; }
a { color: inherit; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-4); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

.only-dark { display: none !important; }
html.dark .only-dark { display: inline-block !important; }
html.dark .only-light { display: none !important; }

/* ===================================================================
   Ambient background — neon grid (Tron-like), subtle, animated runners
=================================================================== */
.astro-stars, .astro-nebula, .astro-shooting { display: none !important; }
.astro-bg {
    position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden;
    background:
        radial-gradient(1200px 700px at 12% -10%, rgba(124, 58, 237, .16), transparent 60%),
        radial-gradient(1000px 600px at 100% 110%, rgba(56, 130, 246, .14), transparent 60%),
        var(--bg);
}
.astro-bg::before {
    content: ''; position: absolute; inset: -2px;
    --g: 56px;
    background-image:
        linear-gradient(to right, rgba(139, 92, 246, .18) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(96, 165, 250, .16) 1px, transparent 1px);
    background-size: var(--g) var(--g);
    -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 40%, #000 20%, transparent 100%);
            mask-image: radial-gradient(ellipse 75% 70% at 50% 40%, #000 20%, transparent 100%);
    animation: grid-drift 36s linear infinite;
}
.astro-bg::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(800px 500px at 50% 0%, rgba(167, 139, 250, .08), transparent 70%);
}
/* light runners travelling along grid lines */
.astro-bg i {
    position: absolute; display: block; border-radius: 2px; opacity: 0;
    background: linear-gradient(90deg, transparent, rgba(167, 139, 250, .0), #c4b5fd 60%, #ffffff);
    box-shadow: 0 0 10px rgba(167, 139, 250, .9), 0 0 24px rgba(96, 165, 250, .55);
}
.astro-bg i.h { height: 2px; width: 180px; animation: run-h 9s linear infinite; }
.astro-bg i.v { width: 2px; height: 180px; background: linear-gradient(180deg, transparent, rgba(96, 165, 250, 0), #93c5fd 60%, #ffffff); animation: run-v 11s linear infinite; }
.astro-bg i:nth-child(1) { top: calc(56px * 4  - 1px); animation-delay: 0s; }
.astro-bg i:nth-child(2) { top: calc(56px * 11 - 1px); animation-delay: 3.4s; animation-duration: 12s; }
.astro-bg i:nth-child(3) { top: calc(56px * 7  - 1px); animation-delay: 6.2s; animation-duration: 10s; }
.astro-bg i:nth-child(4) { left: calc(56px * 6  - 1px); animation-delay: 1.5s; }
.astro-bg i:nth-child(5) { left: calc(56px * 16 - 1px); animation-delay: 5s; animation-duration: 14s; }
.astro-bg i:nth-child(6) { left: calc(56px * 23 - 1px); animation-delay: 8.5s; animation-duration: 9.5s; }
@keyframes run-h { 0% { left: -200px; opacity: 0; } 8% { opacity: .9; } 92% { opacity: .9; } 100% { left: 110vw; opacity: 0; } }
@keyframes run-v { 0% { top: -200px; opacity: 0; } 8% { opacity: .9; } 92% { opacity: .9; } 100% { top: 110vh; opacity: 0; } }
@keyframes grid-drift { from { background-position: 0 0, 0 0; } to { background-position: 56px 0, 0 56px; } }
/* light mode: keep it whisper-quiet */
html:not(.dark) .astro-bg { background: var(--bg); }
html:not(.dark) .astro-bg::before { opacity: .55; }
html:not(.dark) .astro-bg::after { display: none; }
html:not(.dark) .astro-bg i { opacity: 0; animation-name: run-h-light; }
html:not(.dark) .astro-bg i.v { animation-name: run-v-light; }
@keyframes run-h-light { 0% { left: -200px; opacity: 0; } 8% { opacity: .35; } 92% { opacity: .35; } 100% { left: 110vw; opacity: 0; } }
@keyframes run-v-light { 0% { top: -200px; opacity: 0; } 8% { opacity: .35; } 92% { opacity: .35; } 100% { top: 110vh; opacity: 0; } }
/* let the grid show through the shell */
html.dark .ent-topbar, html.dark .ent-sidebar { background: rgba(18, 21, 42, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
html.dark .ent-main { background: transparent; }
html:not(.dark) .ent-topbar, html:not(.dark) .ent-sidebar { background: rgba(255,255,255,.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
html:not(.dark) .ent-main { background: transparent; }
html.dark .astro-card, html.dark .bg-white.dark\:bg-darkPanel, html.dark .dark\:bg-darkPanel { background-color: rgba(18, 21, 42, .78) !important; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* ===================================================================
   Surfaces
=================================================================== */
.astro-glass, .astro-glass-strong, .astro-card {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: none;
}
.astro-card { padding: 20px 22px; transition: border-color .15s; }
.astro-card:hover { border-color: var(--line-strong); }
.astro-divider { border-color: var(--line); }
.astro-stat-value { font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; color: var(--fg); }
.astro-stat-label { font-size: .75rem; color: var(--fg-3); }
.astro-section-label, .astro-label {
    font-size: .72rem; color: var(--fg-3); font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
    margin-bottom: 6px; display: block;
}
.astro-accent { color: var(--fg); }
.astro-border-glow { border: 1px solid var(--line); border-radius: var(--radius-lg); }
.astro-fade { animation: astro-fade .25s ease both; }
@keyframes astro-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===================================================================
   Forms
=================================================================== */
.astro-input, .astro-select, .astro-textarea {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-elev);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: .875rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.astro-input::placeholder, .astro-textarea::placeholder { color: var(--fg-4); }
.astro-input:focus, .astro-select:focus, .astro-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
/* Tailwind-styled inputs across pages: normalise focus ring & colors */
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
select, textarea {
    color: var(--fg);
}
input:focus, select:focus, textarea:focus { outline: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }

/* ===================================================================
   Buttons
=================================================================== */
.astro-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-weight: 500; font-size: .875rem; line-height: 1.25;
    transition: background .15s, border-color .15s, color .15s;
    user-select: none; cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}
.astro-btn:active { transform: translateY(.5px); }
.astro-btn-primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.astro-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.astro-btn-ghost { color: var(--fg-2); background: var(--bg-elev); border-color: var(--line-strong); }
.astro-btn-ghost:hover { background: var(--bg-hover); color: var(--fg); }
.astro-btn-danger { color: var(--danger); background: transparent; border-color: var(--line-strong); }
.astro-btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* Tailwind button patterns used inline across pages */
.bg-primary { background-color: var(--accent) !important; color: #fff; }
.hover\:bg-primary\/90:hover, .hover\:bg-secondary:hover, .hover\:bg-primary:hover { background-color: var(--accent-hover) !important; }
.text-primary { color: var(--accent-text) !important; }
.border-primary { border-color: var(--accent) !important; }
.ring-primary, .focus\:ring-primary:focus { --tw-ring-color: var(--accent-ring) !important; }
.focus\:border-primary:focus { border-color: var(--accent) !important; }
.shadow-primary, .shadow-primary\/20, .shadow-primary\/30, .shadow-primary\/40, .hover\:shadow-primary\/40:hover { box-shadow: none !important; }
/* Gradient blocks (hero cards / CTAs) become one flat accent panel */
.bg-gradient-to-br, .bg-gradient-to-r, .bg-gradient-to-tr, .bg-gradient-to-b {
    background-image: none !important;
    background-color: var(--accent) !important;
    color: #fff;
}
.bg-gradient-to-br .text-white\/80, .bg-gradient-to-r .text-white\/80 { color: rgba(255,255,255,.8); }
.tab-btn { color: var(--fg-3); transition: color .15s, border-color .15s; }
.tab-btn:hover { color: var(--fg); }
.tab-btn.active { color: var(--fg) !important; border-bottom: 2px solid var(--fg) !important; }

/* ===================================================================
   Chips, alerts, avatars, toasts
=================================================================== */
.astro-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 8px; border-radius: 999px;
    font-size: .72rem; font-weight: 500;
    border: 1px solid var(--line);
    color: var(--fg-2); background: var(--bg-subtle);
}
.astro-chip.gold, .astro-chip.violet { color: var(--accent-text); border-color: transparent; background: var(--accent-soft); }
.astro-chip.blue, .astro-chip.cyan   { color: var(--info); border-color: transparent; background: var(--info-soft); }
.astro-chip.red                       { color: var(--danger); border-color: transparent; background: var(--danger-soft); }

.astro-alert { padding: 12px 14px; border-radius: var(--radius); font-size: .875rem; border: 1px solid var(--line); background: var(--bg-subtle); color: var(--fg-2); }
.astro-alert.success { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.astro-alert.error   { border-color: transparent; background: var(--danger-soft); color: var(--danger); }

.astro-avatar {
    width: 36px; height: 36px; border-radius: var(--radius);
    background: var(--accent-soft); color: var(--accent-text);
    display: grid; place-items: center; font-weight: 600;
}

.astro-toast-stack { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.astro-toast {
    pointer-events: auto;
    padding: 11px 14px;
    background: var(--fg); color: var(--bg);
    border-radius: var(--radius);
    font-size: .85rem; font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 10px;
    animation: toast-in .2s ease-out;
}
.astro-toast.leaving { animation: toast-out .2s ease-in forwards; }
.astro-toast .dot { width: 6px; height: 6px; border-radius: 6px; background: var(--accent-text); flex-shrink: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); } }

/* Stray warm accents from old pages → neutral */
.bg-amber-100, .bg-yellow-100 { background: var(--warn-soft) !important; }
.text-amber-600, .text-amber-500, .text-yellow-600, .text-yellow-500 { color: var(--warn) !important; }

/* ===================================================================
   Page header (.astro-hero) — compact, no illustration
=================================================================== */
.astro-hero {
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
    padding: 4px 0 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
    background: none; box-shadow: none; border-radius: 0;
}
.astro-hero .hero-text { flex: 1; min-width: 0; }
.astro-hero .hero-eyebrow { font-size: 11px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-4); margin-bottom: 6px; }
.astro-hero .hero-title { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; color: var(--fg); margin: 0 0 4px; }
.astro-hero .hero-sub { font-size: 13.5px; color: var(--fg-3); margin: 0; }
.astro-hero .hero-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.astro-hero .hero-illu { flex-shrink: 0; width: 104px; height: 104px; display: flex; align-items: center; justify-content: center; animation: hero-float 5s ease-in-out infinite; filter: drop-shadow(0 10px 22px rgba(124, 58, 237, .22)); }
.astro-hero .hero-illu img { width: 100%; height: 100%; object-fit: contain; }
.astro-hero-md .hero-illu { width: 96px; height: 96px; }
@keyframes hero-float { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-7px) rotate(1.5deg); } }
.astro-3d { display: inline-block; vertical-align: middle; }
@media (max-width: 640px) { .astro-hero .hero-illu { width: 72px; height: 72px; } }
@media (max-width: 640px) { .astro-hero { padding-bottom: 16px; } }

/* ===================================================================
   Shell: topbar + sidebar + main
=================================================================== */
.ent-topbar {
    position: relative; z-index: 50;
    height: var(--ent-topbar-h); flex-shrink: 0;
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
}
.ent-topbar-brand { display: flex; align-items: center; min-width: 0; padding: 4px 0; text-decoration: none; }
.ent-topbar-brand .brand-mark { height: 28px; max-width: 180px; display: inline-flex; align-items: center; }
.ent-topbar-brand .brand-mark img { height: 100%; width: auto; max-width: 180px; object-fit: contain; }
.ent-topbar-brand .brand-mark svg { width: 28px; height: 28px; }
.ent-topbar-spacer { flex: 1; }
.ent-topbar-right { display: flex; align-items: center; gap: 6px; }

.ent-icon-btn {
    width: 36px; height: 36px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 1px solid transparent; border-radius: var(--radius);
    color: var(--fg-3); cursor: pointer; font-size: 18px; position: relative;
    transition: background .15s, color .15s;
}
.ent-icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.ent-bell-badge {
    position: absolute; top: 6px; right: 6px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: var(--accent); color: #fff;
    font-size: 10px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-elev);
}
.ent-bell-badge.hidden { display: none; }

/* Language switcher */
.ent-lang-menu { position: relative; }
.ent-lang-btn { width: 36px !important; padding: 0; }
.ent-lang-btn .lang-flag { display: inline-flex; align-items: center; line-height: 1; }
.ent-lang-btn .lang-flag .fi, .ent-lang-dropdown a .lang-flag .fi { width: 20px; height: 15px; border-radius: 2px; background-size: cover; }
.ent-dropdown, .ent-lang-dropdown, .ent-user-dropdown, .ent-ws-menu {
    position: absolute; top: calc(100% + 6px); right: 0;
    min-width: 180px;
    background: var(--bg-elev);
    border: 1px solid var(--line); border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    opacity: 0; visibility: hidden; pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .15s, transform .15s, visibility .15s;
    z-index: 90;
}
.ent-lang-menu.open .ent-lang-dropdown, .ent-user-menu.open .ent-user-dropdown, .ent-ws-menu.open {
    opacity: 1; visibility: visible; pointer-events: auto; transform: none;
}
.ent-lang-dropdown a, .ent-user-dropdown a {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 6px;
    color: var(--fg-2); font-size: 13px; text-decoration: none;
    transition: background .12s, color .12s;
}
.ent-lang-dropdown a:hover, .ent-user-dropdown a:hover { background: var(--bg-hover); color: var(--fg); }
.ent-lang-dropdown a.active { color: var(--fg); background: var(--bg-subtle); }
.ent-lang-dropdown a .lang-name { flex: 1; }
.ent-lang-dropdown a .ph-check { color: var(--accent-text); }

/* User menu */
.ent-user-menu { position: relative; }
.ent-user-trigger {
    display: flex; align-items: center; gap: 8px;
    padding: 3px 8px 3px 3px; height: 36px;
    background: transparent; border: 1px solid transparent; border-radius: var(--radius);
    color: var(--fg); cursor: pointer;
    transition: background .15s;
}
.ent-user-trigger:hover { background: var(--bg-hover); }
.ent-avatar {
    width: 28px; height: 28px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent-text);
    font-weight: 600; font-size: 12px;
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.ent-user-text { display: flex; flex-direction: column; line-height: 1.15; text-align: left; min-width: 0; }
.ent-user-text .name { font-size: 13px; font-weight: 500; color: var(--fg); }
.ent-user-text .role { font-size: 10px; color: var(--fg-4); }
.ent-user-trigger .chev { font-size: 11px; color: var(--fg-4); transition: transform .2s; }
.ent-user-menu.open .ent-user-trigger .chev { transform: rotate(180deg); }
@media (max-width: 720px) { .ent-user-text { display: none; } }
.ent-user-dropdown { width: 240px; }
.ent-user-dropdown .user-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.ent-user-dropdown .ent-avatar.lg { width: 36px; height: 36px; font-size: 14px; }
.ent-user-dropdown .full-name { font-size: 13px; font-weight: 500; color: var(--fg); }
.ent-user-dropdown .full-role { font-size: 11px; color: var(--fg-4); margin-top: 1px; }
.ent-user-dropdown a i { font-size: 16px; color: var(--fg-3); }
.ent-user-dropdown a.logout, .ent-user-dropdown a.logout i { color: var(--danger); }
.ent-user-dropdown .divider { height: 1px; background: var(--line); margin: 4px 0; }
.ent-logout-btn { display: inline-flex; }
@media (max-width: 720px) { .ent-logout-btn { display: none; } }

/* Hamburger (mobile) */
.ent-hamburger {
    position: relative; z-index: 60;
    width: 36px; height: 36px;
    display: none; align-items: center; justify-content: center; flex-direction: column; gap: 4px;
    background: transparent; border: 1px solid transparent; border-radius: var(--radius);
    cursor: pointer; padding: 0; flex-shrink: 0;
}
.ent-hamburger:hover { background: var(--bg-hover); }
.ent-hamburger span { display: block; width: 16px; height: 1.5px; background: var(--fg); border-radius: 2px; transition: transform .25s, opacity .2s; }
.ent-hamburger.is-active span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.ent-hamburger.is-active span:nth-child(2) { opacity: 0; }
.ent-hamburger.is-active span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }
@media (max-width: 1023px) { .ent-hamburger { display: flex; } }

/* Shell */
.ent-shell { position: relative; flex: 1; min-height: 0; display: flex; }
.ent-overlay {
    position: fixed; top: var(--ent-topbar-h); left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(0,0,0,.4);
    opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s;
}
.ent-overlay.open { opacity: 1; visibility: visible; }

/* Sidebar */
.ent-sidebar {
    width: var(--ent-w); height: 100%;
    position: relative; z-index: 50;
    display: flex; flex-direction: column;
    background: var(--bg-elev);
    border-right: 1px solid var(--line);
    transition: width .25s cubic-bezier(.4,0,.2,1), transform .25s cubic-bezier(.4,0,.2,1);
    flex-shrink: 0;
}
html.ent-collapsed .ent-sidebar { width: var(--ent-w-collapsed); }
@media (max-width: 1023px) {
    .ent-sidebar { position: fixed; top: var(--ent-topbar-h); left: 0; bottom: 0; width: var(--ent-w); transform: translateX(-100%); height: auto; box-shadow: var(--shadow-lg); }
    .ent-sidebar.mobile-open { transform: translateX(0); }
    html.ent-collapsed .ent-sidebar { width: var(--ent-w); }
}

/* Workspace switcher */
.ws-dot {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; color: #fff; font-weight: 600; flex-shrink: 0; overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.ws-dot-img { background: var(--bg-subtle); }
.ws-dot-img img { width: 100%; height: 100%; object-fit: cover; }
.ent-ws { padding: 12px 10px 4px; position: relative; flex-shrink: 0; }
.ent-ws-trigger {
    width: 100%; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px;
    padding: 6px 8px;
    background: transparent; border: 1px solid transparent; border-radius: var(--radius);
    color: var(--fg); cursor: pointer; text-align: left;
    transition: background .15s, border-color .15s;
}
.ent-ws-trigger:hover { background: var(--bg-hover); }
.ent-ws-trigger .ws-dot { width: 26px; height: 26px; font-size: 11px !important; }
.ent-ws-trigger .ws-name { font-size: 13px; font-weight: 500; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ent-ws-caret { color: var(--fg-4); font-size: 13px; }
.ent-ws-menu { left: 10px; right: 10px; top: calc(100% - 2px); }
.ent-ws-item {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 7px 8px; background: transparent; border: 0; border-radius: 6px;
    color: var(--fg-2); font-size: 13px; cursor: pointer; transition: background .12s;
}
.ent-ws-item .ws-dot { width: 20px; height: 20px; font-size: 9px !important; }
.ent-ws-item:hover { background: var(--bg-hover); color: var(--fg); }
.ent-ws-item.active { background: var(--bg-subtle); color: var(--fg); }
.ent-ws-item .ph-check { color: var(--accent-text); font-size: 14px; }
.ws-pill { font-size: 9px; padding: 1px 6px; border-radius: 999px; background: var(--bg-subtle); color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--line); }
.ent-ws-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); display: flex; gap: 4px; }
.ent-ws-foot a {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px;
    padding: 6px 8px; border-radius: 6px; color: var(--fg-3); font-size: 12px; text-decoration: none;
    transition: background .12s, color .12s;
}
.ent-ws-foot a:hover { background: var(--bg-hover); color: var(--fg); }

/* TheAssistant entry — calm, one accent */
.ent-assistant {
    position: relative; display: block; margin: 8px 10px 10px;
    border-radius: var(--radius); text-decoration: none; flex-shrink: 0;
    border: 1px solid var(--line);
    background: var(--bg);
    transition: border-color .15s, background .15s;
}
.ent-assistant { padding: 0; overflow: visible; isolation: auto;
    border: 1px solid transparent;
    background: linear-gradient(var(--bg-elev), var(--bg-elev)) padding-box,
                linear-gradient(120deg, #8b5cf6, #60a5fa, #c084fc, #8b5cf6) border-box;
    background-size: 100% 100%, 300% 100%;
    animation: aa-shift 8s linear infinite; }
html.dark .ent-assistant { background: linear-gradient(#141833, #141833) padding-box, linear-gradient(120deg, #8b5cf6, #60a5fa, #c084fc, #8b5cf6) border-box; background-size: 100% 100%, 300% 100%; }
.ent-assistant:hover { background: linear-gradient(var(--bg-hover), var(--bg-hover)) padding-box, linear-gradient(120deg, #8b5cf6, #60a5fa, #c084fc, #8b5cf6) border-box; background-size: 100% 100%, 300% 100%; }
.ent-assistant.is-active { box-shadow: 0 0 0 3px var(--accent-soft); }
.ent-assistant .aa-border, .ent-assistant .aa-bg { display: none; }
@keyframes aa-shift { from { background-position: 0 0, 0% 50%; } to { background-position: 0 0, 300% 50%; } }
.aa-orb { box-shadow: 0 0 14px rgba(139, 92, 246, .45); animation: aa-pulse 3s ease-in-out infinite; }
@keyframes aa-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.aa-content { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 9px 10px; }
.aa-orb { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); overflow: hidden; }
.aa-orb-gif img { width: 100%; height: 100%; object-fit: cover; }
.aa-text { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.aa-title { font-size: 13px; font-weight: 500; color: var(--fg); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-sub { font-size: 11px; color: var(--fg-4); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-arrow { color: var(--fg-4); font-size: 14px; transition: transform .15s, color .15s; }
.ent-assistant:hover .aa-arrow { color: var(--fg); transform: translate(1px, -1px); }

/* Nav */
.ent-nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 12px; }
.ent-nav::-webkit-scrollbar { width: 4px; }
.ent-section-label { font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-4); padding: 14px 8px 4px; }
.ent-link {
    width: 100%; display: grid; grid-template-columns: 20px 1fr 14px; align-items: center; gap: 10px;
    padding: 7px 8px; margin: 1px 0;
    background: transparent; border: 0; border-radius: var(--radius);
    color: var(--fg-2); font-size: 13.5px; font-weight: 450;
    text-decoration: none; text-align: left; cursor: pointer; position: relative;
    transition: background .12s, color .12s;
}
.ent-link > i:first-child { font-size: 18px; justify-self: center; color: var(--fg-3); transition: color .12s; }
.ent-link > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ent-link > .ent-caret { font-size: 11px; color: var(--fg-4); justify-self: center; transition: transform .2s; }
.ent-link > .ent-caret.open { transform: rotate(90deg); }
.ent-link:hover { background: var(--bg-hover); color: var(--fg); }
.ent-link:hover > i:first-child { color: var(--fg); }
.ent-link.active { background: var(--bg-subtle); color: var(--fg); font-weight: 500; }
.ent-link.active > i:first-child { color: var(--accent-text); }
.ent-link.active::before { display: none; }
.ent-submenu { max-height: 0; overflow: hidden; transition: max-height .25s ease; margin: 0 0 4px 18px; padding-left: 10px; border-left: 1px solid var(--line); }
.ent-submenu.open { max-height: 600px; }
.ent-sublink { display: flex; align-items: center; gap: 8px; padding: 5px 8px; margin: 1px 0; color: var(--fg-3); font-size: 12.5px; text-decoration: none; border-radius: 6px; transition: color .12s, background .12s; }
.ent-sublink:hover { color: var(--fg); background: var(--bg-hover); }
.ent-sublink.active { color: var(--fg); background: var(--bg-subtle); }
.ent-sublink .dot { width: 4px; height: 4px; border-radius: 4px; background: currentColor; opacity: .5; flex-shrink: 0; }
.ent-sublink i { font-size: 13px; flex-shrink: 0; }
.ent-sub-divider { height: 1px; background: var(--line); margin: 6px 0; }

/* Collapse button */
.ent-collapse-btn {
    flex-shrink: 0; display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px;
    margin: 6px 10px 12px; padding: 7px 8px;
    background: transparent; border: 1px solid transparent; border-radius: var(--radius);
    color: var(--fg-3); font-size: 12.5px; font-weight: 450; cursor: pointer; text-align: left;
    transition: background .12s, color .12s;
}
.ent-collapse-btn:hover { background: var(--bg-hover); color: var(--fg); }
.ent-collapse-btn i { font-size: 16px; justify-self: center; transition: transform .25s; }
html.ent-collapsed .ent-collapse-btn i { transform: rotate(180deg); }

/* Collapsed mode */
@media (min-width: 1024px) {
    html.ent-collapsed .ent-ws { padding: 12px 10px 4px; }
    html.ent-collapsed .ent-ws-trigger { grid-template-columns: 1fr; justify-items: center; padding: 6px; }
    html.ent-collapsed .ent-ws-trigger > .ws-name, html.ent-collapsed .ent-ws-trigger > .ent-ws-caret { display: none; }
    html.ent-collapsed .aa-content { grid-template-columns: 1fr; justify-items: center; padding: 6px; }
    html.ent-collapsed .aa-text, html.ent-collapsed .aa-arrow { display: none; }
    html.ent-collapsed .ent-section-label { opacity: 0; height: 0; padding: 0; overflow: hidden; margin: 0; }
    html.ent-collapsed .ent-link { grid-template-columns: 1fr; justify-items: center; padding: 9px; }
    html.ent-collapsed .ent-link > span, html.ent-collapsed .ent-link > .ent-caret { display: none; }
    html.ent-collapsed .ent-submenu { display: none; }
    html.ent-collapsed .ent-collapse-btn { grid-template-columns: 1fr; justify-items: center; padding: 8px; }
    html.ent-collapsed .ent-collapse-btn > span { display: none; }
    html.ent-collapsed [data-tip]:hover::after {
        content: attr(data-tip);
        position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
        background: var(--fg); color: var(--bg);
        font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 6px;
        white-space: nowrap; pointer-events: none; z-index: 100;
        box-shadow: var(--shadow-md);
    }
}

/* Main */
.ent-main { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 32px 40px; background: var(--bg); }
@media (max-width: 640px) { .ent-main { padding: 20px 16px 32px; } }

/* ===================================================================
   Notifications popover
=================================================================== */
.notif-pop {
    position: absolute; top: 52px; right: 8px;
    width: 360px; max-width: calc(100vw - 32px); max-height: 70vh;
    background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: var(--shadow-lg); z-index: 50;
    opacity: 0; transform: translateY(-4px); pointer-events: none;
    transition: opacity .15s, transform .15s;
    display: flex; flex-direction: column; overflow: hidden;
}
.ent-notif-pop { top: calc(var(--ent-topbar-h) + 6px); right: 16px; }
.notif-pop.open { opacity: 1; transform: none; pointer-events: auto; }
.notif-pop header { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notif-pop header .title { font-weight: 600; font-size: .9rem; color: var(--fg); }
.notif-pop header button.read-all { font-size: .75rem; color: var(--fg-3); background: transparent; border: 0; cursor: pointer; }
.notif-pop header button.read-all:hover { color: var(--fg); }
.notif-pop .list { overflow-y: auto; flex: 1; min-height: 80px; }
.notif-pop .empty { padding: 36px 16px; text-align: center; color: var(--fg-3); font-size: .85rem; }
.notif-row { display: flex; gap: 12px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--fg-2); position: relative; transition: background .12s; }
.notif-row:hover { background: var(--bg-hover); }
.notif-row:last-child { border-bottom: 0; }
.notif-row .icon-blob { width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; background: var(--bg-subtle); color: var(--fg-3); }
.notif-row.high .icon-blob { background: var(--danger-soft); color: var(--danger); }
.notif-row .body { min-width: 0; flex: 1; }
.notif-row .body .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.notif-row .body .t { font-size: .86rem; font-weight: 500; color: var(--fg); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-row .body .when { font-size: .7rem; color: var(--fg-4); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.notif-row .body .m { font-size: .78rem; color: var(--fg-3); margin-top: 2px; line-height: 1.4; }
.notif-row .body .ws-tag { display: inline-block; font-size: .66rem; padding: 1px 7px; border-radius: 999px; background: var(--bg-subtle); color: var(--fg-3); border: 1px solid var(--line); }
.notif-row .body .row-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.notif-row.unread::before { content: ''; position: absolute; left: 7px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; border-radius: 5px; background: var(--accent); }
.notif-row.read { opacity: .6; }
.notif-row.read .body .t { font-weight: 400; }
.notif-row.read:hover { opacity: .85; }
.notif-tag { display: inline-flex; align-items: center; gap: 5px; font-size: .62rem; padding: 1px 7px; border-radius: 999px; letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.notif-tag.tag-unread { background: var(--accent-soft); color: var(--accent-text); }
.notif-tag.tag-unread .dot { width: 5px; height: 5px; border-radius: 5px; background: var(--accent); }
.notif-tag.tag-read { background: var(--bg-subtle); color: var(--fg-4); border: 1px solid var(--line); }
.notif-pop footer { padding: 10px 14px; border-top: 1px solid var(--line); text-align: center; }
.notif-pop footer a { font-size: .8rem; color: var(--fg-2); text-decoration: none; }
.notif-pop footer a:hover { color: var(--fg); }

/* ===================================================================
   Brain — wikilinks, hashtags, embeds
=================================================================== */
.wikilink {
    display: inline-flex; align-items: baseline; gap: 4px;
    padding: 0 4px; border-radius: 4px;
    text-decoration: none; font-weight: 500;
    background: var(--accent-soft); color: var(--accent-text);
    transition: background .12s;
}
.wikilink:hover { background: var(--accent-ring); }
.wikilink i { font-size: .85em; opacity: .85; }
.wikilink-project { color: var(--info); background: var(--info-soft); }
.wikilink-task { color: var(--ok); background: var(--ok-soft); }
.wikilink-credential { color: var(--warn); background: var(--warn-soft); }
.wikilink.broken { background: var(--danger-soft); color: var(--danger); border-bottom: 1px dashed currentColor; cursor: help; }
.hashtag { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: .92em; font-weight: 500; background: var(--bg-subtle); color: var(--fg-2); text-decoration: none; border: 1px solid var(--line); }
.hashtag:hover { color: var(--fg); border-color: var(--line-strong); }
.embed-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 8px 0; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); background: var(--bg-subtle); text-decoration: none; }
.embed-card:hover { border-color: var(--line-strong); border-left-color: var(--accent); }
.embed-card .embed-ico { font-size: 18px; color: var(--accent-text); }
.embed-card .embed-body { display: flex; flex-direction: column; min-width: 0; }
.embed-card .embed-title { font-weight: 600; color: var(--fg); }
.embed-card .embed-hint { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-4); }
.embed-img { max-width: 100%; border-radius: var(--radius); margin: 8px 0; display: block; }

/* Slash menu (notes editor) */
.slash-menu { position: fixed; z-index: 9999; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; animation: slashIn .12s ease; }
@keyframes slashIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.slash-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.slash-title { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-4); font-weight: 600; flex: 1; }
.slash-back { width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 5px; color: var(--fg-3); cursor: pointer; font-size: 11px; }
.slash-back:hover { background: var(--bg-hover); color: var(--fg); }
.slash-input { width: calc(100% - 16px); margin: 8px; background: var(--bg); border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 10px; color: var(--fg); font-size: 13px; font-family: inherit; outline: none; }
.slash-input:focus { border-color: var(--accent); }
.slash-list { max-height: 280px; overflow-y: auto; padding: 4px; }
.slash-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; user-select: none; }
.slash-item.active, .slash-item:hover { background: var(--bg-hover); }
.slash-item i { font-size: 16px; flex-shrink: 0; width: 18px; text-align: center; color: var(--fg-3); }
.slash-label { flex: 1; min-width: 0; font-size: 13px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slash-hint { font-size: 10px; color: var(--fg-4); font-family: ui-monospace, monospace; background: var(--bg-subtle); padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }

/* ===================================================================
   Third-party widgets: follow the theme
=================================================================== */
/* EasyMDE */
.EasyMDEContainer .CodeMirror { background: var(--bg-elev); color: var(--fg); border: 1px solid var(--line-strong); border-radius: 0 0 var(--radius) var(--radius); }
.EasyMDEContainer .editor-toolbar { background: var(--bg-elev); border: 1px solid var(--line-strong); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; opacity: 1; }
.EasyMDEContainer .editor-toolbar button, .EasyMDEContainer .editor-toolbar i.separator { color: var(--fg-3) !important; border-color: var(--line) !important; }
.EasyMDEContainer .editor-toolbar button:hover, .EasyMDEContainer .editor-toolbar button.active { background: var(--bg-hover); border-color: var(--line) !important; color: var(--fg) !important; }
.EasyMDEContainer .CodeMirror-cursor { border-left-color: var(--fg); }
.EasyMDEContainer .editor-preview, .EasyMDEContainer .editor-preview-side { background: var(--bg-elev); color: var(--fg); border-color: var(--line-strong); }
.EasyMDEContainer .editor-statusbar { color: var(--fg-4); }
.cm-s-easymde .cm-header { color: var(--fg); }
.cm-s-easymde .cm-link, .cm-s-easymde .cm-url { color: var(--accent-text); }
.cm-s-easymde .cm-comment { background: var(--bg-subtle); }
.CodeMirror-selected { background: var(--accent-soft) !important; }
/* FullCalendar */
.fc { --fc-border-color: var(--line); --fc-page-bg-color: var(--bg-elev); --fc-neutral-bg-color: var(--bg-subtle); --fc-today-bg-color: var(--accent-soft);
      --fc-button-bg-color: var(--bg-elev); --fc-button-border-color: var(--line-strong); --fc-button-text-color: var(--fg-2);
      --fc-button-hover-bg-color: var(--bg-hover); --fc-button-hover-border-color: var(--line-strong);
      --fc-button-active-bg-color: var(--fg); --fc-button-active-border-color: var(--fg); --fc-event-border-color: transparent; }
.fc .fc-button { border-radius: var(--radius) !important; font-size: 13px; font-weight: 500; box-shadow: none !important; text-transform: capitalize; }
.fc .fc-button-primary:not(:disabled).fc-button-active { color: var(--bg); }
.fc .fc-toolbar-title { font-size: 1.05rem; font-weight: 600; color: var(--fg); }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number { color: var(--fg-3); font-size: 12px; text-decoration: none; }
.fc .fc-daygrid-day-number { color: var(--fg-2); }
.fc-theme-standard td, .fc-theme-standard th, .fc-theme-standard .fc-scrollgrid { border-color: var(--line); }
.fc .fc-event { border-radius: 4px; font-size: 12px; }
/* Prose / markdown */
.prose { color: var(--fg-2); }
.prose h1, .prose h2, .prose h3, .prose h4, .prose strong { color: var(--fg); }
.prose a { color: var(--accent-text); }
.prose code { background: var(--bg-subtle); color: var(--fg); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--bg-subtle); color: var(--fg); border: 1px solid var(--line); }
.prose blockquote { border-left-color: var(--line-strong); color: var(--fg-3); }
.prose hr { border-color: var(--line); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Aliases used by pages */
.fade-in { animation: astro-fade .25s ease both; }
.ent-topbar-brand .brand-text { font-weight: 600; letter-spacing: -.02em; color: var(--fg); font-size: 15px; }
