/* ============================================================
   Zelern CSS Library — zelern.css
   Custom-built design system. No Tailwind, Bootstrap, or frameworks.
   ============================================================ */

/* ---- Reset ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--z-text);
    background-color: var(--z-body-bg);
    background-image: var(--z-body-image);
    background-attachment: fixed;
    min-height: 100vh;
    transition: background-color 400ms ease, color 300ms ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before,
body::after {
    content: none;
}

img, svg {
    display: block;
    max-width: 100%;
}

a {
    color: var(--z-accent-hot);
    text-decoration: none;
    transition: color var(--z-transition-fast);
}

a:hover:not(.btn) {
    color: var(--z-accent-dark);
    text-decoration: none;
}


::selection {
    background: var(--z-selection);
    color: var(--z-text);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--z-scrollbar-thumb);
    border-radius: var(--z-radius-full);
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--z-scrollbar-thumb-hover);
    background-clip: content-box;
}

ul, ol {
    list-style: none;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* ---- CSS Custom Properties (dark theme default, flat colors) ---- */
:root {
    /* Brand colors — mint-teal flat palette */
    --z-primary: #16231F;
    --z-accent: #4FD5BE;
    --z-accent-hot: #4FD5BE;
    --z-accent-dark: #2EB59D;
    --z-accent-soft: #1A3E37;
    --z-success: #4FD5BE;
    --z-alert: #F08A6A;

    /* Navbar — flat dark with mint accent text */
    --z-nav-text: #F0EDE4;
    --z-nav-text-dim: rgba(240, 237, 228, 0.68);
    --z-nav-bg: rgba(14, 21, 20, 0.9);
    --z-nav-border: rgba(255, 255, 255, 0.06);
    --z-nav-shadow: none;
    --z-nav-hover-bg: rgba(79, 213, 190, 0.1);
    --z-nav-hover-border: rgba(79, 213, 190, 0.22);

    /* Surface / text */
    --z-surface: #0E1514;
    --z-text: #F0EDE4;
    --z-text-light: #B8BDBB;
    --z-text-inverse: #0E1514;
    --z-muted: #7A8886;

    /* Borders */
    --z-border: rgba(255, 255, 255, 0.1);
    --z-border-light: rgba(255, 255, 255, 0.06);
    --z-divider: rgba(255, 255, 255, 0.06);

    /* Surface tiers (flat translucent) */
    --z-bg-white: rgba(22, 32, 30, 0.8);
    --z-bg-hover: rgba(79, 213, 190, 0.08);
    --z-bg-active: rgba(79, 213, 190, 0.14);
    --z-row-hover: rgba(79, 213, 190, 0.05);
    --z-row-stripe: rgba(255, 255, 255, 0.02);

    /* Body — flat dark background */
    --z-body-bg: #0E1514;
    --z-body-image: none;
    --z-body-dust: transparent;
    --z-body-dust-opacity: 0;
    --z-body-vignette: transparent;

    /* Form surfaces */
    --z-input-bg: rgba(255, 255, 255, 0.04);
    --z-input-bg-focus: rgba(255, 255, 255, 0.07);
    --z-input-border: rgba(255, 255, 255, 0.12);
    --z-input-highlight: none;
    --z-input-focus-glow: 0 0 0 3px rgba(79, 213, 190, 0.25);

    /* Button: primary (flat mint) */
    --z-btn-primary-bg: #4FD5BE;
    --z-btn-primary-bg-hover: #3EC1AA;
    --z-btn-primary-border: transparent;
    --z-btn-primary-border-hover: transparent;
    --z-btn-primary-text: #0E1514;
    --z-btn-primary-highlight: none;
    --z-btn-primary-shadow: none;
    --z-btn-primary-shadow-hover: 0 6px 18px rgba(79, 213, 190, 0.28);

    /* Button: outline / ghost */
    --z-btn-outline-bg: transparent;
    --z-btn-outline-bg-hover: rgba(79, 213, 190, 0.1);
    --z-btn-outline-border: rgba(79, 213, 190, 0.4);
    --z-btn-outline-border-hover: #4FD5BE;
    --z-btn-outline-highlight: none;
    --z-btn-outline-highlight-hover: none;
    --z-btn-ghost-bg: transparent;
    --z-btn-ghost-bg-hover: rgba(79, 213, 190, 0.1);
    --z-btn-specular: none;
    --z-btn-sheen: none;

    /* Sidebar */
    --z-sidebar-shadow: none;
    --z-sidebar-hover-bg: rgba(79, 213, 190, 0.08);
    --z-sidebar-hover-border: rgba(79, 213, 190, 0.18);
    --z-sidebar-active-bg: rgba(79, 213, 190, 0.14);
    --z-sidebar-active-border: rgba(79, 213, 190, 0.4);
    --z-sidebar-active-shadow: none;
    --z-sidebar-active-text: #4FD5BE;

    /* Misc */
    --z-scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --z-scrollbar-thumb-hover: rgba(79, 213, 190, 0.35);
    --z-progress-track: rgba(255, 255, 255, 0.06);
    --z-progress-track-shadow: none;
    --z-modal-backdrop: rgba(0, 0, 0, 0.55);
    --z-hero-color: #F0EDE4;
    --z-selection: rgba(79, 213, 190, 0.35);
    --z-specular-surface: none;

    /* Spacing scale (4px base) */
    --z-space-1: 0.25rem;
    --z-space-2: 0.5rem;
    --z-space-3: 0.75rem;
    --z-space-4: 1rem;
    --z-space-5: 1.25rem;
    --z-space-6: 1.5rem;
    --z-space-8: 2rem;
    --z-space-10: 2.5rem;
    --z-space-12: 3rem;
    --z-space-16: 4rem;

    /* Typography scale */
    --z-text-xs: 0.75rem;
    --z-text-sm: 0.875rem;
    --z-text-base: 1rem;
    --z-text-lg: 1.125rem;
    --z-text-xl: 1.25rem;
    --z-text-2xl: 1.5rem;
    --z-text-3xl: 1.875rem;
    --z-text-4xl: 2.25rem;

    /* Font weights */
    --z-font-normal: 400;
    --z-font-medium: 500;
    --z-font-semibold: 600;
    --z-font-bold: 700;

    /* Border radius */
    --z-radius-sm: 0.25rem;
    --z-radius: 0.375rem;
    --z-radius-lg: 0.5rem;
    --z-radius-xl: 0.75rem;
    --z-radius-full: 9999px;

    /* Shadows */
    --z-shadow-sm: 0 1px 2px rgba(26, 26, 25, 0.05);
    --z-shadow: 0 1px 3px rgba(26, 26, 25, 0.1), 0 1px 2px rgba(26, 26, 25, 0.06);
    --z-shadow-md: 0 8px 24px rgba(26, 26, 25, 0.09), 0 2px 6px rgba(26, 26, 25, 0.05);
    --z-shadow-lg: 0 20px 50px rgba(26, 26, 25, 0.14), 0 6px 18px rgba(26, 26, 25, 0.08);

    /* Surface tokens (flat — dark theme default) */
    --z-glass-bg: #141D1B;
    --z-glass-bg-strong: #1A2623;
    --z-glass-bg-soft: rgba(255, 255, 255, 0.03);
    --z-glass-border: rgba(255, 255, 255, 0.08);
    --z-glass-border-bright: rgba(255, 255, 255, 0.14);
    --z-glass-blur: none;
    --z-glass-blur-sm: none;
    --z-glass-highlight: none;
    --z-glass-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    --z-glass-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --z-transition: 220ms cubic-bezier(0.22, 1, 0.36, 1);
    --z-transition-fast: 150ms cubic-bezier(0.22, 1, 0.36, 1);

    /* Layout */
    --z-container-sm: 640px;
    --z-container-md: 768px;
    --z-container-lg: 1024px;
    --z-container-xl: 1280px;
    --z-sidebar-width: 260px;
    --z-navbar-height: 56px;
}

/* ---- Light theme overrides (flat mint + cream) ---- */
[data-theme="light"] {
    color-scheme: light;
    --z-primary: #16231F;
    --z-accent: #3EC4A7;
    --z-accent-hot: #2EB096;
    --z-accent-dark: #2EB096;
    --z-accent-soft: #D8F0E8;
    --z-success: #3EC4A7;
    --z-alert: #E07856;
    --z-surface: #F8F6EE;
    --z-text: #16231F;
    --z-text-light: #4D5C59;
    --z-text-inverse: #FAF9F3;
    --z-muted: #8A9896;
    --z-border: rgba(22, 35, 31, 0.1);
    --z-border-light: rgba(22, 35, 31, 0.05);
    --z-divider: rgba(22, 35, 31, 0.08);
    --z-bg-white: #FFFFFF;
    --z-bg-hover: rgba(62, 196, 167, 0.08);
    --z-bg-active: rgba(62, 196, 167, 0.16);
    --z-row-hover: rgba(62, 196, 167, 0.05);
    --z-row-stripe: rgba(22, 35, 31, 0.02);
    --z-body-bg: #F8F6EE;
    --z-body-image: none;
    --z-body-dust: transparent;
    --z-body-dust-opacity: 0;
    --z-body-vignette: transparent;
    --z-glass-bg: #FFFFFF;
    --z-glass-bg-strong: #FFFFFF;
    --z-glass-bg-soft: rgba(22, 35, 31, 0.02);
    --z-glass-border: rgba(22, 35, 31, 0.08);
    --z-glass-border-bright: rgba(22, 35, 31, 0.14);
    --z-glass-highlight: none;
    --z-glass-shadow: 0 2px 12px rgba(22, 35, 31, 0.06);
    --z-glass-shadow-hover: 0 6px 20px rgba(22, 35, 31, 0.1);
    --z-specular-surface: none;
    --z-input-bg: #FFFFFF;
    --z-input-bg-focus: #FFFFFF;
    --z-input-border: rgba(22, 35, 31, 0.14);
    --z-input-highlight: none;
    --z-input-focus-glow: 0 0 0 3px rgba(62, 196, 167, 0.22);
    --z-btn-primary-bg: #3EC4A7;
    --z-btn-primary-bg-hover: #2EB096;
    --z-btn-primary-border: transparent;
    --z-btn-primary-border-hover: transparent;
    --z-btn-primary-text: #FFFFFF;
    --z-btn-primary-highlight: none;
    --z-btn-primary-shadow: none;
    --z-btn-primary-shadow-hover: 0 6px 18px rgba(62, 196, 167, 0.3);
    --z-btn-outline-bg: transparent;
    --z-btn-outline-bg-hover: rgba(62, 196, 167, 0.1);
    --z-btn-outline-border: #3EC4A7;
    --z-btn-outline-border-hover: #2EB096;
    --z-btn-outline-highlight: none;
    --z-btn-outline-highlight-hover: none;
    --z-btn-ghost-bg: transparent;
    --z-btn-ghost-bg-hover: rgba(22, 35, 31, 0.05);
    --z-btn-specular: none;
    --z-btn-sheen: none;
    --z-nav-text: #16231F;
    --z-nav-text-dim: rgba(22, 35, 31, 0.68);
    --z-nav-bg: #FFFFFF;
    --z-nav-border: rgba(22, 35, 31, 0.06);
    --z-nav-shadow: 0 1px 2px rgba(22, 35, 31, 0.04);
    --z-nav-hover-bg: rgba(62, 196, 167, 0.1);
    --z-nav-hover-border: rgba(62, 196, 167, 0.28);
    --z-sidebar-shadow: none;
    --z-sidebar-hover-bg: rgba(62, 196, 167, 0.08);
    --z-sidebar-hover-border: rgba(62, 196, 167, 0.22);
    --z-sidebar-active-bg: rgba(62, 196, 167, 0.16);
    --z-sidebar-active-border: #3EC4A7;
    --z-sidebar-active-shadow: none;
    --z-sidebar-active-text: #2EB096;
    --z-scrollbar-thumb: rgba(22, 35, 31, 0.14);
    --z-scrollbar-thumb-hover: rgba(62, 196, 167, 0.45);
    --z-progress-track: rgba(22, 35, 31, 0.08);
    --z-progress-track-shadow: none;
    --z-modal-backdrop: rgba(22, 35, 31, 0.35);
    --z-hero-color: #16231F;
    --z-selection: rgba(62, 196, 167, 0.3);
}

