/* SkillBridge - Main Styles
 *
 * CSS variable system for per-org branding.
 * Brand colors (primary, accent, highlight) are customizable per organization.
 * Semantic colors and neutrals are fixed for consistency.
 */

/* ============================================
   CSS Variables
   ============================================ */

:root {
    /* Brand Colors (per-org customizable via context processor) */
    --brand-primary: #46062b;
    --brand-accent: #5e043b;
    --brand-highlight: #800051;

    /* Semantic Colors (fixed) */
    --color-success: #008139;
    --color-warning: #f59e0b;
    --color-error: #d9002b;
    --color-info: #6431da;

    /* Focus Ring (fixed - not per-org, uses info color for accessibility) */
    --color-focus-ring: #6431da;
    --color-focus-ring-alpha: rgba(100, 49, 218, 0.25);

    /* Neutrals (fixed) */
    --color-page-bg: #f0f0f0;
    --color-card-bg: #ffffff;
    --color-text: #232323;
    --color-text-light: #33232c;
    --color-border: #e0e0e0;
    --color-border-dark: #232323;

    /* Sidebar Variables */
    --sidebar-width: 280px;
    --sidebar-bg: var(--brand-primary);
    --sidebar-text: #ffffff;
    --sidebar-text-muted: rgba(255, 255, 255, 0.7);
    --sidebar-border: rgba(255, 255, 255, 0.1);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.1);
    --sidebar-active-bg: var(--brand-accent);

    /* Header */
    --header-height: 52px;
    --header-bg: var(--color-card-bg);

    /* Mobile safe area */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Typography */
    --font-family: 'Poppins', 'Avenir', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-heading: 'Poppins', 'Avenir', sans-serif;
    --font-size-base: 16px;
    --line-height: 1.5;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Border radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ============================================
   Base Styles
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: var(--font-size-base);
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    font-family: var(--font-family);
    line-height: var(--line-height);
    color: var(--color-text);
    background-color: var(--color-page-bg);
    padding-top: var(--safe-top);
}

/* ============================================
   Layout: Sidebar + Main Content
   ============================================ */

.app-layout {
    min-height: 100vh;
}

.app-layout.no-sidebar .app-main {
    margin-left: 0;
}

/* Main content area */
.app-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-normal);
}

.app-content {
    flex: 1;
    padding: var(--spacing-lg);
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    z-index: 1060;
    transition: transform var(--transition-normal), width var(--transition-normal);
    padding-top: var(--safe-top);
}

/* Sidebar brand/logo area — height matches header so dark bg aligns with header bottom */
.sidebar-brand {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0 var(--spacing-sm) 0 0;
    min-height: var(--header-height);
    background: rgba(0, 0, 0, 0.08);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-md);
    padding: 0;
    margin: 0;
    transition: background var(--transition-fast);
}

/* Brand link hover only when sidebar is expanded */
.app-layout:not(.sidebar-collapsed) .sidebar-brand-link:hover {
    background: rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: inherit;
}

.sidebar-brand-logo {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-brand-logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
    color: var(--sidebar-text);
}

/* Icon rail: fixed 64px column for logos, nav icons, and avatars.
   Matches collapsed sidebar width so icons never move during transition. */
.sidebar-icon-rail {
    width: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-brand-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
}

.sidebar-brand-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--sidebar-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-brand-role {
    font-size: 0.65rem;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

/* Organization switcher toggle button (Skool-style stacked arrows) */
.sidebar-org-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    color: var(--sidebar-text);
    flex-shrink: 0;
    transition: background var(--transition-fast), border-color var(--transition-fast);
    padding: 0;
}

.sidebar-org-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.sidebar-org-toggle-svg {
    width: 10px;
    height: 16px;
    opacity: 0.85;
}

/* Organization dropdown (positioned to the right of sidebar) */
.sidebar-org-dropdown {
    position: absolute;
    top: var(--spacing-sm);
    left: 100%;
    width: 240px;
    background: var(--color-card-bg);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    z-index: 100;
    overflow: hidden;
    margin-left: 0.5rem;
}

.sidebar-org-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.65rem 0.85rem;
    color: #ffffff;
    text-decoration: none;
    transition: filter 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-org-dropdown-item:last-child {
    border-bottom: none;
}

.sidebar-org-dropdown-item:hover {
    filter: brightness(1.25);
    color: #ffffff;
    text-decoration: none;
}

.sidebar-org-dropdown-item.is-current {
    font-weight: 600;
}

/* Dot indicator for current org */
.sidebar-org-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffffff;
    flex-shrink: 0;
}

.sidebar-org-dropdown-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar navigation container (wraps nav + scroll arrows) */
.sidebar-nav-container {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Sidebar navigation */
.sidebar-nav {
    flex: 1;
    overflow: hidden auto; /* hidden-x prevents scrollbar during collapse, auto-y for long lists */
    scrollbar-width: none; /* Firefox: hide scrollbar (scroll arrows replace it) */
    padding: var(--spacing-xs) 0;
}

.sidebar-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari: hide scrollbar */
}

/* Nav scroll arrows (HubSpot-style hover-to-scroll) */
.sidebar-nav-arrow {
    position: absolute;
    left: 0;
    right: 0;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--sidebar-text-muted);
    opacity: 0.7;
    z-index: 2;
    transition: opacity var(--transition-fast);
}

.sidebar-nav-arrow:hover {
    opacity: 1;
}

.sidebar-nav-arrow-up {
    top: 0;
    background: linear-gradient(to bottom, var(--sidebar-bg) 40%, transparent);
}

.sidebar-nav-arrow-down {
    bottom: 0;
    background: linear-gradient(to top, var(--sidebar-bg) 40%, transparent);
}

.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav ul + ul {
    margin-top: 0;
}

.sidebar-section-label {
    padding: 12px 20px 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.45);
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-collapsed .sidebar-section-label span {
    visibility: hidden;
}

.sidebar-section-label + ul {
    margin-top: 0;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: background var(--transition-fast);
    /* No left padding — icon rail (64px <i>) handles positioning */
}

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

.sidebar-nav a:focus {
    color: var(--sidebar-text);
}

.sidebar-nav a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text);
}

.sidebar-nav a i,
.sidebar-nav a .bi {
    font-size: 1.1rem;
    width: 64px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-nav a span {
    white-space: nowrap; /* prevent text wrapping during collapse transition */
}

/* Sidebar section headers */
.sidebar-section {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sidebar-text-muted);
    margin-top: var(--spacing-md);
}

/* Sidebar footer (actions + profile) */
.sidebar-footer {
    padding: var(--spacing-sm) 0 0 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.sidebar-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-xs);
    padding: 0 var(--spacing-sm);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    padding: 0.35rem 0 var(--spacing-sm) 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    background: rgba(0, 0, 0, 0.08);
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
    /* No left padding — icon rail handles positioning */
}

/* Profile hover only when sidebar is expanded */
.app-layout:not(.sidebar-collapsed) .sidebar-profile:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sidebar-hover-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
    color: var(--sidebar-text);
}

.sidebar-profile-link {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.sidebar-profile:focus {
    color: inherit;
}

.sidebar-profile-name {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--sidebar-text);
}

.sidebar-profile-email {
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--sidebar-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar collapse button (desktop only) */
.sidebar-collapse-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--sidebar-text);
}

.sidebar-collapse-btn i {
    font-size: 0.85rem;
}

/* Sidebar settings button */
.sidebar-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-settings-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--sidebar-text);
    border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-settings-btn i {
    font-size: 1.1rem;
}

