/* ============================================================
   A — CSS Custom Properties
   ============================================================ */
:root {
    --font-family-base: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-base: 0.875rem;
    --font-size-sm: 0.75rem;

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 64px;
    --topbar-height: 60px;

    /* Sidebar — always dark */
    --sidebar-bg: #111827;
    --sidebar-border: #1f2937;
    --sidebar-text: #9ca3af;
    --sidebar-text-hover: #f9fafb;
    --sidebar-section-label: #6b7280;
    --sidebar-item-hover-bg: #1f2937;
    --sidebar-active-bg: #064e3b;
    --sidebar-active-text: #10b981;
    --sidebar-profile-bg: #1f2937;

    /* TopBar — light mode */
    --topbar-bg: #ffffff;
    --topbar-border: #e5e7eb;
    --topbar-text: #111827;
    --topbar-search-bg: #f3f4f6;
    --topbar-search-border: #e5e7eb;
    --topbar-search-placeholder: #9ca3af;
    --topbar-icon-color: #6b7280;
    --topbar-icon-hover: #111827;

    /* Content — light mode */
    --content-bg: #f9fafb;
    --content-text: #111827;

    /* Shared */
    --badge-bg: #ef4444;
    --badge-text: #ffffff;
    --avatar-bg: #10b981;
    --avatar-text: #ffffff;

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   B — Dark Mode Overrides
   ============================================================ */
#layout-shell.dark {
    --topbar-bg: #1f2937;
    --topbar-border: #374151;
    --topbar-text: #f9fafb;
    --topbar-search-bg: #374151;
    --topbar-search-border: #4b5563;
    --topbar-search-placeholder: #6b7280;
    --topbar-icon-color: #9ca3af;
    --topbar-icon-hover: #f9fafb;
    --content-bg: #111827;
    --content-text: #f9fafb;
}

#layout-shell.dark .card {
    background-color: #1f2937;
    border-color: #374151;
    color: #f9fafb;
}

#layout-shell.dark .card-header {
    background-color: #1f2937;
    border-bottom-color: #374151;
    color: #f9fafb;
}

#layout-shell.dark .card-footer {
    background-color: #1f2937;
    border-top-color: #374151;
    color: #f9fafb;
}

#layout-shell.dark .card-body {
    color: #f9fafb;
}

#layout-shell.dark .card .text-muted {
    color: #9ca3af !important;
}

/* ============================================================
   C — Base Reset
   ============================================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Headings are not interactive — suppress the focus ring Blazor's
   FocusOnNavigate injects on every route change. */
h1, h2, h3, h4, h5, h6 {
    outline: none;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   D — Layout Shell (CSS Grid)
   ============================================================ */
#layout-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns var(--transition);
}

#layout-shell.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
}

.layout-right {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--content-bg);
    transition: background-color var(--transition);
}

.layout-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
    color: var(--content-text);
    transition: color var(--transition);
}

/* ============================================================
   E — Sidebar
   ============================================================ */

/* Shell */
.sidebar {
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    width: var(--sidebar-width);
    transition: width var(--transition);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

#layout-shell.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

/* Brand */
.sidebar-brand {
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    gap: 0.75rem;
    height: var(--topbar-height);
    padding: 0 1rem;
    flex-shrink: 0;
    overflow: hidden;
    text-decoration: none;
}

.sidebar-brand-icon {
    align-items: center;
    background-color: var(--sidebar-active-text);
    border-radius: 8px;
    color: #fff;
    display: flex;
    flex-shrink: 0;
    font-size: 1.125rem;
    height: 36px;
    justify-content: center;
    width: 36px;
}

.sidebar-brand-text {
    color: var(--sidebar-text-hover);
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    overflow: hidden;
    min-width: 0;
    transition: opacity var(--transition), width var(--transition);
    white-space: nowrap;
}

.sidebar-brand-text strong {
    font-size: 0.9375rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-text span {
    color: var(--sidebar-section-label);
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

#layout-shell.sidebar-collapsed .sidebar-brand-text {
    opacity: 0;
    width: 0;
}

/* Nav scroll area */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--sidebar-border) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--sidebar-border);
    border-radius: 4px;
}

/* Section group */
.sidebar-section {
    margin-bottom: 0.125rem;
}

.sidebar-section-label {
    color: var(--sidebar-section-label);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 0.875rem 1rem 0.3rem;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition), height var(--transition), padding var(--transition);
}

#layout-shell.sidebar-collapsed .sidebar-section-label {
    opacity: 0;
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Nav item — NavLink renders as <a>, block Bootstrap's link color */
.sidebar-item,
.sidebar-item:visited,
.sidebar-item:hover,
.sidebar-item:focus,
.sidebar-item:active {
    color: var(--sidebar-text);
    text-decoration: none;
}

.sidebar-item {
    align-items: center;
    border-left: 3px solid transparent;
    cursor: pointer;
    display: flex;
    gap: 0.75rem;
    padding: 0.5625rem 0.875rem;
    position: relative;
    transition: background-color var(--transition), color var(--transition), border-left-color var(--transition), padding var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-item:hover {
    background-color: var(--sidebar-item-hover-bg);
    color: var(--sidebar-text-hover);
}

.sidebar-item.active {
    background-color: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-text);
    color: var(--sidebar-active-text);
    font-weight: 500;
}

.sidebar-item-icon {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    font-size: 1.0625rem;
    justify-content: center;
    line-height: 1;
    width: 20px;
}

.sidebar-item-label {
    font-size: var(--font-size-base);
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--transition), width var(--transition);
    white-space: nowrap;
    flex: 1;
}

/* Notification badge on nav item */
.sidebar-item-badge {
    background-color: var(--badge-bg);
    border-radius: 10px;
    color: var(--badge-text);
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
    margin-left: auto;
    min-width: 18px;
    padding: 2px 5px;
    text-align: center;
    flex-shrink: 0;
    transition: opacity var(--transition);
}

/* Collapsed: hide labels + badges, center icons, remove left border */
#layout-shell.sidebar-collapsed .sidebar-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    border-left-color: transparent !important;
    gap: 0;
}

#layout-shell.sidebar-collapsed .sidebar-item.active {
    color: var(--sidebar-active-text);
}

#layout-shell.sidebar-collapsed .sidebar-item-label,
#layout-shell.sidebar-collapsed .sidebar-item-badge {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Tooltip on hover when collapsed */
#layout-shell.sidebar-collapsed .sidebar-item::after {
    background-color: #374151;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #f9fafb;
    content: attr(data-label);
    font-family: var(--font-family-base);
    font-size: var(--font-size-sm);
    font-weight: 500;
    left: calc(var(--sidebar-collapsed-width) + 8px);
    opacity: 0;
    padding: 5px 10px;
    pointer-events: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.15s ease;
    white-space: nowrap;
    z-index: 300;
}

#layout-shell.sidebar-collapsed .sidebar-item:hover::after {
    opacity: 1;
}

/* User profile card at bottom */
.sidebar-profile {
    background-color: var(--sidebar-profile-bg);
    border-top: 1px solid var(--sidebar-border);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    overflow: hidden;
    transition: padding var(--transition);
}

.sidebar-profile-avatar {
    align-items: center;
    background-color: var(--avatar-bg);
    border-radius: 50%;
    color: var(--avatar-text);
    display: flex;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    width: 34px;
}

.sidebar-profile-info {
    overflow: hidden;
    transition: opacity var(--transition), width var(--transition);
    min-width: 0;
}

.sidebar-profile-name {
    color: var(--sidebar-text-hover);
    font-size: var(--font-size-base);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-profile-email {
    color: var(--sidebar-section-label);
    font-size: var(--font-size-sm);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#layout-shell.sidebar-collapsed .sidebar-profile {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

#layout-shell.sidebar-collapsed .sidebar-profile-info {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* ============================================================
   F — TopBar
   ============================================================ */
.topbar {
    align-items: center;
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    flex-shrink: 0;
    gap: 0.5rem;
    height: var(--topbar-height);
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    transition: background-color var(--transition), border-color var(--transition);
    z-index: 99;
}

/* Hamburger toggle */
.topbar-toggle {
    align-items: center;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--topbar-icon-color);
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    font-size: 1.25rem;
    height: 36px;
    justify-content: center;
    padding: 0;
    transition: color var(--transition), background-color var(--transition);
    width: 36px;
}

.topbar-toggle:hover {
    background-color: var(--topbar-search-bg);
    color: var(--topbar-icon-hover);
}

/* Search bar */
.topbar-search {
    align-items: center;
    background-color: var(--topbar-search-bg);
    border: 1px solid var(--topbar-search-border);
    border-radius: 8px;
    display: flex;
    flex: 1;
    gap: 0.5rem;
    margin: 0 auto;
    max-width: 480px;
    padding: 0.4rem 0.875rem;
    transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
}

.topbar-search:focus-within {
    border-color: var(--sidebar-active-text);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.topbar-search-icon {
    color: var(--topbar-search-placeholder);
    flex-shrink: 0;
    font-size: 0.8125rem;
}

.topbar-search input {
    background: none;
    border: none;
    color: var(--topbar-text);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    outline: none;
    width: 100%;
}

.topbar-search input::placeholder {
    color: var(--topbar-search-placeholder);
}

/* Right-side action cluster */
.topbar-actions {
    align-items: center;
    display: flex;
    flex-shrink: 0;
    gap: 0.125rem;
    margin-left: auto;
}

.topbar-icon-btn {
    align-items: center;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--topbar-icon-color);
    cursor: pointer;
    display: flex;
    font-size: 1.0625rem;
    height: 36px;
    justify-content: center;
    padding: 0;
    position: relative;
    transition: color var(--transition), background-color var(--transition);
    width: 36px;
}

.topbar-icon-btn:hover {
    background-color: var(--topbar-search-bg);
    color: var(--topbar-icon-hover);
}

/* Notification badge */
.topbar-badge {
    background-color: var(--badge-bg);
    border: 2px solid var(--topbar-bg);
    border-radius: 10px;
    color: var(--badge-text);
    font-size: 0.5625rem;
    font-weight: 700;
    line-height: 1;
    min-width: 16px;
    padding: 1px 3px;
    pointer-events: none;
    position: absolute;
    right: 2px;
    text-align: center;
    top: 2px;
    transition: border-color var(--transition);
}

/* Divider between icons and avatar */
.topbar-divider {
    background-color: var(--topbar-border);
    height: 22px;
    margin: 0 0.25rem;
    width: 1px;
    flex-shrink: 0;
}

/* User avatar */
.topbar-avatar {
    align-items: center;
    background-color: var(--avatar-bg);
    border-radius: 50%;
    color: var(--avatar-text);
    cursor: pointer;
    display: flex;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    height: 34px;
    justify-content: center;
    letter-spacing: 0.05em;
    margin-left: 0.375rem;
    text-transform: uppercase;
    transition: filter var(--transition), box-shadow var(--transition);
    user-select: none;
    width: 34px;
}

.topbar-avatar:hover {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

/* ============================================================
   G — Responsive (≤768px)
   ============================================================ */
@media (max-width: 768px) {
    #layout-shell {
        grid-template-columns: 0 1fr;
    }

    #layout-shell.sidebar-collapsed {
        grid-template-columns: 0 1fr;
    }

    .sidebar {
        position: fixed !important;
        left: -260px;
        top: 0;
        height: 100vh;
        width: var(--sidebar-width) !important;
        z-index: 200;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
        transition: left var(--transition) !important;
    }

    #layout-shell.mobile-sidebar-open .sidebar {
        left: 0;
    }

    .sidebar-overlay {
        background: rgba(0, 0, 0, 0.5);
        display: none;
        height: 100vh;
        left: 0;
        position: fixed;
        top: 0;
        width: 100vw;
        z-index: 199;
    }

    #layout-shell.mobile-sidebar-open .sidebar-overlay {
        display: block;
    }

    .layout-content {
        padding: 1rem;
    }

    .topbar-search {
        max-width: none;
        flex: 1;
    }
}

/* ============================================================
   H — Blazor Error UI (preserved)
   ============================================================ */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Loading progress (Blazor default) */
.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem;
}