[data-theme="dark"] {
    color-scheme: dark;
}

/* Device mode (no data-theme) follows OS preference */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        color-scheme: light;
        --z-primary: #16231F;
        --z-accent: #3EC4A7;
        --z-accent-hot: #2EB096;
        --z-accent-dark: #2EB096;
        --z-accent-soft: #D8F0E8;
        --z-success: #3EC4A7;
        --z-alert: #E07856;
        --z-surface: #F8F6EE;
        --z-text: #16231F;
        --z-text-light: #4D5C59;
        --z-text-inverse: #FAF9F3;
        --z-muted: #8A9896;
        --z-border: rgba(22, 35, 31, 0.1);
        --z-border-light: rgba(22, 35, 31, 0.05);
        --z-divider: rgba(22, 35, 31, 0.08);
        --z-bg-white: #FFFFFF;
        --z-bg-hover: rgba(62, 196, 167, 0.08);
        --z-bg-active: rgba(62, 196, 167, 0.16);
        --z-row-hover: rgba(62, 196, 167, 0.05);
        --z-row-stripe: rgba(22, 35, 31, 0.02);
        --z-body-bg: #F8F6EE;
        --z-body-image: none;
        --z-body-dust: transparent;
        --z-body-dust-opacity: 0;
        --z-body-vignette: transparent;
        --z-glass-bg: #FFFFFF;
        --z-glass-bg-strong: #FFFFFF;
        --z-glass-bg-soft: rgba(22, 35, 31, 0.02);
        --z-glass-border: rgba(22, 35, 31, 0.08);
        --z-glass-border-bright: rgba(22, 35, 31, 0.14);
        --z-glass-highlight: none;
        --z-glass-shadow: 0 2px 12px rgba(22, 35, 31, 0.06);
        --z-glass-shadow-hover: 0 6px 20px rgba(22, 35, 31, 0.1);
        --z-specular-surface: none;
        --z-input-bg: #FFFFFF;
        --z-input-bg-focus: #FFFFFF;
        --z-input-border: rgba(22, 35, 31, 0.14);
        --z-input-highlight: none;
        --z-input-focus-glow: 0 0 0 3px rgba(62, 196, 167, 0.22);
        --z-btn-primary-bg: #3EC4A7;
        --z-btn-primary-bg-hover: #2EB096;
        --z-btn-primary-border: transparent;
        --z-btn-primary-border-hover: transparent;
        --z-btn-primary-text: #FFFFFF;
        --z-btn-primary-highlight: none;
        --z-btn-primary-shadow: none;
        --z-btn-primary-shadow-hover: 0 6px 18px rgba(62, 196, 167, 0.3);
        --z-btn-outline-bg: transparent;
        --z-btn-outline-bg-hover: rgba(62, 196, 167, 0.1);
        --z-btn-outline-border: #3EC4A7;
        --z-btn-outline-border-hover: #2EB096;
        --z-btn-outline-highlight: none;
        --z-btn-outline-highlight-hover: none;
        --z-btn-ghost-bg: transparent;
        --z-btn-ghost-bg-hover: rgba(22, 35, 31, 0.05);
        --z-btn-specular: none;
        --z-btn-sheen: none;
        --z-nav-text: #16231F;
        --z-nav-text-dim: rgba(22, 35, 31, 0.68);
        --z-nav-bg: #FFFFFF;
        --z-nav-border: rgba(22, 35, 31, 0.06);
        --z-nav-shadow: 0 1px 2px rgba(22, 35, 31, 0.04);
        --z-nav-hover-bg: rgba(62, 196, 167, 0.1);
        --z-nav-hover-border: rgba(62, 196, 167, 0.28);
        --z-sidebar-shadow: none;
        --z-sidebar-hover-bg: rgba(62, 196, 167, 0.08);
        --z-sidebar-hover-border: rgba(62, 196, 167, 0.22);
        --z-sidebar-active-bg: rgba(62, 196, 167, 0.16);
        --z-sidebar-active-border: #3EC4A7;
        --z-sidebar-active-shadow: none;
        --z-sidebar-active-text: #2EB096;
        --z-scrollbar-thumb: rgba(22, 35, 31, 0.14);
        --z-scrollbar-thumb-hover: rgba(62, 196, 167, 0.45);
        --z-progress-track: rgba(22, 35, 31, 0.08);
        --z-progress-track-shadow: none;
        --z-modal-backdrop: rgba(22, 35, 31, 0.35);
        --z-hero-color: #16231F;
        --z-selection: rgba(62, 196, 167, 0.3);
    }
}

/* ---- Sinhala font ---- */
.lang-si {
    font-family: 'Noto Sans Sinhala', system-ui, sans-serif;
}

/* ---- Tamil font ---- */
.lang-ta {
    font-family: 'Noto Sans Tamil', system-ui, sans-serif;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--z-font-semibold);
    line-height: 1.3;
    color: var(--z-text);
    letter-spacing: -0.015em;
}

h1 { font-size: var(--z-text-4xl); }
h2 { font-size: var(--z-text-3xl); }
h3 { font-size: var(--z-text-2xl); }
h4 { font-size: var(--z-text-xl); }
h5 { font-size: var(--z-text-lg); }
h6 { font-size: var(--z-text-base); font-weight: var(--z-font-medium); }

p {
    margin-bottom: var(--z-space-4);
}

small, .text-sm { font-size: var(--z-text-sm); }
.text-xs { font-size: var(--z-text-xs); }
.text-lg { font-size: var(--z-text-lg); }
.text-xl { font-size: var(--z-text-xl); }
.text-muted { color: var(--z-muted); }
.text-success { color: var(--z-success); }
.text-alert { color: var(--z-alert); }
.text-accent { color: var(--z-accent); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-medium { font-weight: var(--z-font-medium); }
.font-semibold { font-weight: var(--z-font-semibold); }
.font-bold { font-weight: var(--z-font-bold); }

/* ---- Layout ---- */
.container {
    width: 100%;
    max-width: var(--z-container-xl);
    margin-inline: auto;
    padding-inline: var(--z-space-4);
}

.container-sm { max-width: var(--z-container-sm); }
.container-md { max-width: var(--z-container-md); }
.container-lg { max-width: var(--z-container-lg); }

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--z-space-1); }
.gap-2 { gap: var(--z-space-2); }
.gap-3 { gap: var(--z-space-3); }
.gap-4 { gap: var(--z-space-4); }
.gap-6 { gap: var(--z-space-6); }
.gap-8 { gap: var(--z-space-8); }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Spacing */
.m-0 { margin: 0; }
.mt-1 { margin-top: var(--z-space-1); }
.mt-2 { margin-top: var(--z-space-2); }
.mt-4 { margin-top: var(--z-space-4); }
.mt-6 { margin-top: var(--z-space-6); }
.mt-8 { margin-top: var(--z-space-8); }
.mb-1 { margin-bottom: var(--z-space-1); }
.mb-2 { margin-bottom: var(--z-space-2); }
.mb-4 { margin-bottom: var(--z-space-4); }
.mb-6 { margin-bottom: var(--z-space-6); }
.mb-8 { margin-bottom: var(--z-space-8); }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }

.p-2 { padding: var(--z-space-2); }
.p-3 { padding: var(--z-space-3); }
.p-4 { padding: var(--z-space-4); }
.p-6 { padding: var(--z-space-6); }
.p-8 { padding: var(--z-space-8); }
.px-4 { padding-inline: var(--z-space-4); }
.px-6 { padding-inline: var(--z-space-6); }
.py-2 { padding-block: var(--z-space-2); }
.py-3 { padding-block: var(--z-space-3); }
.py-4 { padding-block: var(--z-space-4); }
.py-8 { padding-block: var(--z-space-8); }
.py-16 { padding-block: var(--z-space-16); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.w-full { width: 100%; }

/* ---- Navbar (dark frosted glass — same in both themes) ---- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--z-navbar-height);
    background: var(--z-nav-bg);
    -webkit-backdrop-filter: var(--z-glass-blur);
    backdrop-filter: var(--z-glass-blur);
    color: var(--z-nav-text);
    display: flex;
    align-items: center;
    padding-inline: var(--z-space-6);
    box-shadow: var(--z-nav-shadow);
    border-bottom: 1px solid var(--z-nav-border);
}

.navbar a,
.navbar span,
.navbar-brand,
.navbar-brand * {
    color: var(--z-nav-text) !important;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: var(--z-space-3);
    color: var(--z-nav-text);
    font-weight: var(--z-font-bold);
    font-size: var(--z-text-lg);
}

.navbar-brand:hover {
    text-decoration: none;
}

.navbar-brand img,
.navbar-brand .navbar-logo {
    height: 32px;
    width: auto;
    display: block;
}

/* Inlined SVG logo. `color` flows into the Z + wordmark via
   currentColor in the SVG, so the same markup looks right in both
   light and dark nav themes — charcoal on white, surface on near-black. */
.navbar-brand .navbar-logo {
    color: var(--z-nav-text);
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: var(--z-space-1);
    margin-left: auto;
}

.navbar-nav a {
    color: var(--z-nav-text);
    padding: var(--z-space-2) var(--z-space-4);
    border-radius: var(--z-radius-full);
    font-size: var(--z-text-sm);
    font-weight: var(--z-font-medium);
    border: 1px solid transparent;
    transition: all var(--z-transition);
}

.navbar-nav a:hover {
    background: var(--z-nav-hover-bg);
    border-color: var(--z-nav-hover-border);
    text-decoration: none;
}

/* ---- Sidebar ----
   Sticky positioning so the navigation stays in view while the main
   content scrolls — keyboard / mouse can jump between sections without
   scrolling back to the top. The sidebar lives at top: navbar-height
   so it tucks below the fixed top bar. */
.layout-sidebar {
    display: flex;
    min-height: calc(100vh - var(--z-navbar-height));
    align-items: flex-start;
}

.sidebar {
    width: var(--z-sidebar-width);
    background: var(--z-glass-bg);
    -webkit-backdrop-filter: var(--z-glass-blur);
    backdrop-filter: var(--z-glass-blur);
    border-right: 1px solid var(--z-divider);
    box-shadow: var(--z-sidebar-shadow);
    padding: var(--z-space-5) var(--z-space-3);
    flex-shrink: 0;
    position: sticky;
    top: var(--z-navbar-height, 56px);
    height: calc(100vh - var(--z-navbar-height, 56px));
    overflow-y: auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
}

/* Slim translucent scrollbar — only appears when the sidebar's
   contents overflow (e.g. small viewports). Webkit specifics; Firefox
   uses scrollbar-color further down. */
.sidebar::-webkit-scrollbar       { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(204, 155, 122, 0.18); border-radius: 999px; }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(204, 155, 122, 0.18) transparent; }

/* --- Sidebar links --- */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a,
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--z-radius-lg);
    color: var(--z-text-light);
    font-size: var(--z-text-sm);
    font-weight: var(--z-font-medium);
    border: 1px solid transparent;
    transition: all 160ms ease;
    text-decoration: none;
    position: relative;
}

.sidebar-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 7px;
    background: rgba(204, 155, 122, 0.08);
    color: var(--z-muted);
    flex-shrink: 0;
    transition: all 160ms ease;
}
/* The actual SVG inside the tile. Sized below the tile so there's a
   clean coloured frame around the glyph. stroke comes from currentColor
   on the parent so hover/active state colours propagate. */
.sidebar-link-icon .z-icon {
    width: 16px;
    height: 16px;
    display: block;
}
.sidebar-link-label { flex: 1; }

.sidebar-nav a:hover,
.sidebar-link:hover {
    background: var(--z-sidebar-hover-bg);
    border-color: var(--z-sidebar-hover-border);
    color: var(--z-text);
    text-decoration: none;
    transform: translateX(1px);
}
.sidebar-link:hover .sidebar-link-icon {
    background: rgba(204, 155, 122, 0.16);
    color: var(--z-accent);
}

.sidebar-nav a.active,
.sidebar-link.active {
    background: var(--z-sidebar-active-bg);
    border-color: var(--z-sidebar-active-border);
    color: var(--z-sidebar-active-text);
    font-weight: var(--z-font-semibold);
    box-shadow: var(--z-sidebar-active-shadow);
}
.sidebar-link.active .sidebar-link-icon {
    background: var(--z-accent);
    color: var(--z-text-inverse);
}
/* Vertical accent strip on the active link — gives a clear visual
   anchor without shouting. */
.sidebar-link.active::before {
    content: "";
    position: absolute;
    left: -3px;
    top: 8px; bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--z-accent);
}

.sidebar-section {
    padding: 18px 12px 6px;
    font-size: 10px;
    font-weight: var(--z-font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--z-muted);
}
.sidebar-section:first-child { padding-top: 4px; }

/* --- Sidebar footer --- */
.sidebar-footer {
    margin-top: auto;
    padding: 12px 12px 4px;
    border-top: 1px solid var(--z-divider);
}
.sidebar-role-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(204, 155, 122, 0.12);
    color: var(--z-accent);
    border: 1px solid rgba(204, 155, 122, 0.3);
}
.sidebar-role-pill::before {
    content: "●";
    font-size: 8px;
}
.sidebar-role-owner {
    background: rgba(93, 202, 165, 0.14);
    color: var(--z-success);
    border-color: rgba(93, 202, 165, 0.35);
}
.sidebar-role-admin {
    background: rgba(204, 155, 122, 0.14);
    color: var(--z-accent);
    border-color: rgba(204, 155, 122, 0.35);
}
.sidebar-role-moderator {
    background: rgba(120, 145, 200, 0.14);
    color: #6f8fc8;
    border-color: rgba(120, 145, 200, 0.35);
}
.sidebar-role-viewer {
    background: rgba(136, 135, 128, 0.14);
    color: var(--z-muted);
    border-color: rgba(136, 135, 128, 0.35);
}

.main-content {
    flex: 1;
    padding: var(--z-space-8) var(--z-space-6);
    overflow-x: hidden;
    position: relative;
    z-index: 1;
    min-width: 0; /* lets flex children shrink below their natural size when content is wide */
}

/* On narrow screens the sticky sidebar would eat too much real estate;
   collapse to a top strip and stop sticking. */
@media (max-width: 768px) {
    .layout-sidebar { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--z-divider);
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 8px;
        gap: 4px;
    }
    .sidebar-section { display: none; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
    .sidebar-link { padding: 6px 10px; }
    .sidebar-link.active::before { display: none; }
    .sidebar-footer { display: none; }
}

/* ---- Card (dark liquid glass) ---- */
.card {
    position: relative;
    background: var(--z-glass-bg);
    -webkit-backdrop-filter: var(--z-glass-blur);
    backdrop-filter: var(--z-glass-blur);
    border: 1px solid var(--z-glass-border);
    border-radius: var(--z-radius-xl);
    box-shadow: var(--z-glass-shadow), var(--z-glass-highlight);
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: var(--z-specular-surface);
}

.card-header {
    padding: var(--z-space-5) var(--z-space-6);
    border-bottom: 1px solid var(--z-divider);
    font-weight: var(--z-font-semibold);
    color: var(--z-text);
    position: relative;
}

.card-body {
    padding: var(--z-space-6);
    position: relative;
}

.card-footer {
    padding: var(--z-space-4) var(--z-space-6);
    border-top: 1px solid var(--z-divider);
    background: var(--z-glass-bg-soft);
    border-radius: 0 0 var(--z-radius-xl) var(--z-radius-xl);
    position: relative;
}

/* ---- Stat Card (dark liquid glass) ---- */
.stat-card {
    position: relative;
    background: var(--z-glass-bg);
    -webkit-backdrop-filter: var(--z-glass-blur);
    backdrop-filter: var(--z-glass-blur);
    border: 1px solid var(--z-glass-border);
    border-radius: var(--z-radius-xl);
    padding: var(--z-space-6);
    box-shadow: var(--z-glass-shadow), var(--z-glass-highlight);
    overflow: hidden;
    transition: transform var(--z-transition), box-shadow var(--z-transition);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: var(--z-specular-surface);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--z-glass-border-bright);
    box-shadow: var(--z-glass-shadow-hover), var(--z-glass-highlight);
}

.stat-card-value {
    font-size: var(--z-text-3xl);
    font-weight: var(--z-font-bold);
    color: var(--z-text);
    line-height: 1;
    position: relative;
    letter-spacing: -0.02em;
}

.stat-card-label {
    font-size: var(--z-text-xs);
    color: var(--z-muted);
    margin-top: var(--z-space-2);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: var(--z-font-semibold);
}

/* ---- Buttons (Apple liquid glass) ---- */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--z-space-2);
    padding: var(--z-space-3) var(--z-space-5);
    font-size: var(--z-text-sm);
    font-weight: var(--z-font-semibold);
    letter-spacing: 0.01em;
    border-radius: var(--z-radius-full);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--z-transition);
    white-space: nowrap;
    line-height: 1.5;
    -webkit-backdrop-filter: var(--z-glass-blur-sm);
    backdrop-filter: var(--z-glass-blur-sm);
    overflow: hidden;
    isolation: isolate;
}

.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: var(--z-btn-specular);
    opacity: 0.9;
    transition: opacity var(--z-transition);
    z-index: 1;
}