/* Sidebar scrim (mobile overlay) */
.sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    z-index: 1055;
}

/* Sidebar toggle button */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-light);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    position: relative;
    z-index: 1;
}

.sidebar-toggle:hover {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

.sidebar-toggle:focus {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
}

.sidebar-toggle i {
    font-size: 0.85rem;
}

/* Sidebar close button (mobile) — matches org toggle size */
.sidebar-close {
    display: none;
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.sidebar-close:hover {
    background: var(--sidebar-hover-bg);
}

/* ============================================
   Top Header (Mobile)
   ============================================ */

.app-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem var(--spacing-md);
    background: var(--header-bg);
    border-bottom: 1px solid var(--color-border);
    height: var(--header-height);
    position: sticky;
    top: var(--safe-top);
    z-index: 1050;
}

.app-header-title {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-55%);
    text-align: center;
    font-family: var(--font-family-heading);
    font-weight: 900;
    text-transform: uppercase;
    color: var(--color-text);
    margin: 0;
    font-size: clamp(1.15rem, 4.2vw, 1.75rem);
    letter-spacing: 0.5px;
    line-height: 1;
    pointer-events: none;
}

.app-header-title::after {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    background: var(--brand-primary);
    margin: 0.2rem auto 0;
    border-radius: 2px;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    position: relative;
    z-index: 1;
    margin-left: auto;
}

/* Header button base — 28px square, transparent, border, brand hover */
.header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    min-width: 28px;
    padding: 0 0.375rem;
    border-radius: var(--radius-md);
    color: var(--color-text-light);
    background: transparent;
    border: 1px solid var(--color-border);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    gap: 0.25rem;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.header-btn:hover {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

.header-btn i {
    font-size: 0.85rem;
}

/* Icon-only variant (square) */
.header-btn-icon {
    padding: 0;
    width: 28px;
}

/* Active state (filled) */
.header-btn-active {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

/* Settings button — alias for backwards compat */
.header-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    color: var(--color-text-light);
    background: transparent;
    border: 1px solid var(--color-border);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.header-settings-btn:hover {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

.header-settings-btn i {
    font-size: 0.85rem;
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 1023px) {
    .app-main {
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
        width: 100vw;
        max-width: 320px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar.open + .sidebar-scrim {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .sidebar-close {
        display: inline-flex;
    }

    /* Compact nav items on mobile to prevent scrollbar */
    .sidebar-nav a {
        padding: 0.35rem 0;
    }

    .sidebar-nav a i,
    .sidebar-nav a .bi {
        font-size: 1rem;
        width: 48px;
    }

    .sidebar-icon-rail {
        width: 48px;
    }

    .sidebar-profile {
        padding: 0.25rem 0;
    }
}

@media (min-width: 1024px) {
    .sidebar-toggle {
        display: none;
    }

    .sidebar-scrim {
        display: none;
    }

    /* Show header on desktop for settings gear and page title */
    .app-header {
        display: flex;
        padding-left: var(--spacing-sm);
    }

    .app-header-title {
        font-size: 1.5rem;
    }
}

/* ============================================
   Bootstrap Overrides
   ============================================ */

/* Primary color overrides */
.btn-primary {
    --bs-btn-bg: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--brand-accent);
    --bs-btn-hover-border-color: var(--brand-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--brand-highlight);
    --bs-btn-active-border-color: var(--brand-highlight);
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: var(--brand-primary);
    --bs-btn-disabled-border-color: var(--brand-primary);
    --bs-btn-disabled-color: #fff;
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary);
    --bs-btn-hover-border-color: var(--brand-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--brand-accent);
    --bs-btn-active-border-color: var(--brand-accent);
    --bs-btn-active-color: #fff;
}

/* Link color for main content */
a {
    color: var(--brand-primary);
}

a:hover {
    color: var(--brand-accent);
}

/* Ensure sidebar links always stay white - override general link styles */
.sidebar a,
.sidebar a:link,
.sidebar a:visited,
.sidebar a:hover,
.sidebar a:focus,
.sidebar a:active {
    color: var(--sidebar-text) !important;
    text-decoration: none;
}

/* Form focus states */
.form-control:focus,
.form-select:focus {
    border-color: var(--color-focus-ring);
    box-shadow: 0 0 0 0.2rem var(--color-focus-ring-alpha);
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.form-check-input:focus {
    border-color: var(--color-focus-ring);
    box-shadow: 0 0 0 0.2rem var(--color-focus-ring-alpha);
}

/* Badge variants */
.badge.bg-primary {
    background-color: var(--brand-primary) !important;
}

.badge.bg-success {
    background-color: var(--color-success) !important;
}

.badge.bg-warning {
    background-color: var(--color-warning) !important;
    color: var(--color-text) !important;
}

.badge.bg-danger {
    background-color: var(--color-error) !important;
}

.badge.bg-info {
    background-color: var(--color-info) !important;
}

/* Alert variants */
.alert-primary {
    --bs-alert-bg: rgba(70, 6, 43, 0.1);
    --bs-alert-border-color: rgba(70, 6, 43, 0.2);
    --bs-alert-color: var(--brand-primary);
}

.alert-success {
    --bs-alert-bg: rgba(0, 129, 57, 0.1);
    --bs-alert-border-color: rgba(0, 129, 57, 0.2);
    --bs-alert-color: var(--color-success);
}

.alert-warning {
    --bs-alert-bg: rgba(245, 158, 11, 0.1);
    --bs-alert-border-color: rgba(245, 158, 11, 0.2);
    --bs-alert-color: #92400e;
}

.alert-danger {
    --bs-alert-bg: rgba(217, 0, 43, 0.1);
    --bs-alert-border-color: rgba(217, 0, 43, 0.2);
    --bs-alert-color: var(--color-error);
}

.alert-info {
    --bs-alert-bg: rgba(100, 49, 218, 0.1);
    --bs-alert-border-color: rgba(100, 49, 218, 0.2);
    --bs-alert-color: var(--color-info);
}

/* Pagination */
.page-link {
    color: var(--brand-primary);
}

.page-link:hover {
    color: var(--brand-accent);
}

.page-item.active .page-link {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

/* Navbar brand */
.navbar-brand {
    color: var(--brand-primary);
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

/* Clickable cards */
.card-clickable {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    color: var(--color-text);
}

.card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--color-text);
}

.card-clickable .card-title {
    color: var(--color-text);
}

.card-clickable .card-text {
    color: var(--color-text-light);
}

/* Clickable table rows */
.table-clickable tbody tr {
    transition: background-color 0.1s ease;
}

.table-clickable tbody tr:hover {
    background-color: #f8f9fa;
}

/* Links within clickable rows - make them stand out */
.table-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 500;
}

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

/* Clickable list items */
.list-clickable .list-group-item[data-href] {
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.list-clickable .list-group-item[data-href]:hover {
    background-color: #f8f9fa;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-md);
    font-weight: 600;
}

.card-body {
    padding: var(--spacing-md);
}

/* Stat cards (dashboard) */
.stat-card {
    padding: var(--spacing-lg);
    text-align: center;
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1;
    margin-bottom: var(--spacing-xs);
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   Filter Bar (Dashboard Controls)
   ============================================ */

/* Main container */
.filter-bar {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    margin-bottom: var(--spacing-md);
}

/* Horizontal filter row */
.filters-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow-x: auto;
    overflow-y: visible;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.filters-row::-webkit-scrollbar {
    display: none;
}

/* Search input with icon */
.search-input-wrapper {
    position: relative;
    flex: 1 1 260px;
    min-width: 220px;
}

.search-input-wrapper .filter-control {
    width: 100%;
    padding-left: 2.5rem;
}

.search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    width: 18px;
    height: 18px;
}

/* Base control style - pill shaped inputs */
.filter-control {
    height: 40px;
    min-width: 180px;
    padding: 0 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #f9fafb;
    color: var(--color-text);
    font-size: 0.95rem;
    font-family: var(--font-family);
    line-height: 1;
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-control:hover {
    background: #f3f4f6;
}

.filter-control:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.1);
    background: #fff;
}

.filter-control::placeholder {
    color: #9ca3af;
}

/* Growing control that takes available space */
.filter-control--grow {
    flex: 1 1 260px;
    min-width: 220px;
}

/* Filter select dropdowns - custom chevron */
.filter-select {
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E") right 0.5rem center/1.25rem no-repeat;
    appearance: none;
    cursor: pointer;
    min-width: 90px;
    color: #374151;
    font-weight: 500;
    height: auto;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.1);
}

.filter-select:hover {
    border-color: #9ca3af;
}

/* ============================================
   Action Dropdown - Standard inline dropdowns
   ============================================ */

.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-family);
    line-height: 1.4;
}