.loading-progress circle {
    fill: none;
    stroke: #10b981;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #e5e7eb;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 600;
    inset: calc(20vh + 3.25rem) 0 auto;
    color: #9ca3af;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}

/* ============================================================
   I — Auth / Identity pages
   ============================================================ */

/* ------ root wrapper (fills viewport, no shell chrome) ------ */
.auth-root {
    min-height: 100vh;
    background: var(--content-bg, #f9fafb);
    display: flex;
    flex-direction: column;
}

/* ------ Login: 40 / 60 split ------ */
.auth-split {
    display: grid;
    grid-template-columns: 40% 60%;
    min-height: 100vh;
}

.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: #fff;
    overflow-y: auto;
}

.auth-form-inner {
    width: 100%;
    max-width: 400px;
}

.auth-hero-panel {
    position: relative;
    background:
        linear-gradient(135deg, rgba(6,78,59,0.85) 0%, rgba(16,185,129,0.7) 100%),
        url("https://images.unsplash.com/photo-1497366216548-37526070297c?auto=format&fit=crop&w=1400&q=80")
        center/cover no-repeat;
    display: flex;
    align-items: flex-end;
    padding: 3rem;
    overflow: hidden;
}

.auth-hero-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 70% 30%, rgba(16,185,129,0.25) 0%, transparent 65%);
    pointer-events: none;
}

.auth-hero-overlay {
    position: relative;
    z-index: 1;
}

.auth-hero-quote {
    color: #fff;
    border: none;
    padding: 0;
    margin: 0;
}

.auth-hero-quote p {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.auth-hero-quote footer {
    font-size: 0.875rem;
    opacity: 0.75;
}

/* ------ Card layout (register / forgot / reset / confirm) ------ */
.auth-card-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 480px;
}

/* ------ Brand mark ------ */
.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    margin-bottom: 2rem;
}

.auth-brand-centered {
    justify-content: center;
}

.auth-brand-icon {
    width: 36px;
    height: 36px;
    background: #10b981;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.auth-brand-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em;
}

/* ------ Headings ------ */
.auth-heading {
    margin-bottom: 1.75rem;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.35rem;
    line-height: 1.25;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: #6b7280;
    margin: 0;
}

/* ------ Alert banner ------ */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.auth-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* ------ Form ------ */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.auth-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-label-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #10b981;
    text-decoration: none;
}

.auth-label-link:hover { text-decoration: underline; }

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 0.875rem;
    color: #9ca3af;
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 1;
}

.auth-input {
    width: 100%;
    padding: 0.65rem 2.75rem 0.65rem 2.5rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #111827;
    background: #fff;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}

.auth-input::placeholder { color: #9ca3af; }

.auth-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.auth-input-toggle {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.95rem;
    line-height: 1;
    transition: color var(--transition);
}

.auth-input-toggle:hover { color: #374151; }

.auth-validation {
    font-size: 0.78rem;
    color: #dc2626;
}

.auth-hint {
    font-size: 0.78rem;
    color: #9ca3af;
}

/* ------ Primary button ------ */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
}

.auth-btn-primary {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
    width: 100%;
    margin-top: 0.25rem;
}

.auth-btn-primary:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.auth-btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.auth-btn-ghost {
    background: transparent;
    color: #374151;
    border-color: #e5e7eb;
    width: 100%;
}

.auth-btn-ghost:hover { background: #f3f4f6; }

/* ------ Spinner ------ */
.auth-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
    flex-shrink: 0;
}

.auth-spinner-lg {
    width: 2.5rem;
    height: 2.5rem;
    border-width: 3px;
    border-color: #e5e7eb;
    border-top-color: #10b981;
}

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

/* ------ Footer text / links ------ */
.auth-footer-text {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin: 1.25rem 0 0;
}

.auth-link {
    color: #10b981;
    font-weight: 600;
    text-decoration: none;
}

.auth-link:hover { text-decoration: underline; }

/* ------ Success / status states ------ */
.auth-success-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0;
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #d1fae5;
    color: #059669;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
}

.auth-success-icon--error {
    background: #fef2f2;
    color: #dc2626;
}

.auth-status-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
}

/* ------ Responsive ------ */

/* Tablet: stack split vertically, hero becomes a top banner */
@media (max-width: 1024px) {
    .auth-split {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .auth-hero-panel {
        min-height: 200px;
        align-items: center;
        justify-content: center;
        padding: 2rem;
        order: -1;
    }

    .auth-hero-quote p { font-size: 1.125rem; }

    .auth-form-panel {
        padding: 2rem 1.5rem;
    }
}

/* Mobile: tighten card and remove hero */
@media (max-width: 640px) {
    .auth-hero-panel { display: none; }

    .auth-split {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    .auth-form-panel {
        align-items: flex-start;
        padding: 1.5rem 1rem;
    }

    .auth-form-inner { max-width: 100%; }

    .auth-card {
        box-shadow: none;
        padding: 1.5rem 1rem;
        border-radius: 0;
    }

    .auth-field-row {
        grid-template-columns: 1fr;
    }

    .auth-title { font-size: 1.25rem; }
}

/* ============================================================
   J — Employee module  (em-* namespace)
   ============================================================ */

/* ── J.1  CSS tokens ───────────────────────────────────────── */
:root {
    --em-status-active-bg:       #d1fae5;
    --em-status-active-text:     #065f46;
    --em-status-onboarding-bg:   #dbeafe;
    --em-status-onboarding-text: #1e40af;
    --em-status-suspended-bg:    #fef3c7;
    --em-status-suspended-text:  #92400e;
    --em-status-danger-bg:       #fee2e2;
    --em-status-danger-text:     #991b1b;
    --em-status-candidate-bg:    #ede9fe;
    --em-status-candidate-text:  #5b21b6;
    --em-status-onleave-bg:      #ccfbf1;
    --em-status-onleave-text:    #134e4a;

    --em-card-bg:            #ffffff;
    --em-card-border:        #e5e7eb;
    --em-card-shadow:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --em-card-shadow-hover:  0 8px 24px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);

    --em-table-row-hover:    #f0fdf4;
    --em-table-border:       #e5e7eb;
    --em-table-head-bg:      #f9fafb;

    --em-input-bg:           #ffffff;
    --em-input-border:       #d1d5db;
    --em-input-text:         #111827;
    --em-input-placeholder:  #9ca3af;

    --em-skeleton-base:      #e5e7eb;
    --em-skeleton-shine:     #f3f4f6;
}

#layout-shell.dark {
    --em-status-active-bg:       #064e3b;
    --em-status-active-text:     #34d399;
    --em-status-onboarding-bg:   #1e3a5f;
    --em-status-onboarding-text: #93c5fd;
    --em-status-suspended-bg:    #451a03;
    --em-status-suspended-text:  #fcd34d;
    --em-status-danger-bg:       #450a0a;
    --em-status-danger-text:     #fca5a5;
    --em-status-candidate-bg:    #2e1065;
    --em-status-candidate-text:  #c4b5fd;
    --em-status-onleave-bg:      #042f2e;
    --em-status-onleave-text:    #5eead4;

    --em-card-bg:            #1f2937;
    --em-card-border:        #374151;
    --em-card-shadow:        0 1px 3px rgba(0,0,0,0.3);
    --em-card-shadow-hover:  0 8px 24px rgba(0,0,0,0.4);

    --em-table-row-hover:    #064e3b;
    --em-table-border:       #374151;
    --em-table-head-bg:      #1f2937;

    --em-input-bg:           #374151;
    --em-input-border:       #4b5563;
    --em-input-text:         #f9fafb;
    --em-input-placeholder:  #6b7280;

    --em-skeleton-base:      #374151;
    --em-skeleton-shine:     #4b5563;
}

/* ── J.2  Page header ──────────────────────────────────────── */
.em-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.em-page-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--content-text);
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.em-page-subtitle {
    font-size: var(--font-size-sm);
    color: #6b7280;
    margin: 0;
}

/* ── J.3  Buttons ──────────────────────────────────────────── */
.em-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: 0.5rem;
    font-size: var(--font-size-base);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.em-btn-primary {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

.em-btn-primary:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.em-btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.em-btn-primary:disabled.em-btn-loading {
    opacity: 1;
    background: #059669;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.25);
    animation: em-btn-pulse 1.2s ease-in-out infinite;
}

@keyframes em-btn-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,0.25); }
    50%       { box-shadow: 0 0 0 6px rgba(16,185,129,0.10); }
}

.em-spinner-sm {
    display: inline-block;
    width: 0.875rem;
    height: 0.875rem;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 0.35rem;
    flex-shrink: 0;
}

.em-btn-ghost {
    background: transparent;
    color: var(--content-text);
    border-color: var(--em-card-border);
}

.em-btn-ghost:hover:not(:disabled) {
    background: var(--em-table-head-bg);
}

.em-btn-icon {
    padding: 0.55rem;
    width: 2.25rem;
    height: 2.25rem;
}

/* ── J.4  Toolbar ──────────────────────────────────────────── */
.em-toolbar {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.em-search-wrap {
    position: relative;
    flex: 1;
    min-width: 220px;
    max-width: 360px;
}

.em-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--em-input-placeholder);
    font-size: 0.8125rem;
    pointer-events: none;
}

.em-input {
    width: 100%;
    padding: 0.55rem 0.875rem 0.55rem 2.25rem;
    border: 1.5px solid var(--em-input-border);
    border-radius: 0.5rem;
    font-size: var(--font-size-base);
    color: var(--em-input-text);
    background: var(--em-input-bg);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
    box-sizing: border-box;
}

.em-input::placeholder { color: var(--em-input-placeholder); }

.em-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.em-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.55rem 2.25rem 0.55rem 0.875rem;
    border: 1.5px solid var(--em-input-border);
    border-radius: 0.5rem;
    font-size: var(--font-size-base);
    color: var(--em-input-text);
    background: var(--em-input-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 0.75rem) center;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    min-width: 150px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.em-select:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.em-view-toggle {
    display: flex;
    border: 1.5px solid var(--em-input-border);
    border-radius: 0.5rem;
    overflow: hidden;
    flex-shrink: 0;
}

.em-view-btn {
    background: var(--em-input-bg);
    border: none;
    color: var(--em-input-placeholder);
    cursor: pointer;
    font-size: 0.9375rem;
    height: 2.175rem;
    padding: 0 0.65rem;
    transition: background var(--transition), color var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.em-view-btn:hover { background: var(--em-table-head-bg); color: var(--content-text); }
.em-view-btn.active { background: #10b981; color: #ffffff; }

.em-result-count {
    font-size: var(--font-size-sm);
    color: #6b7280;
    white-space: nowrap;
    margin-left: auto;
}

.em-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--font-size-sm);
    color: #3730a3;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    padding: 0.25rem 0.625rem;
    white-space: nowrap;
}

.em-column-picker {
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    z-index: 100;
    background: var(--em-input-bg);
    border: 1.5px solid var(--em-input-border);
    border-radius: 0.625rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    padding: 0.5rem 0;
    min-width: 11rem;
}

.em-column-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    font-size: var(--font-size-sm);
    color: var(--content-text);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.em-column-picker-item:hover { background: var(--em-table-head-bg); }

@media (max-width: 640px) {
    .em-toolbar { flex-direction: column; align-items: stretch; }
    .em-search-wrap { max-width: 100%; }
    .em-result-count { margin-left: 0; }
}

/* ── J.5  Card grid ────────────────────────────────────────── */
.em-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 1280px) { .em-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .em-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .em-grid { grid-template-columns: 1fr; } }

.em-card {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--em-card-shadow);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
    color: var(--content-text);
}

.em-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--em-card-shadow-hover);
    border-color: #10b981;
}

.em-card:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