.btn::after {
    content: "";
    position: absolute;
    left: -30%;
    top: 0;
    width: 40%;
    height: 100%;
    pointer-events: none;
    background: var(--z-btn-sheen);
    transform: skewX(-20deg);
    opacity: 0;
    transition: opacity var(--z-transition), left 600ms cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 2;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:hover::after {
    opacity: 1;
    left: 130%;
}

.btn:active {
    transform: translateY(0);
}

.btn > * {
    position: relative;
    z-index: 3;
}

.btn-primary {
    background: var(--z-btn-primary-bg);
    color: var(--z-btn-primary-text);
    border-color: var(--z-btn-primary-border);
    box-shadow: var(--z-btn-primary-highlight), var(--z-btn-primary-shadow);
}

.btn-primary:hover {
    background: var(--z-btn-primary-bg-hover);
    border-color: var(--z-btn-primary-border-hover);
    box-shadow: var(--z-btn-primary-highlight), var(--z-btn-primary-shadow-hover);
}

.btn-accent {
    background: var(--z-accent);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: none;
}

.btn-accent:hover {
    background: var(--z-accent-dark);
    box-shadow: 0 6px 18px rgba(62, 196, 167, 0.28);
}

.btn-success {
    background: var(--z-success);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: none;
}

.btn-success:hover {
    background: var(--z-accent-dark);
    box-shadow: 0 6px 18px rgba(62, 196, 167, 0.28);
}

.btn-danger {
    background: var(--z-alert);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: none;
}

.btn-danger:hover {
    background: #CC6B4A;
    box-shadow: 0 6px 18px rgba(224, 120, 86, 0.28);
}

.btn-outline {
    background: var(--z-btn-outline-bg);
    border-color: var(--z-btn-outline-border);
    color: var(--z-text);
    box-shadow: var(--z-btn-outline-highlight);
}

.btn-outline:hover {
    background: var(--z-btn-outline-bg-hover);
    border-color: var(--z-btn-outline-border-hover);
    box-shadow: var(--z-btn-outline-highlight-hover);
}

.btn-ghost {
    background: var(--z-btn-ghost-bg);
    color: var(--z-text-light);
    border-color: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.btn-ghost::before { display: none; }

.btn-ghost:hover {
    background: var(--z-btn-ghost-bg-hover);
    color: var(--z-text);
}

.btn-google {
    background: #ffffff;
    color: #1f1f1f;
    border-color: #dadce0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    gap: var(--z-space-3);
    font-weight: 500;
}

.btn-google::before,
.btn-google::after { display: none; }

.btn-google:hover {
    background: #f7f9fc;
    border-color: #d2d6dc;
    color: #1f1f1f;
}

.btn-google svg { flex-shrink: 0; }

.oauth-divider {
    display: flex;
    align-items: center;
    margin: var(--z-space-4) 0;
    color: var(--z-text-muted);
    font-size: var(--z-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.oauth-divider::before,
.oauth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--z-border);
}

.oauth-divider span {
    padding: 0 var(--z-space-3);
}

.btn-sm {
    padding: var(--z-space-2) var(--z-space-4);
    font-size: var(--z-text-xs);
}

.btn-lg {
    padding: var(--z-space-4) var(--z-space-8);
    font-size: var(--z-text-base);
}

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: var(--z-space-4);
}

.form-label {
    display: block;
    font-size: var(--z-text-sm);
    font-weight: var(--z-font-medium);
    color: var(--z-text);
    margin-bottom: var(--z-space-1);
}

.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: var(--z-space-3) var(--z-space-4);
    font-size: var(--z-text-sm);
    line-height: 1.5;
    color: var(--z-text);
    background: var(--z-input-bg);
    -webkit-backdrop-filter: var(--z-glass-blur-sm);
    backdrop-filter: var(--z-glass-blur-sm);
    border: 1px solid var(--z-input-border);
    border-radius: var(--z-radius-lg);
    box-shadow: var(--z-input-highlight);
    transition: all var(--z-transition);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--z-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    background: var(--z-input-bg-focus);
    border-color: var(--z-accent);
    box-shadow: var(--z-input-focus-glow);
}

.form-input.error,
.form-select.error {
    border-color: var(--z-alert);
}

/* Native <select> arrows look out of place against the custom-styled
   text inputs (each browser/OS draws them differently). Strip the
   native chevron and overlay the same SVG caret used by .dob-picker /
   .time-picker selects, so dropdowns feel like one widget family.
   Targets both `select.form-input` (most common in our templates) and
   the standalone `.form-select` class. */
select.form-input,
.form-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Reserve right-side padding for the caret so option text doesn't
       collide with it. The base form-input padding-right is small. */
    padding-right: calc(var(--z-space-4) + 18px);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%237A8886' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--z-space-4) center;
    background-size: 12px 12px;
    cursor: pointer;
}
/* Hide the legacy IE/Edge dropdown arrow as a defence-in-depth. */
select.form-input::-ms-expand,
.form-select::-ms-expand {
    display: none;
}

.form-help {
    display: block; /* a <span> by markup but always on its own row */
    font-size: var(--z-text-xs);
    color: var(--z-muted);
    margin-top: 2px; /* sits snug under the field; field padding gives the breathing room */
    line-height: 1.4;
}

.form-error {
    font-size: var(--z-text-xs);
    color: var(--z-alert);
    margin-top: var(--z-space-1);
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--z-space-2);
    font-size: var(--z-text-sm);
}

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--z-space-4) var(--z-space-5);
    text-align: left;
    border-bottom: 1px solid var(--z-divider);
    color: var(--z-text);
}

.table th {
    font-size: var(--z-text-xs);
    font-weight: var(--z-font-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--z-muted);
    background: var(--z-glass-bg-soft);
}

.table tbody tr {
    transition: background-color var(--z-transition-fast);
}

.table tbody tr:hover {
    background-color: var(--z-row-hover);
}

.table-striped tr:nth-child(even) {
    background-color: var(--z-row-stripe);
}

/* Whole-row links (behaviour wired in zelern.js via [data-row-href]).
   The :hover background already comes from .table tbody tr:hover. */
.table tbody tr.row-link {
    cursor: pointer;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px var(--z-space-3);
    font-size: var(--z-text-xs);
    font-weight: var(--z-font-semibold);
    border-radius: var(--z-radius-full);
    line-height: 1.4;
    border: none;
    box-shadow: none;
}

.badge-success {
    background: rgba(62, 196, 167, 0.16);
    color: var(--z-accent);
}

.badge-alert {
    background: rgba(224, 120, 86, 0.16);
    color: var(--z-alert);
}

.badge-muted {
    background: rgba(138, 152, 150, 0.16);
    color: var(--z-muted);
}

.badge-accent {
    background: rgba(62, 196, 167, 0.16);
    color: var(--z-accent);
}

/* ---- Alerts ---- */
.alert {
    padding: var(--z-space-3) var(--z-space-4);
    border-radius: var(--z-radius);
    font-size: var(--z-text-sm);
    margin-bottom: var(--z-space-4);
    border: 1px solid transparent;
}

.alert {
    border-radius: var(--z-radius-lg);
}

.alert-success {
    background: rgba(62, 196, 167, 0.1);
    border-color: rgba(62, 196, 167, 0.3);
    color: var(--z-accent);
}

.alert-danger {
    background: rgba(224, 120, 86, 0.1);
    border-color: rgba(224, 120, 86, 0.3);
    color: var(--z-alert);
}

.alert-warning {
    background: rgba(224, 120, 86, 0.08);
    border-color: rgba(224, 120, 86, 0.25);
    color: var(--z-alert);
}

.alert-info {
    background: rgba(62, 196, 167, 0.06);
    border-color: var(--z-border);
    color: var(--z-text-light);
}

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--z-modal-backdrop);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--z-transition), visibility var(--z-transition);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--z-glass-bg-strong);
    -webkit-backdrop-filter: var(--z-glass-blur);
    backdrop-filter: var(--z-glass-blur);
    border: 1px solid var(--z-glass-border-bright);
    border-radius: var(--z-radius-xl);
    box-shadow: var(--z-shadow-lg), var(--z-glass-highlight);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    margin: var(--z-space-4);
    color: var(--z-text);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--z-space-5) var(--z-space-6);
    border-bottom: 1px solid var(--z-divider);
}

.modal-body {
    padding: var(--z-space-6);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--z-space-2);
    padding: var(--z-space-5) var(--z-space-6);
    border-top: 1px solid var(--z-divider);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--z-text-xl);
    color: var(--z-muted);
    cursor: pointer;
    padding: var(--z-space-1);
    line-height: 1;
}

.modal-close:hover {
    color: var(--z-text);
}

/* ---- Toast notifications ---- */
.toast-container {
    position: fixed;
    top: var(--z-space-4);
    right: var(--z-space-4);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--z-space-2);
}

.toast {
    background: var(--z-glass-bg-strong);
    -webkit-backdrop-filter: var(--z-glass-blur);
    backdrop-filter: var(--z-glass-blur);
    border: 1px solid var(--z-glass-border-bright);
    border-radius: var(--z-radius-lg);
    padding: var(--z-space-4) var(--z-space-5);
    box-shadow: var(--z-glass-shadow), var(--z-glass-highlight);
    font-size: var(--z-text-sm);
    color: var(--z-text);
    min-width: 280px;
    max-width: 400px;
    animation: toast-in 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.toast-success { border-left: 3px solid var(--z-success); }
.toast-error { border-left: 3px solid var(--z-alert); }
.toast-warning { border-left: 3px solid var(--z-accent); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--z-space-1);
}

.pagination a,
.pagination span {
    padding: var(--z-space-2) var(--z-space-3);
    min-width: 36px;
    text-align: center;
    font-size: var(--z-text-sm);
    border-radius: var(--z-radius-full);
    color: var(--z-text-light);
    border: 1px solid transparent;
    transition: all var(--z-transition);
}

.pagination a:hover {
    background: var(--z-btn-ghost-bg-hover);
    border-color: var(--z-divider);
    text-decoration: none;
    color: var(--z-text);
}

.pagination .active {
    background: var(--z-accent);
    color: #FFFFFF;
    border-color: transparent;
    box-shadow: none;
}

/* ---- Breadcrumbs ---- */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: var(--z-space-2);
    font-size: var(--z-text-sm);
    color: var(--z-muted);
    margin-bottom: var(--z-space-4);
}

.breadcrumbs a {
    color: var(--z-text-light);
}

.breadcrumbs a:hover {
    color: var(--z-accent);
}

.breadcrumbs .separator::after {
    content: "/";
    margin-left: var(--z-space-2);
}

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--z-border-light);
    gap: 0;
    margin-bottom: var(--z-space-6);
}

.tabs {
    border-bottom-color: var(--z-divider);
}