.action-dropdown-toggle:hover {
    border-color: #9ca3af;
    background: #f9fafb;
}

.action-dropdown-toggle:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.1);
}

.action-dropdown-toggle--sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

.action-dropdown-toggle--outline {
    background: transparent;
}

.action-dropdown-label {
    white-space: nowrap;
}

.action-dropdown-chevron {
    width: 1rem;
    height: 1rem;
    opacity: 0.5;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.action-dropdown-chevron.rotate-180 {
    transform: rotate(180deg);
}

.action-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    min-width: 10rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 50;
    overflow: hidden;
}

.action-dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 400;
    color: #374151;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
    font-family: var(--font-family);
}

.action-dropdown-item:hover {
    background: #f3f4f6;
}

.action-dropdown-item.is-active {
    background: rgba(70, 6, 43, 0.05);
    color: var(--brand-primary);
    font-weight: 500;
}

.action-dropdown-item .bi-check2 {
    color: var(--color-success);
}

/* Status toggle buttons (like Active/Archive) */
.status-toggle {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.25rem;
}

.status-toggle__btn {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text-light);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.875rem;
    min-width: 5.5rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-family);
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
    height: auto;
    line-height: 1.4;
    cursor: pointer;
}

.status-toggle__btn:hover {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}

.status-toggle__btn--active {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}

.status-toggle__btn--active:hover {
    background: var(--brand-primary);
    color: #fff;
    border-color: var(--brand-primary);
}

/* Icon buttons (for filters panel toggle, etc.) */
.icon-btn,
.filter-reset-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 40px;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.icon-btn:hover,
.filter-reset-btn:hover {
    background: #f3f4f6;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Active filter pills */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.25rem 0 0;
    padding: 0;
    list-style: none;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem 0.35rem 1rem;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-pill__label {
    font-weight: 600;
    margin-right: 0.25rem;
}

.filter-pill__remove {
    border: 0;
    background: none;
    color: #4b5563;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.filter-pill__remove:hover {
    color: #111827;
}

.filter-pill__remove:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Toggle switches */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.toggle-switch input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    width: 46px;
    height: 26px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: #e5e7eb;
    position: relative;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.toggle-switch input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.toggle-switch input[type="checkbox"]:checked {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    border-color: transparent;
    box-shadow: 0 0 0 2px rgba(70, 6, 43, 0.25);
}

.toggle-switch input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}

.toggle-switch input[type="checkbox"]:focus-visible {
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.2);
}

/* Apply/Primary action button */
.filter-apply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 40px;
    padding: 0 1.5rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent));
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(70, 6, 43, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.filter-apply-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(70, 6, 43, 0.28);
    background: linear-gradient(90deg, var(--brand-accent), var(--brand-primary));
}

.filter-apply-btn:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .filter-bar {
        padding: 1rem;
    }

    .filters-row {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .filters-row > * {
        width: 100%;
    }

    .search-input-wrapper {
        flex: 1 1 auto;
        min-width: 0;
    }

    .filter-control--grow {
        flex: 1 1 auto;
    }

    .icon-btn,
    .filter-reset-btn {
        width: 100%;
    }

    .status-toggle {
        width: 100%;
        margin-left: 0;
    }

    .status-toggle__btn {
        flex: 1;
    }
}

/* Legacy support - map old class names */
.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 200px;
}

.filter-bar .btn {
    white-space: nowrap;
}

/* ============================================
   Enhanced Form Controls
   ============================================ */

/* Modern form control styling */
.form-control-modern,
.form-select-modern {
    height: 44px;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    color: var(--color-text);
    font-size: 0.95rem;
    font-family: var(--font-family);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control-modern:hover,
.form-select-modern:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.form-control-modern:focus,
.form-select-modern:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.1);
    background: #fff;
}

.form-control-modern::placeholder {
    color: #9ca3af;
}

/* Modern select with custom chevron */
.form-select-modern {
    padding-right: 2.5rem;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
}

/* Enhanced Bootstrap form overrides */
.form-control,
.form-select {
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:hover,
.form-select:hover {
    border-color: #9ca3af;
}

/* Form labels */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

/* Form help text */
.form-text {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.35rem;
}

/* Input groups */
.input-group-modern {
    display: flex;
    align-items: stretch;
}

.input-group-modern .form-control-modern {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-modern .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Form card container */
.form-card {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    padding: 1.5rem;
}

.form-card-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

/* Color picker enhancement */
.form-control-color {
    width: 44px;
    height: 44px;
    padding: 4px;
    border-radius: 8px;
    cursor: pointer;
}

.form-control-color::-webkit-color-swatch-wrapper {
    padding: 0;
}

.form-control-color::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* Checkbox and radio enhancements */
.form-check-input {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 4px;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.form-check-label {
    font-size: 0.95rem;
    cursor: pointer;
}

/* Switch toggle (Bootstrap style enhanced) */
.form-switch .form-check-input {
    width: 2.5rem;
    height: 1.35rem;
    border-radius: 999px;
    background-color: #e5e7eb;
    border: none;
    transition: background-color 0.2s ease;
}

.form-switch .form-check-input:checked {
    background-color: var(--brand-primary);
}

.form-switch .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(70, 6, 43, 0.15);
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-md);
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--color-text-light);
    margin-bottom: var(--spacing-md);
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--spacing-sm);
}