.em-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--avatar-bg);
    color: var(--avatar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.em-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.em-card-name   { font-size: var(--font-size-base); font-weight: 600; color: var(--content-text); line-height: 1.3; margin: 0; }
.em-card-number { font-size: var(--font-size-sm); color: #9ca3af; margin: 0; }
.em-card-title  { font-size: var(--font-size-sm); color: #6b7280; margin: 0.15rem 0 0; }

.em-card-dept {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    font-size: var(--font-size-sm);
    color: #6b7280;
    margin-top: 0.1rem;
}

.em-card-dept-icon { font-size: 0.75rem; flex-shrink: 0; }

.em-card-footer { margin-top: 0.625rem; width: 100%; display: flex; justify-content: center; }

/* ── J.6  Status badges ────────────────────────────────────── */
.em-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1.4;
}

.em-badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.em-badge-active      { background: var(--em-status-active-bg);      color: var(--em-status-active-text); }
.em-badge-onboarding  { background: var(--em-status-onboarding-bg);  color: var(--em-status-onboarding-text); }
.em-badge-suspended   { background: var(--em-status-suspended-bg);   color: var(--em-status-suspended-text); }
.em-badge-danger      { background: var(--em-status-danger-bg);      color: var(--em-status-danger-text); }
.em-badge-candidate   { background: var(--em-status-candidate-bg);   color: var(--em-status-candidate-text); }
.em-badge-onleave     { background: var(--em-status-onleave-bg);     color: var(--em-status-onleave-text); }

/* ── J.7  Table view ───────────────────────────────────────── */
.em-table-wrap {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    overflow-x: auto;
    box-shadow: var(--em-card-shadow);
    scrollbar-width: thin;
    scrollbar-color: var(--em-card-border) transparent;
}

.em-table-wrap::-webkit-scrollbar { height: 6px; }
.em-table-wrap::-webkit-scrollbar-track { background: transparent; }
.em-table-wrap::-webkit-scrollbar-thumb { background: var(--em-card-border); border-radius: 3px; }
.em-table-wrap::-webkit-scrollbar-thumb:hover { background: #6b7280; }

.em-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

.em-table thead th {
    background: var(--em-table-head-bg);
    color: #6b7280;
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--em-table-border);
    white-space: nowrap;
}

.em-table thead th.em-th-center { text-align: center; }

.em-table tbody tr {
    cursor: pointer;
    transition: background var(--transition);
    border-bottom: 1px solid var(--em-table-border);
}

.em-table tbody tr:last-child { border-bottom: none; }
.em-table tbody tr:hover { background: var(--em-table-row-hover); }

.em-table td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    color: var(--content-text);
}

.em-table td.em-td-center { text-align: center; }

.em-table-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.em-table-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--avatar-bg);
    color: var(--avatar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    flex-shrink: 0;
    overflow: hidden;
}

.em-table-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.em-table-name   { font-weight: 600; line-height: 1.3; }
.em-table-sub    { font-size: var(--font-size-sm); color: #9ca3af; line-height: 1.3; }
.em-table-muted  { color: #6b7280; }

/* ── J.8  Pagination ───────────────────────────────────────── */
.em-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.25rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.em-pagination-info { font-size: var(--font-size-sm); color: #6b7280; }

.em-pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.em-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.45rem;
    border-radius: 0.375rem;
    border: 1.5px solid var(--em-input-border);
    background: var(--em-card-bg);
    color: var(--content-text);
    font-size: var(--font-size-sm);
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.em-page-btn:hover:not(:disabled) {
    border-color: #10b981;
    color: #10b981;
    background: rgba(16,185,129,0.06);
}

.em-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.em-page-btn.active   { background: #10b981; border-color: #10b981; color: #ffffff; }

/* ── J.9  Empty state ──────────────────────────────────────── */
.em-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: #6b7280;
}

.em-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--em-table-head-bg);
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
}

.em-empty-title { font-size: 1rem; font-weight: 600; color: var(--content-text); margin: 0 0 0.4rem; }
.em-empty-sub   { font-size: var(--font-size-sm); color: #9ca3af; max-width: 280px; margin: 0 0 1.25rem; line-height: 1.55; }

/* ── J.10  Loading skeleton ────────────────────────────────── */
@keyframes em-skeleton-pulse {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

.em-skeleton {
    background: linear-gradient(
        90deg,
        var(--em-skeleton-base) 25%,
        var(--em-skeleton-shine) 50%,
        var(--em-skeleton-base) 75%
    );
    background-size: 400% 100%;
    animation: em-skeleton-pulse 1.4s ease-in-out infinite;
    border-radius: 0.375rem;
}

.em-card-skeleton {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: var(--em-card-shadow);
}

.em-skel-avatar       { width: 48px; height: 48px; border-radius: 50%; margin-bottom: 0.25rem; }
.em-skel-line         { height: 0.75rem; }
.em-skel-line-lg      { width: 65%; }
.em-skel-line-md      { width: 50%; }
.em-skel-line-sm      { width: 40%; }
.em-skel-badge        { width: 4.5rem; height: 1.25rem; border-radius: 9999px; }
.em-skel-table-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }

.em-table-skel-row td { padding: 0.875rem 1rem; }

.em-skel-row-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
}

/* ============================================================
   K — Employee form  (ef-* namespace)
   ============================================================ */

/* ── K.1  Page chrome ──────────────────────────────────────── */
.ef-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    margin-bottom: 1.25rem;
    transition: color var(--transition);
}

.ef-back-link:hover { color: #10b981; }

/* ── K.2  Form card sections ───────────────────────────────── */
.ef-section {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--em-card-shadow);
    overflow: hidden;
}

.ef-section-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--em-card-border);
}

.ef-section-icon {
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: rgba(16,185,129,0.1);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.ef-section-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--content-text);
    margin: 0;
}

.ef-section-subtitle {
    font-size: var(--font-size-sm);
    color: #9ca3af;
    margin: 0;
    margin-left: auto;
}

.ef-section-body {
    padding: 1.25rem;
}

/* ── K.3  Field grid ───────────────────────────────────────── */
.ef-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem 1.25rem;
}

.ef-grid-2 { grid-template-columns: repeat(2, 1fr); }
.ef-grid-4 { grid-template-columns: repeat(4, 1fr); }
.ef-col-span-2 { grid-column: span 2; }
.ef-col-span-3 { grid-column: span 3; }
.ef-col-span-full { grid-column: 1 / -1; }

@media (max-width: 1024px) {
    .ef-grid   { grid-template-columns: repeat(2, 1fr); }
    .ef-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .ef-col-span-3 { grid-column: span 2; }
}

@media (max-width: 640px) {
    .ef-grid, .ef-grid-2, .ef-grid-4 { grid-template-columns: 1fr; }
    .ef-col-span-2, .ef-col-span-3, .ef-col-span-full { grid-column: span 1; }
}

/* ── K.4  Field anatomy ────────────────────────────────────── */
.ef-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ef-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

#layout-shell.dark .ef-label { color: #d1d5db; }

.ef-required {
    color: #ef4444;
    font-size: 0.75rem;
}

.ef-input,
.ef-select,
.ef-textarea {
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: 1.5px solid var(--em-input-border);
    border-radius: 0.5rem;
    font-size: var(--font-size-base);
    color: var(--em-input-text);
    background: var(--em-input-bg);
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    box-sizing: border-box;
}

.ef-input::placeholder,
.ef-textarea::placeholder { color: var(--em-input-placeholder); }

.ef-input:focus,
.ef-select:focus,
.ef-textarea:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.ef-input.invalid,
.ef-select.invalid,
.ef-textarea.invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

.ef-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath fill='%236b7280' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 0.75rem) center;
    cursor: pointer;
}

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

.ef-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    line-height: 1.4;
}

.ef-validation {
    font-size: 0.75rem;
    color: #dc2626;
}

/* ── K.5  Form actions bar ─────────────────────────────────── */
.ef-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1.25rem 0 0.5rem;
}

.ef-error-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    color: #b91c1c;
    font-size: var(--font-size-sm);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

#layout-shell.dark .ef-error-banner {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* ── K.6  Page guide card ─────────────────────────────────── */
.ef-page-guide {
    display: flex;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(16,185,129,0.05) 0%, transparent 70%);
    border: 1px solid rgba(16,185,129,0.2);
    border-left: 3px solid #10b981;
    border-radius: 0.75rem;
    padding: 1.125rem 1.375rem;
    margin-bottom: 1.5rem;
}

.ef-page-guide__icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    background: rgba(16,185,129,0.12);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #10b981;
    font-size: 1rem;
}

.ef-page-guide__content { flex: 1; min-width: 0; }

.ef-page-guide__heading {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 0.3rem;
}

.ef-page-guide__body {
    font-size: 0.8125rem;
    color: #6b7280;
    line-height: 1.6;
    margin: 0 0 0.75rem;
}

.ef-page-guide__steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1.25rem;
}

.ef-page-guide__step {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #374151;
}

.ef-page-guide__step i {
    color: #10b981;
    font-size: 0.6875rem;
    flex-shrink: 0;
}

#layout-shell.dark .ef-page-guide {
    background: linear-gradient(135deg, rgba(16,185,129,0.07) 0%, transparent 70%);
    border-color: rgba(16,185,129,0.25);
    border-left-color: #10b981;
}

#layout-shell.dark .ef-page-guide__heading { color: #f9fafb; }
#layout-shell.dark .ef-page-guide__body    { color: #9ca3af; }
#layout-shell.dark .ef-page-guide__step    { color: #d1d5db; }

/* ═══════════════════════════════════════════════════════════════
   L — Org Chart  (oc-*)
   ═══════════════════════════════════════════════════════════════ */

/* ── L.1  Tree container ───────────────────────────────────── */
.oc-tree {
    padding: 0.5rem 0;
}

/* ── L.2  Node wrap & children connector ──────────────────── */
.oc-node-wrap {
    position: relative;
}

.oc-children {
    margin-left: 2.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--em-border);
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

/* ── L.3  Node card ───────────────────────────────────────── */
.oc-node {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--em-card-bg);
    border: 1px solid var(--em-border);
    border-radius: 0.75rem;
    margin-bottom: 0.375rem;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.oc-node:hover {
    border-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
}

/* ── L.4  Left cluster: expand btn + avatar ───────────────── */
.oc-node-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.oc-expand-btn {
    background: none;
    border: none;
    padding: 0.3rem;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.85rem;
    line-height: 1;
    border-radius: 0.375rem;
    transition: transform var(--transition), color var(--transition), background var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.625rem;
    height: 1.625rem;
}

.oc-expand-btn:hover {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.oc-node-expanded > .oc-node .oc-expand-btn,
.oc-node.oc-node-expanded .oc-expand-btn {
    transform: rotate(90deg);
    color: #10b981;
}

.oc-expand-btn-placeholder {
    width: 1.625rem;
    flex-shrink: 0;
}

.oc-node-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    flex-shrink: 0;
}

/* ── L.5  Node body (name + code) ─────────────────────────── */
.oc-node-body {
    flex: 1;
    min-width: 0;
}

.oc-node-name {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: var(--em-text-primary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.oc-node-code {
    display: inline-block;
    margin-top: 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.45rem;
    border-radius: 0.3rem;
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    text-transform: uppercase;
}

/* ── L.6  Meta info (head + headcount) ────────────────────── */
.oc-node-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: var(--font-size-sm);
    color: #6b7280;
    min-width: 12rem;
    flex-shrink: 0;
}

.oc-node-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── L.7  Action buttons (reveal on hover) ────────────────── */
.oc-node-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity var(--transition);
}

.oc-node:hover .oc-node-actions {
    opacity: 1;
}

.em-btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    gap: 0.25rem;
}

.em-btn-danger {
    color: #ef4444;
    border-color: #fecaca;
}

.em-btn-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #b91c1c;
}

/* ── L.8  Loading skeleton ────────────────────────────────── */
.oc-node-skeleton {
    height: 4.25rem;
    border-radius: 0.75rem;
    background: linear-gradient(
        90deg,
        var(--em-skeleton-from) 25%,
        var(--em-skeleton-to) 50%,
        var(--em-skeleton-from) 75%
    );
    background-size: 200% 100%;
    animation: em-shimmer 1.4s infinite;
    margin-bottom: 0.5rem;
}

/* ── L.9  Dark mode overrides ─────────────────────────────── */
#layout-shell.dark .oc-node-code {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

#layout-shell.dark .em-btn-danger {
    border-color: #7f1d1d;
    color: #f87171;
}

#layout-shell.dark .em-btn-danger:hover {
    background: #450a0a;
    border-color: #ef4444;
    color: #fca5a5;
}