.tab {
    padding: var(--z-space-3) var(--z-space-4);
    font-size: var(--z-text-sm);
    font-weight: var(--z-font-medium);
    color: var(--z-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: all var(--z-transition);
}

.tab:hover {
    color: var(--z-text);
    text-decoration: none;
}

.tab.active {
    color: var(--z-accent-hot);
    border-bottom-color: var(--z-accent-hot);
}

/* ---- Progress bar ---- */
.progress {
    height: 8px;
    background: var(--z-progress-track);
    border-radius: var(--z-radius-full);
    overflow: hidden;
    box-shadow: var(--z-progress-track-shadow);
}

.progress-bar {
    height: 100%;
    background: var(--z-success);
    border-radius: var(--z-radius-full);
    box-shadow: none;
    transition: width 300ms ease;
}

.progress-bar-accent {
    background: var(--z-accent);
    box-shadow: none;
}
.progress-bar-alert {
    background: var(--z-alert);
    box-shadow: none;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: var(--z-space-16) var(--z-space-4);
    color: var(--z-muted);
}

.empty-state h3 {
    color: var(--z-text-light);
    margin-bottom: var(--z-space-2);
}

/* ---- Loading / HTMX indicator ---- */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--z-accent-hot);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Divider ---- */
.divider {
    border: none;
    border-top: 1px solid var(--z-divider);
    margin: var(--z-space-6) 0;
}

/* ---- Landing page specific ---- */
.hero {
    padding: var(--z-space-16) var(--z-space-4);
    text-align: center;
    position: relative;
}

.hero h1 {
    font-size: clamp(2.25rem, 6vw, 4rem);
    margin-bottom: var(--z-space-5);
    letter-spacing: -0.035em;
    line-height: 1.05;
    color: var(--z-hero-color);
}

.hero .tagline {
    font-size: var(--z-text-xl);
    color: var(--z-text-light);
    margin-bottom: var(--z-space-10);
    max-width: 640px;
    margin-inline: auto;
    position: relative;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--z-space-6);
    padding: var(--z-space-8) 0;
}

.feature-card {
    position: relative;
    padding: var(--z-space-8);
    background: var(--z-glass-bg);
    -webkit-backdrop-filter: var(--z-glass-blur);
    backdrop-filter: var(--z-glass-blur);
    border: 1px solid var(--z-glass-border);
    border-radius: var(--z-radius-xl);
    box-shadow: var(--z-glass-shadow), var(--z-glass-highlight);
    overflow: hidden;
    transition: transform var(--z-transition), box-shadow var(--z-transition);
}

.feature-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: var(--z-specular-surface);
}

.feature-card:hover {
    transform: translateY(-3px);
    border-color: var(--z-glass-border-bright);
    box-shadow: var(--z-glass-shadow-hover), var(--z-glass-highlight);
}

.feature-card > * { position: relative; }

.feature-card h3 {
    font-size: var(--z-text-lg);
    margin-bottom: var(--z-space-3);
    color: var(--z-text);
}

.feature-card p {
    color: var(--z-text-light);
    font-size: var(--z-text-sm);
    margin-bottom: 0;
}

.footer {
    border-top: 1px solid var(--z-divider);
    padding: var(--z-space-8) var(--z-space-4);
    text-align: center;
    color: var(--z-muted);
    font-size: var(--z-text-sm);
    position: relative;
    z-index: 1;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        padding: var(--z-space-4);
    }

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .hide-mobile {
        display: none;
    }

    .modal {
        max-width: calc(100% - var(--z-space-8));
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .hide-tablet {
        display: none;
    }
}

/* ---- Legacy class aliases (backward compatibility) ---- */
input.input,
select.input,
textarea.input {
    display: block;
    width: 100%;
    padding: var(--z-space-3) var(--z-space-4);
    font-size: var(--z-text-sm);
    line-height: 1.5;
    color: var(--z-text);
    background: var(--z-input-bg);
    -webkit-backdrop-filter: var(--z-glass-blur-sm);
    backdrop-filter: var(--z-glass-blur-sm);
    border: 1px solid var(--z-input-border);
    border-radius: var(--z-radius-lg);
    box-shadow: var(--z-input-highlight);
    transition: all var(--z-transition);
}

input.input::placeholder,
textarea.input::placeholder {
    color: var(--z-muted);
}

input.input:focus,
select.input:focus,
textarea.input:focus {
    outline: none;
    background: var(--z-input-bg-focus);
    border-color: var(--z-accent);
    box-shadow: var(--z-input-focus-glow);
}

input.input:disabled,
textarea.input:disabled,
select.input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

textarea.input {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--z-space-4);
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--z-space-3);
    margin-top: var(--z-space-6);
    padding-top: var(--z-space-4);
    border-top: 1px solid var(--z-divider);
}

.alert-error {
    border-radius: var(--z-radius-lg);
    background: rgba(224, 120, 86, 0.1);
    border: 1px solid rgba(224, 120, 86, 0.3);
    color: var(--z-alert);
}

/* ---- Theme switcher (floating pill) ---- */
.theme-switch {
    position: fixed;
    bottom: var(--z-space-5);
    right: var(--z-space-5);
    z-index: 150;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: var(--z-glass-bg);
    border: 1px solid var(--z-glass-border);
    border-radius: var(--z-radius-full);
    box-shadow: var(--z-glass-shadow);
}

.theme-switch button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--z-text-light);
    cursor: pointer;
    border-radius: var(--z-radius-full);
    transition: all var(--z-transition);
    padding: 0;
}

.theme-switch button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-switch button:hover {
    color: var(--z-text);
    background: var(--z-btn-ghost-bg-hover);
}

.theme-switch button[aria-pressed="true"] {
    background: var(--z-accent);
    color: #FFFFFF;
    border: 1px solid transparent;
    box-shadow: none;
}

@media (max-width: 640px) {
    .theme-switch {
        bottom: var(--z-space-3);
        right: var(--z-space-3);
    }
    .theme-switch button {
        width: 30px;
        height: 30px;
    }
}

/* ===== Feed (Facebook-style social posts) ===== */
.post-card {
    overflow: hidden;
}
.post-header {
    display: flex;
    align-items: center;
    gap: var(--z-space-3);
    padding: var(--z-space-4);
    border-bottom: 1px solid var(--z-border-light);
}
.post-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--z-border-light);
}
.post-avatar-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--z-text);
}
.post-byline { flex: 1; min-width: 0; }
.post-byline a { color: inherit; text-decoration: none; }
.post-byline a:hover { text-decoration: underline; }
.post-meta-action { margin-left: auto; }
.post-body {
    padding: var(--z-space-4);
    white-space: pre-wrap;
    word-wrap: break-word;
}
.post-image {
    display: block;
    width: 100%;
    max-height: 600px;
    object-fit: cover;
    background: var(--z-border-light);
}
.post-footer {
    display: flex;
    gap: var(--z-space-2);
    padding: var(--z-space-2) var(--z-space-4);
    border-top: 1px solid var(--z-border-light);
}
.post-action {
    flex: 1;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--z-radius);
    padding: var(--z-space-2) var(--z-space-3);
    cursor: pointer;
    color: var(--z-text-muted);
    font: inherit;
    transition: background 0.15s, color 0.15s;
}
.post-action:hover { background: var(--z-border-light); color: var(--z-text); }
.post-action.is-active { color: var(--z-accent); font-weight: 600; }

.post-comments { padding: 0 var(--z-space-4) var(--z-space-3); }
.comment-list { display: flex; flex-direction: column; gap: var(--z-space-2); }
.comment {
    display: flex;
    align-items: flex-start;
    gap: var(--z-space-2);
    padding-top: var(--z-space-2);
}
.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--z-border-light);
    flex-shrink: 0;
}
.comment-avatar-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--z-text-xs);
    font-weight: 600;
    text-transform: uppercase;
}
.comment-body {
    background: var(--z-border-light);
    padding: var(--z-space-2) var(--z-space-3);
    border-radius: var(--z-radius-lg);
    flex: 1;
    min-width: 0;
}
.comment-form {
    display: flex;
    gap: var(--z-space-2);
    margin-top: var(--z-space-3);
}
.comment-form .form-input { flex: 1; }

/* ===== Feed: Start-free-trial CTA ===== */
.cta-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--z-space-4);
    padding: var(--z-space-5);
    border: 1px solid var(--z-accent);
    background: var(--z-accent-soft);
    border-radius: var(--z-radius-lg);
    flex-wrap: wrap;
}
.cta-card h3 { color: var(--z-accent); }
.cta-card .btn { flex-shrink: 0; }

/* ===== Tag chip input (class form) ===== */
.tag-input-shell {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--z-space-2);
    padding: var(--z-space-2) var(--z-space-3);
    border: 1px solid var(--z-input-border);
    background: var(--z-input-bg);
    border-radius: var(--z-radius);
    min-height: 42px;
    cursor: text;
}
.tag-input-shell:focus-within {
    background: var(--z-input-bg-focus);
    box-shadow: var(--z-input-focus-glow);
    border-color: var(--z-accent);
}
.tag-input-chips {
    display: contents;
}
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--z-space-1);
    padding: 2px 8px 2px 10px;
    background: rgba(79, 213, 190, 0.15);
    color: var(--z-text);
    border-radius: var(--z-radius-full);
    font-size: var(--z-text-sm);
    line-height: 1.6;
}
.tag-chip button {
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 1.1em;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 2px;
    opacity: 0.7;
}
.tag-chip button:hover { opacity: 1; }

.tag-input-text {
    flex: 1;
    min-width: 120px;
    border: 0;
    background: transparent;
    outline: none;
    padding: 4px 0;
    color: var(--z-text);
}

.tag-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    max-height: 220px;
    overflow-y: auto;
    background: var(--z-glass-bg-strong);
    border: 1px solid var(--z-glass-border);
    border-radius: var(--z-radius);
    box-shadow: var(--z-shadow-md);
    list-style: none;
    margin: 0;
    padding: 4px 0;
}
.tag-suggestions li {
    padding: 6px 12px;
    cursor: pointer;
    font-size: var(--z-text-sm);
}
.tag-suggestions li:hover {
    background: var(--z-bg-hover);
    color: var(--z-accent);
}

/* Tag pill rendered inside a table cell. */
.tag-pill {
    display: inline-block;
    padding: 1px 8px;
    margin-right: 4px;
    margin-bottom: 2px;
    border-radius: var(--z-radius-full);
    font-size: var(--z-text-xs);
    background: rgba(79, 213, 190, 0.12);
    color: var(--z-text-light);
}