.empty-state-message {
    color: var(--color-text-light);
    margin-bottom: var(--spacing-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================
   Status Badges
   ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-badge--active,
.status-badge--confirmed,
.status-badge--assigned {
    background: rgba(0, 129, 57, 0.1);
    color: var(--color-success);
}

.status-badge--pending,
.status-badge--draft {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.status-badge--cancelled,
.status-badge--declined,
.status-badge--inactive {
    background: rgba(217, 0, 43, 0.1);
    color: var(--color-error);
}

.status-badge--open,
.status-badge--published {
    background: rgba(100, 49, 218, 0.1);
    color: var(--color-info);
}

/* ============================================
   Tables
   ============================================ */

.table {
    --bs-table-bg: var(--color-card-bg);
}

.table > thead {
    background: var(--color-page-bg);
}

.table > thead th {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-light);
    border-bottom-width: 1px;
}

.table-hover > tbody > tr:hover {
    --bs-table-hover-bg: rgba(0, 0, 0, 0.02);
}

/* Responsive table wrapper */
.table-responsive {
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

/* ============================================
   Loading States (Alpine.js)
   ============================================ */

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

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

.btn .loading-spinner {
    margin-right: 0.5rem;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--color-border) 25%, var(--color-page-bg) 50%, var(--color-border) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ============================================
   Toast Notifications (Sonner-style)
   ============================================ */

.toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    pointer-events: none;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: stretch;
    background: var(--color-card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    pointer-events: auto;
    min-width: 300px;
    max-width: 400px;

    /* Slide animation */
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-hiding {
    transform: translateX(120%);
    opacity: 0;
}

/* Toast content */
.toast-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    flex: 1;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-message {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--color-text);
    word-break: break-word;
}

/* Toast close button */
.toast-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    background: transparent;
    border: none;
    border-left: 1px solid var(--color-border);
    color: var(--color-text-light);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.toast-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--color-text);
}

/* Toast types - left border accent */
.toast-success {
    border-left: 4px solid var(--color-success);
}

.toast-success .toast-icon {
    color: var(--color-success);
}

.toast-error {
    border-left: 4px solid var(--color-error);
}

.toast-error .toast-icon {
    color: var(--color-error);
}

.toast-warning {
    border-left: 4px solid var(--color-warning);
}

.toast-warning .toast-icon {
    color: #d39e00;
}

.toast-info {
    border-left: 4px solid var(--color-info);
}

.toast-info .toast-icon {
    color: var(--color-info);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .toast-container {
        left: var(--spacing-sm);
        right: var(--spacing-sm);
        bottom: var(--spacing-sm);
        max-width: none;
    }

    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* ============================================
   Accessibility
   ============================================ */

/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Visually hidden until focused (for skip links) */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible styles */
:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
}

/* Skip link for keyboard navigation */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--brand-primary);
    color: white;
    border-radius: var(--radius-md);
    z-index: 9999;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--spacing-md);
}

/* ============================================
   Utilities
   ============================================ */

.text-brand { color: var(--brand-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }
.text-info { color: var(--color-info); }
.text-muted { color: var(--color-text-light); }

.bg-brand { background-color: var(--brand-primary); }
.bg-brand-accent { background-color: var(--brand-accent); }
.bg-brand-highlight { background-color: var(--brand-highlight); }

.border-brand { border-color: var(--brand-primary); }

/* Avatar helper */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border-radius: 50%;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.bg-brand-light {
    background-color: rgba(70, 6, 43, 0.1);
}

/* ============================================
   Icon Copy Button (click-to-copy)
   ============================================ */

.btn-icon-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-light);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-icon-copy:hover {
    background: var(--brand-primary);
    color: #fff;
}

.btn-icon-copy:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* ============================================
   Scroll Sentinel (for infinite scroll)
   ============================================ */

.scroll-sentinel {
    height: 1px;
    width: 100%;
    visibility: hidden;
}

.scroll-status {
    text-align: center;
    padding: var(--spacing-md);
}

/* ============================================
   Sidebar Desktop (show collapse button)
   ============================================ */

@media (min-width: 1024px) {
    .sidebar-collapse-btn {
        display: flex;
    }
}

/* ============================================
   Payment UI Styles
   ============================================ */

.pay-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    background: linear-gradient(135deg, #198754, #20c997);
    color: #fff;
    white-space: nowrap;
}

/* ============================================
   My Pay Dashboard
   ============================================ */

/* Balance cards row */
.mypay-balance-cards {
    display: flex;
    gap: 0.75rem;
    margin-bottom: var(--spacing-md);
}

.mypay-balance-card {
    flex: 1;
    min-width: 0;
    padding: 1rem 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: left;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.mypay-balance-card__label {
    font-size: 0.8125rem;
    font-weight: 500;
    opacity: 0.85;
    margin-bottom: 0.25rem;
}

.mypay-balance-card__amount {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.mypay-balance-card__detail {
    font-size: 0.75rem;
    opacity: 0.75;
    margin-top: 0.125rem;
}

.mypay-balance-card__indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: transparent;
    transition: background 0.2s;
}

.mypay-balance-card--selected .mypay-balance-card__indicator {
    background: currentColor;
}

/* Card variants — use org brand colors + global semantic colors */
.mypay-balance-card--earnings {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
    border-color: color-mix(in srgb, var(--brand-primary) 40%, transparent);
}

.mypay-balance-card--paid {
    background: linear-gradient(135deg, #198754, #20c997);
    color: #fff;
    border-color: rgba(21, 115, 71, 0.3);
}

.mypay-balance-card--outstanding {
    background: #fff;
    color: #1f2937;
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.mypay-balance-card--outstanding.mypay-balance-card--selected {
    border-color: #1f2937;
}

.mypay-balance-card--available {
    background: color-mix(in srgb, var(--brand-primary) 18%, rgba(255, 255, 255, 0.5));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: var(--brand-primary);
    border-color: color-mix(in srgb, var(--brand-primary) 20%, rgba(255, 255, 255, 0.3));
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
    .mypay-balance-cards {
        flex-wrap: wrap;
    }
    .mypay-balance-card {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .mypay-balance-card {
        flex: 1 1 100%;
    }
}

/* Payment card (bill row) */
.payment-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border: 1px solid #e5e7eb;
    border-left: 3px solid var(--brand-primary, #0d6efd);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #fff;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.payment-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left-color: var(--brand-primary-dark, #0b5ed7);
}

.payment-card__left {
    min-width: 0;
    flex: 1;
}

.payment-card__role {
    font-weight: 600;
    font-size: 0.9375rem;
    color: #1f2937;
}

.payment-card__opp {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 0.125rem;
}

.payment-card__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
    margin-left: 1rem;
}

.payment-card__amount {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
}

.payment-card__amount--paid {
    color: #10b981;
}

/* Deposit card (expandable) */
.deposit-card {
    border: 1px solid #e5e7eb;
    border-left: 3px solid #6f42c1;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: #fff;
    transition: box-shadow 0.15s;
}

.deposit-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.deposit-card__header {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    cursor: pointer;
    list-style: none;
    gap: 1rem;
}

.deposit-card__header::-webkit-details-marker {
    display: none;
}

.deposit-card__left {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
    min-width: 0;
}

.deposit-card__amount {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
}

.deposit-card__bank {
    font-size: 0.8125rem;
    color: #6b7280;
}

.deposit-card__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}

.deposit-card__date {
    font-size: 0.75rem;
    color: #9ca3af;
}

.deposit-card__chevron {
    transition: transform 0.2s;
    color: #9ca3af;
    flex-shrink: 0;
}

.deposit-card[open] .deposit-card__chevron {
    transform: rotate(180deg);
}

.deposit-card__body {
    padding: 0 1rem 0.875rem;
    border-top: 1px solid #f3f4f6;
}

.deposit-card__error {
    padding: 0.5rem 0.75rem;
    margin-top: 0.5rem;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 6px;
    font-size: 0.8125rem;
}

.deposit-card__meta {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* My Pay info button (in filter bar) */
.mypay-info-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}

.mypay-info-btn:hover {
    border-color: #9ca3af;
    color: #374151;
}

/* My Pay Modal */
.mypay-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.mypay-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-width: 520px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
}

.mypay-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    line-height: 1;
}

.mypay-modal__close:hover {
    color: #1f2937;
}

/* Status guide */
.mypay-status-guide__item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}

.mypay-status-guide__item:last-child {
    border-bottom: none;
}