/* ── L.10  Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .oc-node-meta {
        display: none;
    }

    .oc-node-actions {
        opacity: 1;
    }

    .oc-children {
        margin-left: 1rem;
        padding-left: 0.75rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   M — Payroll Module  (pr-*)
   ═══════════════════════════════════════════════════════════════ */

/* ── M.1  Status badges ───────────────────────────────────── */
.pr-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.pr-badge-draft       { background: #f3f4f6; color: #6b7280; }
.pr-badge-calculating { background: #dbeafe; color: #1d4ed8; }
.pr-badge-calculated  { background: #ccfbf1; color: #0f766e; }
.pr-badge-locked      { background: #fef3c7; color: #b45309; }
.pr-badge-approved    { background: #dcfce7; color: #15803d; }
.pr-badge-completed   { background: #10b981; color: #fff; }
.pr-badge-cancelled   { background: #fee2e2; color: #b91c1c; }

/* ── M.2  Stat row ────────────────────────────────────────── */
.pr-stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.pr-stat-card {
    background: var(--em-card-bg);
    border: 1px solid var(--em-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
}

.pr-stat-label {
    font-size: var(--font-size-sm);
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pr-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--em-text-primary);
    margin-top: 0.3rem;
    letter-spacing: -0.02em;
}

/* ── M.3  Action bar ──────────────────────────────────────── */
.pr-action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: var(--em-card-bg);
    border: 1px solid var(--em-border);
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* ── M.4  Initiate panel ──────────────────────────────────── */
.pr-initiate-panel {
    background: var(--em-card-bg);
    border: 1px solid var(--em-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.pr-panel-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--em-text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
}

/* ── M.5  Register breakdown rows ────────────────────────── */
.pr-register-row:hover td { background: rgba(16, 185, 129, 0.04); }
.pr-register-row-expanded td { background: rgba(16, 185, 129, 0.06); }

.pr-breakdown-row td { padding: 0 !important; }

.pr-breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-top: 1px solid var(--em-border);
    background: var(--em-card-bg);
}

.pr-breakdown-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pr-sub-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.pr-sub-table td {
    padding: 0.25rem 0.375rem;
    color: var(--em-text-secondary);
    border: none;
    background: transparent !important;
}

.pr-sub-table td.pr-num-col { text-align: right; }

.pr-sub-total td {
    border-top: 1px solid var(--em-border);
    padding-top: 0.4rem;
    font-weight: 600;
    color: var(--em-text-primary);
}

.pr-ytd-note {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px dashed var(--em-border);
}

.pr-num-col {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── M.6  Salary structure component rows ─────────────────── */
.pr-component-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr 1fr 2rem auto;
    gap: 0.75rem;
    align-items: start;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--em-border);
    margin-bottom: 0.75rem;
}

/* ── M.7  Info callout ────────────────────────────────────── */
.pr-info-callout {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.625rem;
    padding: 1rem 1.25rem;
    font-size: var(--font-size-sm);
    color: #15803d;
    line-height: 1.5;
}

.pr-info-callout i { flex-shrink: 0; margin-top: 0.1rem; font-size: 1rem; }

/* ── M.8  Status banner (completed / cancelled) ───────────── */
.pr-status-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.pr-status-banner-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.pr-status-banner-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* ── M.9  Processing banner ──────────────────────────────── */
.pr-processing-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1rem;
    animation: pr-processing-fadein 0.15s ease;
}

@keyframes pr-processing-fadein {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

#layout-shell.dark .pr-processing-banner {
    background: #1e3a5f;
    border-color: #1d4ed8;
    color: #93c5fd;
}

/* ── M.10 Dark mode overrides ─────────────────────────────── */
#layout-shell.dark .pr-badge-draft       { background: #374151; color: #9ca3af; }
#layout-shell.dark .pr-badge-calculating { background: #1e3a5f; color: #93c5fd; }
#layout-shell.dark .pr-badge-calculated  { background: #134e4a; color: #5eead4; }
#layout-shell.dark .pr-badge-locked      { background: #451a03; color: #fcd34d; }
#layout-shell.dark .pr-badge-approved    { background: #14532d; color: #86efac; }
#layout-shell.dark .pr-badge-completed   { background: #065f46; color: #a7f3d0; }
#layout-shell.dark .pr-badge-cancelled   { background: #450a0a; color: #fca5a5; }

#layout-shell.dark .pr-info-callout {
    background: #052e16;
    border-color: #166534;
    color: #86efac;
}

#layout-shell.dark .pr-status-banner-success {
    background: #052e16;
    border-color: #166534;
    color: #86efac;
}

#layout-shell.dark .pr-status-banner-danger {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

/* ── M.10  Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .pr-stat-row { grid-template-columns: 1fr; }
    .pr-breakdown { grid-template-columns: 1fr; }
    .pr-component-row { grid-template-columns: 1fr 1fr; }
    .pr-action-bar { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════════
   N — Employee Profile  (ep-*)
   ═══════════════════════════════════════════════════════════════ */

/* ── N.1  Profile header ──────────────────────────────────── */
.ep-profile-header {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--em-card-bg);
    border: 1px solid var(--em-border);
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.ep-header-body {
    flex: 1;
    min-width: 0;
}

.ep-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* ── N.2  Profile photo ───────────────────────────────────── */
.ep-photo-wrap {
    position: relative;
    width: 6rem;
    height: 6rem;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid var(--em-border);
    transition: border-color var(--transition);
}

.ep-photo-wrap:hover {
    border-color: #10b981;
}

.ep-photo-initials {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #10b981, #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
}

.ep-photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
    color: #fff;
    font-size: 0.7rem;
    gap: 0.15rem;
    text-align: center;
}

.ep-photo-wrap:hover .ep-photo-overlay {
    opacity: 1;
}

/* ── N.3  Tab bar ─────────────────────────────────────────── */
.ep-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--em-border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.ep-tab-btn {
    background: none;
    border: none;
    padding: 0.7rem 1.25rem;
    cursor: pointer;
    font-weight: 500;
    font-size: var(--font-size-base);
    font-family: inherit;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color var(--transition), border-color var(--transition);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ep-tab-btn:hover {
    color: var(--em-text-primary);
}

.ep-tab-btn.active {
    color: #10b981;
    border-bottom-color: #10b981;
}

/* ── N.4  Info grid (overview) ────────────────────────────── */
.ep-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.ep-dl {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ep-dl-row {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--em-border);
    align-items: baseline;
}

.ep-dl-row:last-child {
    border-bottom: none;
}

.ep-dl-row dt {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
}

.ep-dl-row dd {
    font-size: var(--font-size-sm);
    color: var(--em-text-primary);
    margin: 0;
}

.ep-dl-row dd a {
    color: #10b981;
    text-decoration: none;
}

.ep-dl-row dd a:hover {
    text-decoration: underline;
}

.ep-dl-muted {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-left: 0.35rem;
}

/* ── N.5  Upload panel ────────────────────────────────────── */
.ep-upload-panel {
    background: var(--em-card-bg);
    border: 1px solid var(--em-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

/* ── N.6  Document list ───────────────────────────────────── */
.ep-doc-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ep-doc-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--em-border);
    border-radius: 0.625rem;
    margin-bottom: 0.5rem;
    background: var(--em-card-bg);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.ep-doc-item:hover {
    border-color: #10b981;
    box-shadow: 0 1px 6px rgba(16, 185, 129, 0.1);
}

.ep-doc-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    color: #6b7280;
    width: 2rem;
    text-align: center;
}

.ep-doc-info {
    flex: 1;
    min-width: 0;
}

.ep-doc-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--em-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ep-doc-meta {
    font-size: 0.72rem;
    color: #9ca3af;
    margin-top: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.ep-doc-actions {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

/* ── N.7  Employment timeline ─────────────────────────────── */
.ep-timeline {
    position: relative;
    padding-left: 2.25rem;
}

.ep-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0.4rem;
    bottom: 0.4rem;
    width: 2px;
    background: var(--em-border);
    border-radius: 1px;
}

.ep-timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.ep-timeline-item:last-child {
    margin-bottom: 0;
}

.ep-timeline-dot {
    position: absolute;
    left: -1.875rem;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    border: 2px solid;
    top: 0.2rem;
    flex-shrink: 0;
}

.ep-timeline-body {
    padding-left: 0.25rem;
}

.ep-timeline-title {
    font-weight: 600;
    font-size: var(--font-size-base);
    color: var(--em-text-primary);
    display: flex;
    align-items: center;
}

.ep-timeline-meta {
    font-size: var(--font-size-sm);
    color: #9ca3af;
    margin-top: 0.125rem;
}

.ep-timeline-change {
    font-size: var(--font-size-sm);
    color: #6b7280;
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem;
}

.ep-timeline-from {
    background: #fee2e2;
    color: #b91c1c;
    padding: 0.1rem 0.4rem;
    border-radius: 0.3rem;
    font-size: 0.72rem;
    font-weight: 500;
}

.ep-timeline-to {
    background: #dcfce7;
    color: #15803d;
    padding: 0.1rem 0.4rem;
    border-radius: 0.3rem;
    font-size: 0.72rem;
    font-weight: 500;
}

.ep-timeline-reason {
    font-size: 0.72rem;
    color: #9ca3af;
    font-style: italic;
    margin-top: 0.2rem;
}

/* ── N.8  Dark mode overrides ─────────────────────────────── */
#layout-shell.dark .ep-timeline-from { background: #450a0a; color: #fca5a5; }
#layout-shell.dark .ep-timeline-to   { background: #052e16; color: #86efac; }

/* ── N.9  Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .ep-profile-header { flex-wrap: wrap; }
    .ep-info-grid { grid-template-columns: 1fr; }
    .ep-dl-row { grid-template-columns: 7rem 1fr; }
    .ep-header-actions { width: 100%; }
    .ep-photo-overlay { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   SHARED TABLE / LIST UTILITIES
   ═══════════════════════════════════════════════════════════ */

/* Empty state (full-page centred) */
.em-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 1rem;
    text-align: center;
}
.em-empty-state .em-empty-icon { font-size: 2.5rem; color: #d1d5db; margin-bottom: 1rem; }
.em-empty-state .em-empty-title { font-size: 1rem; font-weight: 600; color: var(--content-text); margin: 0 0 0.4rem; }
.em-empty-state .em-empty-body { font-size: 0.85rem; color: #9ca3af; margin: 0 0 1.25rem; }

/* Inline empty (inside a list card) */
.em-empty { display: flex; flex-direction: column; align-items: center; padding: 3rem 1rem; text-align: center; }
.em-empty-icon { font-size: 2.25rem; color: #d1d5db; margin-bottom: 0.75rem; }
.em-empty-title { font-size: 0.95rem; font-weight: 600; color: var(--content-text); margin: 0 0 0.35rem; }
.em-empty-subtitle { font-size: 0.82rem; color: #9ca3af; margin: 0 0 1.25rem; }

/* Loading row */
.em-loading-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 2rem 0;
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Muted text */
.em-muted { color: #9ca3af; font-size: 0.85rem; }

/* Table action buttons */
.em-table-actions { display: flex; gap: 0.25rem; justify-content: flex-end; white-space: nowrap; }
.em-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s, color 0.15s;
}
.em-action-btn:hover { background: #f3f4f6; color: var(--content-text); }
.em-action-btn-danger:hover { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

/* Semantic badge colours (neutral / blue / green / red) */
.em-badge-neutral  { background: #f3f4f6; color: #374151; }
.em-badge-blue     { background: #dbeafe; color: #1d4ed8; }
.em-badge-green    { background: #dcfce7; color: #15803d; }
.em-badge-red      { background: #fee2e2; color: #b91c1c; }

/* Dark mode overrides for utilities */
#layout-shell.dark .em-muted { color: #6b7280; }
#layout-shell.dark .em-action-btn { border-color: #374151; color: #9ca3af; }
#layout-shell.dark .em-action-btn:hover { background: #374151; color: #f9fafb; }
#layout-shell.dark .em-action-btn-danger:hover { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
#layout-shell.dark .em-badge-neutral { background: #374151; color: #d1d5db; }
#layout-shell.dark .em-badge-blue    { background: #1e3a5f; color: #93c5fd; }
#layout-shell.dark .em-badge-green   { background: #14532d; color: #86efac; }
#layout-shell.dark .em-badge-red     { background: #450a0a; color: #fca5a5; }

/* ═══════════════════════════════════════════════════════════
   LOANS PAGE  (ln-)
   ═══════════════════════════════════════════════════════════ */

.ln-employee-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--card-bg, #fff);
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    z-index: 200;
    overflow: hidden;
}
.ln-employee-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 0.6rem 0.875rem;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}
.ln-employee-option:hover { background: #f3f4f6; }
.ln-employee-name  { font-size: 0.875rem; font-weight: 500; color: var(--content-text); }
.ln-employee-meta  { font-size: 0.78rem; color: #9ca3af; }

.ln-selected-employee {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--content-text);
}
.ln-clear-btn {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0.1rem 0.2rem;
}
.ln-clear-btn:hover { color: #374151; }

.ln-repayments-row > td {
    background: #f9fafb;
    padding: 0.5rem 1rem 0.5rem 2rem;
    border-top: none;
}
.ln-repayments-table { margin: 0; border: none; box-shadow: none; }
.ln-repayments-table th,
.ln-repayments-table td { font-size: 0.8rem; padding: 0.35rem 0.75rem; }

/* Dark mode */
#layout-shell.dark .ln-employee-dropdown { background: #1f2937; border-color: #374151; }
#layout-shell.dark .ln-employee-option:hover { background: #374151; }
#layout-shell.dark .ln-employee-name { color: #f9fafb; }
#layout-shell.dark .ln-selected-employee { background: #052e16; border-color: #166534; }
#layout-shell.dark .ln-repayments-row > td { background: #111827; }

/* ═══════════════════════════════════════════════════════════
   TAX RELIEFS PAGE  (tr-)
   ═══════════════════════════════════════════════════════════ */

.tr-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.tr-badge-verified { background: #dcfce7; color: #15803d; }
.tr-badge-pending  { background: #fef3c7; color: #b45309; }

#layout-shell.dark .tr-badge-verified { background: #14532d; color: #86efac; }
#layout-shell.dark .tr-badge-pending  { background: #451a03; color: #fcd34d; }

/* ============================================================
   ATTENDANCE MODULE  (at-)
   ============================================================ */

/* ── Clock panel / inline action panel ─────────────────────── */
.at-clock-panel {
    background: var(--em-card-bg);
    border: 1.5px solid var(--em-card-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--em-card-shadow);
}

.at-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--content-text);
    margin-bottom: 1rem;
}

/* ── Detail value ───────────────────────────────────────────── */
.at-detail-value {
    font-size: var(--font-size-base);
    color: var(--content-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.at-method-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: #e0f2fe;
    color: #0369a1;
    text-transform: uppercase;
}

#layout-shell.dark .at-method-chip { background: #0c4a6e; color: #7dd3fc; }

/* ── Attendance status badges ───────────────────────────────── */
.at-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Attendance status colours */
.at-badge-present      { background: #d1fae5; color: #065f46; }
.at-badge-absent       { background: #fee2e2; color: #991b1b; }
.at-badge-late         { background: #fef3c7; color: #92400e; }
.at-badge-halfday      { background: #dbeafe; color: #1e40af; }
.at-badge-missingpunch { background: #fce7f3; color: #9d174d; }
.at-badge-onleave      { background: #ccfbf1; color: #134e4a; }
.at-badge-holiday      { background: #ede9fe; color: #5b21b6; }
.at-badge-weekend      { background: #f3f4f6; color: #374151; }

/* Overtime status colours */
.at-badge-ot-pending   { background: #fef3c7; color: #92400e; }
.at-badge-ot-approved  { background: #d1fae5; color: #065f46; }
.at-badge-ot-rejected  { background: #fee2e2; color: #991b1b; }
.at-badge-ot-cancelled { background: #f3f4f6; color: #374151; }

/* Holiday type colours */
.at-badge-holiday-national { background: #dbeafe; color: #1e40af; }
.at-badge-holiday-optional { background: #d1fae5; color: #065f46; }
.at-badge-holiday-tenant   { background: #ede9fe; color: #5b21b6; }

/* Dark-mode overrides */
#layout-shell.dark .at-badge-present      { background: #064e3b; color: #34d399; }
#layout-shell.dark .at-badge-absent       { background: #450a0a; color: #fca5a5; }
#layout-shell.dark .at-badge-late         { background: #451a03; color: #fcd34d; }
#layout-shell.dark .at-badge-halfday      { background: #1e3a5f; color: #93c5fd; }
#layout-shell.dark .at-badge-missingpunch { background: #500724; color: #fbcfe8; }
#layout-shell.dark .at-badge-onleave      { background: #042f2e; color: #5eead4; }
#layout-shell.dark .at-badge-holiday      { background: #2e1065; color: #c4b5fd; }
#layout-shell.dark .at-badge-weekend      { background: #1f2937; color: #9ca3af; }

#layout-shell.dark .at-badge-ot-pending   { background: #451a03; color: #fcd34d; }
#layout-shell.dark .at-badge-ot-approved  { background: #064e3b; color: #34d399; }
#layout-shell.dark .at-badge-ot-rejected  { background: #450a0a; color: #fca5a5; }
#layout-shell.dark .at-badge-ot-cancelled { background: #1f2937; color: #9ca3af; }

#layout-shell.dark .at-badge-holiday-national { background: #1e3a5f; color: #93c5fd; }
#layout-shell.dark .at-badge-holiday-optional { background: #064e3b; color: #34d399; }
#layout-shell.dark .at-badge-holiday-tenant   { background: #2e1065; color: #c4b5fd; }

/* ═══════════════════════════════════════════════════════════════
   N — Leave Module  (lv-*)
   ═══════════════════════════════════════════════════════════════ */

/* ── N.1  Request form panel ───────────────────────────────── */
.lv-request-panel {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--em-card-shadow);
}

.lv-panel-title {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--content-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0 1.25rem;
}

/* ── N.2  Balance card grid ────────────────────────────────── */
.lv-balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.lv-balance-card {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    padding: 1.25rem 1rem;
    box-shadow: var(--em-card-shadow);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    text-decoration: none;
    color: var(--content-text);
}

.lv-balance-card:hover,
.lv-balance-card.selected {
    border-color: #10b981;
    box-shadow: var(--em-card-shadow-hover);
    transform: translateY(-2px);
}

.lv-balance-type {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: #6b7280;
}

.lv-balance-available {
    font-size: 1.75rem;
    font-weight: 700;
    color: #10b981;
    line-height: 1;
    letter-spacing: -0.03em;
}

.lv-balance-label {
    font-size: 0.6875rem;
    color: #9ca3af;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lv-balance-row {
    display: flex;
    justify-content: space-between;
    font-size: var(--font-size-sm);
    color: #6b7280;
    margin-top: 0.25rem;
}

.lv-balance-row span:last-child {
    font-weight: 600;
    color: var(--content-text);
}

/* ── N.3  Leave status badges ──────────────────────────────── */
.lv-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.lv-badge-pending   { background: #fef3c7; color: #b45309; }
.lv-badge-approved  { background: #dcfce7; color: #15803d; }
.lv-badge-rejected  { background: #fee2e2; color: #b91c1c; }
.lv-badge-cancelled { background: #f3f4f6; color: #6b7280; }

/* ── N.4  Leave type chip (active/inactive) ────────────────── */
.lv-type-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.lv-type-chip-active   { background: #d1fae5; color: #065f46; }
.lv-type-chip-inactive { background: #f3f4f6; color: #6b7280; }

/* ── N.5  Detail view ──────────────────────────────────────── */
.lv-detail-section {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: var(--em-card-shadow);
    overflow: hidden;
}

.lv-detail-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--em-card-border);
}

.lv-detail-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--content-text);
    margin: 0;
}

.lv-detail-body {
    padding: 1.25rem;
}

.lv-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem 1.5rem;
}

@media (max-width: 900px)  { .lv-detail-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .lv-detail-grid { grid-template-columns: 1fr; } }

.lv-detail-item {}
.lv-detail-item-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.lv-detail-item-value {
    font-size: var(--font-size-base);
    color: var(--content-text);
    font-weight: 500;
}

/* ── N.6  Action cluster on detail page ────────────────────── */
.lv-action-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.875rem 1.25rem;
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    margin-bottom: 1rem;
    box-shadow: var(--em-card-shadow);
}

/* ── N.7  Dark mode ────────────────────────────────────────── */
#layout-shell.dark .lv-badge-pending   { background: #451a03; color: #fcd34d; }
#layout-shell.dark .lv-badge-approved  { background: #064e3b; color: #34d399; }
#layout-shell.dark .lv-badge-rejected  { background: #450a0a; color: #fca5a5; }
#layout-shell.dark .lv-badge-cancelled { background: #1f2937; color: #9ca3af; }
#layout-shell.dark .lv-type-chip-active   { background: #064e3b; color: #34d399; }
#layout-shell.dark .lv-type-chip-inactive { background: #374151; color: #9ca3af; }
#layout-shell.dark .lv-balance-available  { color: #34d399; }

/* ── K.6  Quick-create link (appended to ef-* form fields) ─── */
.ef-quick-create-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.3rem;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: #10b981;
    text-decoration: none;
    transition: color var(--transition), opacity var(--transition);
    line-height: 1.4;
}

.ef-quick-create-link:hover { color: #059669; text-decoration: underline; }

#layout-shell.dark .ef-quick-create-link       { color: #34d399; }
#layout-shell.dark .ef-quick-create-link:hover { color: #6ee7b7; }

/* ═══════════════════════════════════════════════════════════════
   O — Modal  (mo-*)
   ═══════════════════════════════════════════════════════════════ */

/* ── O.1  Backdrop ─────────────────────────────────────────── */
.mo-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 400;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.mo-backdrop.mo-open {
    display: flex;
    animation: mo-fade-in 0.18s ease;
}

@keyframes mo-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── O.2  Card ─────────────────────────────────────────────── */
.mo-card {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.875rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    animation: mo-slide-up 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes mo-slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── O.3  Header ───────────────────────────────────────────── */
.mo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.25rem 1rem;
    border-bottom: 1px solid var(--em-card-border);
    flex-shrink: 0;
}

.mo-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--content-text);
    margin: 0;
    line-height: 1.3;
}

.mo-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.4rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 0.875rem;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.mo-close:hover {
    background: var(--em-table-head-bg);
    color: var(--content-text);
}

/* ── O.4  Body ─────────────────────────────────────────────── */
.mo-body {
    padding: 1.25rem;
    flex: 1;
    overflow-y: auto;
}

/* ── O.5  Footer ───────────────────────────────────────────── */
.mo-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.625rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--em-card-border);
    flex-shrink: 0;
}

/* ── O.6  Responsive ───────────────────────────────────────── */
@media (max-width: 520px) {
    .mo-card     { border-radius: 0.75rem 0.75rem 0 0; max-height: 90vh; }
    .mo-backdrop { align-items: flex-end; padding: 0; }
}

/* ── O.7  Dark mode ────────────────────────────────────────── */
#layout-shell.dark .mo-card {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* ═══════════════════════════════════════════════════════════════════
   P — Error pages  (err-*)
   ═══════════════════════════════════════════════════════════════════ */

/* ── P.1  Page shell ───────────────────────────────────────── */
.error-layout-shell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background-color: var(--content-bg);
    color: var(--content-text);
}

.err-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 3rem 1.5rem;
    text-align: center;
}

/* ── P.2  Error code ───────────────────────────────────────── */
.err-code {
    font-size: clamp(5rem, 18vw, 9rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    user-select: none;
}

.err-code-500 {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ── P.3  Heading + body ───────────────────────────────────── */
.err-title {
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    font-weight: 700;
    color: var(--content-text);
    margin: 0 0 0.75rem;
}

.err-body {
    font-size: var(--font-size-sm);
    color: #6b7280;
    max-width: 36rem;
    line-height: 1.6;
    margin: 0 0 2rem;
}

/* ── P.4  Action row ───────────────────────────────────────── */
.err-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── P.5  Illustration ─────────────────────────────────────── */
.err-illustration {
    width: 140px;
    height: 140px;
    margin-bottom: 1.5rem;
    color: #a5b4fc;
    animation: err-float 5s ease-in-out infinite;
}

.err-code-500 ~ .err-illustration,
.err-illustration:has(+ .err-code-500) {
    color: #fcd34d;
}

@keyframes err-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

.err-svg-ring { opacity: 0.35; }
.err-svg-lens { color: #6366f1; }
.err-svg-handle { color: #8b5cf6; }
.err-svg-detail { opacity: 0.7; }
.err-svg-panel { color: #f59e0b; }
.err-svg-stand { opacity: 0.5; }
.err-svg-star { animation: err-twinkle 3s ease-in-out infinite alternate; }
.err-svg-star:nth-child(even) { animation-delay: 1.5s; }

@keyframes err-twinkle {
    from { opacity: 0.2; }
    to   { opacity: 0.55; }
}

/* ── P.6  Dark mode ────────────────────────────────────────── */
#layout-shell.dark .err-title {
    color: #f3f4f6;
}

#layout-shell.dark .err-body {
    color: #9ca3af;
}

#layout-shell.dark .err-illustration {
    color: #818cf8;
}

/* ═══════════════════════════════════════════════════════════════════
   Q — TopBar Search dropdown  (ts-*)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Q.1  Input row ────────────────────────────────────────── */
.topbar-search {
    position: static; /* overridden by .topbar-search-open */
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-search-open {
    position: relative;
}

.topbar-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: var(--font-size-sm);
    color: var(--topbar-text, #1f2937);
    min-width: 0;
}

.topbar-search-input::placeholder {
    color: #9ca3af;
}

/* ── Q.2  Kbd hints ────────────────────────────────────────── */
.ts-kbd-hint {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
    pointer-events: none;
}

.ts-kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem 0.35rem;
    font-size: 0.6875rem;
    font-family: inherit;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    background: #f9fafb;
    color: #6b7280;
    line-height: 1.4;
}

/* ── Q.3  Dropdown card ────────────────────────────────────── */
.topbar-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 480px;
    max-width: 560px;
    max-height: 480px;
    overflow-y: auto;
    background: var(--em-card-bg, #fff);
    border: 1px solid var(--em-card-border, #e5e7eb);
    border-radius: 0.75rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
    z-index: 600;
    overscroll-behavior: contain;
}

/* ── Q.4  Section label ────────────────────────────────────── */
.ts-section-label {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #9ca3af;
    text-transform: uppercase;
}

/* ── Q.5  Divider ──────────────────────────────────────────── */
.ts-divider {
    height: 1px;
    background: var(--em-card-border, #e5e7eb);
    margin: 0.25rem 0;
}

/* ── Q.6  Result row ───────────────────────────────────────── */
.ts-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background var(--transition, 0.15s ease);
    user-select: none;
}

.ts-result-item:hover,
.ts-highlighted {
    background: var(--em-table-head-bg, #f9fafb);
}

/* ── Q.7  Avatar & icon ────────────────────────────────────── */
.ts-result-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.ts-result-icon {
    width: 34px;
    height: 34px;
    border-radius: 0.5rem;
    background: var(--em-table-head-bg, #f3f4f6);
    color: #6b7280;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Q.8  Body text ────────────────────────────────────────── */
.ts-result-body {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.ts-result-name {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--content-text, #111827);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ts-result-sub {
    font-size: 0.75rem;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Q.9  Status dot ───────────────────────────────────────── */
.ts-result-badge {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ts-dot-active   { background: #10b981; }
.ts-dot-leave    { background: #f59e0b; }
.ts-dot-suspended { background: #ef4444; }
.ts-dot-inactive { background: #d1d5db; }

/* ── Q.10  Loading skeleton rows ───────────────────────────── */
.ts-loading-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
}

/* ── Q.11  Empty state ─────────────────────────────────────── */
.ts-empty {
    padding: 2rem 1rem;
    text-align: center;
    font-size: var(--font-size-sm);
    color: #9ca3af;
}

/* ── Q.12  Footer link ─────────────────────────────────────── */
.ts-footer {
    border-top: 1px solid var(--em-card-border, #e5e7eb);
    padding: 0.625rem 1rem;
    text-align: right;
}

.ts-footer a {
    font-size: 0.8125rem;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.ts-footer a:hover {
    text-decoration: underline;
}

/* ── Q.13  Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .topbar-search-dropdown {
        min-width: 0;
        left: -3rem;
        right: 0;
        max-width: none;
    }

    .ts-kbd-hint { display: none; }
}

/* ── Q.14  Dark mode ───────────────────────────────────────── */
#layout-shell.dark .topbar-search-input {
    color: #f3f4f6;
}

#layout-shell.dark .ts-kbd {
    background: #374151;
    border-color: #4b5563;
    color: #9ca3af;
}

#layout-shell.dark .ts-result-item:hover,
#layout-shell.dark .ts-highlighted {
    background: #1f2937;
}

/* ============================================================
   User menu dropdown
   ============================================================ */
.topbar-user-menu {
    position: relative;
}

.um-dropdown {
    background: var(--em-card-bg, #fff);
    border: 1px solid var(--em-card-border, #e5e7eb);
    border-radius: 0.75rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
    min-width: 220px;
    padding: 0.375rem 0;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 600;
}

.um-header {
    align-items: center;
    display: flex;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
}

.um-header-avatar {
    align-items: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    color: #fff;
    display: flex;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    height: 36px;
    justify-content: center;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    width: 36px;
}

.um-header-info {
    min-width: 0;
}

.um-header-name {
    font-size: 0.875rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.um-header-email {
    color: #9ca3af;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.um-divider {
    background: var(--em-card-border, #e5e7eb);
    height: 1px;
    margin: 0.25rem 0;
}

.um-item {
    align-items: center;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    display: flex;
    font-size: 0.875rem;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    text-align: left;
    transition: background var(--transition, 0.15s ease);
    width: 100%;
}

.um-item:hover {
    background: var(--em-table-head-bg, #f9fafb);
}

.um-item i {
    font-size: 1rem;
    flex-shrink: 0;
    opacity: 0.7;
    width: 1.1rem;
}

.um-item-danger {
    color: #ef4444;
}

.um-item-danger i {
    opacity: 1;
}

/* Dark mode */
#layout-shell.dark .um-dropdown {
    background: #1e2530;
    border-color: #374151;
}

#layout-shell.dark .um-header-name {
    color: #f3f4f6;
}

#layout-shell.dark .um-item {
    color: #d1d5db;
}

#layout-shell.dark .um-item:hover {
    background: #1f2937;
}

#layout-shell.dark .um-item-danger {
    color: #f87171;
}

#layout-shell.dark .ts-result-name {
    color: #f3f4f6;
}

#layout-shell.dark .ts-result-icon {
    background: #1f2937;
    color: #9ca3af;
}

/* ═══════════════════════════════════════════════════════════════════
   R — Dashboard  (db-*)
   ═══════════════════════════════════════════════════════════════════ */

/* ── R.1  Greeting ─────────────────────────────────────────── */
.db-greeting {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.db-greeting-title {
    font-size: clamp(1.25rem, 3vw, 1.625rem);
    font-weight: 700;
    color: var(--content-text);
    margin: 0 0 0.25rem;
}
.db-greeting-sub  { font-size: var(--font-size-sm); color: #6b7280; margin: 0; }
.db-greeting-date { font-size: 0.8125rem; color: #9ca3af; text-align: right; }

/* ── R.2  KPI grid ─────────────────────────────────────────── */
.db-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.db-kpi-card {
    background: var(--em-card-bg, #fff);
    border: 1px solid var(--em-card-border, #e5e7eb);
    border-radius: 0.875rem;
    padding: 1.25rem 1.375rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--em-card-shadow, 0 1px 3px rgba(0,0,0,.06));
    transition: box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.db-kpi-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.db-kpi-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 0.875rem 0.875rem 0 0;
    background: var(--db-kpi-accent, #10b981);
}
.db-kpi-card.accent-blue   { --db-kpi-accent: #6366f1; }
.db-kpi-card.accent-amber  { --db-kpi-accent: #f59e0b; }
.db-kpi-card.accent-red    { --db-kpi-accent: #ef4444; }
.db-kpi-card.accent-purple { --db-kpi-accent: #8b5cf6; }
.db-kpi-card.accent-teal   { --db-kpi-accent: #14b8a6; }
.db-kpi-card.accent-green  { --db-kpi-accent: #10b981; }
.db-kpi-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: color-mix(in srgb, var(--db-kpi-accent, #10b981) 12%, transparent);
    color: var(--db-kpi-accent, #10b981);
    flex-shrink: 0;
}
.db-kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}
.db-kpi-value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--content-text);
    line-height: 1;
    margin: 0;
}
.db-kpi-delta {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}
.db-kpi-delta.up   { color: #10b981; }
.db-kpi-delta.down { color: #ef4444; }
.db-kpi-delta.neu  { color: #9ca3af; }
.db-kpi-footer { font-size: 0.75rem; color: #9ca3af; margin-top: auto; }

/* ── R.3  Content grid ─────────────────────────────────────── */
.db-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.db-content-grid.wide-left { grid-template-columns: 3fr 2fr; }
@media (max-width: 1100px) {
    .db-content-grid,
    .db-content-grid.wide-left { grid-template-columns: 1fr; }
}

/* ── R.4  Widget card ──────────────────────────────────────── */
.db-widget {
    background: var(--em-card-bg, #fff);
    border: 1px solid var(--em-card-border, #e5e7eb);
    border-radius: 0.875rem;
    box-shadow: var(--em-card-shadow, 0 1px 3px rgba(0,0,0,.06));
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.db-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--em-card-border, #e5e7eb);
    gap: 0.75rem;
    flex-shrink: 0;
}
.db-widget-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--content-text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.db-widget-title i { color: #9ca3af; font-size: 0.9rem; }
.db-widget-action {
    font-size: 0.8125rem;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.db-widget-action:hover { text-decoration: underline; }
.db-widget-body { padding: 1rem 1.25rem; flex: 1; overflow: hidden; }
.db-widget-body.no-pad { padding: 0; }

/* ── R.5  Chart canvas ─────────────────────────────────────── */
.db-chart-wrap { position: relative; width: 100%; }

/* ── R.6  Activity feed ────────────────────────────────────── */
.db-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.db-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--em-card-border, #e5e7eb);
    font-size: var(--font-size-sm);
}
.db-feed-item:last-child { border-bottom: none; }
.db-feed-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 0.35rem; }
.db-feed-body { flex: 1; min-width: 0; }
.db-feed-text { color: var(--content-text); line-height: 1.45; margin: 0 0 0.2rem; }
.db-feed-time { color: #9ca3af; font-size: 0.75rem; }

/* ── R.7  Mini table ───────────────────────────────────────── */
.db-mini-table { width: 100%; border-collapse: collapse; font-size: var(--font-size-sm); }
.db-mini-table th {
    padding: 0.5rem 1rem;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #9ca3af;
    border-bottom: 1px solid var(--em-card-border, #e5e7eb);
    white-space: nowrap;
}
.db-mini-table td {
    padding: 0.625rem 1rem;
    color: var(--content-text);
    border-bottom: 1px solid var(--em-card-border, #f3f4f6);
    vertical-align: middle;
}
.db-mini-table tr:last-child td { border-bottom: none; }
.db-mini-table tr:hover td { background: var(--em-table-head-bg, #f9fafb); cursor: pointer; }

/* ── R.8  Leave balance bars ───────────────────────────────── */
.db-leave-bar { display: flex; flex-direction: column; gap: 0.875rem; padding: 0.25rem 0; }
.db-leave-row { display: flex; flex-direction: column; gap: 0.3rem; }
.db-leave-row-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--content-text);
}
.db-leave-row-header span:last-child { color: #9ca3af; }
.db-leave-track { height: 6px; border-radius: 99px; background: var(--em-card-border, #e5e7eb); overflow: hidden; }
.db-leave-fill  { height: 100%; border-radius: 99px; background: #10b981; transition: width 0.5s ease; }

/* ── R.9  Holiday list ─────────────────────────────────────── */
.db-holiday-list { display: flex; flex-direction: column; }
.db-holiday-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--em-card-border, #f3f4f6);
}
.db-holiday-item:last-child { border-bottom: none; }
.db-holiday-date-box {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.625rem;
    background: color-mix(in srgb, #6366f1 10%, transparent);
    color: #6366f1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    line-height: 1.1;
}
.db-holiday-day   { font-size: 1.1rem; }
.db-holiday-month { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.05em; }
.db-holiday-name  { font-size: var(--font-size-sm); font-weight: 600; color: var(--content-text); }
.db-holiday-type  { font-size: 0.75rem; color: #9ca3af; }

/* ── R.10  Dark mode ───────────────────────────────────────── */
#layout-shell.dark .db-kpi-card,
#layout-shell.dark .db-widget { background: #1f2937; border-color: #374151; }
#layout-shell.dark .db-widget-header,
#layout-shell.dark .db-mini-table th,
#layout-shell.dark .db-mini-table td,
#layout-shell.dark .db-feed-item,
#layout-shell.dark .db-holiday-item { border-color: #374151; }
#layout-shell.dark .db-mini-table tr:hover td { background: #111827; }
#layout-shell.dark .db-leave-track { background: #374151; }
#layout-shell.dark .db-kpi-icon { background: color-mix(in srgb, var(--db-kpi-accent, #10b981) 20%, transparent); }

/* ═══════════════════════════════════════════════════════════════════
   S — Subscription Status Pages  (sub-status-*)
   ═══════════════════════════════════════════════════════════════════ */

/* ── S.1  Full-viewport centred shell ──────────────────────── */
.sub-status-page {
    min-height: 100vh;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* ── S.2  Card ─────────────────────────────────────────────── */
.sub-status-card {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 1.25rem;
    box-shadow:
        0 4px 6px -1px rgba(0,0,0,.07),
        0 24px 64px -8px rgba(0,0,0,.12);
    padding: 2.5rem 2.25rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: sub-status-appear 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes sub-status-appear {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── S.3  Brand lockup ─────────────────────────────────────── */
.sub-status-brand {
    margin-bottom: 2rem;
}

/* ── S.4  Status icon badge ────────────────────────────────── */
.sub-status-icon {
    width: 5rem;
    height: 5rem;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.sub-status-icon--suspended {
    background: #fee2e2;
    color: #dc2626;
    box-shadow: 0 0 0 8px rgba(220,38,38,.08);
}

.sub-status-icon--past-due {
    background: #fef3c7;
    color: #d97706;
    box-shadow: 0 0 0 8px rgba(217,119,6,.08);
}

.sub-status-icon--cancelled {
    background: #f3f4f6;
    color: #6b7280;
    box-shadow: 0 0 0 8px rgba(107,114,128,.07);
}

.sub-status-icon--trialing {
    background: #dbeafe;
    color: #2563eb;
    box-shadow: 0 0 0 8px rgba(37,99,235,.08);
}

/* ── S.5  Title & body copy ────────────────────────────────── */
.sub-status-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #111827;
    margin: 0 0 0.75rem;
    letter-spacing: -0.025em;
    line-height: 1.25;
}

.sub-status-body {
    font-size: 0.9375rem;
    color: #6b7280;
    line-height: 1.65;
    margin: 0 0 1.75rem;
    max-width: 34rem;
}

/* ── S.6  Checklist ────────────────────────────────────────── */
.sub-status-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    width: 100%;
    margin-bottom: 2rem;
}

.sub-status-check-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    background: #f9fafb;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    color: #374151;
    text-align: left;
}

.sub-status-check-item i {
    font-size: 1rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.sub-status-check-item--positive i {
    color: #10b981;
}

/* ── S.7  Action buttons ───────────────────────────────────── */
.sub-status-actions {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    width: 100%;
    margin-bottom: 1.5rem;
}

.sub-status-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.sub-status-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.sub-status-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.sub-status-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16,185,129,.35);
}

.sub-status-btn-primary:hover {
    box-shadow: 0 6px 16px rgba(16,185,129,.4);
}

.sub-status-btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245,158,11,.35);
}

.sub-status-btn-warning:hover {
    box-shadow: 0 6px 16px rgba(245,158,11,.4);
}

.sub-status-btn-trial {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(99,102,241,.35);
}

.sub-status-btn-trial:hover {
    box-shadow: 0 6px 16px rgba(99,102,241,.4);
}

.sub-status-btn-ghost {
    background: transparent;
    color: #6b7280;
    border: 1.5px solid #e5e7eb;
}

.sub-status-btn-ghost:hover {
    background: #f9fafb;
    color: #374151;
    box-shadow: none;
}

/* ── S.8  Meta footer ──────────────────────────────────────── */
.sub-status-meta {
    font-size: 0.8125rem;
    color: #9ca3af;
    margin: 0;
}

.sub-status-meta strong {
    color: #6b7280;
    font-weight: 600;
}

/* ── S.9  Responsive ───────────────────────────────────────── */
@media (max-width: 520px) {
    .sub-status-card {
        padding: 2rem 1.25rem 1.5rem;
        border-radius: 1rem;
    }

    .sub-status-title { font-size: 1.25rem; }
    .sub-status-body  { font-size: 0.875rem; }
}

/* ── Permission Toggle ─────────────────────────────────────── */
.perm-toggle {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.perm-toggle:hover:not(.perm-toggle--disabled) {
    background: var(--color-surface-hover, #f9fafb);
    border-color: var(--color-border-hover, #d1d5db);
}

.perm-toggle--on {
    background: #f0fdf4;
    border-color: #86efac;
}

.perm-toggle--on:hover:not(.perm-toggle--disabled) {
    background: #dcfce7;
}

.perm-toggle--disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.perm-toggle-switch {
    width: 2rem;
    height: 1.125rem;
    border-radius: 9999px;
    background: #d1d5db;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
}

.perm-toggle--on .perm-toggle-switch {
    background: #10b981;
}

.perm-toggle-knob {
    position: absolute;
    top: 0.125rem;
    left: 0.125rem;
    width: 0.875rem;
    height: 0.875rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}

.perm-toggle--on .perm-toggle-knob {
    transform: translateX(0.875rem);
}

.perm-toggle-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text, #111827);
    flex: 1;
}

.perm-toggle--on .perm-toggle-label {
    color: #065f46;
}

#layout-shell.dark .perm-toggle {
    background: #1f2937;
    border-color: #374151;
}

#layout-shell.dark .perm-toggle:hover:not(.perm-toggle--disabled) {
    background: #374151;
    border-color: #4b5563;
}

#layout-shell.dark .perm-toggle--on {
    background: #064e3b;
    border-color: #10b981;
}

#layout-shell.dark .perm-toggle--on:hover:not(.perm-toggle--disabled) {
    background: #065f46;
}

#layout-shell.dark .perm-toggle-label {
    color: #d1d5db;
}

#layout-shell.dark .perm-toggle--on .perm-toggle-label {
    color: #6ee7b7;
}

/* ============================================================
   Breadcrumb  (bc-*)
   ============================================================ */
.bc {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.8125rem;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
}

.bc-link {
    align-items: center;
    color: #6b7280;
    display: inline-flex;
    gap: 0.3rem;
    text-decoration: none;
    transition: color var(--transition);
}

.bc-link:hover {
    color: #10b981;
}

.bc-link i {
    font-size: 0.8rem;
}

.bc-sep {
    color: #d1d5db;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.bc-current {
    align-items: center;
    color: var(--content-text);
    display: inline-flex;
    font-weight: 600;
    gap: 0.3rem;
}

.bc-current i {
    font-size: 0.8rem;
}

#layout-shell.dark .bc-link { color: #9ca3af; }
#layout-shell.dark .bc-link:hover { color: #10b981; }
#layout-shell.dark .bc-sep { color: #4b5563; }

/* ============================================================
   Manage Profile page  (profile-*)
   ============================================================ */

/* ── Outer wrapper ─────────────────────────────────────────── */
.profile-page {
    max-width: 860px;
}

/* ── Hero header ───────────────────────────────────────────── */
.profile-page-header {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 1rem;
    box-shadow: var(--em-card-shadow);
    margin-bottom: 1.5rem;
    padding: 1.75rem 2rem;
}

.profile-avatar-block {
    align-items: center;
    display: flex;
    gap: 1.25rem;
}

.profile-avatar {
    align-items: center;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    color: #fff;
    display: flex;
    flex-shrink: 0;
    height: 72px;
    justify-content: center;
    width: 72px;
}

.profile-avatar-initials {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.profile-name {
    color: var(--content-text);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.2rem;
    line-height: 1.3;
}

.profile-email {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0 0 0.625rem;
}

/* ── Badges ────────────────────────────────────────────────── */
.profile-badges {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.badge {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 600;
    gap: 0.3rem;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.6rem;
}

.badge-role {
    background: #ede9fe;
    color: #5b21b6;
}

.badge-mfa {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

/* ── Tab bar ───────────────────────────────────────────────── */
.profile-tabs {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    box-shadow: var(--em-card-shadow);
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    overflow: hidden;
    padding: 0.375rem;
}

.profile-tab {
    align-items: center;
    background: none;
    border: none;
    border-radius: 0.5rem;
    color: #6b7280;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.profile-tab:hover {
    background: var(--em-table-head-bg, #f9fafb);
    color: var(--content-text);
}

.profile-tab.active {
    background: #10b981;
    color: #fff;
    font-weight: 600;
}

/* ── Alert banners ─────────────────────────────────────────── */
.profile-alert {
    align-items: center;
    border-radius: 0.5rem;
    display: flex;
    font-size: 0.875rem;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding: 0.75rem 1rem;
}

.profile-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.profile-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* ── Loading state ─────────────────────────────────────────── */
.profile-loading {
    align-items: center;
    color: #6b7280;
    display: flex;
    font-size: 0.875rem;
    gap: 0.75rem;
    padding: 3rem 0;
}

.profile-loading .auth-spinner {
    border-color: rgba(16,185,129,0.25);
    border-top-color: #10b981;
}

/* ── Tab body card ─────────────────────────────────────────── */
.profile-tab-body {
    background: var(--em-card-bg);
    border: 1px solid var(--em-card-border);
    border-radius: 1rem;
    box-shadow: var(--em-card-shadow);
}

/* ── Section ───────────────────────────────────────────────── */
.profile-section {
    padding: 1.75rem 2rem;
}

.profile-section-title {
    color: var(--content-text);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}

.profile-section-sub {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0 0 1.5rem;
}

/* ── Form ──────────────────────────────────────────────────── */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-width: 520px;
}

.profile-form-row {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr 1fr;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.profile-label {
    color: #374151;
    font-size: 0.8125rem;
    font-weight: 600;
}

.profile-input-wrap {
    align-items: center;
    display: flex;
    position: relative;
}

.profile-input {
    background: var(--em-card-bg);
    border: 1.5px solid var(--em-card-border);
    border-radius: 0.5rem;
    color: var(--content-text);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    padding: 0.6rem 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    width: 100%;
}

.profile-input::placeholder {
    color: #9ca3af;
}

.profile-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.profile-input-readonly {
    background: var(--em-table-head-bg, #f9fafb);
    color: #6b7280;
    cursor: not-allowed;
}

.profile-input-code {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 0.15em;
}

.profile-toggle-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    position: absolute;
    right: 0.25rem;
    transition: color var(--transition);
}

.profile-toggle-btn:hover {
    color: #374151;
}

.profile-validation {
    color: #dc2626;
    font-size: 0.78rem;
}

.profile-hint {
    color: #9ca3af;
    font-size: 0.78rem;
    margin: 0;
}

/* ── Form actions ──────────────────────────────────────────── */
.profile-form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.375rem;
}

/* ── Buttons ───────────────────────────────────────────────── */
.profile-btn {
    align-items: center;
    border: 1.5px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    transition: all var(--transition);
}

.profile-btn-primary {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.profile-btn-primary:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.profile-btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

.profile-btn-secondary {
    background: transparent;
    border-color: var(--em-card-border);
    color: var(--content-text);
}

.profile-btn-secondary:hover {
    background: var(--em-table-head-bg, #f9fafb);
}

.profile-btn-danger {
    background: transparent;
    border-color: #fca5a5;
    color: #dc2626;
}

.profile-btn-danger:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #ef4444;
}

.profile-btn-danger:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

/* ── MFA status banner ─────────────────────────────────────── */
.profile-mfa-status {
    align-items: flex-start;
    border-radius: 0.75rem;
    display: flex;
    font-size: 0.875rem;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
}

.profile-mfa-status i {
    flex-shrink: 0;
    font-size: 1.4rem;
    margin-top: 0.1rem;
}

.profile-mfa-status strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.profile-mfa-status p {
    color: inherit;
    margin: 0;
    opacity: 0.8;
}

.profile-mfa-enabled {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.profile-mfa-disabled {
    background: #fefce8;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* ── Recovery codes ────────────────────────────────────────── */
.profile-recovery-codes {
    background: #f8fafc;
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 1rem 1.25rem;
}

.profile-recovery-title {
    align-items: center;
    color: #374151;
    display: flex;
    font-size: 0.8125rem;
    font-weight: 600;
    gap: 0.4rem;
    margin: 0 0 0.875rem;
}

.recovery-code-list {
    display: grid;
    gap: 0.35rem 1rem;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}

.recovery-code-list li code {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    color: #1f2937;
    display: block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8125rem;
    letter-spacing: 0.1em;
    padding: 0.3rem 0.6rem;
    text-align: center;
}

/* ── MFA setup flow ────────────────────────────────────────── */
.profile-mfa-setup {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    max-width: 440px;
}

.profile-mfa-steps {
    color: #374151;
    font-size: 0.875rem;
    margin: 0;
    padding-left: 1.25rem;
}

.profile-mfa-qr {
    background: #fff;
    border: 1px solid var(--em-card-border);
    border-radius: 0.75rem;
    display: inline-block;
    padding: 1rem;
}

.profile-mfa-manual {
    color: #6b7280;
    font-size: 0.875rem;
    margin: 0;
}

.profile-mfa-key {
    background: var(--em-table-head-bg, #f9fafb);
    border: 1px solid var(--em-card-border);
    border-radius: 0.375rem;
    color: var(--content-text);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
}

/* ── Confirm block (disable MFA) ───────────────────────────── */
.profile-confirm-block {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 0.75rem;
    color: #7f1d1d;
    font-size: 0.875rem;
    max-width: 440px;
    padding: 1.1rem 1.25rem;
}

.profile-confirm-block p {
    margin: 0 0 1rem;
}

.profile-confirm-actions {
    display: flex;
    gap: 0.75rem;
}

/* ── Dark mode overrides ───────────────────────────────────── */
#layout-shell.dark .profile-page-header,
#layout-shell.dark .profile-tabs,
#layout-shell.dark .profile-tab-body {
    background: var(--em-card-bg);
    border-color: var(--em-card-border);
}

#layout-shell.dark .profile-tab:hover {
    background: #1f2937;
    color: #f9fafb;
}

#layout-shell.dark .profile-label {
    color: #d1d5db;
}

#layout-shell.dark .profile-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

#layout-shell.dark .profile-input:focus {
    border-color: #10b981;
}

#layout-shell.dark .profile-input-readonly {
    background: #1f2937;
    color: #6b7280;
}

#layout-shell.dark .profile-toggle-btn:hover {
    color: #f9fafb;
}

#layout-shell.dark .badge-role {
    background: #312e81;
    color: #c4b5fd;
}

#layout-shell.dark .badge-mfa {
    background: #064e3b;
    color: #6ee7b7;
}

#layout-shell.dark .badge-warning {
    background: #451a03;
    color: #fcd34d;
}

#layout-shell.dark .profile-alert-success {
    background: #064e3b;
    border-color: #065f46;
    color: #6ee7b7;
}

#layout-shell.dark .profile-alert-error {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

#layout-shell.dark .profile-mfa-enabled {
    background: #064e3b;
    border-color: #065f46;
    color: #6ee7b7;
}

#layout-shell.dark .profile-mfa-disabled {
    background: #451a03;
    border-color: #78350f;
    color: #fcd34d;
}

#layout-shell.dark .profile-recovery-codes {
    background: #1f2937;
}

#layout-shell.dark .recovery-code-list li code {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

#layout-shell.dark .profile-mfa-key {
    background: #374151;
    border-color: #4b5563;
}

#layout-shell.dark .profile-confirm-block {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fca5a5;
}

#layout-shell.dark .profile-btn-secondary {
    border-color: #4b5563;
    color: #d1d5db;
}

#layout-shell.dark .profile-btn-secondary:hover {
    background: #374151;
}

#layout-shell.dark .profile-btn-danger {
    border-color: #7f1d1d;
    color: #f87171;
}

#layout-shell.dark .profile-btn-danger:hover:not(:disabled) {
    background: #450a0a;
    border-color: #b91c1c;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 560px) {
    .profile-page-header,
    .profile-section {
        padding: 1.25rem 1rem;
    }

    .profile-form-row {
        grid-template-columns: 1fr;
    }

    .profile-tabs {
        flex-wrap: wrap;
    }

    .recovery-code-list {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   Profile Photo Upload + CropperJS modal  (ef-photo-* / pc-*)
   ============================================================ */
.ef-photo-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.ef-avatar-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #e5e7eb;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #d1d5db;
}

.ef-avatar-preview.ef-avatar-empty {
    background: #f3f4f6;
}

.ef-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ef-avatar-placeholder-icon {
    font-size: 2rem;
    color: #9ca3af;
}

.ef-photo-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.ef-upload-label {
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ef-file-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.ef-remove-photo {
    color: #ef4444 !important;
    border-color: #fca5a5 !important;
}

.ef-remove-photo:hover {
    background: #fef2f2 !important;
}

/* Cropper modal */
.pc-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.pc-preview-wrap {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 6px;
    background: #111827;
}

.pc-crop-img {
    display: block;
    max-width: 100%;
}

.pc-hint {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
    margin: 0;
}

/* Widen the cropper modal card */
.mo-backdrop .mo-card:has(.pc-modal-body) {
    max-width: 600px;
    width: 95vw;
}

/* ── Performance module badges ─────────────────────────────────────────── */
.pf-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Cycle status */
.pf-badge-draft        { background: #f3f4f6; color: #374151; }
.pf-badge-active       { background: #dcfce7; color: #15803d; }
.pf-badge-calibration  { background: #ede9fe; color: #6d28d9; }
.pf-badge-completed    { background: #cffafe; color: #0e7490; }
.pf-badge-cancelled    { background: #fee2e2; color: #b91c1c; }

/* Assignment status */
.pf-badge-pending      { background: #fef3c7; color: #b45309; }
.pf-badge-inprogress   { background: #dbeafe; color: #1d4ed8; }
.pf-badge-submitted    { background: #ede9fe; color: #6d28d9; }
.pf-badge-acknowledged { background: #dcfce7; color: #15803d; }

/* Stage pill */
.pf-stage {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 500;
    background: #f9fafb;
    color: #374151;
    border: 1px solid #e5e7eb;
}

/* Create panel */
.pf-create-panel {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.pf-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dark mode */
#layout-shell.dark .pf-badge-draft        { background: #1f2937; color: #9ca3af; }
#layout-shell.dark .pf-badge-active       { background: #064e3b; color: #34d399; }
#layout-shell.dark .pf-badge-calibration  { background: #2e1065; color: #c4b5fd; }
#layout-shell.dark .pf-badge-completed    { background: #164e63; color: #67e8f9; }
#layout-shell.dark .pf-badge-cancelled    { background: #450a0a; color: #fca5a5; }
#layout-shell.dark .pf-badge-pending      { background: #451a03; color: #fcd34d; }
#layout-shell.dark .pf-badge-inprogress   { background: #1e3a5f; color: #93c5fd; }
#layout-shell.dark .pf-badge-submitted    { background: #2e1065; color: #c4b5fd; }
#layout-shell.dark .pf-badge-acknowledged { background: #064e3b; color: #34d399; }
#layout-shell.dark .pf-stage              { background: #1f2937; color: #d1d5db; border-color: #374151; }
#layout-shell.dark .pf-create-panel       { background: #1f2937; border-color: #374151; }
#layout-shell.dark .pf-panel-title        { color: #f9fafb; }

/* ── Performance: stage timeline ────────────────────────────────────────── */
.pf-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 1.25rem 0 1.75rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.pf-timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
    position: relative;
}

.pf-timeline-step:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 14px;
    right: 50%;
    left: -50%;
    height: 2px;
    background: #e5e7eb;
    z-index: 0;
}

.pf-timeline-step.done::before,
.pf-timeline-step.current::before { background: #6d28d9; }

.pf-timeline-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #9ca3af;
    position: relative;
    z-index: 1;
}

.pf-timeline-step.done  .pf-timeline-dot { background: #6d28d9; border-color: #6d28d9; color: #fff; }
.pf-timeline-step.current .pf-timeline-dot { background: #fff; border-color: #6d28d9; color: #6d28d9; box-shadow: 0 0 0 4px rgba(109,40,217,0.15); }

.pf-timeline-label {
    font-size: 0.62rem;
    font-weight: 500;
    color: #9ca3af;
    margin-top: 0.35rem;
    text-align: center;
    line-height: 1.2;
}

.pf-timeline-step.done    .pf-timeline-label { color: #6d28d9; }
.pf-timeline-step.current .pf-timeline-label { color: #111827; font-weight: 700; }

/* dark mode */
#layout-shell.dark .pf-timeline-step::before               { background: #374151; }
#layout-shell.dark .pf-timeline-step.done::before,
#layout-shell.dark .pf-timeline-step.current::before       { background: #7c3aed; }
#layout-shell.dark .pf-timeline-dot                        { background: #1f2937; border-color: #374151; color: #6b7280; }
#layout-shell.dark .pf-timeline-step.done .pf-timeline-dot { background: #7c3aed; border-color: #7c3aed; color: #fff; }
#layout-shell.dark .pf-timeline-step.current .pf-timeline-dot { background: #1f2937; border-color: #7c3aed; color: #a78bfa; }
#layout-shell.dark .pf-timeline-label                      { color: #6b7280; }
#layout-shell.dark .pf-timeline-step.done .pf-timeline-label    { color: #a78bfa; }
#layout-shell.dark .pf-timeline-step.current .pf-timeline-label { color: #f9fafb; }

/* Detail section (reusable) */
.pf-detail-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.pf-detail-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
}

.pf-detail-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.pf-detail-body { padding: 1.25rem; }

.pf-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.pf-detail-item-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 0.2rem;
}

.pf-detail-item-value {
    font-size: 0.9rem;
    color: #111827;
    font-weight: 500;
}

.pf-action-bar {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

/* dark mode */
#layout-shell.dark .pf-detail-section   { background: #111827; border-color: #374151; }
#layout-shell.dark .pf-detail-header    { border-color: #374151; }
#layout-shell.dark .pf-detail-title     { color: #f9fafb; }
#layout-shell.dark .pf-detail-item-value { color: #e5e7eb; }

/* ── Responsive table → card layout ───────────────────────── */
@media (max-width: 768px) {
    .em-table-wrap--responsive .em-table thead { display: none; }

    .em-table-wrap--responsive .em-table,
    .em-table-wrap--responsive .em-table tbody,
    .em-table-wrap--responsive .em-table tr,
    .em-table-wrap--responsive .em-table td {
        display: block;
    }

    .em-table-wrap--responsive .em-table tbody tr {
        padding: 0.875rem 1rem;
        border-bottom: 1px solid var(--em-table-border);
    }

    .em-table-wrap--responsive .em-table td {
        padding: 0.25rem 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        text-align: right;
    }

    .em-table-wrap--responsive .em-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: var(--font-size-sm);
        color: #6b7280;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        text-align: left;
        flex-shrink: 0;
    }

    .em-table-wrap--responsive .em-table td.em-td-center {
        text-align: right;
    }

    .em-table-wrap--responsive .em-table td.em-table-name {
        font-size: 1rem;
        padding-bottom: 0.375rem;
        border-bottom: 1px solid var(--em-table-border);
        margin-bottom: 0.25rem;
    }

    .em-table-wrap--responsive .em-table td.em-table-name::before {
        display: none;
    }

    .em-table-wrap--responsive .em-table td:last-child {
        justify-content: flex-end;
        padding-top: 0.5rem;
    }

    .em-table-wrap--responsive .em-table td:last-child::before {
        display: none;
    }
}