/* ===== Switch toggle (replaces a checkbox visually, same form semantics) ===== */
.switch {
    display: inline-flex;
    align-items: center;
    gap: var(--z-space-3);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.switch input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.switch-track {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    background: var(--z-input-bg);
    border: 1px solid var(--z-input-border);
    border-radius: var(--z-radius-full);
    transition: background var(--z-transition-fast),
                border-color var(--z-transition-fast);
}
.switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--z-text-light);
    border-radius: 50%;
    transition: transform var(--z-transition-fast),
                background var(--z-transition-fast);
}
.switch input[type="checkbox"]:checked + .switch-track {
    background: var(--z-accent);
    border-color: var(--z-accent);
}
.switch input[type="checkbox"]:checked + .switch-track .switch-thumb {
    background: var(--z-text-inverse);
    transform: translateX(20px);
}
.switch input[type="checkbox"]:focus-visible + .switch-track {
    box-shadow: var(--z-input-focus-glow);
}
.switch:has(input:disabled) {
    opacity: 0.55;
    cursor: not-allowed;
}
.switch-label {
    color: var(--z-text);
    font-size: var(--z-text-sm);
}

/* ===== Realtime field-availability indicator ===== */
/* Empty status reserves no vertical space — the form-help below sits
 * snug against the input. Once the user starts typing and a status
 * appears, top margin returns and the help text shifts down by one
 * line, which is the expected behaviour. */
.code-status {
    display: block;
    font-size: var(--z-text-xs);
    line-height: 1.4;
}
.code-status:not(:empty) {
    margin-top: var(--z-space-1);
}
.code-status-muted { color: var(--z-text-muted); }
.code-status-good  { color: var(--z-accent); font-weight: 500; }
.code-status-bad   { color: var(--z-alert); font-weight: 500; }

/* ===== Read-only form input ===== */
/* For fields that should be displayed but never edited (auto-generated
 * student/teacher numbers, immutable class codes). Using a real
 * <input readonly> keeps box height + text vertical alignment identical
 * to an editable input next to it — no <p>-vs-<input> rendering quirks.
 *
 * Visual cues for "read-only": dashed border, dimmer text, not-allowed
 * cursor. Background is unchanged so it still looks like a field. */
.form-input[readonly] {
    border-style: dashed;
    color: var(--z-text-light);
    cursor: not-allowed;
}
.form-input[readonly]:focus {
    box-shadow: none;
    border-color: var(--z-input-border);
}

/* ============================================================================
   Compact icon-first global navbar (with search + bell + avatar menu).
   Used on every non-institute global page via {{template "navbar" .}}.
   ========================================================================= */

.navbar-icons {
    gap: var(--z-space-3);
    padding-inline: var(--z-space-4);
}
.navbar-icons .navbar-brand img,
.navbar-icons .navbar-brand .navbar-logo {
    height: 28px;
}

/* Brand cluster — logo + optional institute context name. The HTML
   keeps them as separate <a>s (nesting <a> in <a> is invalid) so this
   wrapper just lays them out on one line. */
.navbar-brand-group {
    display: inline-flex;
    align-items: center;
    gap: var(--z-space-2);
    min-width: 0;
}
.navbar-context-divider {
    color: var(--z-nav-text-dim);
    opacity: 0.5;
    font-weight: 300;
    font-size: var(--z-text-base);
    user-select: none;
}
.navbar-context-name {
    color: var(--z-nav-text-strong, var(--z-text-inverse));
    font-weight: 500;
    font-size: var(--z-text-sm);
    text-decoration: none;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: opacity 160ms ease;
}
.navbar-context-name:hover {
    opacity: 0.85;
    text-decoration: none;
}

/* Sysadmin sidebar now uses the shared .sidebar / .layout-sidebar
   chrome. The "system admin" pill in the footer gets its own
   alert-tinted variant so it reads at-a-glance as a privileged
   context. */
.sidebar-role-sysadmin {
    background: rgba(216, 90, 48, 0.14);
    color: var(--z-alert);
    border-color: rgba(216, 90, 48, 0.35);
}

/* ---- Search bar in the navbar ---- */
.navbar-search {
    position: relative;
    flex: 1 1 320px;
    max-width: 520px;
    margin: 0 var(--z-space-4);
}
.navbar-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--z-nav-text-dim);
    pointer-events: none;
    display: flex;
    align-items: center;
}
.navbar-search-input {
    width: 100%;
    padding: 8px 14px 8px 38px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--z-radius-full);
    color: var(--z-nav-text);
    font-size: var(--z-text-sm);
    transition: all var(--z-transition);
}
.navbar-search-input::placeholder { color: var(--z-nav-text-dim); }
.navbar-search-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--z-nav-hover-border);
    box-shadow: 0 0 0 3px rgba(79, 213, 190, 0.15);
}
.navbar-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--z-bg-white);
    color: var(--z-text);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    max-height: 60vh;
    overflow-y: auto;
    z-index: 200;
    backdrop-filter: var(--z-glass-blur);
}
.navbar-search-dropdown[hidden] { display: none; }
.navbar-search-section-label {
    padding: 8px 14px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--z-muted);
}
.navbar-search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--z-text);
}
.navbar-search-result:hover,
.navbar-search-result.is-active {
    background: var(--z-bg-hover);
    text-decoration: none;
}
.navbar-search-result .result-icon {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--z-bg-active);
    display: flex; align-items: center; justify-content: center;
    color: var(--z-accent);
    font-weight: 600;
    flex-shrink: 0;
}
.navbar-search-result .result-title { font-weight: 500; line-height: 1.2; }
.navbar-search-result .result-sub   { font-size: 12px; color: var(--z-muted); }
.navbar-search-empty {
    padding: 14px;
    color: var(--z-muted);
    font-size: var(--z-text-sm);
    text-align: center;
}

/* ---- Icon buttons group on the right ---- */
.navbar-icons-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--z-nav-text);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--z-transition);
    text-decoration: none;
    padding: 0;
}
.nav-icon-btn:hover,
.nav-icon-btn:focus-visible {
    background: var(--z-nav-hover-bg);
    border-color: var(--z-nav-hover-border);
    color: var(--z-nav-text);
    text-decoration: none;
    outline: none;
}

/* ---- Bell ---- */
.nav-bell { position: relative; }
.nav-bell-btn { position: relative; }
.nav-bell-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--z-alert);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    border-radius: 9px;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--z-nav-bg);
}
.nav-bell-badge[hidden] { display: none; }
.nav-bell-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-width: calc(100vw - 24px);
    background: var(--z-bg-white);
    color: var(--z-text);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    z-index: 200;
    backdrop-filter: var(--z-glass-blur);
    overflow: hidden;
}
.nav-bell-dropdown[hidden] { display: none; }
.nav-bell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--z-border);
}
.nav-bell-list {
    max-height: 50vh;
    overflow-y: auto;
}
.nav-bell-empty {
    padding: 28px 14px;
    color: var(--z-muted);
    text-align: center;
    font-size: var(--z-text-sm);
}
.nav-bell-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--z-divider);
    text-decoration: none;
    color: inherit;
}
.nav-bell-item:hover { background: var(--z-bg-hover); text-decoration: none; }
.nav-bell-item.is-unread { background: var(--z-row-hover); }
.nav-bell-item .bell-icon {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--z-bg-active);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}
.nav-bell-item .bell-title  { font-weight: 500; line-height: 1.25; }
.nav-bell-item .bell-body   { font-size: 13px; color: var(--z-text-light); margin-top: 2px; line-height: 1.35; }
.nav-bell-item .bell-time   { font-size: 11px; color: var(--z-muted); margin-top: 4px; }
.nav-bell-footer {
    display: block;
    padding: 10px 14px;
    text-align: center;
    border-top: 1px solid var(--z-border);
    color: var(--z-accent);
    text-decoration: none;
    font-size: var(--z-text-sm);
    font-weight: 500;
}
.nav-bell-footer:hover { background: var(--z-bg-hover); text-decoration: none; }

/* ---- Avatar / user menu ---- */
.nav-avatar-wrap { position: relative; }
.nav-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 50%;
    background: var(--z-accent);
    color: var(--z-text-inverse);
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    transition: all var(--z-transition);
}
.nav-avatar-btn:hover,
.nav-avatar-btn:focus-visible {
    border-color: var(--z-nav-hover-border);
    outline: none;
}
.nav-avatar-btn img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.nav-avatar-letter {
    font-weight: 600;
    font-size: 14px;
}
.nav-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--z-bg-white);
    color: var(--z-text);
    border: 1px solid var(--z-border);
    border-radius: var(--z-radius);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    z-index: 200;
    backdrop-filter: var(--z-glass-blur);
    overflow: hidden;
    padding: 6px 0;
}
.nav-menu-dropdown[hidden] { display: none; }
.nav-menu-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--z-divider);
    margin-bottom: 4px;
}
.nav-menu-name { font-weight: 600; line-height: 1.2; }
.nav-menu-email { font-size: 12px; color: var(--z-muted); }
.nav-menu-dropdown a {
    display: block;
    padding: 8px 14px;
    color: var(--z-text);
    text-decoration: none;
    font-size: var(--z-text-sm);
}
.nav-menu-dropdown a:hover { background: var(--z-bg-hover); text-decoration: none; }
.nav-menu-divider { height: 1px; background: var(--z-divider); margin: 6px 0; }

.link-btn {
    background: transparent;
    border: none;
    color: var(--z-accent);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    font-weight: 500;
}
.link-btn:hover { text-decoration: underline; }

/* Compact mode for narrow screens — drop the search width */
@media (max-width: 720px) {
    .navbar-search { display: none; }
    .navbar-icons { padding-inline: var(--z-space-3); }
    .nav-bell-dropdown { width: 320px; }
}

/* ============================================================================
   /notifications inbox page list
   ========================================================================= */
.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--z-divider);
}
.inbox-item:last-child { border-bottom: none; }
.inbox-item-unread { background: var(--z-row-hover); }
.inbox-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--z-bg-active);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.inbox-title { font-weight: 500; line-height: 1.3; }
.inbox-text  { color: var(--z-text-light); font-size: 14px; margin-top: 2px; line-height: 1.45; }
.inbox-meta  { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.inbox-link  { font-size: 13px; color: var(--z-accent); text-decoration: none; }
.inbox-link:hover { text-decoration: underline; }

/* ============================================================================
   Toast popup container — quick on-screen notifications driven by zelern.js
   ========================================================================= */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--z-bg-white);
    color: var(--z-text);
    border: 1px solid var(--z-border);
    border-left: 4px solid var(--z-accent);
    border-radius: var(--z-radius);
    padding: 12px 14px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    min-width: 280px;
    max-width: 360px;
    pointer-events: auto;
    transform: translateY(8px);
    opacity: 0;
    transition: all 220ms ease;
}
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast-title { font-weight: 600; line-height: 1.25; }
.toast-body  { font-size: 13px; color: var(--z-text-light); margin-top: 4px; line-height: 1.4; }
.toast-link  { font-size: 13px; color: var(--z-accent); text-decoration: none; display: inline-block; margin-top: 6px; }