.mypay-status-guide__item .badge {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.mypay-status-guide__item p {
    margin: 0;
    font-size: 0.875rem;
    color: #4b5563;
}

/* Bill detail modal content */
.bill-detail__header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.bill-detail__title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.bill-detail__opp {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.bill-detail__section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.bill-detail__items {
    margin-bottom: 1rem;
}

.bill-detail__item {
    display: flex;
    justify-content: space-between;
    padding: 0.375rem 0;
    font-size: 0.875rem;
    color: #4b5563;
}

.bill-detail__item--total {
    border-top: 1px solid #e5e7eb;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    font-weight: 700;
    color: #1f2937;
}

.bill-detail__item-amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Bill detail timeline */
.bill-detail__timeline {
    margin-bottom: 1rem;
}

.bill-detail__event {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.375rem 0;
    position: relative;
}

.bill-detail__event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d1d5db;
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.bill-detail__event:first-child .bill-detail__event-dot {
    background: var(--brand-primary, #0d6efd);
}

.bill-detail__event-content {
    display: flex;
    justify-content: space-between;
    flex: 1;
    gap: 0.5rem;
}

.bill-detail__event-label {
    font-size: 0.875rem;
    color: #374151;
}

.bill-detail__event-date {
    font-size: 0.75rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.bill-detail__meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #9ca3af;
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
}

/* Payment timeline (step indicators with connecting lines) */
.payment-timeline {
    position: relative;
    padding-left: 24px;
}

.payment-timeline-step {
    position: relative;
    padding-bottom: 20px;
    padding-left: 16px;
}

.payment-timeline-step:last-child {
    padding-bottom: 0;
}

.payment-timeline-step::before {
    content: "";
    position: absolute;
    left: -24px;
    top: 8px;
    bottom: -12px;
    width: 2px;
    background: #dee2e6;
}

.payment-timeline-step:last-child::before {
    display: none;
}

.payment-timeline-dot {
    position: absolute;
    left: -30px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
    background: #fff;
}

.payment-timeline-step.completed .payment-timeline-dot {
    background: #198754;
    border-color: #198754;
}

.payment-timeline-step.active .payment-timeline-dot {
    background: #0d6efd;
    border-color: #0d6efd;
}

.payment-timeline-step.failed .payment-timeline-dot {
    background: #dc3545;
    border-color: #dc3545;
}

.payment-timeline-step.pending .payment-timeline-dot {
    background: #ffc107;
    border-color: #ffc107;
}

/* Stat cards (used in dashboard/platform) */
.stat-card {
    padding: 16px;
    text-align: center;
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card-label {
    font-size: 0.8125rem;
    color: var(--color-text-light, #6c757d);
    margin-top: 4px;
}

/* ============================================
   Sidebar Collapsed State (Desktop)
   Icon rail pattern: only sidebar width changes.
   Icons sit in fixed 64px columns and never move.
   Text clips naturally via overflow: hidden on .sidebar.
   ============================================ */

@media (min-width: 1024px) {
    .app-layout.sidebar-collapsed .app-main {
        margin-left: 64px;
    }

    .app-layout.sidebar-collapsed .sidebar {
        width: 64px;
        overflow: hidden;
    }

    /* Hide elements that would cause layout issues or overlap */
    .app-layout.sidebar-collapsed .sidebar-org-toggle,
    .app-layout.sidebar-collapsed .sidebar-org-dropdown {
        display: none;
    }

    /* Footer actions: center the collapse button, hide admin icons */
    .app-layout.sidebar-collapsed .sidebar-footer-actions {
        justify-content: center;
    }

    .app-layout.sidebar-collapsed .sidebar-footer-actions a,
    .app-layout.sidebar-collapsed .sidebar-footer-actions button[aria-label="Settings"] {
        display: none;
    }

    /* Collapsed: settings button aligns with logo center (32px in 64px rail) */
    .app-layout.sidebar-collapsed .header-settings-btn {
        margin-left: calc(32px - 14px - var(--spacing-sm));
    }

    /* Collapsed: avatar and logo look like buttons (match collapse button style) */
    .app-layout.sidebar-collapsed .sidebar-profile-avatar,
    .app-layout.sidebar-collapsed .sidebar-brand-logo-placeholder,
    .app-layout.sidebar-collapsed .sidebar-brand-logo {
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .app-layout.sidebar-collapsed .sidebar-profile:hover .sidebar-profile-avatar,
    .app-layout.sidebar-collapsed .sidebar-brand-link:hover .sidebar-brand-logo-placeholder,
    .app-layout.sidebar-collapsed .sidebar-brand-link:hover .sidebar-brand-logo {
        background: rgba(255, 255, 255, 0.12);
        border-color: rgba(255, 255, 255, 0.2);
    }
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .toast {
        transform: none;
        opacity: 1;
    }

    .toast-show {
        transform: none;
    }

    .toast-hiding {
        transform: none;
        opacity: 0;
    }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */

@media (prefers-contrast: more) {
    :root {
        --color-border: #232323;
        --shadow-sm: none;
        --shadow-md: none;
        --shadow-lg: none;
    }

    .card,
    .filter-bar {
        border-width: 2px;
    }

    .btn {
        border-width: 2px;
    }

    a:focus,
    button:focus,
    input:focus,
    select:focus,
    textarea:focus {
        outline-width: 3px;
    }
}

/* ============================================
   Form Loading State
   ============================================ */

.form-loading {
    pointer-events: none;
    opacity: 0.7;
}

.form-loading input,
.form-loading select,
.form-loading textarea {
    background-color: var(--color-page-bg);
}

.form-error {
    margin-bottom: var(--spacing-md);
}

/* ============================================
   HTMX Indicators
   ============================================ */

/* Hide indicators by default */
.htmx-indicator {
    display: none;
}

/* Show indicator when htmx is requesting */
.htmx-request .htmx-indicator {
    display: inline-block;
}

/* Hide the normal icon when loading */
.htmx-request .submit-icon {
    display: none;
}

/* Disable button during request */
.htmx-request {
    pointer-events: none;
    opacity: 0.7;
}

/* ============================================
   Settings Modal (Skool-style)
   ============================================ */

/* Modal backdrop */
.settings-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1070;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.settings-modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

/* Modal container */
.settings-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 95%;
    max-width: 900px;
    height: min(720px, 90vh);
    background: var(--color-card-bg);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1071;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.settings-modal.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal header */
.settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
}

.settings-modal-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-modal-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.settings-modal-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.settings-modal-title-group {
    display: flex;
    flex-direction: column;
}

.settings-modal-org-name-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-modal-org-name {
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
}

.settings-modal-edit-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.settings-modal-edit-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.settings-modal-name-form {
    display: flex;
}

.settings-modal-name-input {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1.2;
    padding: 0.15rem 0.5rem;
    outline: none;
    width: 220px;
}

.settings-modal-name-input:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.2);
}

.settings-modal-org-code {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    opacity: 0.75;
    cursor: pointer;
    padding: 0.1rem 0.4rem;
    margin-left: -0.4rem;
    border-radius: 4px;
    transition: opacity 0.15s ease, background-color 0.15s ease;
    font-family: monospace;
    letter-spacing: 0.05em;
    align-self: flex-start;
}

.settings-modal-org-code:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.12);
}

.settings-modal-org-code .bi {
    font-size: 0.75rem;
}

.settings-modal-subtitle {
    font-size: 0.85rem;
    opacity: 0.85;
}

.settings-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-modal-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Modal body - two column layout */
.settings-modal-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Left navigation */
.settings-modal-nav {
    width: 200px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-right: 1px solid var(--color-border);
    padding: 1rem 0;
    overflow-y: auto;
}

.settings-nav-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    font-family: var(--font-family);
}

.settings-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--color-text);
}

.settings-nav-item.is-active {
    background: var(--color-card-bg);
    color: var(--brand-primary);
    font-weight: 600;
    border-right: 3px solid var(--brand-primary);
    padding-right: calc(1.25rem - 3px);
}

/* Right content area */
.settings-modal-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.settings-panel {
    display: none;
}

.settings-panel.is-active {
    display: block;
}

.settings-panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.settings-panel-description {
    color: #6b7280;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Settings form sections */
.settings-section {
    margin-bottom: 2rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 1rem;
}

.settings-field {
    margin-bottom: 1.25rem;
}

.settings-field:last-child {
    margin-bottom: 0;
}

.settings-field-label {
    display: block;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.settings-field-help {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: 0.35rem;
}

/* Color picker row */
.settings-color-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.settings-color-field {
    flex: 1;
    min-width: 150px;
}

.settings-color-input-group {
    display: flex;
    gap: 0.5rem;
}

.settings-color-input-group input[type="color"] {
    width: 44px;
    height: 44px;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    cursor: pointer;
}

.settings-color-input-group input[type="text"] {
    flex: 1;
}

/* Panel header with label and action */
.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.settings-section-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

/* Divider between sections */
.settings-divider {
    height: 1px;
    background: var(--color-border);
    margin: 1.5rem 0;
}

/* Vocabulary actions row */
.settings-vocab-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-vocab-actions .form-select {
    width: auto;
    min-width: 160px;
}

.settings-preset-buttons {
    display: flex;
    gap: 0.35rem;
}

/* Legacy preset form support */
.settings-preset-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-preset-form .form-select {
    width: auto;
    min-width: 160px;
}

/* Vocabulary table */
.settings-vocab-table {
    margin-bottom: 0;
}

.settings-vocab-table th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7280;
    border-bottom-width: 1px;
}

.settings-vocab-table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

.settings-vocab-table td:first-child {
    font-weight: 500;
    color: var(--color-text);
    width: 120px;
}

.settings-vocab-table tbody tr:last-child td {
    border-bottom: none;
}

/* Vocabulary preview state */
.settings-vocab-table input.is-preview {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

/* Dashboard panel */
.settings-dashboard-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.settings-dashboard-stats .stat-card {
    flex: 1;
    min-width: 0;
}

.settings-dashboard-chart {
    height: 280px;
    position: relative;
    overflow: hidden;
}

.settings-dashboard-chart canvas {
    width: 100% !important;
    height: 240px !important;
}

/* Integration items */
.settings-integration-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
}

.settings-integration-item:last-child {
    margin-bottom: 0;
}

.settings-integration-info strong {
    display: block;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.settings-integration-info small {
    color: #6b7280;
}

/* Tablet: horizontal pill nav, centered modal */
@media (max-width: 900px) {
    .settings-modal {
        height: min(720px, 95vh);
    }

    .settings-modal-header {
        padding: 1rem 1.25rem;
    }

    .settings-modal-logo {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        font-size: 1rem;
    }

    .settings-modal-logo img {
        border-radius: 8px;
    }

    .settings-modal-org-name {
        font-size: 1rem;
    }

    .settings-modal-body {
        flex-direction: column;
    }

    .settings-modal-nav {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        padding: 0.5rem;
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0.25rem;
    }

    .settings-nav-item {
        flex-shrink: 0;
        padding: 0.5rem 1rem;
        border-radius: 999px;
        white-space: nowrap;
    }

    .settings-nav-item.is-active {
        background: var(--brand-primary);
        color: #fff;
        border-right: none;
        padding-right: 1rem;
    }

    .settings-modal-content {
        padding: 1rem;
    }

    .settings-color-row {
        flex-direction: column;
        gap: 1rem;
    }

    .settings-color-field {
        min-width: 100%;
    }

    .settings-panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .settings-preset-form {
        width: 100%;
    }

    .settings-preset-form .form-select {
        flex: 1;
    }
}

/* Mobile: full-screen takeover */
@media (max-width: 576px) {
    .settings-modal {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        top: 0;
        left: 0;
        transform: translateY(100%);
    }

    .settings-modal.is-open {
        transform: translateY(0);
    }

    .settings-modal-header {
        padding: 0.75rem 1rem;
    }

    .settings-modal-header-left {
        gap: 0.75rem;
    }

    .settings-modal-logo {
        width: 32px;
        height: 32px;
        border-radius: 6px;
        font-size: 0.9rem;
    }

    .settings-modal-logo img {
        border-radius: 6px;
    }

    .settings-modal-org-name {
        font-size: 0.95rem;
    }

    .settings-modal-org-code {
        font-size: 0.7rem;
    }
}

/* ============================================
   Share Calendar Modal
   ============================================ */

.share-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1070;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.share-modal-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.share-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 95%;
    max-width: 560px;
    max-height: 80vh;
    background: var(--color-card-bg);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 1071;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.share-modal.is-open {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: #fff;
}

.share-modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.share-modal-close:hover {
    color: #fff;
}

.share-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.share-section {
    margin-bottom: 0.25rem;
}

.share-token-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.share-token-url {
    word-break: break-all;
    font-size: 0.78rem;
}

@media (max-width: 576px) {
    .share-modal {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
}

/* ============================================
   Sortable (SortableJS)
   ============================================ */

/* Ghost element during drag */
.sortable-ghost {
    opacity: 0.4;
    background-color: var(--bs-light, #f8f9fa);
}

/* Element being dragged (chosen) */
.sortable-chosen {
    background-color: var(--color-card-bg);
}

/* Element while being dragged (in motion) */
.sortable-drag {
    opacity: 0.9;
}

/* Drag handle styling */
.drag-handle {
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle:hover {
    color: var(--bs-primary, var(--brand-primary)) !important;
}

/* Skill card 3-dot options menu (positioned in top-right of card) */
.skill-card-menu {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
}

.skill-card-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: none;
    border: none;
    border-radius: var(--radius-sm, 0.25rem);
    color: var(--color-text-muted, #6c757d);
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.15s, background-color 0.15s;
}

.skill-card-menu-btn:hover {
    opacity: 1;
    background: var(--color-bg-subtle, rgba(0, 0, 0, 0.05));
}

.skill-card-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 140px;
    background: var(--color-card-bg, #fff);
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: var(--radius-md, 0.375rem);
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.1));
    padding: 0.25rem 0;
    z-index: 100;
}

.skill-card-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.4rem 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--color-text, #212529);
    white-space: nowrap;
}

.skill-card-menu-item:hover {
    background: var(--color-bg-subtle, rgba(0, 0, 0, 0.05));
}

/* Level breakdown badges in skill cards */
.skill-level-badges {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

/* Elevate card above neighbors so tooltip isn't hidden behind adjacent cards.
   The card-clickable transform creates a stacking context that traps the tooltip. */
.card:has(.skill-level-badge:hover) {
    z-index: 3;
}

.skill-level-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
}

.skill-level-badge-1 {
    background-color: color-mix(in srgb, var(--color-info, #0dcaf0) 15%, transparent);
    color: var(--color-info, #0dcaf0);
}

.skill-level-badge-2 {
    background-color: color-mix(in srgb, var(--color-primary, #0d6efd) 15%, transparent);
    color: var(--color-primary, #0d6efd);
}

.skill-level-badge-3 {
    background-color: color-mix(in srgb, var(--color-success, #198754) 15%, transparent);
    color: var(--color-success, #198754);
}

/* =============================================================================
   Calendar
   ============================================================================= */

:root {
    --calendar-cell-min-height: 100px;
    --calendar-avail-bg: color-mix(in srgb, var(--color-success) 8%, transparent);
    --calendar-today-ring: var(--brand-primary);
}

/* Calendar page transitions (content only, nav stays fixed) */
@keyframes calendar-enter-up {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes calendar-enter-left {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes calendar-enter-right {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.calendar-container {
    background: var(--color-card-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.calendar-content {
    animation: calendar-enter-up 0.12s ease-out;
}

/* Directional enter (set by JS from sessionStorage) */
.calendar-enter-from-left  { animation: calendar-enter-left  0.12s ease-out; }
.calendar-enter-from-right { animation: calendar-enter-right 0.12s ease-out; }

/* Directional leave */
.calendar-leaving-up {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.08s ease-in, transform 0.08s ease-in;
}
.calendar-leaving-left {
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 0.08s ease-in, transform 0.08s ease-in;
}
.calendar-leaving-right {
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.08s ease-in, transform 0.08s ease-in;
}

/* Share button — far left of header, matches sidebar-org-toggle size */
.calendar-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--color-text-light);
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    position: relative;
    z-index: 1;
}

.calendar-share-btn:hover {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

.calendar-share-btn:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
}

/* Navigation */
.calendar-nav {
    --calendar-ctrl-h: 28px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

.calendar-nav-controls {
    display: flex;
    gap: 0.25rem;
}

.calendar-nav-selects {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Uniform height for every control in the nav bar */
.calendar-nav .header-btn,
.calendar-nav .form-select {
    height: var(--calendar-ctrl-h);
    min-height: var(--calendar-ctrl-h);
    max-height: var(--calendar-ctrl-h);
    box-sizing: border-box;
    font-size: 0.8125rem;
    line-height: 1;
    padding-top: 0;
    padding-bottom: 0;
}

.calendar-nav-views {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.calendar-month-select {
    width: auto;
    min-width: 8rem;
}

.calendar-year-select {
    width: auto;
    min-width: 5.5rem;
}

/* Month grid */
.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day-headers {
    border-bottom: 1px solid var(--color-border);
}

.calendar-day-header {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-text-light);
    letter-spacing: 0.05em;
}

.calendar-day-cell {
    min-height: var(--calendar-cell-min-height);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 0.25rem;
    position: relative;
    overflow: hidden;
}

.calendar-day-cell:last-child {
    border-right: none;
}

/* Other month days: grid structure preserved, content dimmed */
.calendar-other-month {
    background: var(--color-page-bg);
}

.calendar-other-month .calendar-day-number {
    color: var(--color-border);
}

/* Unavailable day marker (diagonal red line through the day number) */
.calendar-day-unavailable {
    position: relative;
    color: var(--color-text-light);
}

.calendar-day-unavailable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 15%;
    width: 70%;
    height: 1.5px;
    background: var(--color-error);
    transform: rotate(-45deg);
    border-radius: 1px;
    pointer-events: none;
    opacity: 0.6;
}

.calendar-day-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 50%;
    margin-bottom: 0.125rem;
}

.calendar-today-ring {
    background: var(--calendar-today-ring);
    color: #fff;
    font-weight: 600;
}

/* Exception indicator (in month cell) */
.calendar-exception-indicator {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    font-size: 0.6875rem;
    color: var(--color-error);
    line-height: 1;
}

.calendar-exception-indicator .bi-plus-circle-fill {
    color: var(--color-success);
}

/* Event chips */
.calendar-day-events {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.calendar-event-chip {
    display: block;
    padding: 1px 4px;
    font-size: 0.6875rem;
    line-height: 1.4;
    border-left: 3px solid var(--brand-primary);
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.04);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.calendar-event-chip:hover {
    background: rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: inherit;
}

.calendar-chip-text {
    display: inline;
}

.calendar-chip-overflow {
    font-size: 0.6875rem;
    color: var(--color-text-light);
    padding: 1px 4px;
}

/* Week agenda view */
.calendar-week-view {
    display: flex;
    flex-direction: column;
}

.calendar-week-day {
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
}

.calendar-week-day:last-child {
    border-bottom: none;
}

.calendar-week-day-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.calendar-week-day-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.calendar-week-day-date {
    color: var(--color-text-light);
    font-size: 0.875rem;
}

/* Availability summary in week view */
.calendar-avail-summary {
    font-size: 0.8125rem;
    color: var(--color-success);
    margin-bottom: 0.375rem;
}

/* Exception notice in week view */
.calendar-exception-notice {
    font-size: 0.8125rem;
    margin-bottom: 0.375rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.calendar-exception-unavailable {
    color: var(--color-error);
}

.calendar-exception-available {
    color: var(--color-success);
}

/* Assignment items in week view */
.calendar-week-assignments {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.calendar-week-assignment {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--brand-primary);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.03);
    text-decoration: none;
    color: inherit;
    gap: 1rem;
}

.calendar-week-assignment:hover {
    background: rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
}

.calendar-week-assignment-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.calendar-week-assignment-title {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-week-assignment-role {
    font-size: 0.8125rem;
}

.calendar-week-assignment-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    font-size: 0.8125rem;
}

.calendar-week-assignment-time {
    white-space: nowrap;
}

.calendar-week-assignment-org {
    font-size: 0.75rem;
}

.calendar-week-empty {
    font-size: 0.8125rem;
    color: var(--color-text-light);
    padding: 0.25rem 0;
}

/* Selected day ring */
.calendar-day-selected .calendar-day-number {
    outline: 2px solid var(--brand-primary);
    outline-offset: 1px;
}

/* Mobile selected-day panel (hidden on desktop) */
.calendar-day-panel {
    display: none;
}

/* Month empty state */
.calendar-month-empty {
    padding: 3rem 1rem;
    text-align: center;
}

/* Responsive: smaller screens */
@media (max-width: 767.98px) {
    .calendar-nav {
        --calendar-ctrl-h: 44px;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .calendar-day-cell {
        min-height: 44px;
        padding: 0.125rem;
        cursor: pointer;
    }

    .calendar-day-number {
        width: 1.375rem;
        height: 1.375rem;
        font-size: 0.6875rem;
    }

    .calendar-chip-text {
        display: none;
    }

    .calendar-event-chip {
        width: 10px;
        height: 10px;
        padding: 0;
        border-radius: 50%;
        border-left: none;
        display: inline-block;
    }

    .calendar-day-events {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px;
    }

    .calendar-chip-overflow {
        font-size: 0.5625rem;
        padding: 0;
    }

    .calendar-nav-selects {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .calendar-week-assignment {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .calendar-week-assignment-meta {
        align-items: flex-start;
        flex-direction: row;
        gap: 0.75rem;
    }

    /* Mobile selected-day panel */
    .calendar-day-panel {
        display: block;
        border-top: 1px solid var(--color-border);
        padding: 0.75rem 1rem;
    }

    .calendar-day-panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
    }

    .calendar-day-panel-title {
        font-weight: 600;
        font-size: 0.9375rem;
    }

    .calendar-day-panel-body {
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
    }
}

/* Print styles */
@media print {
    .sidebar, .app-header, .calendar-nav,
    .calendar-day-panel, .calendar-week-empty { display: none !important; }
    .calendar-container { border: none; box-shadow: none; }
    .calendar-chip-text { display: inline !important; }
    .calendar-event-chip { background: none; border-left-color: #333 !important; }
    .calendar-today-ring { background: none; border: 2px solid #333; }
    .calendar-content { animation: none !important; }
    .app-content { padding: 0 !important; }
}

/* =============================================================================
   Availability Settings (Sprint 7.4)
   ============================================================================= */

.avail-day-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--color-border);
}

.avail-day-row:last-child {
    border-bottom: none;
}

.avail-day-label {
    width: 100px;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
}

.avail-day-rules {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    align-items: center;
    min-height: 2rem;
}

.avail-rule-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: var(--calendar-avail-bg);
    border: 1px solid color-mix(in srgb, var(--color-success) 20%, transparent);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--color-text);
}

.avail-rule-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--color-text-light);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 0.875rem;
}

.avail-rule-remove:hover {
    background: var(--color-error);
    color: #fff;
}

.avail-no-rules {
    font-style: italic;
    color: var(--color-text-light);
    font-size: 0.8125rem;
}

.avail-day-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-light);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}

.avail-day-add:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.avail-overnight-badge {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-warning);
    background: color-mix(in srgb, var(--color-warning) 12%, transparent);
    padding: 0 0.25rem;
    border-radius: 2px;
}

.avail-disabled-banner {
    padding: 0.75rem 1rem;
    background: color-mix(in srgb, var(--color-warning) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-warning) 25%, transparent);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--color-text);
}

/* Responsive: mobile stacking */
@media (max-width: 767.98px) {
    .avail-day-row {
        flex-wrap: wrap;
    }

    .avail-day-label {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

/* ============================================
   Star Rating Component (Amazon-style)
   ============================================ */

/* Main container */
.star-rating {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.875rem;
    line-height: 1;
}

/* Numeric value */
.star-rating-value {
    font-weight: 600;
    color: var(--color-text);
}

/* Stars container */
.star-rating-stars {
    display: inline-flex;
    gap: 0.1rem;
}

/* Individual star with partial fill support */
.star-rating-stars .star {
    position: relative;
    display: inline-block;
    width: 1em;
    height: 1em;
    font-size: 1rem;
}

/* Empty star (background) */
.star-rating-stars .star::before {
    content: "\2605"; /* Filled star character */
    position: absolute;
    left: 0;
    top: 0;
    color: #d1d5db; /* Light gray for empty */
}

/* Filled portion (foreground with clip) */
.star-rating-stars .star::after {
    content: "\2605"; /* Filled star character */
    position: absolute;
    left: 0;
    top: 0;
    color: var(--color-warning); /* Amber/gold for filled */
    clip-path: inset(0 calc(100% - var(--fill, 0%)) 0 0);
}

/* Rating count */
.star-rating-count {
    color: var(--color-text-light);
    font-size: 0.8125rem;
}

/* Size variants */
.star-rating.star-rating-sm {
    font-size: 0.75rem;
}

.star-rating.star-rating-sm .star-rating-stars .star {
    font-size: 0.875rem;
}

.star-rating.star-rating-lg {
    font-size: 1rem;
}

.star-rating.star-rating-lg .star-rating-stars .star {
    font-size: 1.25rem;
}

/* Interactive star input */
.star-rating-input {
    display: inline-flex;
    gap: 0.25rem;
}

.star-rating-input .star-input {
    font-size: 1.5rem;
    cursor: pointer;
    color: #d1d5db;
    transition: color 0.1s ease, transform 0.1s ease;
    background: none;
    border: none;
    padding: 0;
    line-height: 1;
}

.star-rating-input .star-input:hover {
    transform: scale(1.1);
}

.star-rating-input .star-input.filled,
.star-rating-input .star-input.preview {
    color: var(--color-warning);
}

.star-rating-input .star-input.preview:not(.filled) {
    color: #fcd34d; /* Lighter gold for preview */
}

/* Star rating input - Alpine.js version */
.star-rating-input {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.star-rating-input .star-input-btn {
    font-size: 1.5rem;
    cursor: pointer;
    color: #d1d5db;
    transition: color 0.15s ease, transform 0.15s ease;
    background: none;
    border: none;
    padding: 0.125rem;
    line-height: 1;
}

.star-rating-input .star-input-btn:hover {
    transform: scale(1.15);
}

.star-rating-input .star-input-btn:focus {
    outline: none;
}

.star-rating-input .star-input-btn:focus-visible {
    outline: 2px solid var(--color-focus-ring);
    outline-offset: 2px;
    border-radius: 2px;
}

.star-rating-input .star-input-btn.active,
.star-rating-input .star-input-btn.hover {
    color: var(--color-warning);
}

.star-rating-input .star-input-btn.hover:not(.active) {
    color: #fcd34d; /* Lighter gold for hover preview */
}

.star-rating-input .star-input-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.star-rating-input .star-rating-input-label {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

/* Size variants */
.star-rating-input.star-rating-input-sm .star-input-btn {
    font-size: 1.25rem;
}

.star-rating-input.star-rating-input-lg .star-input-btn {
    font-size: 2rem;
}

/* Avatar component for rating cards */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: var(--brand-primary);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.avatar-md {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}

.avatar-lg {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.125rem;
}

/* Sidebar badge for rating count */
.sidebar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 0.625rem;
    background: var(--color-error);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    margin-left: auto;
}

/* ==================================
   SKILL TOOLTIP COMPONENT
   ================================== */

/* Skill pill hover state */
.skill-pill {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.skill-pill:hover {
    background-color: #e2e8f0 !important;
}

/* Bootstrap tooltip customization for skill ratings */
.tooltip.skill-tooltip {
    --bs-tooltip-max-width: 280px;
    --bs-tooltip-bg: rgba(15, 15, 15, 0.95);
    --bs-tooltip-padding-x: 0.875rem;
    --bs-tooltip-padding-y: 0.75rem;
}

.tooltip.skill-tooltip .tooltip-inner {
    max-width: var(--bs-tooltip-max-width);
    text-align: left;
}

/* Tooltip content layout */
.skill-tooltip-content {
    min-width: 180px;
}

.skill-tooltip-header {
    font-weight: 600;
    font-size: 0.8125rem;
    color: #fff;
    margin-bottom: 0.5rem;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.skill-tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    font-size: 0.75rem;
}

.skill-tooltip-comp {
    color: rgba(255, 255, 255, 0.85);
    margin-right: 0.75rem;
}

.skill-tooltip-stars {
    white-space: nowrap;
}

/* Rating value - white text, not gold */
.skill-tooltip-stars .rating-value {
    color: #fff;
    font-weight: 600;
    margin-right: 0.25rem;
}

/* Filled stars - gold */
.skill-tooltip-stars .stars {
    color: #fbbf24;
    letter-spacing: 0;
}

/* Rating count - muted */
.skill-tooltip-stars .rating-count {
    color: rgba(255, 255, 255, 0.6);
    margin-left: 0.25rem;
}

/* ==================================
   WORKER LIST TABLE
   ================================== */

.worker-list-table {
    table-layout: auto;
}

.worker-list-table .worker-col-name {
    white-space: nowrap;
    width: 1%;  /* Shrink to fit content */
}

.worker-list-table .worker-col-skills {
    /* Takes remaining space */
}

.worker-list-table .worker-col-contact {
    width: 60px;
    white-space: nowrap;
}

.worker-list-table .worker-col-status {
    width: 80px;
    white-space: nowrap;
}

/* Placeholder icon for missing contact info */
.btn-icon-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--color-border);
    opacity: 0.4;
}

/* Responsive: on smaller screens, allow name wrapping */
@media (max-width: 767.98px) {
    .worker-list-table .worker-col-name {
        white-space: normal;
        min-width: 120px;
    }
}