/* ============================================================================
   12-hour time picker (zelern.js [data-zelern-time])
   ========================================================================= */
.time-picker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* Match the native form-input's outer padding so the widget sits neatly
       next to other form fields. */
    padding: 0;
}

.time-picker-select {
    /* Inherit the form-input look so the widget feels like one control. */
    background: var(--z-input-bg);
    color: var(--z-text);
    border: 1px solid var(--z-input-border);
    border-radius: var(--z-radius);
    padding: 8px 28px 8px 10px;
    font-size: var(--z-text-sm);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--z-transition);
    /* Custom dropdown caret so this looks consistent across browsers. */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%237A8886' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px 12px;
}
.time-picker-select:focus {
    outline: none;
    background-color: var(--z-input-bg-focus);
    border-color: var(--z-accent);
    box-shadow: var(--z-input-focus-glow);
}

.time-picker-hour, .time-picker-minute { min-width: 64px; text-align: center; }
.time-picker-ampm { min-width: 76px; margin-left: 4px; }

.time-picker-colon {
    color: var(--z-muted);
    font-weight: 600;
    font-size: var(--z-text-base);
    padding: 0 2px;
    user-select: none;
}

/* Compact at narrow widths — let the AM/PM wrap below the hour:minute pair. */
@media (max-width: 480px) {
    .time-picker { flex-wrap: wrap; }
    .time-picker-hour, .time-picker-minute { min-width: 56px; }
    .time-picker-ampm { margin-left: 0; }
}

/* DOB picker — Year → Month → Day, three native selects. Same look-and-feel
   as the time picker (shared dropdown caret styling) so they feel like
   parts of the same widget family. */
.dob-picker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 0;
}
.dob-picker-select {
    background: var(--z-input-bg);
    color: var(--z-text);
    border: 1px solid var(--z-input-border);
    border-radius: var(--z-radius);
    padding: 8px 28px 8px 10px;
    font-size: var(--z-text-sm);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--z-transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%237A8886' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px 12px;
}
.dob-picker-select:focus {
    outline: none;
    background-color: var(--z-input-bg-focus);
    border-color: var(--z-accent);
    box-shadow: var(--z-input-focus-glow);
}

.dob-picker-year  { min-width: 96px; }
.dob-picker-month { min-width: 132px; }
.dob-picker-day   { min-width: 76px; text-align: center; }

@media (max-width: 480px) {
    .dob-picker-year  { min-width: 84px; }
    .dob-picker-month { min-width: 116px; }
    .dob-picker-day   { min-width: 68px; }
}

/* User-search dropdown — used by the student-create form and the
   parent-add dialog. Sits inline below the email input; hidden until JS
   populates it. */
.user-search-results {
    position: relative;
    margin-top: 4px;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    max-height: 280px;
    overflow-y: auto;
    z-index: 5;
}
.user-search-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}
.user-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 120ms ease;
}
.user-search-item:hover, .user-search-item:focus {
    background: var(--z-surface-hover, rgba(204, 155, 122, 0.08));
    outline: none;
}
.user-search-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--z-accent);
    color: var(--z-text-inverse);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    overflow: hidden;
}
.user-search-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-search-meta { flex: 1; min-width: 0; }
.user-search-name { font-weight: 500; font-size: 14px; }
.user-search-line { font-size: 12px; color: var(--z-muted); }
.user-search-empty {
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--z-muted);
}
input.is-linked {
    background-color: rgba(93, 202, 165, 0.08);
    border-color: var(--z-success);
}
.btn.btn-xs { padding: 2px 8px; font-size: 11px; }

/* Paysheet receipt — printable record the teacher saves as PDF.
   Screen view keeps the navbar + back/print buttons; print view (below)
   strips them so the page renders as a clean single-page document. */
.paysheet-receipt {
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: 12px;
    padding: 40px;
    max-width: 720px;
    margin: 0 auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
.paysheet-receipt-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    border-bottom: 1px solid var(--z-border);
    padding-bottom: 24px;
    margin-bottom: 24px;
}
.paysheet-receipt-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}
.paysheet-receipt-brand-name {
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}
.paysheet-receipt-title {
    margin: 8px 0 0 0;
    font-size: 1.6rem;
    font-weight: 600;
}
.paysheet-receipt-ref { text-align: right; }
.paysheet-receipt-id {
    font-size: 11px;
    color: var(--z-muted);
    word-break: break-all;
}
.paysheet-receipt-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}
.paysheet-receipt-amount {
    background: var(--z-surface-hover, rgba(204, 155, 122, 0.08));
    border: 1px solid var(--z-border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}
.paysheet-receipt-amount-value {
    font-size: 2.4rem;
    font-weight: 600;
    margin-top: 4px;
    color: var(--z-success);
    letter-spacing: -0.01em;
}
.paysheet-receipt-notes {
    border-top: 1px dashed var(--z-border);
    padding-top: 16px;
    margin-bottom: 24px;
}
.paysheet-receipt-footer {
    border-top: 1px solid var(--z-border);
    padding-top: 16px;
}

/* Print rules — hide chrome (navbar, action buttons, alerts), show
   only the receipt itself. The browser's native "Save as PDF" produces
   a clean PDF the teacher can keep for their records. */
@media print {
    .navbar, .no-print, .alert { display: none !important; }
    body, html { background: white !important; }
    .paysheet-receipt {
        border: 0;
        box-shadow: none;
        padding: 0;
        max-width: 100%;
    }
    main { padding: 0 !important; }
}
@media (max-width: 640px) {
    .paysheet-receipt-meta { grid-template-columns: 1fr; }
    .paysheet-receipt-header { flex-direction: column; }
    .paysheet-receipt-ref { text-align: left; }
}

/* Dashboard quick-action tiles. Big and friendly — these are the
   most-used flows in the app, so they get top billing above the stats. */
.quick-action-tile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all var(--z-transition);
}
.quick-action-tile:hover {
    transform: translateY(-1px);
    border-color: var(--z-accent);
    box-shadow: 0 4px 16px rgba(204, 155, 122, 0.12);
}
.quick-action-icon {
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(204, 155, 122, 0.1);
    flex-shrink: 0;
}
.quick-action-title {
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 2px;
}
.quick-action-hint {
    font-size: 13px;
    color: var(--z-muted);
    line-height: 1.4;
}
@media (max-width: 768px) {
    .dashboard-quick-actions { grid-template-columns: 1fr !important; }
}

/* "Live now" highlight on quick-action class cards. Subtle accent
   border-left + a faint surface tint so the eye finds it instantly
   without flooding the page. */
.quick-card-live {
    border-left: 4px solid var(--z-success);
    background: linear-gradient(to right, rgba(93, 202, 165, 0.04), transparent 30%);
}

/* Dashboard income tile — same .stat-card body but with a slimmer
   header line and a label-on-top layout (income amount is the hero,
   not the label). */
.stat-card.stat-card-income .stat-card-label {
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
}

/* P&L table on the dashboard — two-column "This month" / "All time"
   breakdown. The deduction row gets a subdued tone, the net row a
   slightly heavier divider so the bottom line stands out without
   shouting. */
.pl-table tbody td { vertical-align: top; }
.pl-table .pl-deduction td { color: var(--z-muted); }
.pl-table .pl-deduction td:first-child { color: var(--z-text); }
.pl-table .pl-net {
    border-top: 2px solid var(--z-border);
}
.pl-table .pl-net td {
    padding-top: 14px;
    font-size: 1.05rem;
}

/* Report-builder form on /settings/reports. Type picker uses
   radio-cards so the user sees a description per option. */
.report-type-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 6px;
}
@media (max-width: 720px) {
    .report-type-grid { grid-template-columns: 1fr; }
}
.report-type-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--z-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--z-transition);
    background: var(--z-surface);
}
.report-type-option:hover {
    border-color: var(--z-accent);
}
.report-type-option input[type="radio"] {
    margin-top: 2px;
    flex-shrink: 0;
}
.report-type-option input[type="radio"]:checked + .report-type-body .report-type-title {
    color: var(--z-accent);
}
.report-type-option:has(input[type="radio"]:checked) {
    border-color: var(--z-accent);
    background: rgba(204, 155, 122, 0.06);
}
.report-type-title { font-weight: 600; margin-bottom: 2px; }
.report-type-desc { font-size: 12px; color: var(--z-muted); line-height: 1.4; }

.report-format-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* Print-friendly report document (analogous to .paysheet-receipt). */
.report-doc {
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: 10px;
    padding: 32px;
    max-width: 900px;
    margin: 0 auto;
}
.report-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    border-bottom: 1px solid var(--z-border);
    padding-bottom: 16px;
    margin-bottom: 20px;
}
.report-doc-brand {
    display: flex; align-items: center; gap: 8px;
}
.report-doc-brand-name { font-weight: 600; }
.report-doc-title {
    margin: 8px 0 0 0;
    font-size: 1.4rem;
    font-weight: 600;
}
.report-doc-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 13px;
}
.report-doc-table th, .report-doc-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--z-divider);
    text-align: left;
    vertical-align: top;
}
.report-doc-table th {
    font-weight: 600;
    background: rgba(204, 155, 122, 0.05);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.04em;
}
.report-doc-summary td {
    font-weight: 600;
    border-top: 2px solid var(--z-border);
    border-bottom: none;
}
.report-doc-summary td:last-child { text-align: right; }
.report-doc-footer {
    border-top: 1px solid var(--z-border);
    padding-top: 12px;
    margin-top: 16px;
}

/* Print rules — reuse the same approach as paysheet receipt: hide
   navbar / .no-print / alerts, strip card chrome. */
@media print {
    .report-doc {
        border: 0;
        box-shadow: none;
        padding: 0;
        max-width: 100%;
    }
}

/* Settings → Members per-row Change panel. The <details> trigger is
   styled like a button; the body holds the role-change select + the
   remove form. */
.member-actions { display: inline-block; text-align: left; }
.member-actions[open] summary { color: var(--z-accent); }
.member-actions-body {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--z-border);
    border-radius: 8px;
    background: var(--z-surface);
    min-width: 240px;
}

/* Operator multi-pick widget — Settings → Add members.
   Renders chips inline with the input so it looks like a single
   "tag-input"-style control. The dropdown sits below the shell. */
.operator-picker { position: relative; }
.operator-picker-shell {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    background: var(--z-input-bg);
    border: 1px solid var(--z-input-border);
    border-radius: var(--z-radius-lg);
    min-height: 44px;
    align-items: center;
}
.operator-picker-shell:focus-within {
    border-color: var(--z-accent);
    background: var(--z-input-bg-focus);
    box-shadow: var(--z-input-focus-glow);
}
.operator-picker-chips {
    display: contents; /* let chips share the flex layout with the input */
    list-style: none;
    margin: 0;
    padding: 0;
}
.operator-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    background: rgba(204, 155, 122, 0.12);
    border: 1px solid var(--z-accent);
    border-radius: 999px;
    font-size: 13px;
    line-height: 1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.operator-chip-label {
    color: var(--z-text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}
.operator-chip-x {
    border: 0;
    background: transparent;
    color: var(--z-muted);
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 120ms ease;
}
.operator-chip-x:hover {
    color: var(--z-alert);
    background: rgba(216, 90, 48, 0.12);
}
.operator-picker-input {
    flex: 1;
    min-width: 160px;
    border: 0;
    outline: none;
    background: transparent;
    font-size: var(--z-text-sm);
    padding: 4px 2px;
    color: var(--z-text);
}
.operator-picker-input::placeholder { color: var(--z-muted); }
.operator-picker-results {
    /* Dropdown sits in normal flow below the shell — same approach as
       the quick-search dropdown, so the surrounding card grows to fit
       and `overflow: hidden` on the card never clips us. */
    margin-top: 6px;
    max-height: 320px;
}

/* Settings → Activity table. Long IDs and JSON dumps need monospace
   to stay readable; the details summary is a quiet "view" link. */
.activity-table td { vertical-align: top; }
.activity-id {
    font-family: var(--z-font-mono, "SFMono-Regular", "Menlo", monospace);
    word-break: break-all;
    color: var(--z-muted);
}
.activity-details {
    margin: 4px 0 0 0;
    padding: 8px;
    background: rgba(204, 155, 122, 0.04);
    border: 1px solid var(--z-border);
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.4;
    white-space: pre-wrap;
    max-width: 360px;
}

/* Make stat-card a clickable tile when it's wrapped in <a>. */
a.stat-card-link {
    text-decoration: none;
    color: inherit;
    transition: all var(--z-transition);
}
a.stat-card-link:hover {
    transform: translateY(-1px);
    border-color: var(--z-accent);
}

/* Live-class table row + per-row attendance progress bar. */
.live-row td { vertical-align: middle; }
.live-progress {
    margin-top: 6px;
    width: 100%;
    height: 6px;
    background: rgba(204, 155, 122, 0.12);
    border-radius: 999px;
    overflow: hidden;
}
.live-progress-bar {
    height: 100%;
    background: var(--z-success);
    transition: width 200ms ease;
}

/* Dashboard column charts (server-rendered CSS bars, no JS). One bar
   per data point, height proportional to value. */
.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    height: 180px;
    padding-bottom: 8px;
}
.chart-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
}
.chart-col-track {
    flex: 1;
    width: 100%;
    max-width: 48px;
    background: rgba(204, 155, 122, 0.06);
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}
.chart-col-fill {
    width: 100%;
    border-radius: 6px 6px 0 0;
    transition: height 200ms ease;
    min-height: 1px;
}
.chart-col-fill-accent  { background: linear-gradient(to top, var(--z-accent), rgba(204, 155, 122, 0.7)); }
.chart-col-fill-success { background: linear-gradient(to top, var(--z-success), rgba(93, 202, 165, 0.7)); }
.chart-col-label {
    font-size: 11px;
    color: var(--z-muted);
    text-align: center;
    line-height: 1.2;
}
.chart-col-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--z-text);
    text-align: center;
    line-height: 1.2;
}

/* Horizontal "rank bar" used in the top-classes panel. Bar grows
   from left to right; the count sits to the right of the track. */
.rank-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.rank-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(204, 155, 122, 0.08);
    border-radius: 999px;
    overflow: hidden;
}
.rank-bar-fill {
    height: 100%;
    background: var(--z-accent);
    border-radius: 999px;
    transition: width 200ms ease;
}
.rank-bar-value {
    font-size: 13px;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}

/* Quick student-search dropdown — visually identical to .user-search
   results on the student-create form. Stays in normal flow so the card
   grows with its contents (absolute positioning previously clipped the
   dropdown to the card border). */
.quick-search-card { position: relative; }
.quick-student-results {
    /* Override .user-search-results inline-flow defaults only where
       needed for this page; the rest comes from the base widget. */
    margin-top: 8px;
    max-height: 360px;
}

/* ── Impersonation knob ───────────────────────────────────────────────
   Floating right-edge control shown only during a sysadmin "view as"
   session (markup self-guards on .Impersonation). Collapsed to a thin
   handle; hover or keyboard-focus slides the panel in. Styled with the
   alert colour so it always reads as an elevated, non-default mode. */
/* The knob itself is ONLY the thin orange tab, pinned to the right
   edge. It shrink-wraps to the handle's 40px width. The options panel
   is an absolutely-positioned popover anchored to the LEFT of the tab
   (right: 100%), so it always opens *into* the screen and can never
   extend past the viewport's right edge regardless of page width. */
.imp-knob {
    position: fixed;
    top: 50%;
    right: 0;
    z-index: 9998;
    width: 40px;
    transform: translateY(-50%);
    outline: none;
}
.imp-knob-handle {
    width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 0;
    background: var(--z-alert);
    color: var(--z-text-inverse);
    border-radius: 10px 0 0 10px;
    box-shadow: -3px 0 14px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}
.imp-knob-handle-label {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-transform: uppercase;
}
.imp-knob:focus-visible .imp-knob-handle {
    outline: 2px solid var(--z-text);
    outline-offset: 2px;
}
.imp-knob-panel {
    position: absolute;
    top: 50%;
    /* Sit immediately to the left of the 40px tab. */
    right: 100%;
    width: var(--imp-panel-w, 268px);
    box-sizing: border-box;
    padding: 16px;
    background: var(--z-surface);
    color: var(--z-text);
    border: 1px solid var(--z-border);
    border-radius: 10px 0 0 10px;
    box-shadow: -10px 0 28px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Hidden until hover / keyboard focus. Slides in from the right. */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-50%) translateX(12px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.imp-knob:hover .imp-knob-panel,
.imp-knob:focus .imp-knob-panel,
.imp-knob:focus-within .imp-knob-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}
.imp-knob-eyebrow {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--z-alert);
}
.imp-knob-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: var(--z-text-sm);
}
.imp-knob-key { color: var(--z-muted); }
.imp-knob-val { font-weight: 600; text-align: right; }
.imp-knob-note {
    margin: 4px 0 8px;
    font-size: var(--z-text-xs);
    color: var(--z-muted);
    line-height: 1.4;
}
.imp-knob-leave {
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    background: var(--z-alert);
    color: var(--z-text-inverse);
    font-weight: 600;
    font-size: var(--z-text-sm);
    cursor: pointer;
}
.imp-knob-leave:hover { filter: brightness(1.06); }
@media (prefers-reduced-motion: reduce) {
    .imp-knob-panel { transition: none; }
}

/* =============================================================================
   Institute search — dashboard widget + full search page
   ============================================================================= */
.inst-search {
    position: relative;
}
.inst-search-box {
    display: flex;
    align-items: center;
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: 10px;
    padding: 0 14px;
    gap: 10px;
    transition: border-color var(--z-transition), box-shadow var(--z-transition);
}
.inst-search-box:focus-within {
    border-color: var(--z-accent);
    box-shadow: 0 0 0 3px rgba(204, 155, 122, 0.12);
}
.inst-search-icon {
    color: var(--z-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.inst-search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 0;
    font-size: 1rem;
    color: var(--z-text);
    outline: none;
}
.inst-search-input::placeholder { color: var(--z-muted); }

/* Full-page variant — taller input + square right edge for the button */
.inst-search-box-page {
    border-radius: 10px 0 0 10px;
    border-right: none;
    padding-right: 0;
}
.inst-search-box-page .inst-search-input { padding: 14px 0; font-size: 1.05rem; }

/* Results dropdown */
.inst-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    z-index: 200;
}
.inst-search-panel {
    background: var(--z-surface);
    border: 1px solid var(--z-border);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(26, 26, 25, 0.12);
    overflow: hidden;
}
.inst-search-empty {
    padding: 18px 16px;
    color: var(--z-muted);
    font-size: var(--z-text-sm);
}
.inst-search-section {
    border-top: 1px solid var(--z-border);
}
.inst-search-section:first-child { border-top: none; }
.inst-search-section-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px 5px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--z-muted);
    background: var(--z-bg-active);
}
.inst-search-see-all {
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--z-accent);
    text-decoration: none;
}
.inst-search-see-all:hover { text-decoration: underline; }
.inst-search-row {
    display: block;
    padding: 9px 14px;
    text-decoration: none;
    color: var(--z-text);
    border-top: 1px solid var(--z-border-light, #e8e6df);
    transition: background var(--z-transition);
}
.inst-search-row:first-of-type { border-top: none; }
.inst-search-row:hover { background: var(--z-bg-hover); text-decoration: none; }
.inst-search-row-main { font-size: 14px; line-height: 1.3; }
.inst-search-row-sub  { font-size: 12px; color: var(--z-muted); margin-top: 1px; line-height: 1.2; }

@media (max-width: 640px) {
    .inst-search-results { position: static; margin-top: 4px; }
}

/* Search term highlight inside results */
mark.search-hl {
    background: rgba(204, 155, 122, 0.28);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
    font-weight: 600;
    font-style: normal;
}


