/**
 * MusicJuries 2.0 - Unified Stylesheet
 * Copyright (c) Taveren Labs LLC. All rights reserved.
 *
 * This file consolidates all CSS for the MusicJuries application.
 * Tenant theming is handled via CSS custom properties only.
 *
 * Table of Contents:
 * ====================
 * 1.  CSS Custom Properties (Design Tokens)
 * 2.  Reset / Base Styles
 * 3.  Layout (Header, Sidebar, Footer, Main Content)
 * 4.  Typography
 * 5.  Forms and Inputs
 * 6.  Buttons
 * 7.  Tables
 * 8.  Cards and Panels
 * 9.  Modals and Overlays
 * 10. Alerts and Notifications
 * 11. Navigation and Menus
 * 12. Page-Specific Styles
 * 13. Utility Classes
 */

/* Google Fonts: Cinzel (web fallback for Trajan Pro) */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&display=swap');

/* =============================================================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================================= */

:root {
    /* -------------------------------------------------------------------------
       Primary Colors - Tenant Customizable
       ------------------------------------------------------------------------- */
    --primary-color: #4f46e5;
    --primary-color-rgb: 79, 70, 229;
    --primary-dark: #4338ca;
    --primary-light: #6366f1;
    --primary-50: #eef2ff;

    --secondary-color: #14b8a6;
    --secondary-color-rgb: 20, 184, 166;
    --secondary-dark: #0f766e;
    --secondary-light: #2dd4bf;

    --accent-color: #f59e0b;
    --accent-color-rgb: 245, 158, 11;
    --accent-dark: #d97706;
    --accent-light: #fbbf24;

    /* -------------------------------------------------------------------------
       Semantic Colors
       ------------------------------------------------------------------------- */
    --success: #10b981;
    --success-rgb: 16, 185, 129;
    --success-light: #d1fae5;
    --success-dark: #065f46;

    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --warning-light: #fef3c7;
    --warning-dark: #92400e;

    --error: #ef4444;
    --error-rgb: 239, 68, 68;
    --error-light: #fee2e2;
    --error-dark: #991b1b;

    --info: #3b82f6;
    --info-rgb: 59, 130, 246;
    --info-light: #dbeafe;
    --info-dark: #1e40af;

    /* -------------------------------------------------------------------------
       Text Colors
       ------------------------------------------------------------------------- */
    --text-color: #1f2937;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --text-inverse: #ffffff;

    /* -------------------------------------------------------------------------
       Background Colors
       ------------------------------------------------------------------------- */
    --bg-color: #ffffff;
    --bg-alt: #f3f4f6;
    --bg-dark: #e5e7eb;
    --bg-darker: #d1d5db;

    /* -------------------------------------------------------------------------
       Border Colors
       ------------------------------------------------------------------------- */
    --border-color: #e5e7eb;
    --border-dark: #d1d5db;
    --border-light: #f3f4f6;

    /* -------------------------------------------------------------------------
       Shadow Colors
       ------------------------------------------------------------------------- */
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-dark: rgba(0, 0, 0, 0.25);

    /* -------------------------------------------------------------------------
       Sidebar/Navigation Colors - Tenant Customizable
       ------------------------------------------------------------------------- */
    --sidebar-bg: var(--primary-color);
    --sidebar-bg-dark: var(--primary-dark);
    --sidebar-text: #ffffff;
    --sidebar-text-muted: rgba(255, 255, 255, 0.7);
    --sidebar-icon: var(--secondary-color);
    --sidebar-active-bg: rgba(255, 255, 255, 0.2);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.1);

    /* -------------------------------------------------------------------------
       Header Colors - Tenant Customizable
       ------------------------------------------------------------------------- */
    --header-bg: var(--primary-color);
    --header-text: #ffffff;

    /* -------------------------------------------------------------------------
       Typography
       ------------------------------------------------------------------------- */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'Montserrat', var(--font-sans);
    --font-mono: 'Fira Code', 'Consolas', 'Monaco', monospace;
    --font-signature: 'Dancing Script', cursive;

    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;

    /* -------------------------------------------------------------------------
       Spacing Scale
       ------------------------------------------------------------------------- */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-2xl: 3rem;     /* 48px */
    --spacing-3xl: 4rem;     /* 64px */

    /* -------------------------------------------------------------------------
       Border Radius
       ------------------------------------------------------------------------- */
    --radius-sm: 0.25rem;    /* 4px */
    --radius: 0.375rem;      /* 6px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-full: 9999px;

    /* -------------------------------------------------------------------------
       Shadows
       ------------------------------------------------------------------------- */
    --shadow-xs: 0 1px 2px 0 var(--shadow-color);
    --shadow-sm: 0 1px 3px 0 var(--shadow-color), 0 1px 2px -1px var(--shadow-color);
    --shadow-md: 0 4px 6px -1px var(--shadow-color), 0 2px 4px -2px var(--shadow-color);
    --shadow-lg: 0 10px 15px -3px var(--shadow-color), 0 4px 6px -4px var(--shadow-color);
    --shadow-xl: 0 20px 25px -5px var(--shadow-color), 0 8px 10px -6px var(--shadow-color);

    /* -------------------------------------------------------------------------
       Transitions
       ------------------------------------------------------------------------- */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    --transition-menu: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* -------------------------------------------------------------------------
       Z-Index Scale
       ------------------------------------------------------------------------- */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-sidebar: 1000;
    --z-overlay: 999;
    --z-mobile-menu: 1010;

    /* -------------------------------------------------------------------------
       Layout
       ------------------------------------------------------------------------- */
    --sidebar-width-collapsed: 4rem;
    --sidebar-width-expanded: 16rem;
    --header-height: 4rem;
    --container-max-width: 1280px;
    --content-max-width: 1200px;
}

/* =============================================================================
   Dark Mode Variables
   ============================================================================= */

html.dark-mode {
    --text-color: #f9fafb;
    --text-muted: #d1d5db;
    --text-light: #9ca3af;

    --bg-color: #111827;
    --bg-alt: #1f2937;
    --bg-dark: #374151;
    --bg-darker: #4b5563;

    --border-color: #374151;
    --border-dark: #4b5563;
    --border-light: #1f2937;

    --shadow-color: rgba(0, 0, 0, 0.3);

    --sidebar-bg: #0f172a;
    --sidebar-bg-dark: #020617;
    --sidebar-text: #f9fafb;
    --sidebar-text-muted: rgba(255, 255, 255, 0.7);

    --header-bg: #1f2937;

    /* Adjust semantic colors for dark mode */
    --success-light: rgba(16, 185, 129, 0.2);
    --warning-light: rgba(245, 158, 11, 0.2);
    --error-light: rgba(239, 68, 68, 0.2);
    --info-light: rgba(59, 130, 246, 0.2);

    --primary-50: rgba(79, 70, 229, 0.2);
}

/* =============================================================================
   Theme Variants
   ============================================================================= */

/**
 * Theme: Classic (Default)
 * The original MusicJuries theme - modern and clean
 * This is the base theme; variables are already defined in :root
 */
body.theme-classic {
    /* Classic theme uses default :root variables - no overrides needed */
}

/**
 * Theme: Concert Hall Elegance
 * A sophisticated, refined theme inspired by concert hall aesthetics
 * Deep navy, warm gold accents, cream backgrounds
 */
body.theme-elegance {
    /* -------------------------------------------------------------------------
       Primary Colors - Navy & Gold
       ------------------------------------------------------------------------- */
    --primary-color: #1a2744;
    --primary-color-rgb: 26, 39, 68;
    --primary-dark: #0a1628;
    --primary-light: #2a3a5c;
    --primary-50: #f0f2f7;

    --secondary-color: #c9a962;
    --secondary-color-rgb: 201, 169, 98;
    --secondary-dark: #b8944d;
    --secondary-light: #dbc07a;
    --secondary-50: #fdf9ef;
    --secondary-100: #f9f0d9;

    --accent-color: #c9a962;
    --accent-color-rgb: 201, 169, 98;
    --accent-dark: #b8944d;
    --accent-light: #dbc07a;

    /* -------------------------------------------------------------------------
       Text Colors - Warmer tones
       ------------------------------------------------------------------------- */
    --text-color: #1a2744;
    --text-muted: #5a6478;
    --text-light: #8a92a4;

    /* -------------------------------------------------------------------------
       Background Colors - Cream palette
       ------------------------------------------------------------------------- */
    --bg-color: #faf8f3;
    --bg-alt: #f5f3ed;
    --bg-dark: #f0ede5;
    --bg-darker: #e5e2da;

    /* -------------------------------------------------------------------------
       Border Colors - Softer
       ------------------------------------------------------------------------- */
    --border-color: #e5e2da;
    --border-dark: #d5d2ca;
    --border-light: #f5f3ed;

    /* -------------------------------------------------------------------------
       Shadow Colors - Warmer shadows
       ------------------------------------------------------------------------- */
    --shadow-color: rgba(10, 22, 40, 0.08);
    --shadow-color-dark: rgba(10, 22, 40, 0.15);

    /* -------------------------------------------------------------------------
       Sidebar/Navigation - Dark navy
       ------------------------------------------------------------------------- */
    --sidebar-bg: #1a2744;
    --sidebar-bg-dark: #0a1628;
    --sidebar-text: #ffffff;
    --sidebar-text-muted: rgba(255, 255, 255, 0.7);
    --sidebar-icon: #c9a962;
    --sidebar-active-bg: rgba(201, 169, 98, 0.2);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);

    /* -------------------------------------------------------------------------
       Header Colors
       ------------------------------------------------------------------------- */
    --header-bg: #1a2744;
    --header-text: #ffffff;

    /* -------------------------------------------------------------------------
       Typography - Elegant fonts
       ------------------------------------------------------------------------- */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Cormorant Garamond', Georgia, serif;
    --font-display: 'Cormorant Garamond', Georgia, serif;

    /* -------------------------------------------------------------------------
       Border Radius - Slightly larger for elegance
       ------------------------------------------------------------------------- */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.625rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
}

/**
 * Theme: Concert Hall Elegance + Dark Mode
 * Combines elegance theme with dark mode preferences
 */
html.dark-mode body.theme-elegance {
    --text-color: #f9fafb;
    --text-muted: #a8b4d4;
    --text-light: #8a92a4;

    --bg-color: #0a1628;
    --bg-alt: #1a2744;
    --bg-dark: #2a3a5c;
    --bg-darker: #3a4a6c;

    --border-color: #2a3a5c;
    --border-dark: #3a4a6c;
    --border-light: #1a2744;

    --shadow-color: rgba(0, 0, 0, 0.3);

    --sidebar-bg: #050d18;
    --sidebar-bg-dark: #020810;
}

/* -------------------------------------------------------------------------
   Theme Override Rules - Override Tailwind defaults when theme is applied
   ------------------------------------------------------------------------- */

/* Elegance theme overrides for Tailwind background classes */
body.theme-elegance {
    background-color: var(--bg-color) !important;
}

body.theme-elegance .bg-gray-50,
body.theme-elegance .bg-gray-100 {
    background-color: var(--bg-color) !important;
}

body.theme-elegance .bg-white {
    background-color: var(--bg-color) !important;
}

body.theme-elegance .text-gray-800,
body.theme-elegance .text-gray-900 {
    color: var(--text-color) !important;
}

body.theme-elegance .text-gray-600,
body.theme-elegance .text-gray-700 {
    color: var(--text-muted) !important;
}

/* Elegance theme - cards and containers */
body.theme-elegance .card,
body.theme-elegance .bg-white.rounded-lg,
body.theme-elegance .bg-white.shadow {
    background-color: #ffffff !important;
    border: 1px solid rgba(201, 169, 98, 0.2);
}

/* Elegance theme - buttons use gold accent */
body.theme-elegance .btn-primary,
body.theme-elegance .bg-indigo-600,
body.theme-elegance .bg-blue-600 {
    background-color: var(--primary-color) !important;
}

body.theme-elegance .btn-primary:hover,
body.theme-elegance .hover\:bg-indigo-700:hover,
body.theme-elegance .hover\:bg-blue-700:hover {
    background-color: var(--primary-dark) !important;
}

/* Elegance theme - accent/secondary buttons */
body.theme-elegance .btn-secondary,
body.theme-elegance .bg-teal-500,
body.theme-elegance .bg-green-500 {
    background-color: var(--secondary-color) !important;
    color: var(--primary-dark) !important;
}

/* Elegance theme - text accents */
body.theme-elegance .text-indigo-600,
body.theme-elegance .text-blue-600 {
    color: var(--primary-color) !important;
}

/* Elegance theme - borders */
body.theme-elegance .border-gray-200,
body.theme-elegance .border-gray-300 {
    border-color: var(--border-color) !important;
}

/* Elegance theme - headings */
body.theme-elegance h1,
body.theme-elegance h2,
body.theme-elegance h3,
body.theme-elegance h4,
body.theme-elegance h5,
body.theme-elegance h6 {
    font-family: var(--font-heading, var(--font-sans));
    font-variant: small-caps;
    letter-spacing: 0.03em;
    color: var(--text-color);
}

/* Elegance theme - elegant navigation styling */
body.theme-elegance {
    /* Fonts already set in the elegance theme block above (lines ~335-340) */

    /* Elegant navigation uses the theme's navy colors
       Tenant's --sidebar-icon and --secondary-color provide accent colors */
    --topbar-bg: var(--sidebar-bg, #1a2744);
    --topbar-text: #ffffff;
}


/* Classic theme - uses tenant branding colors directly */
body.theme-classic {
    /* Navigation colors come entirely from tenant-override.php */
}

/* Topbar base styles */
.topbar-elegant {
    position: relative;
}

/* Gradient stroke on bottom of topbar using tenant brand colors */
.topbar-elegant::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        var(--tenant-primary, #4f46e5) 0%,
        var(--tenant-secondary, #14b8a6) 50%,
        var(--tenant-accent, #f59e0b) 100%
    );
}

/* Elegance theme - navigation refinements */
body.theme-elegance .topbar-elegant {
    background: linear-gradient(135deg, var(--sidebar-bg, #1a2744) 0%, var(--sidebar-bg-dark, #0a1628) 100%);
}

body.theme-elegance .sidebar-gradient {
    background: linear-gradient(180deg, var(--sidebar-bg, #1a2744) 0%, var(--sidebar-bg-dark, #0a1628) 100%);
}

/* Elegance theme - refined shadows and effects */
body.theme-elegance .topbar-elegant,
body.theme-elegance .sidebar-gradient {
    box-shadow: 0 4px 20px rgba(10, 22, 40, 0.15);
}

body.theme-elegance .nav-user-avatar {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

body.theme-elegance .sidebar-item-icon {
    background: rgba(255, 255, 255, 0.08);
}

body.theme-elegance .sidebar-item:hover .sidebar-item-icon,
body.theme-elegance .sidebar-item.active .sidebar-item-icon {
    background: rgba(255, 255, 255, 0.15);
}

/* Elegance theme - user role text uses tenant secondary/accent color */
body.theme-elegance .nav-user-role {
    color: var(--sidebar-icon, var(--secondary-color, #c9a962));
}

/* Elegance theme - icon colors use tenant sidebar-icon */
body.theme-elegance .sidebar-item-icon svg,
body.theme-elegance .sidebar-item-icon i {
    color: var(--sidebar-icon, var(--secondary-color, #c9a962));
}

/* Elegance theme - active states use tenant accent with transparency */
body.theme-elegance .sidebar-item.active {
    background: var(--sidebar-active-bg, rgba(255, 255, 255, 0.15));
}

/* Elegance theme - grain texture overlay for refined look */
body.theme-elegance::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Elegance theme - refined card styling */
body.theme-elegance .card,
body.theme-elegance .panel,
body.theme-elegance .bg-white.rounded-lg.shadow {
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 16px rgba(10, 22, 40, 0.06);
}

/* Elegance theme - refined button styling */
body.theme-elegance .btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

body.theme-elegance .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* =============================================================================
   2. RESET / BASE STYLES
   ============================================================================= */

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

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

body {
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-color);
    background-color: var(--bg-alt);
    min-height: 100vh;
}

/* Remove default list styles */
ul, ol {
    list-style: none;
}

/* Remove default link styles */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Prevent a:hover color override on button-styled links */
a[class*="btn-"]:hover {
    color: #ffffff !important;
}

a.text-white:hover {
    color: #ffffff !important;
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Images */
img, svg {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Remove default button styles */
button {
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* Remove default fieldset styles */
fieldset {
    border: none;
    padding: 0;
}

/* Selection styling */
::selection {
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Hidden utility */
[hidden] {
    display: none !important;
}

/* =============================================================================
   3. LAYOUT (Header, Sidebar, Footer, Main Content)
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Page Container
   ----------------------------------------------------------------------------- */
.layout-container {
    display: flex;
    min-height: 100vh;
}

.layout-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: padding-left var(--transition-menu);
}

@media (min-width: 1024px) {
    .layout-main {
        padding-left: var(--sidebar-width-collapsed);
    }

    .layout-main.sidebar-expanded {
        padding-left: var(--sidebar-width-expanded);
    }
}

/* -----------------------------------------------------------------------------
   Content Wrapper
   ----------------------------------------------------------------------------- */
.content-wrapper {
    flex: 1;
    padding: var(--spacing-lg);
    transition: padding-left var(--transition-menu);
}

@media (min-width: 1024px) {
    .content-wrapper {
        padding-left: calc(var(--sidebar-width-collapsed) + var(--spacing-lg));
    }
}

.content-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

/* -----------------------------------------------------------------------------
   Header
   ----------------------------------------------------------------------------- */
.header {
    background-color: var(--header-bg);
    color: var(--header-text);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--container-max-width);
    margin: 0 auto;
}

.header-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--header-text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* -----------------------------------------------------------------------------
   Sidebar
   ----------------------------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width-collapsed);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-dark) 100%);
    color: var(--sidebar-text);
    z-index: var(--z-sidebar);
    overflow-x: hidden;
    overflow-y: auto;
    transition: width var(--transition-menu);
    display: flex;
    flex-direction: column;
}

@media (min-width: 1024px) {
    .sidebar:hover {
        width: var(--sidebar-width-expanded);
    }
}

/* Mobile sidebar */
@media (max-width: 1023px) {
    .sidebar {
        width: var(--sidebar-width-expanded);
        transform: translateX(-100%);
        transition: transform var(--transition-menu);
    }

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

.sidebar-header {
    padding: var(--spacing-md);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: var(--header-height);
    border-bottom: 1px solid var(--sidebar-hover-bg);
}

.sidebar-logo {
    width: 2.5rem;
    height: 2.5rem;
    transition: transform var(--transition-base);
}

.sidebar:hover .sidebar-logo {
    transform: scale(1);
}

.sidebar:not(:hover) .sidebar-logo {
    transform: scale(0.8);
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-sm) 0;
}

.sidebar-footer {
    padding: var(--spacing-md);
    border-top: 1px solid var(--sidebar-hover-bg);
}

/* -----------------------------------------------------------------------------
   Footer
   ----------------------------------------------------------------------------- */
.footer {
    background-color: var(--bg-alt);
    border-top: 1px solid var(--border-color);
    padding: var(--spacing-lg);
    margin-top: auto;
}

.footer-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* -----------------------------------------------------------------------------
   Page Header / Title Section
   ----------------------------------------------------------------------------- */
.page-header {
    margin-bottom: var(--spacing-xl);
}

.page-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-color);
    margin-bottom: var(--spacing-sm);
}

.page-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-muted);
}

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

.page-breadcrumb a {
    color: var(--text-muted);
}

.page-breadcrumb a:hover {
    color: var(--primary-color);
}

/* =============================================================================
   4. TYPOGRAPHY
   ============================================================================= */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    color: var(--text-color);
    margin-bottom: var(--spacing-md);
}

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

p {
    margin-bottom: var(--spacing-md);
}

.text-lead {
    font-size: var(--font-size-xl);
    color: var(--text-muted);
    line-height: var(--line-height-relaxed);
}

.text-small {
    font-size: var(--font-size-sm);
}

.text-xs {
    font-size: var(--font-size-xs);
}

.text-muted {
    color: var(--text-muted);
}

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

strong, .text-bold {
    font-weight: var(--font-weight-bold);
}

em, .text-italic {
    font-style: italic;
}

.text-mono {
    font-family: var(--font-mono);
}

.text-signature {
    font-family: var(--font-signature);
    font-size: var(--font-size-2xl);
}

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text colors */
.text-primary { color: var(--primary-color); }
.text-secondary { color: var(--secondary-color); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-info { color: var(--info); }

/* Links */
.link {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.link:hover {
    color: var(--primary-dark);
}

/* Lists */
.list-disc {
    list-style-type: disc;
    padding-left: var(--spacing-lg);
}

.list-decimal {
    list-style-type: decimal;
    padding-left: var(--spacing-lg);
}

.list-disc li,
.list-decimal li {
    margin-bottom: var(--spacing-sm);
}

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background-color: var(--bg-dark);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius-sm);
}

pre {
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    background-color: var(--bg-dark);
    padding: var(--spacing-md);
    border-radius: var(--radius);
    overflow-x: auto;
}

pre code {
    background: none;
    padding: 0;
}

/* =============================================================================
   5. FORMS AND INPUTS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Form Layout
   ----------------------------------------------------------------------------- */
.form {
    width: 100%;
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.form-row > * {
    flex: 1;
    min-width: 200px;
}

.form-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-xl);
}

/* -----------------------------------------------------------------------------
   Labels
   ----------------------------------------------------------------------------- */
.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-color);
    margin-bottom: var(--spacing-xs);
}

.form-label-required::after {
    content: ' *';
    color: var(--error);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* -----------------------------------------------------------------------------
   Input Base Styles
   ----------------------------------------------------------------------------- */
.form-input,
.form-select,
.form-textarea {
    display: block;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--text-color);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-dark);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-light);
}

/* Input sizes */
.form-input-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.form-input-lg {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-lg);
}

/* Disabled state */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
    background-color: var(--bg-alt);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.7;
}

/* Readonly state */
.form-input[readonly],
.form-textarea[readonly] {
    background-color: var(--bg-alt);
}

/* Error state */
.form-input-error,
.form-select-error,
.form-textarea-error {
    border-color: var(--error);
}

.form-input-error:focus,
.form-select-error:focus,
.form-textarea-error:focus {
    box-shadow: 0 0 0 3px rgba(var(--error-rgb), 0.1);
}

.form-error-message {
    font-size: var(--font-size-sm);
    color: var(--error);
    margin-top: var(--spacing-xs);
}

/* Success state */
.form-input-success,
.form-select-success {
    border-color: var(--success);
}

/* -----------------------------------------------------------------------------
   Select
   ----------------------------------------------------------------------------- */
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-md) center;
    padding-right: calc(var(--spacing-md) * 2 + 16px);
    cursor: pointer;
}

/* -----------------------------------------------------------------------------
   Textarea
   ----------------------------------------------------------------------------- */
.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-textarea-autosize {
    resize: none;
    overflow: hidden;
}

/* -----------------------------------------------------------------------------
   Checkbox and Radio
   ----------------------------------------------------------------------------- */
.form-checkbox,
.form-radio {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    cursor: pointer;
}

.form-checkbox input,
.form-radio input {
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.form-checkbox-label,
.form-radio-label {
    font-size: var(--font-size-base);
    color: var(--text-color);
    cursor: pointer;
}

/* Checkbox/Radio group */
.form-checkbox-group,
.form-radio-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-checkbox-group-inline,
.form-radio-group-inline {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

/* -----------------------------------------------------------------------------
   File Input
   ----------------------------------------------------------------------------- */
.form-file {
    display: block;
    width: 100%;
}

.form-file-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--bg-alt);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.form-file-label:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-50);
}

.form-file input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* -----------------------------------------------------------------------------
   Input Group (with addons)
   ----------------------------------------------------------------------------- */
.form-input-group {
    display: flex;
    align-items: stretch;
}

.form-input-group .form-input {
    flex: 1;
    border-radius: 0;
}

.form-input-group .form-input:first-child {
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

.form-input-group .form-input:last-child {
    border-top-right-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.form-input-addon {
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-md);
    background-color: var(--bg-alt);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.form-input-addon:first-child {
    border-right: none;
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

.form-input-addon:last-child {
    border-left: none;
    border-top-right-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

/* -----------------------------------------------------------------------------
   Range Slider
   ----------------------------------------------------------------------------- */
.form-range {
    width: 100%;
    height: 0.5rem;
    background: linear-gradient(to right, var(--error) 0%, var(--warning) 50%, var(--success) 100%);
    border-radius: var(--radius-full);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.form-range::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary-color);
    border: 3px solid var(--bg-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    width: 1.5rem;
    height: 1.5rem;
    background: var(--primary-color);
    border: 3px solid var(--bg-color);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    cursor: pointer;
}

/* =============================================================================
   6. BUTTONS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Base Button
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-family: var(--font-sans);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-normal);
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.3);
}

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

/* Button icon */
.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* Icon-only button */
.btn-icon-only {
    padding: var(--spacing-sm);
}

.btn-icon-only .btn-icon {
    margin: 0;
}

/* -----------------------------------------------------------------------------
   Button Variants
   ----------------------------------------------------------------------------- */

/* Primary */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-primary:active {
    background-color: var(--primary-dark);
    transform: translateY(1px);
}

/* Secondary */
.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--text-inverse);
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
    border-color: var(--secondary-dark);
}

/* Accent */
.btn-accent {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--text-inverse);
}

.btn-accent:hover {
    background-color: var(--accent-dark);
    border-color: var(--accent-dark);
}

/* Success */
.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: var(--text-inverse);
}

.btn-success:hover {
    background-color: var(--success-dark);
    border-color: var(--success-dark);
}

/* Warning */
.btn-warning {
    background-color: var(--warning);
    border-color: var(--warning);
    color: var(--text-inverse);
}

.btn-warning:hover {
    background-color: var(--warning-dark);
    border-color: var(--warning-dark);
}

/* Danger/Error */
.btn-danger,
.btn-error {
    background-color: var(--error);
    border-color: var(--error);
    color: var(--text-inverse);
}

.btn-danger:hover,
.btn-error:hover {
    background-color: var(--error-dark);
    border-color: var(--error-dark);
}

/* Light */
.btn-light {
    background-color: var(--bg-alt);
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-light:hover {
    background-color: var(--bg-dark);
    border-color: var(--border-dark);
}

/* Dark */
.btn-dark {
    background-color: var(--text-color);
    border-color: var(--text-color);
    color: var(--text-inverse);
}

.btn-dark:hover {
    background-color: #000;
}

/* -----------------------------------------------------------------------------
   Outline Buttons
   ----------------------------------------------------------------------------- */
.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--bg-alt);
}

.btn-outline-primary {
    background-color: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.btn-outline-secondary:hover {
    background-color: var(--secondary-color);
    color: var(--text-inverse);
}

.btn-outline-danger {
    background-color: transparent;
    border-color: var(--error);
    color: var(--error);
}

.btn-outline-danger:hover {
    background-color: var(--error);
    color: var(--text-inverse);
}

/* -----------------------------------------------------------------------------
   Ghost/Text Buttons
   ----------------------------------------------------------------------------- */
.btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--text-color);
}

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

.btn-ghost-primary {
    color: var(--primary-color);
}

.btn-ghost-primary:hover {
    background-color: var(--primary-50);
}

/* Link Button */
.btn-link {
    background-color: transparent;
    border-color: transparent;
    color: var(--primary-color);
    text-decoration: underline;
    padding: 0;
}

.btn-link:hover {
    color: var(--primary-dark);
}

/* -----------------------------------------------------------------------------
   Button Sizes
   ----------------------------------------------------------------------------- */
.btn-xs {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-lg);
}

.btn-xl {
    padding: var(--spacing-lg) var(--spacing-2xl);
    font-size: var(--font-size-xl);
}

/* Full width button */
.btn-block {
    display: flex;
    width: 100%;
}

/* -----------------------------------------------------------------------------
   Button Group
   ----------------------------------------------------------------------------- */
.btn-group {
    display: inline-flex;
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

.btn-group .btn:last-child {
    border-top-right-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
}

.btn-group .btn:not(:last-child) {
    border-right-color: rgba(255, 255, 255, 0.2);
}

/* =============================================================================
   7. TABLES
   ============================================================================= */

.table-container {
    width: 100%;
    overflow-x: auto;
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

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

.table th,
.table td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: var(--bg-alt);
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
    white-space: nowrap;
}

.table tbody tr:hover {
    background-color: var(--bg-alt);
}

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

/* Table variants */
.table-striped tbody tr:nth-child(even) {
    background-color: var(--bg-alt);
}

.table-bordered {
    border: 1px solid var(--border-color);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--border-color);
}

/* Compact table */
.table-compact th,
.table-compact td {
    padding: var(--spacing-sm);
}

/* Table alignment */
.table td.text-right,
.table th.text-right {
    text-align: right;
}

.table td.text-center,
.table th.text-center {
    text-align: center;
}

/* Table responsive wrapper */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* =============================================================================
   8. CARDS AND PANELS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Card Base
   ----------------------------------------------------------------------------- */
.card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

/* On mobile screens, remove overflow:hidden from cards so inner tables
   with overflow-x:auto can actually be scrolled horizontally. */
@media (max-width: 768px) {
    .card {
        overflow: visible;
    }
}

.card-header {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-alt);
}

.card-header-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
    margin: 0;
}

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

.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-alt);
}

/* Card variants */
.card-flat {
    box-shadow: none;
}

.card-hover {
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.card-hover:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-clickable {
    cursor: pointer;
}

/* Card with accent border */
.card-accent-primary {
    border-left: 4px solid var(--primary-color);
}

.card-accent-success {
    border-left: 4px solid var(--success);
}

.card-accent-warning {
    border-left: 4px solid var(--warning);
}

.card-accent-error {
    border-left: 4px solid var(--error);
}

/* -----------------------------------------------------------------------------
   Stat Card
   ----------------------------------------------------------------------------- */
.card-stat {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
}

.card-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-full);
    background-color: var(--primary-50);
    color: var(--primary-color);
    flex-shrink: 0;
}

.card-stat-content {
    flex: 1;
}

.card-stat-value {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-color);
    line-height: 1;
}

.card-stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* -----------------------------------------------------------------------------
   Panel
   ----------------------------------------------------------------------------- */
.panel {
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.panel-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.panel-title-icon {
    color: var(--primary-color);
}

.panel-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.panel-body {
    padding: var(--spacing-lg);
}

.panel-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-alt);
}

/* =============================================================================
   9. MODALS AND OVERLAYS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Modal Backdrop
   ----------------------------------------------------------------------------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

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

/* -----------------------------------------------------------------------------
   Modal
   ----------------------------------------------------------------------------- */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-modal);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), transform var(--transition-base), visibility var(--transition-base);
}

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

/* Modal sizes */
.modal-sm { width: 24rem; }
.modal-md { width: 32rem; }
.modal-lg { width: 48rem; }
.modal-xl { width: 64rem; }
.modal-full { width: calc(100vw - 2rem); height: calc(100vh - 2rem); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
    margin: 0;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.modal-close:hover {
    background-color: var(--bg-alt);
    color: var(--text-color);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    max-height: calc(90vh - 10rem);
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-alt);
}

/* -----------------------------------------------------------------------------
   Overlay
   ----------------------------------------------------------------------------- */
.overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: var(--z-overlay);
    display: none;
}

.overlay.overlay-open {
    display: block;
}

/* Mobile menu overlay */
.mobile-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: var(--z-overlay);
    display: none;
}

.mobile-overlay.menu-open {
    display: block;
}

/* =============================================================================
   10. ALERTS AND NOTIFICATIONS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Alert Base
   ----------------------------------------------------------------------------- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius);
    border-left: 4px solid;
    margin-bottom: var(--spacing-md);
}

.alert-icon {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--spacing-xs);
}

.alert-message {
    font-size: var(--font-size-sm);
}

.alert-close {
    flex-shrink: 0;
    padding: var(--spacing-xs);
    margin: calc(var(--spacing-xs) * -1);
    border-radius: var(--radius-sm);
    color: inherit;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}

/* Alert variants */
.alert-success {
    background-color: var(--success-light);
    border-color: var(--success);
    color: var(--success-dark);
}

.alert-warning {
    background-color: var(--warning-light);
    border-color: var(--warning);
    color: var(--warning-dark);
}

.alert-error {
    background-color: var(--error-light);
    border-color: var(--error);
    color: var(--error-dark);
}

.alert-info {
    background-color: var(--info-light);
    border-color: var(--info);
    color: var(--info-dark);
}

/* Inline alert (no left border) */
.alert-inline {
    border-left: none;
    border: 1px solid;
}

/* -----------------------------------------------------------------------------
   Toast Notification
   ----------------------------------------------------------------------------- */
.toast-container {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    max-width: 24rem;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: toast-slide-in var(--transition-base) ease-out;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
}

.toast-message {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

.toast-close {
    flex-shrink: 0;
    padding: var(--spacing-xs);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}

.toast-close:hover {
    background-color: var(--bg-alt);
    color: var(--text-color);
}

/* Toast variants */
.toast-success .toast-icon { color: var(--success); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-error .toast-icon { color: var(--error); }
.toast-info .toast-icon { color: var(--info); }

/* -----------------------------------------------------------------------------
   Badge
   ----------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.5rem;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    line-height: 1.5;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

.badge-secondary {
    background-color: var(--secondary-color);
    color: var(--text-inverse);
}

.badge-success {
    background-color: var(--success);
    color: var(--text-inverse);
}

.badge-warning {
    background-color: var(--warning);
    color: var(--text-inverse);
}

.badge-error {
    background-color: var(--error);
    color: var(--text-inverse);
}

.badge-info {
    background-color: var(--info);
    color: var(--text-inverse);
}

.badge-light {
    background-color: var(--bg-alt);
    color: var(--text-color);
}

/* Outline badges */
.badge-outline-primary {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.badge-outline-success {
    background-color: transparent;
    border: 1px solid var(--success);
    color: var(--success);
}

.badge-outline-warning {
    background-color: transparent;
    border: 1px solid var(--warning);
    color: var(--warning);
}

.badge-outline-error {
    background-color: transparent;
    border: 1px solid var(--error);
    color: var(--error);
}

/* Badge sizes */
.badge-sm {
    padding: 0 0.375rem;
    font-size: 0.625rem;
}

.badge-lg {
    padding: 0.25rem 0.75rem;
    font-size: var(--font-size-sm);
}

/* Dot badge (notification indicator) */
.badge-dot {
    width: 0.5rem;
    height: 0.5rem;
    padding: 0;
    border-radius: var(--radius-full);
}

/* =============================================================================
   11. NAVIGATION AND MENUS
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Navigation Menu
   ----------------------------------------------------------------------------- */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--sidebar-text-muted);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

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

.nav-link-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: var(--sidebar-icon);
}

.nav-link-text {
    flex: 1;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar collapsed state - hide text */
@media (min-width: 1024px) {
    .sidebar:not(:hover) .nav-link-text,
    .sidebar:not(:hover) .nav-link-chevron {
        opacity: 0;
        visibility: hidden;
        position: absolute;
    }

    .sidebar:not(:hover) .nav-link {
        justify-content: center;
        padding: var(--spacing-sm);
    }

    .sidebar:not(:hover) .nav-link-icon {
        margin: 0;
        transform: scale(1.2);
    }
}

/* Nav group */
.nav-group {
    margin-bottom: var(--spacing-md);
}

.nav-group-title {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Submenu */
.nav-submenu {
    display: none;
    flex-direction: column;
    padding-left: var(--spacing-xl);
    margin-top: var(--spacing-xs);
}

.nav-submenu.open {
    display: flex;
}

.nav-submenu .nav-link {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: var(--font-size-sm);
}

.nav-link-chevron {
    width: 1rem;
    height: 1rem;
    margin-left: auto;
    transition: transform var(--transition-fast);
}

.nav-item.open .nav-link-chevron {
    transform: rotate(180deg);
}

/* -----------------------------------------------------------------------------
   Tabs
   ----------------------------------------------------------------------------- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    gap: var(--spacing-xs);
}

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

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

.tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    padding: var(--spacing-lg) 0;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Pill tabs */
.tabs-pills {
    border-bottom: none;
    background-color: var(--bg-alt);
    padding: var(--spacing-xs);
    border-radius: var(--radius-lg);
}

.tabs-pills .tab {
    border-bottom: none;
    border-radius: var(--radius);
    margin-bottom: 0;
}

.tabs-pills .tab.active {
    background-color: var(--bg-color);
    box-shadow: var(--shadow-sm);
}

/* -----------------------------------------------------------------------------
   Breadcrumb
   ----------------------------------------------------------------------------- */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-muted);
}

.breadcrumb-item a {
    color: var(--text-muted);
}

.breadcrumb-item a:hover {
    color: var(--primary-color);
}

.breadcrumb-item.active {
    color: var(--text-color);
}

.breadcrumb-separator {
    color: var(--text-light);
}

/* -----------------------------------------------------------------------------
   Dropdown
   ----------------------------------------------------------------------------- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 12rem;
    padding: var(--spacing-xs);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
}

.dropdown.open .dropdown-menu,
.dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu-right {
    left: auto;
    right: 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: var(--font-size-sm);
    color: var(--text-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-alt);
}

.dropdown-item-icon {
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: var(--spacing-xs) 0;
}

/* -----------------------------------------------------------------------------
   Pagination
   ----------------------------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 var(--spacing-sm);
    font-size: var(--font-size-sm);
    color: var(--text-color);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.pagination-item:hover {
    background-color: var(--bg-alt);
    border-color: var(--border-dark);
}

.pagination-item.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--text-inverse);
}

.pagination-item:disabled,
.pagination-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================================================
   12. PAGE-SPECIFIC STYLES
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Login Page
   ----------------------------------------------------------------------------- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.login-card {
    width: 100%;
    max-width: 24rem;
    background-color: var(--bg-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.login-header {
    padding: var(--spacing-xl);
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-inverse);
}

.login-logo {
    width: 4rem;
    height: 4rem;
    margin: 0 auto var(--spacing-md);
}

.login-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    margin: 0;
}

.login-form {
    padding: var(--spacing-xl);
}

/* -----------------------------------------------------------------------------
   Dashboard Page
   ----------------------------------------------------------------------------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: var(--spacing-lg);
}

.dashboard-stat {
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.dashboard-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-full);
    margin-bottom: var(--spacing-md);
}

.dashboard-stat-value {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-color);
}

.dashboard-stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   Jury Setup Page
   ----------------------------------------------------------------------------- */
.jury-setup-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
}

@media (min-width: 1024px) {
    .jury-setup-container {
        grid-template-columns: 2fr 1fr;
    }
}

.jury-slot {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: box-shadow var(--transition-fast);
}

.jury-slot:hover {
    box-shadow: var(--shadow-md);
}

.jury-slot-time {
    font-weight: var(--font-weight-semibold);
    color: var(--primary-color);
    min-width: 5rem;
}

.jury-slot-student {
    flex: 1;
}

.jury-slot-actions {
    display: flex;
    gap: var(--spacing-xs);
}

/* -----------------------------------------------------------------------------
   Student Evaluation Page
   ----------------------------------------------------------------------------- */
.evaluation-header {
    background: linear-gradient(to right, var(--primary-50), var(--bg-alt));
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xl);
    text-align: center;
}

.evaluation-student-name {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--primary-dark);
    margin-bottom: var(--spacing-sm);
}

.evaluation-info {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xl);
    color: var(--text-muted);
    flex-wrap: wrap;
}

.evaluation-criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: var(--spacing-lg);
}

.evaluation-criterion {
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.evaluation-criterion-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
    margin-bottom: var(--spacing-md);
}

.evaluation-slider-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.evaluation-score {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--primary-color);
    min-width: 3rem;
    text-align: center;
}

/* -----------------------------------------------------------------------------
   Repertoire Sheet Page
   ----------------------------------------------------------------------------- */
.repertoire-container {
    max-width: 50rem;
    margin: 0 auto;
}

.repertoire-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.repertoire-section {
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.repertoire-section-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.repertoire-piece {
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: var(--spacing-md);
}

.repertoire-piece:last-child {
    margin-bottom: 0;
}

.repertoire-piece-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
}

.repertoire-piece-composer {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   Schedule Page
   ----------------------------------------------------------------------------- */
.schedule-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.schedule-day-header {
    padding: var(--spacing-md);
    background-color: var(--bg-alt);
    font-weight: var(--font-weight-semibold);
    text-align: center;
}

.schedule-day {
    min-height: 8rem;
    padding: var(--spacing-sm);
    background-color: var(--bg-color);
}

.schedule-day-number {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
}

.schedule-event {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-xs);
    background-color: var(--primary-50);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-xs);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.schedule-event:hover {
    background-color: var(--primary-color);
    color: var(--text-inverse);
}

/* -----------------------------------------------------------------------------
   Statistics/Reports Page
   ----------------------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: var(--spacing-lg);
}

.stats-chart-container {
    background-color: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.stats-chart-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-color);
    margin-bottom: var(--spacing-md);
}

.stats-chart {
    height: 16rem;
}

/* -----------------------------------------------------------------------------
   User Management Page
   ----------------------------------------------------------------------------- */
.user-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    background-color: var(--primary-color);
    color: var(--text-inverse);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
}

.user-status {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

.user-status-active {
    background-color: var(--success-light);
    color: var(--success-dark);
}

.user-status-inactive {
    background-color: var(--error-light);
    color: var(--error-dark);
}

.user-status-pending {
    background-color: var(--warning-light);
    color: var(--warning-dark);
}

/* -----------------------------------------------------------------------------
   Repertoire Sheet
   ----------------------------------------------------------------------------- */

/* Page-Level Variables */
.rep-sheet-page {
    overflow: visible !important;
    --rep-card-bg: var(--bg-color);

    /* Three repertoire type colors (blue / indigo / purple) */
    --rep-jury-color: var(--info, #3b82f6);
    --rep-jury-light: var(--info-light, #dbeafe);
    --rep-jury-dark: var(--info-dark, #1e40af);
    --rep-jury-border: #60a5fa;
    --rep-jury-accent: #93c5fd;
    --rep-jury-header-from: #1e3a8a;

    --rep-general-color: var(--primary-light, #6366f1);
    --rep-general-light: #e0e7ff;
    --rep-general-dark: var(--primary-dark, #4338ca);
    --rep-general-border: #818cf8;
    --rep-general-accent: #a5b4fc;
    --rep-general-header-from: #3730a3;

    --rep-technical-color: #a855f7;
    --rep-technical-light: #f3e8ff;
    --rep-technical-dark: #7e22ce;
    --rep-technical-border: #c084fc;
    --rep-technical-accent: #d8b4fe;
    --rep-technical-header-from: #6b21a8;
}

.dark-mode .rep-sheet-page {
    overflow: visible !important;
    --rep-card-bg: var(--bg-alt);
    --rep-jury-light: #1e3a8a;
    --rep-jury-accent: var(--rep-jury-color);
    --rep-jury-header-from: var(--rep-jury-dark);
    --rep-general-light: #312e81;
    --rep-general-accent: var(--rep-general-color);
    --rep-general-header-from: var(--rep-general-dark);
    --rep-technical-light: #581c87;
    --rep-technical-accent: var(--rep-technical-color);
    --rep-technical-header-from: var(--rep-technical-dark);
}

html.dark-mode { overflow: auto !important; }
html.dark-mode body { overflow: visible !important; background-color: var(--sidebar-bg, #0f172a); }
.dark-mode .content-container,
.dark-mode .content-wrapper,
.dark-mode .content-body { overflow: visible !important; }

/* Cards */
.rep-sheet-page .rep-card {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
    background-color: var(--rep-card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.rep-sheet-page .rep-card-header {
    font-weight: bold;
    font-size: 1.25rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    color: white;
    border-bottom: 1px solid var(--border-color);
}

.rep-sheet-page .rep-card-body {
    padding: 1rem;
    background-color: var(--rep-card-bg);
    color: var(--text-color);
}

.rep-sheet-page .student-card,
.rep-sheet-page .accompanist-card,
.rep-sheet-page .ai-powered-card,
.rep-sheet-page .repertoire-card {
    background-color: var(--rep-card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.rep-sheet-page .ai-result-area {
    background-color: var(--rep-card-bg);
    border-left: 1px solid var(--border-color);
}

/* Buttons */
.rep-sheet-page .btn-primary {
    background-color: var(--rep-jury-dark);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

.rep-sheet-page .btn-primary:hover { background-color: var(--rep-jury-header-from); }

.rep-sheet-page .btn-secondary {
    background-color: var(--bg-alt);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

.rep-sheet-page .btn-secondary:hover { background-color: var(--border-color); }

.rep-sheet-page .btn-danger {
    background-color: var(--error);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    transition: all 0.2s;
}

.rep-sheet-page .btn-danger:hover { background-color: var(--error-dark); }

/* Forms */
.rep-sheet-page .form-group { margin-bottom: 1.5rem; }

.rep-sheet-page .form-control {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background-color: var(--rep-card-bg);
    color: var(--text-color);
    transition: all 0.2s;
}

.rep-sheet-page .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 79, 70, 229), 0.2);
    outline: none;
}

.rep-sheet-page .form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.rep-sheet-page .appearance-checkbox {
    appearance: checkbox !important;
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
}

.rep-sheet-page select {
    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 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.dark-mode .rep-sheet-page select {
    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='%23e5e7eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.rep-sheet-page .work-type-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    width: 100%;
}

.rep-sheet-page .work-type-field-wrapper { flex-shrink: 0; }
.rep-sheet-page .repertoire-input-field-wrapper { flex: 1; }

.rep-sheet-page .work-type-select {
    width: auto;
    min-width: fit-content;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    color: var(--text-color);
    background-color: var(--rep-card-bg);
    cursor: pointer;
    transition: all 0.2s;
    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 8l4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.25em 1.25em;
}

.rep-sheet-page .work-type-select:hover { border-color: var(--text-light); }

.rep-sheet-page .work-type-select:focus {
    outline: none;
    border-color: var(--rep-jury-color);
    box-shadow: 0 0 0 1px var(--rep-jury-color);
}

.dark-mode .rep-sheet-page .work-type-select {
    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='%23e5e7eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
}

.rep-sheet-page #smartRepertoireInput {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    background-color: var(--rep-card-bg);
    color: var(--text-color);
}

.rep-sheet-page #smartRepertoireInput:focus {
    outline: none;
    border-color: var(--rep-jury-color);
    box-shadow: 0 0 0 1px var(--rep-jury-color);
}

.rep-sheet-page #smartRepertoireInput:disabled {
    background-color: var(--bg-alt);
    color: var(--text-light);
    cursor: not-allowed;
}

/* Tables */
.rep-sheet-page .table-modern {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.rep-sheet-page .table-modern thead { background-color: var(--bg-alt); }

.rep-sheet-page .table-modern th {
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.rep-sheet-page .repertoire-card:nth-of-type(1) .table-modern thead { background-color: var(--rep-jury-light); }
.rep-sheet-page .repertoire-card:nth-of-type(1) .table-modern th { color: var(--rep-jury-dark); border-bottom-color: var(--rep-jury-accent); }
.rep-sheet-page .repertoire-card:nth-of-type(2) .table-modern thead { background-color: var(--rep-general-light); }
.rep-sheet-page .repertoire-card:nth-of-type(2) .table-modern th { color: var(--rep-general-dark); border-bottom-color: var(--rep-general-accent); }
.rep-sheet-page .repertoire-card:nth-of-type(3) .table-modern thead { background-color: var(--rep-technical-light); }
.rep-sheet-page .repertoire-card:nth-of-type(3) .table-modern th { color: var(--rep-technical-dark); border-bottom-color: var(--rep-technical-accent); }

.dark-mode .rep-sheet-page .repertoire-card:nth-of-type(1) .table-modern th { color: var(--info-light, #dbeafe); }
.dark-mode .rep-sheet-page .repertoire-card:nth-of-type(2) .table-modern th { color: #e0e7ff; }
.dark-mode .rep-sheet-page .repertoire-card:nth-of-type(3) .table-modern th { color: #f3e8ff; }

.rep-sheet-page .table-modern tbody tr { transition: all 0.2s; }
.rep-sheet-page .table-modern tbody tr:hover { background-color: var(--bg-alt); }

.rep-sheet-page .table-modern td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--rep-card-bg);
    color: var(--text-color);
}

.rep-sheet-page .rep-table-header {
    background-color: var(--text-light);
    color: var(--text-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
}

/* Badges */
.rep-sheet-page .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full, 9999px);
    font-size: 0.75rem;
    font-weight: 500;
}

.rep-sheet-page .badge-blue { background-color: var(--rep-jury-light); color: var(--rep-jury-dark); }
.rep-sheet-page .badge-purple { background-color: #ede9fe; color: #5b21b6; }
.dark-mode .rep-sheet-page .badge-purple { background-color: #5b21b6; color: #ede9fe; }

/* Lucide Icons */
.rep-sheet-page *[data-lucide] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    stroke-width: 1.5;
    stroke: currentColor;
    fill: none;
    vertical-align: middle;
}

.rep-sheet-page .rep-icon { color: var(--primary-color); }
.rep-sheet-page .rep-text-muted { color: var(--text-muted); }

.rep-sheet-page .rep-delete-btn {
    color: var(--error);
    padding: 0.25rem;
    border-radius: var(--radius-full, 9999px);
    transition: all 0.2s;
}

.rep-sheet-page .rep-delete-btn:hover { color: var(--error-dark); background-color: var(--error-light); }

.rep-sheet-page .repertoire-item {
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    transition: all 0.3s;
}

/* Animations */
.rep-sheet-page .fade-in { animation: repFadeIn 0.5s ease forwards; }
@keyframes repFadeIn { from { opacity: 0; } to { opacity: 1; } }
.rep-sheet-page .slide-in { animation: repSlideIn 0.5s ease forwards; }
@keyframes repSlideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.rep-sheet-page .highlight-new { animation: repHighlightNew 2s ease-out; }
@keyframes repHighlightNew { 0% { background-color: rgba(var(--info-rgb, 59, 130, 246), 0.15); } 100% { background-color: transparent; } }
.rep-sheet-page .animate-pulse { animation: repPulse 1s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes repPulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.85; transform: scale(1.03); } }

/* Suggestions Dropdown */
.rep-sheet-page .suggestions-dropdown {
    position: absolute;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: var(--rep-card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    z-index: 10;
}

@media (min-width: 768px) {
    .rep-sheet-page #smartRepertoireInput + .suggestions-dropdown { width: 110%; }
}

.rep-sheet-page .suggestion-item { padding: 0.75rem; cursor: pointer; transition: all 0.1s; color: var(--text-color); }
.rep-sheet-page .suggestion-item:hover { background-color: var(--bg-alt); }
.rep-sheet-page .suggestion-item.active { background-color: var(--border-color); }

/* Toast Notification */
.rep-sheet-page .toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--rep-card-bg);
    color: var(--text-color);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    min-width: 300px;
    max-width: 90%;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.dark-mode .rep-sheet-page .toast { border: 1px solid var(--border-color); }
.rep-sheet-page .toast.show { transform: translateY(0); opacity: 1; }

/* Tooltips */
.rep-sheet-page .tooltip { position: relative; display: inline-flex; cursor: pointer; }

.rep-sheet-page .tooltip-content {
    visibility: hidden;
    position: absolute;
    z-index: 100;
    width: 250px;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem;
    background-color: var(--rep-card-bg);
    color: var(--text-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
}

.dark-mode .rep-sheet-page .tooltip-content { background-color: var(--sidebar-bg, #0f172a); }
.rep-sheet-page .tooltip:hover .tooltip-content { visibility: visible; opacity: 1; }

.rep-sheet-page .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--rep-card-bg) transparent transparent transparent;
}

.dark-mode .rep-sheet-page .tooltip-content::after { border-color: var(--sidebar-bg, #0f172a) transparent transparent transparent; }

/* AI Input & Results */
.rep-sheet-page .ai-input-section { display: flex; flex-direction: column; gap: 0.5rem; }

.rep-sheet-page .ai-result-card {
    background-color: var(--rep-card-bg);
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.rep-sheet-page .ai-result-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.rep-sheet-page .ai-result-text {
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
    line-height: 1.25;
    position: relative;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm, 0.25rem);
    transition: all 0.2s ease;
}

.rep-sheet-page .ai-result-text.editable { cursor: pointer; padding-right: 1.75rem; }

.rep-sheet-page .ai-result-text.editable::after {
    content: "";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.875rem;
    height: 0.875rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'%3E%3C/path%3E%3Cpath d='M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.rep-sheet-page .ai-result-text.editable:hover { background-color: rgba(var(--info-rgb, 59, 130, 246), 0.1); }
.rep-sheet-page .ai-result-text.editable:hover::after { opacity: 1; }

.rep-sheet-page .ai-result-text.editable::before {
    content: "Click to edit";
    position: absolute;
    bottom: calc(100% + 5px);
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-color);
    color: var(--bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm, 0.25rem);
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 5;
}

.rep-sheet-page .ai-result-text.editable:hover::before { opacity: 1; visibility: visible; }

.dark-mode .rep-sheet-page .ai-result-text.editable::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e5e7eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'%3E%3C/path%3E%3Cpath d='M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z'%3E%3C/path%3E%3C/svg%3E");
}

.dark-mode .rep-sheet-page .ai-result-text.editable::before { border: 1px solid var(--border-color); }

.rep-sheet-page .ai-result-edit-input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--rep-jury-color);
    border-radius: var(--radius-sm, 0.25rem);
    font-size: 0.875rem;
    font-weight: 500;
    background-color: var(--rep-card-bg);
    color: var(--text-color);
    box-shadow: 0 0 0 2px rgba(var(--info-rgb, 59, 130, 246), 0.25);
    outline: none;
}

.rep-sheet-page .ai-button {
    background-color: var(--rep-jury-dark);
    color: white;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.rep-sheet-page .ai-button:hover { background-color: var(--rep-jury-header-from); }
.rep-sheet-page .ai-button:disabled { background-color: var(--text-light); cursor: not-allowed; }

/* Help Section */
.rep-sheet-page #tableHelpText {
    border-left: 3px solid var(--rep-jury-color);
    line-height: 1.4;
    color: var(--text-color);
}

.rep-sheet-page #tableHelpText p { margin-bottom: 0.5rem; }
.rep-sheet-page #tableHelpText p:last-child { margin-bottom: 0; }
.rep-sheet-page #tableHelpText.hidden { display: none; }
.rep-sheet-page #tableHelpText:not(.hidden) { animation: repFadeInSlide 0.3s ease-out; }

@keyframes repFadeInSlide {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Add-to-Table Buttons */
.rep-sheet-page .add-table-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.rep-sheet-page .add-table-btn[disabled],
.rep-sheet-page .add-table-btn.disabled { opacity: 0.5; cursor: not-allowed; }

.rep-sheet-page .add-table-btn--jury { background-color: var(--rep-jury-light); color: var(--rep-jury-dark); border-color: var(--rep-jury-border); }
.rep-sheet-page .add-table-btn--jury:hover:not([disabled]) { background-color: var(--rep-jury-accent); border-color: var(--rep-jury-color); transform: translateY(-1px); }
.rep-sheet-page .add-table-btn--jury:active:not([disabled]) { background-color: var(--rep-jury-accent); transform: translateY(0); }

.rep-sheet-page .add-table-btn--general { background-color: var(--rep-general-light); color: var(--rep-general-dark); border-color: var(--rep-general-border); }
.rep-sheet-page .add-table-btn--general:hover:not([disabled]) { background-color: var(--rep-general-accent); border-color: var(--rep-general-color); transform: translateY(-1px); }
.rep-sheet-page .add-table-btn--general:active:not([disabled]) { background-color: var(--rep-general-accent); transform: translateY(0); }

.rep-sheet-page .add-table-btn--technical { background-color: var(--rep-technical-light); color: var(--rep-technical-dark); border-color: var(--rep-technical-border); }
.rep-sheet-page .add-table-btn--technical:hover:not([disabled]) { background-color: var(--rep-technical-accent); border-color: var(--rep-technical-color); transform: translateY(-1px); }
.rep-sheet-page .add-table-btn--technical:active:not([disabled]) { background-color: var(--rep-technical-accent); transform: translateY(0); }

.rep-sheet-page .add-table-btn i { stroke-width: 2.5; width: 16px; height: 16px; }

.rep-sheet-page .add-table-btn--jury.selected,
.rep-sheet-page .add-table-btn--jury:has(input:checked) {
    background-color: var(--rep-jury-color) !important;
    color: white !important;
    border-color: #2563eb !important;
    box-shadow: 0 3px 6px rgba(var(--info-rgb, 59, 130, 246), 0.3) !important;
    opacity: 1 !important;
}

.rep-sheet-page .add-table-btn--general.selected,
.rep-sheet-page .add-table-btn--general:has(input:checked) {
    background-color: var(--rep-general-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 3px 6px rgba(var(--primary-color-rgb, 79, 70, 229), 0.3) !important;
    opacity: 1 !important;
}

.rep-sheet-page .add-table-btn--technical.selected,
.rep-sheet-page .add-table-btn--technical:has(input:checked) {
    background-color: var(--rep-technical-color) !important;
    color: white !important;
    border-color: #9333ea !important;
    box-shadow: 0 3px 6px rgba(147, 51, 234, 0.3) !important;
    opacity: 1 !important;
}

/* Radio Group */
.rep-sheet-page .radio-group { display: flex; gap: 0.5rem; }

.rep-sheet-page .radio-option { position: relative; transition: all 0.2s ease; }

.rep-sheet-page .radio-option.selected {
    background-color: var(--rep-jury-light);
    border-color: var(--rep-jury-color);
    color: var(--rep-jury-dark);
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.rep-sheet-page .radio-option:hover:not(.selected) { background-color: var(--bg-alt); border-color: var(--border-color); }
.rep-sheet-page .radio-option:focus-within { outline: 2px solid var(--rep-jury-color); outline-offset: 2px; }

/* Colorful Card Headers for Repertoire Sections */
.rep-sheet-page .repertoire-card:nth-of-type(1) .rep-card-header {
    background: linear-gradient(to right, var(--rep-jury-header-from), var(--rep-jury-color));
    color: white;
    border-bottom-color: var(--rep-jury-border);
}

.rep-sheet-page .repertoire-card:nth-of-type(2) .rep-card-header {
    background: linear-gradient(to right, var(--rep-general-header-from), var(--rep-general-color));
    color: white;
    border-bottom-color: var(--rep-general-border);
}

.rep-sheet-page .repertoire-card:nth-of-type(3) .rep-card-header {
    background: linear-gradient(to right, var(--rep-technical-header-from), var(--rep-technical-color));
    color: white;
    border-bottom-color: var(--rep-technical-border);
}

/* Responsive */
@media (max-width: 768px) {
    .rep-sheet-page .rep-card-body { padding: 0.75rem; }
    .rep-sheet-page .table-modern th,
    .rep-sheet-page .table-modern td { padding: 0.5rem 0.375rem; }
    .rep-sheet-page .ai-result-area { border-left: none; border-top: 1px solid var(--border-color); margin-top: 1rem; padding-top: 1rem; }
    .rep-sheet-page .rep-card-header { padding: 0.5rem 0.75rem; font-size: 1.125rem; }
    .rep-sheet-page .table-modern { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 640px) {
    .rep-sheet-page .work-type-input-wrapper { flex-direction: column; align-items: stretch; }
    .rep-sheet-page .work-type-field-wrapper,
    .rep-sheet-page .repertoire-input-field-wrapper { width: 100%; }
    .rep-sheet-page .work-type-select { width: 100%; }
    .rep-sheet-page #smartRepertoireInput { width: 100%; }
    .rep-sheet-page .radio-group { flex-direction: column; }
    .rep-sheet-page .radio-option { width: 100%; justify-content: flex-start; padding: 0.5rem 0.75rem; }
}

/* =============================================================================
   13. UTILITY CLASSES
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Display
   ----------------------------------------------------------------------------- */
.u-hidden { display: none !important; }
.u-block { display: block !important; }
.u-inline { display: inline !important; }
.u-inline-block { display: inline-block !important; }
.u-flex { display: flex !important; }
.u-inline-flex { display: inline-flex !important; }
.u-grid { display: grid !important; }

/* Responsive display */
@media (max-width: 639px) {
    .u-hidden-mobile { display: none !important; }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .u-hidden-tablet { display: none !important; }
}

@media (min-width: 1024px) {
    .u-hidden-desktop { display: none !important; }
}

@media (max-width: 1023px) {
    .u-show-desktop-only { display: none !important; }
}

@media (min-width: 640px) {
    .u-show-mobile-only { display: none !important; }
}

/* -----------------------------------------------------------------------------
   Flexbox
   ----------------------------------------------------------------------------- */
.u-flex-row { flex-direction: row !important; }
.u-flex-column { flex-direction: column !important; }
.u-flex-wrap { flex-wrap: wrap !important; }
.u-flex-nowrap { flex-wrap: nowrap !important; }

.u-justify-start { justify-content: flex-start !important; }
.u-justify-end { justify-content: flex-end !important; }
.u-justify-center { justify-content: center !important; }
.u-justify-between { justify-content: space-between !important; }
.u-justify-around { justify-content: space-around !important; }

.u-align-start { align-items: flex-start !important; }
.u-align-end { align-items: flex-end !important; }
.u-align-center { align-items: center !important; }
.u-align-stretch { align-items: stretch !important; }

.u-flex-1 { flex: 1 1 0% !important; }
.u-flex-auto { flex: 1 1 auto !important; }
.u-flex-none { flex: none !important; }
.u-flex-shrink-0 { flex-shrink: 0 !important; }
.u-flex-grow { flex-grow: 1 !important; }

.u-gap-xs { gap: var(--spacing-xs) !important; }
.u-gap-sm { gap: var(--spacing-sm) !important; }
.u-gap-md { gap: var(--spacing-md) !important; }
.u-gap-lg { gap: var(--spacing-lg) !important; }
.u-gap-xl { gap: var(--spacing-xl) !important; }

/* -----------------------------------------------------------------------------
   Margin
   ----------------------------------------------------------------------------- */
.u-margin-0 { margin: 0 !important; }
.u-margin-xs { margin: var(--spacing-xs) !important; }
.u-margin-sm { margin: var(--spacing-sm) !important; }
.u-margin-md { margin: var(--spacing-md) !important; }
.u-margin-lg { margin: var(--spacing-lg) !important; }
.u-margin-xl { margin: var(--spacing-xl) !important; }
.u-margin-auto { margin: auto !important; }

.u-margin-top-0 { margin-top: 0 !important; }
.u-margin-top-xs { margin-top: var(--spacing-xs) !important; }
.u-margin-top-sm { margin-top: var(--spacing-sm) !important; }
.u-margin-top-md { margin-top: var(--spacing-md) !important; }
.u-margin-top-lg { margin-top: var(--spacing-lg) !important; }
.u-margin-top-xl { margin-top: var(--spacing-xl) !important; }

.u-margin-bottom-0 { margin-bottom: 0 !important; }
.u-margin-bottom-xs { margin-bottom: var(--spacing-xs) !important; }
.u-margin-bottom-sm { margin-bottom: var(--spacing-sm) !important; }
.u-margin-bottom-md { margin-bottom: var(--spacing-md) !important; }
.u-margin-bottom-lg { margin-bottom: var(--spacing-lg) !important; }
.u-margin-bottom-xl { margin-bottom: var(--spacing-xl) !important; }

.u-margin-left-0 { margin-left: 0 !important; }
.u-margin-left-xs { margin-left: var(--spacing-xs) !important; }
.u-margin-left-sm { margin-left: var(--spacing-sm) !important; }
.u-margin-left-md { margin-left: var(--spacing-md) !important; }
.u-margin-left-lg { margin-left: var(--spacing-lg) !important; }
.u-margin-left-xl { margin-left: var(--spacing-xl) !important; }
.u-margin-left-auto { margin-left: auto !important; }

.u-margin-right-0 { margin-right: 0 !important; }
.u-margin-right-xs { margin-right: var(--spacing-xs) !important; }
.u-margin-right-sm { margin-right: var(--spacing-sm) !important; }
.u-margin-right-md { margin-right: var(--spacing-md) !important; }
.u-margin-right-lg { margin-right: var(--spacing-lg) !important; }
.u-margin-right-xl { margin-right: var(--spacing-xl) !important; }
.u-margin-right-auto { margin-right: auto !important; }

.u-margin-x-auto { margin-left: auto !important; margin-right: auto !important; }

/* -----------------------------------------------------------------------------
   Padding
   ----------------------------------------------------------------------------- */
.u-padding-0 { padding: 0 !important; }
.u-padding-xs { padding: var(--spacing-xs) !important; }
.u-padding-sm { padding: var(--spacing-sm) !important; }
.u-padding-md { padding: var(--spacing-md) !important; }
.u-padding-lg { padding: var(--spacing-lg) !important; }
.u-padding-xl { padding: var(--spacing-xl) !important; }

.u-padding-top-0 { padding-top: 0 !important; }
.u-padding-top-xs { padding-top: var(--spacing-xs) !important; }
.u-padding-top-sm { padding-top: var(--spacing-sm) !important; }
.u-padding-top-md { padding-top: var(--spacing-md) !important; }
.u-padding-top-lg { padding-top: var(--spacing-lg) !important; }
.u-padding-top-xl { padding-top: var(--spacing-xl) !important; }

.u-padding-bottom-0 { padding-bottom: 0 !important; }
.u-padding-bottom-xs { padding-bottom: var(--spacing-xs) !important; }
.u-padding-bottom-sm { padding-bottom: var(--spacing-sm) !important; }
.u-padding-bottom-md { padding-bottom: var(--spacing-md) !important; }
.u-padding-bottom-lg { padding-bottom: var(--spacing-lg) !important; }
.u-padding-bottom-xl { padding-bottom: var(--spacing-xl) !important; }

.u-padding-left-0 { padding-left: 0 !important; }
.u-padding-left-sm { padding-left: var(--spacing-sm) !important; }
.u-padding-left-md { padding-left: var(--spacing-md) !important; }
.u-padding-left-lg { padding-left: var(--spacing-lg) !important; }

.u-padding-right-0 { padding-right: 0 !important; }
.u-padding-right-sm { padding-right: var(--spacing-sm) !important; }
.u-padding-right-md { padding-right: var(--spacing-md) !important; }
.u-padding-right-lg { padding-right: var(--spacing-lg) !important; }

/* -----------------------------------------------------------------------------
   Width and Height
   ----------------------------------------------------------------------------- */
.u-width-full { width: 100% !important; }
.u-width-auto { width: auto !important; }
.u-width-screen { width: 100vw !important; }
.u-max-width-full { max-width: 100% !important; }
.u-min-width-0 { min-width: 0 !important; }

.u-height-full { height: 100% !important; }
.u-height-auto { height: auto !important; }
.u-height-screen { height: 100vh !important; }
.u-min-height-screen { min-height: 100vh !important; }

/* -----------------------------------------------------------------------------
   Text Utilities
   ----------------------------------------------------------------------------- */
.u-text-left { text-align: left !important; }
.u-text-center { text-align: center !important; }
.u-text-right { text-align: right !important; }

.u-text-xs { font-size: var(--font-size-xs) !important; }
.u-text-sm { font-size: var(--font-size-sm) !important; }
.u-text-base { font-size: var(--font-size-base) !important; }
.u-text-lg { font-size: var(--font-size-lg) !important; }
.u-text-xl { font-size: var(--font-size-xl) !important; }
.u-text-2xl { font-size: var(--font-size-2xl) !important; }
.u-text-3xl { font-size: var(--font-size-3xl) !important; }

.u-font-normal { font-weight: var(--font-weight-normal) !important; }
.u-font-medium { font-weight: var(--font-weight-medium) !important; }
.u-font-semibold { font-weight: var(--font-weight-semibold) !important; }
.u-font-bold { font-weight: var(--font-weight-bold) !important; }

.u-text-uppercase { text-transform: uppercase !important; }
.u-text-lowercase { text-transform: lowercase !important; }
.u-text-capitalize { text-transform: capitalize !important; }

.u-text-truncate {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.u-whitespace-nowrap { white-space: nowrap !important; }
.u-whitespace-normal { white-space: normal !important; }

.u-line-clamp-2 {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.u-line-clamp-3 {
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* Text colors */
.u-text-primary { color: var(--primary-color) !important; }
.u-text-secondary { color: var(--secondary-color) !important; }
.u-text-success { color: var(--success) !important; }
.u-text-warning { color: var(--warning) !important; }
.u-text-error { color: var(--error) !important; }
.u-text-info { color: var(--info) !important; }
.u-text-muted { color: var(--text-muted) !important; }
.u-text-light { color: var(--text-light) !important; }
.u-text-inverse { color: var(--text-inverse) !important; }

/* -----------------------------------------------------------------------------
   Background Utilities
   ----------------------------------------------------------------------------- */
.u-bg-transparent { background-color: transparent !important; }
.u-bg-white { background-color: var(--bg-color) !important; }
.u-bg-alt { background-color: var(--bg-alt) !important; }
.u-bg-dark { background-color: var(--bg-dark) !important; }
.u-bg-primary { background-color: var(--primary-color) !important; }
.u-bg-secondary { background-color: var(--secondary-color) !important; }
.u-bg-success { background-color: var(--success) !important; }
.u-bg-warning { background-color: var(--warning) !important; }
.u-bg-error { background-color: var(--error) !important; }
.u-bg-info { background-color: var(--info) !important; }

.u-bg-success-light { background-color: var(--success-light) !important; }
.u-bg-warning-light { background-color: var(--warning-light) !important; }
.u-bg-error-light { background-color: var(--error-light) !important; }
.u-bg-info-light { background-color: var(--info-light) !important; }

/* -----------------------------------------------------------------------------
   Border Utilities
   ----------------------------------------------------------------------------- */
.u-border { border: 1px solid var(--border-color) !important; }
.u-border-0 { border: 0 !important; }
.u-border-top { border-top: 1px solid var(--border-color) !important; }
.u-border-bottom { border-bottom: 1px solid var(--border-color) !important; }
.u-border-left { border-left: 1px solid var(--border-color) !important; }
.u-border-right { border-right: 1px solid var(--border-color) !important; }

.u-border-primary { border-color: var(--primary-color) !important; }
.u-border-success { border-color: var(--success) !important; }
.u-border-warning { border-color: var(--warning) !important; }
.u-border-error { border-color: var(--error) !important; }

.u-rounded-none { border-radius: 0 !important; }
.u-rounded-sm { border-radius: var(--radius-sm) !important; }
.u-rounded { border-radius: var(--radius) !important; }
.u-rounded-md { border-radius: var(--radius-md) !important; }
.u-rounded-lg { border-radius: var(--radius-lg) !important; }
.u-rounded-xl { border-radius: var(--radius-xl) !important; }
.u-rounded-full { border-radius: var(--radius-full) !important; }

/* -----------------------------------------------------------------------------
   Shadow Utilities
   ----------------------------------------------------------------------------- */
.u-shadow-none { box-shadow: none !important; }
.u-shadow-xs { box-shadow: var(--shadow-xs) !important; }
.u-shadow-sm { box-shadow: var(--shadow-sm) !important; }
.u-shadow-md { box-shadow: var(--shadow-md) !important; }
.u-shadow-lg { box-shadow: var(--shadow-lg) !important; }
.u-shadow-xl { box-shadow: var(--shadow-xl) !important; }

/* -----------------------------------------------------------------------------
   Positioning
   ----------------------------------------------------------------------------- */
.u-relative { position: relative !important; }
.u-absolute { position: absolute !important; }
.u-fixed { position: fixed !important; }
.u-sticky { position: sticky !important; }
.u-static { position: static !important; }

.u-top-0 { top: 0 !important; }
.u-right-0 { right: 0 !important; }
.u-bottom-0 { bottom: 0 !important; }
.u-left-0 { left: 0 !important; }
.u-inset-0 { inset: 0 !important; }

/* -----------------------------------------------------------------------------
   Z-Index
   ----------------------------------------------------------------------------- */
.u-z-0 { z-index: 0 !important; }
.u-z-10 { z-index: 10 !important; }
.u-z-20 { z-index: 20 !important; }
.u-z-30 { z-index: 30 !important; }
.u-z-40 { z-index: 40 !important; }
.u-z-50 { z-index: 50 !important; }
.u-z-auto { z-index: auto !important; }

/* -----------------------------------------------------------------------------
   Overflow
   ----------------------------------------------------------------------------- */
.u-overflow-auto { overflow: auto !important; }
.u-overflow-hidden { overflow: hidden !important; }
.u-overflow-visible { overflow: visible !important; }
.u-overflow-scroll { overflow: scroll !important; }
.u-overflow-x-auto { overflow-x: auto !important; }
.u-overflow-y-auto { overflow-y: auto !important; }
.u-overflow-x-hidden { overflow-x: hidden !important; }
.u-overflow-y-hidden { overflow-y: hidden !important; }

/* -----------------------------------------------------------------------------
   Cursor
   ----------------------------------------------------------------------------- */
.u-cursor-pointer { cursor: pointer !important; }
.u-cursor-default { cursor: default !important; }
.u-cursor-not-allowed { cursor: not-allowed !important; }
.u-cursor-move { cursor: move !important; }
.u-cursor-grab { cursor: grab !important; }

/* -----------------------------------------------------------------------------
   Pointer Events
   ----------------------------------------------------------------------------- */
.u-pointer-events-none { pointer-events: none !important; }
.u-pointer-events-auto { pointer-events: auto !important; }

/* -----------------------------------------------------------------------------
   User Select
   ----------------------------------------------------------------------------- */
.u-select-none { user-select: none !important; }
.u-select-text { user-select: text !important; }
.u-select-all { user-select: all !important; }

/* -----------------------------------------------------------------------------
   Opacity
   ----------------------------------------------------------------------------- */
.u-opacity-0 { opacity: 0 !important; }
.u-opacity-25 { opacity: 0.25 !important; }
.u-opacity-50 { opacity: 0.5 !important; }
.u-opacity-75 { opacity: 0.75 !important; }
.u-opacity-100 { opacity: 1 !important; }

/* -----------------------------------------------------------------------------
   Transitions
   ----------------------------------------------------------------------------- */
.u-transition { transition: all var(--transition-base) !important; }
.u-transition-fast { transition: all var(--transition-fast) !important; }
.u-transition-slow { transition: all var(--transition-slow) !important; }
.u-transition-none { transition: none !important; }

/* -----------------------------------------------------------------------------
   Animation
   ----------------------------------------------------------------------------- */
.u-animate-spin {
    animation: spin 1s linear infinite !important;
}

.u-animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite !important;
}

.u-animate-bounce {
    animation: bounce 1s infinite !important;
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
    50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}

/* -----------------------------------------------------------------------------
   Visibility
   ----------------------------------------------------------------------------- */
.u-visible { visibility: visible !important; }
.u-invisible { visibility: hidden !important; }

/* Screen reader only */
.u-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* -----------------------------------------------------------------------------
   Print Utilities
   ----------------------------------------------------------------------------- */
@media print {
    .u-print-hidden { display: none !important; }
    .u-print-block { display: block !important; }
    .u-print-break-before { page-break-before: always !important; }
    .u-print-break-after { page-break-after: always !important; }
    .u-print-avoid-break { page-break-inside: avoid !important; }
}

/* -----------------------------------------------------------------------------
   Schedule Planner
   ----------------------------------------------------------------------------- */

/* Week view table */
.planner-week-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.planner-week-table th,
.planner-week-table td {
    border: 1px solid #e5e7eb;
    padding: 8px;
    vertical-align: top;
    text-align: left;
}
.planner-week-table th {
    background: #f9fafb;
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
    white-space: nowrap;
}
.planner-week-table th.planner-day-header {
    cursor: pointer;
    transition: background 0.15s;
}
.planner-week-table th.planner-day-header:hover {
    background: #eff6ff;
    color: var(--primary-color);
}
.planner-week-table td {
    min-height: 60px;
    position: relative;
}
.planner-week-table td.planner-cell-empty {
    background: #fafafa;
}

/* Plan block card in week view */
.planner-block {
    position: relative;
    padding: 6px 8px;
    margin-bottom: 6px;
    border-radius: 6px;
    border-left: 4px solid var(--block-color, #6366f1);
    background: color-mix(in srgb, var(--block-color, #6366f1) 10%, white);
    font-size: 0.8rem;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.1s;
}
.planner-block:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}
.planner-block .planner-block-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}
.planner-block .planner-block-time {
    color: #6b7280;
    font-size: 0.75rem;
}
.planner-block .planner-block-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-top: 3px;
}
.planner-block .planner-block-badge.generated {
    background: #d1fae5;
    color: #065f46;
}

/* Empty cell placeholder */
.planner-add-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    color: #9ca3af;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    font-size: 1.2rem;
}
.planner-add-placeholder:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #eff6ff;
}

/* Day view grid */
.planner-day-grid {
    display: grid;
    grid-template-columns: 60px repeat(var(--room-count, 4), 1fr);
    gap: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}
.planner-day-grid .planner-time-label {
    padding: 4px 6px;
    font-size: 0.7rem;
    color: #6b7280;
    border-bottom: 1px solid #f3f4f6;
    text-align: right;
    background: #f9fafb;
}
.planner-day-grid .planner-room-header {
    padding: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    text-align: center;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    border-left: 1px solid #e5e7eb;
    color: #374151;
}
.planner-day-grid .planner-room-col {
    position: relative;
    border-left: 1px solid #e5e7eb;
    min-height: 30px;
    border-bottom: 1px solid #f3f4f6;
}
.planner-day-grid .planner-day-block {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 4px;
    border-left: 3px solid var(--block-color, #6366f1);
    background: color-mix(in srgb, var(--block-color, #6366f1) 12%, white);
    padding: 4px 6px;
    font-size: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    z-index: 2;
    transition: box-shadow 0.15s;
}
.planner-day-grid .planner-day-block:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 3;
}

/* Legend */
.planner-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.planner-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: #4b5563;
}
.planner-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

/* Action bar */
.planner-action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* Mobile: stacked cards */
@media (max-width: 1023px) {
    .planner-week-table { display: none; }
    .planner-day-grid { display: none; }
    .planner-mobile-cards { display: block !important; }
}
@media (min-width: 1024px) {
    .planner-mobile-cards { display: none !important; }
}

.planner-mobile-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-left: 4px solid var(--block-color, #6366f1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s;
}
.planner-mobile-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* -----------------------------------------------------------------------------
   Division Management Page
   ----------------------------------------------------------------------------- */
.division-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.division-stat-card {
    background: #fff;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: var(--radius, 0.5rem);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.division-progress-bar {
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}
.division-progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.5s ease;
}
.division-student-group {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem 0.5rem 0 0;
    cursor: pointer;
    text-align: left;
    font-size: 0.875rem;
}
.division-student-group:hover {
    background: #f3f4f6;
}
.division-readiness-dot {
    font-size: 0.75rem;
    letter-spacing: 1px;
}
.division-readiness-dot.dot-complete { color: #10b981; }
.division-readiness-dot.dot-partial  { color: #f59e0b; }
.division-readiness-dot.dot-none     { color: #d1d5db; }

@media (max-width: 768px) {
    .division-stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .division-stat-grid {
        grid-template-columns: 1fr;
    }
}


/* =============================================================================
   14. FORM BUILDER — Jotform-Style Design
   ============================================================================= */

/* ── Header ────────────────────────────────────────────────────────────────── */
.fb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 1.25rem;
    height: 52px;
    background: var(--bg-color);
    border-bottom: 1px solid #e5e7eb;
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width-collapsed);
    right: 0;
    z-index: 100;
    transition: left var(--transition-menu);
}
@media (max-width: 1023px) {
    .fb-header { left: 0; }
}
/* When nav sidebar expands on hover, push fixed elements right */
@media (min-width: 1024px) {
    .sidebar:hover ~ .content-wrapper .fb-header,
    .sidebar:hover ~ .content-container .fb-header {
        left: var(--sidebar-width-expanded);
    }
}
.fb-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}
.fb-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-decoration: none;
    white-space: nowrap;
}
.fb-back-link:hover { color: var(--primary-color); }
.fb-header-divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    flex-shrink: 0;
}
.fb-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fb-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.fb-header-actions .btn {
    border-radius: 9999px;
    padding: 0.375rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}
.fb-header-actions .btn-primary {
    background: var(--secondary-color);
    color: #fff;
}
.fb-header-actions .btn-primary:hover {
    background: var(--secondary-dark);
}
.fb-header-actions .btn-secondary {
    background: #1f2937;
    color: #fff;
    border: none;
}
.fb-header-actions .btn-secondary:hover {
    background: #374151;
}
.fb-btn-active {
    background-color: var(--primary-color) !important;
    color: #fff !important;
    border-color: var(--primary-color) !important;
}

/* ── Container ─────────────────────────────────────────────────────────────── */
.fb-container {
    min-height: calc(100vh - var(--header-height) - 52px);
    margin-top: calc(var(--header-height) + 52px);
    position: relative;
    background: #eef1f6;
}

/* ── Toolbox Panel ─────────────────────────────────────────────────────────── */
.fb-toolbox {
    background: var(--bg-color);
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: calc(var(--header-height) + 52px);
    left: var(--sidebar-width-collapsed);
    width: 260px;
    height: calc(100vh - var(--header-height) - 52px);
    overflow: hidden;
    z-index: 90;
    transition: left var(--transition-menu);
}
@media (max-width: 1023px) {
    .fb-toolbox { left: 0; }
}
@media (min-width: 1024px) {
    .sidebar:hover ~ .content-wrapper .fb-toolbox,
    .sidebar:hover ~ .content-container .fb-toolbox {
        left: var(--sidebar-width-expanded);
    }
}
.fb-toolbox-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-color);
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.fb-toolbox-header svg,
.fb-toolbox-header i { color: var(--primary-color); }
.fb-toolbox-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}
.fb-toolbox-category-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem 0.25rem 0.375rem;
    margin-top: 0.25rem;
}
.fb-toolbox-category-label:first-child { margin-top: 0; }

/* 2-column pill grid */
.fb-toolbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.fb-tool-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.625rem;
    border-radius: 9999px;
    background: var(--bg-alt);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-color);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}
.fb-tool-item:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}
.fb-tool-item:active {
    transform: scale(0.97);
}
.fb-tool-icon {
    color: var(--primary-color);
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}
.fb-tool-label {
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Hide the "Score" badge and footer in new design */
.fb-tool-badge { display: none; }
.fb-toolbox-footer { display: none; }

/* ── Toolbox Hover Previews ────────────────────────────────────────────────── */
.fb-tool-preview {
    display: none;
    position: fixed;
    z-index: 9999;
    width: 260px;
    padding: 0.875rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.14);
    border: 1px solid #e5e7eb;
    pointer-events: none;
}
.fb-tool-preview.fb-tp-visible { display: block; }
.fb-tool-preview-arrow {
    position: absolute;
    left: -6px;
    width: 12px;
    height: 12px;
    background: var(--bg-color);
    border-left: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    transform: rotate(45deg);
}
/* Preview content helpers */
.fb-tp-label { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.25rem; color: var(--text-color); }
.fb-tp-req { color: var(--error); font-weight: 400; }
.fb-tp-desc { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.625rem; line-height: 1.4; }
.fb-tp-slider { margin-bottom: 0.5rem; }
.fb-tp-slider-track { height: 6px; background: #e5e7eb; border-radius: 3px; position: relative; }
.fb-tp-slider-fill { position: absolute; left: 0; top: 0; height: 100%; width: 60%; background: var(--primary-color); border-radius: 3px; }
.fb-tp-slider-thumb { position: absolute; top: -4px; left: 60%; width: 14px; height: 14px; background: #fff; border: 2px solid var(--primary-color); border-radius: 50%; transform: translateX(-50%); }
.fb-tp-slider-labels { display: flex; justify-content: space-between; font-size: 0.6875rem; color: var(--text-light); margin-top: 0.25rem; }
.fb-tp-comment-hint { font-size: 0.6875rem; color: var(--text-light); font-style: italic; }
.fb-tp-select { display: flex; align-items: center; justify-content: space-between; padding: 0.375rem 0.625rem; border: 1px solid #e5e7eb; border-radius: var(--radius); font-size: 0.75rem; color: var(--text-light); background: var(--bg-alt); }
.fb-tp-textarea { border: 1px solid #e5e7eb; border-radius: var(--radius); height: 48px; background: var(--bg-alt); display: flex; align-items: start; padding: 0.375rem 0.5rem; }
.fb-tp-textarea-placeholder { font-size: 0.75rem; color: var(--text-light); }
.fb-tp-options { display: flex; flex-direction: column; gap: 0.375rem; }
.fb-tp-option { display: flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; color: var(--text-color); }
.fb-tp-radio { width: 14px; height: 14px; border: 2px solid #d1d5db; border-radius: 50%; flex-shrink: 0; }
.fb-tp-radio-on { border-color: var(--primary-color); background: radial-gradient(circle, var(--primary-color) 40%, transparent 41%); }
.fb-tp-checkbox { width: 14px; height: 14px; border: 2px solid #d1d5db; border-radius: 3px; flex-shrink: 0; }
.fb-tp-checkbox-on { border-color: var(--primary-color); background: var(--primary-color); position: relative; }
.fb-tp-checkbox-on::after { content: '✓'; position: absolute; top: -2px; left: 1px; font-size: 10px; color: #fff; }
.fb-tp-check-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.75rem; cursor: default; }
.fb-tp-table { width: 100%; border-collapse: collapse; font-size: 0.625rem; }
.fb-tp-table th, .fb-tp-table td { padding: 0.25rem 0.375rem; text-align: center; border: 1px solid #e5e7eb; }
.fb-tp-table th { background: var(--bg-alt); font-weight: 600; color: var(--text-muted); }
.fb-tp-table td:first-child { text-align: left; font-weight: 500; }
.fb-tp-input-mock { display: flex; align-items: center; justify-content: space-between; padding: 0.375rem 0.625rem; border: 1px solid #e5e7eb; border-radius: var(--radius); font-size: 0.75rem; color: var(--text-light); background: var(--bg-alt); }
.fb-tp-upload { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; padding: 0.75rem; border: 2px dashed #e5e7eb; border-radius: var(--radius); text-align: center; font-size: 0.75rem; color: var(--text-muted); }
.fb-tp-upload small { font-size: 0.625rem; color: var(--text-light); }
.fb-tp-signature {}
.fb-tp-sig-tabs { display: flex; gap: 0; margin-bottom: 0.375rem; }
.fb-tp-sig-tab { padding: 0.25rem 0.5rem; font-size: 0.6875rem; color: var(--text-muted); border: 1px solid #e5e7eb; cursor: default; }
.fb-tp-sig-tab:first-child { border-radius: 4px 0 0 4px; }
.fb-tp-sig-tab:last-child { border-radius: 0 4px 4px 0; }
.fb-tp-sig-tab.active { background: var(--primary-light); color: #fff; border-color: var(--primary-light); }
.fb-tp-sig-pad { height: 36px; border: 1px dashed #d1d5db; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.fb-tp-section-demo {}
.fb-tp-section-title { font-weight: 700; font-size: 0.875rem; color: var(--text-color); border-bottom: 2px solid var(--primary-color); padding-bottom: 0.25rem; margin-bottom: 0.25rem; }
.fb-tp-section-sub { font-size: 0.6875rem; color: var(--text-muted); }
.fb-tp-divider-demo { padding: 0.375rem 0; }
.fb-tp-placeholder-line { height: 8px; background: #f0f0f0; border-radius: 4px; margin-bottom: 0.5rem; }
.fb-tp-hr { border: none; border-top: 2px solid #d1d5db; margin: 0.375rem 0; }
.fb-tp-placeholder-line:last-child { margin-bottom: 0; }
.fb-tp-branding { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.fb-tp-branding-logo { width: 24px; height: 24px; background: var(--bg-alt); border-radius: var(--radius); border: 1px solid #e5e7eb; }
.fb-tp-branding-name { font-size: 0.75rem; font-weight: 600; color: var(--text-color); }
.fb-tp-form-header { background: var(--bg-alt); border-radius: var(--radius); padding: 0.5rem 0.625rem; }
.fb-tp-fh-name { font-size: 0.8125rem; font-weight: 700; color: var(--text-color); }
.fb-tp-fh-info { font-size: 0.625rem; color: var(--text-muted); margin-top: 0.125rem; }
.fb-tp-fh-sub { font-size: 0.625rem; color: var(--text-light); margin-top: 0.125rem; }
.fb-tp-repertoire { background: var(--bg-alt); border-radius: var(--radius); padding: 0.5rem 0.625rem; }
.fb-tp-rep-title { font-size: 0.75rem; font-weight: 600; color: var(--text-color); display: flex; align-items: center; gap: 0.25rem; margin-bottom: 0.375rem; }
.fb-tp-rep-piece { font-size: 0.6875rem; color: var(--text-muted); padding: 0.125rem 0; }
.fb-tp-rep-mvmts { font-size: 0.625rem; color: var(--text-light); padding-left: 0.5rem; }

/* ── Canvas Wrapper ────────────────────────────────────────────────────────── */
.fb-canvas-wrapper {
    padding: 1.5rem 2rem;
    margin-left: 260px;
    min-height: 0;
    overflow-y: auto;
    transition: margin-left 0.15s ease;
}
/* Full-width canvas when toolbox is hidden (preview mode) */
.fb-container:has(.fb-toolbox[style*="display: none"]) .fb-canvas-wrapper {
    margin-left: 0;
}

/* ── Form Metadata (shared by settings modal) ─────────────────────────────── */
.fb-meta-name-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.fb-meta-name-row .form-input { flex: 1; }

/* ── Canvas Toolbar ────────────────────────────────────────────────────────── */
.fb-canvas-toolbar {
    display: none; /* Hidden in new Jotform design */
}

/* ── Canvas ─────────────────────────────────────────────────────────────────── */
.fb-canvas-drop-wrapper {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    min-height: 300px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Canvas branding (logo + school name) */
.fb-canvas-branding {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
}
.fb-canvas-branding-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: var(--radius);
}
.fb-canvas-branding-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Canvas form title */
.fb-canvas-form-title {
    display: block;
    width: 100%;
    border: none;
    outline: none;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-color);
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
    background: transparent;
}
.fb-canvas-form-title::placeholder {
    color: var(--text-light);
}
.fb-canvas-form-title:focus {
    border-bottom: 2px solid var(--primary-color);
}

.fb-canvas {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-flow: dense;
    gap: 0.25rem;
}
/* Remove grid backgrounds */
.fb-grid-dot,
.fb-grid-line { background-image: none !important; }

/* Empty state */
.fb-canvas-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    text-align: center;
}
.fb-canvas-empty svg,
.fb-canvas-empty i { margin-bottom: 1rem; opacity: 0.4; }
.fb-canvas-empty-title { font-size: 1rem; font-weight: 600; color: var(--text-muted); margin-bottom: 0.25rem; }
.fb-canvas-empty-sub { font-size: 0.8125rem; color: var(--text-light); }

/* Submit button mockup at bottom of canvas */
.fb-canvas-submit-mock {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0 0.5rem;
}
.fb-canvas-submit-mock-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 2rem;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: default;
    opacity: 0.5;
    pointer-events: none;
}

/* ── Field Card Wrappers (hold card + add-between button) ──────────────────── */
.fb-field-wrapper {
    position: relative;
}

/* ── Inline Add Between Buttons ────────────────────────────────────────────── */
.fb-add-between {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    margin-bottom: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}
.fb-field-card:hover > .fb-add-between,
.fb-add-between:hover {
    opacity: 1;
}
.fb-add-between-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px dashed #d1d5db;
    background: var(--bg-color);
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 300;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.fb-add-between-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.06);
}

/* Bottom add button (after all fields) */
.fb-add-end {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}
.fb-add-end:hover { opacity: 1; }

/* ── Field Cards ───────────────────────────────────────────────────────────── */
.fb-field-card {
    position: relative;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    grid-column: span 12;
}
.fb-field-card.fb-col-6  { grid-column: span 6; }
.fb-field-card.fb-col-4  { grid-column: span 4; }
@media (max-width: 640px) {
    .fb-field-card.fb-col-6,
    .fb-field-card.fb-col-4 { grid-column: span 12; }
}
.fb-field-card:hover {
    border-color: rgba(var(--primary-color-rgb), 0.25);
    background: rgba(var(--primary-color-rgb), 0.02);
}
.fb-field-card.fb-field-selected {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.03);
}

/* Field header: hidden by default, shown on hover/select as floating toolbar */
.fb-field-header {
    position: absolute;
    top: -32px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-color);
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 10;
}
.fb-field-card:hover .fb-field-header,
.fb-field-card.fb-field-selected .fb-field-header {
    opacity: 1;
    pointer-events: auto;
}

.fb-field-header-left {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Hide these elements in new design */
/* Hide these elements in new design */
.fb-expand-toggle,
.fb-field-order,
.fb-field-card-label,
.fb-field-type-text { display: none; }

/* Drag handle — always accessible at left edge of card */
.fb-drag-handle {
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--text-light);
    padding: 0.375rem 0.125rem;
    border-radius: 0.25rem;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 5;
}
.fb-field-card:hover > .fb-drag-handle,
.fb-field-card.fb-field-selected > .fb-drag-handle {
    opacity: 1;
}
.fb-drag-handle:hover { color: var(--text-color); background: var(--bg-alt); }
.fb-drag-handle:active { cursor: grabbing; }

.fb-field-type-badge {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius);
    background: var(--bg-alt);
    color: var(--text-muted);
}
.fb-badge-scoring { background: rgba(var(--primary-color-rgb), 0.1); color: var(--primary-color); }
.fb-badge-input { background: rgba(20, 184, 166, 0.1); color: var(--secondary-color); }
.fb-badge-decorative { background: rgba(245, 158, 11, 0.1); color: var(--accent-color); }

.fb-field-actions {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}
.fb-field-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.1s ease;
}
.fb-field-action-btn:hover { background: var(--bg-alt); color: var(--text-color); }
.fb-field-action-delete:hover { background: rgba(239, 68, 68, 0.1); color: var(--error); }

/* Field body: always visible (never collapsed in new design) */
.fb-field-body {
    display: block !important;
}
.fb-field-card-collapsed .fb-field-body {
    display: block !important;
}

/* ── Decorative field types ────────────────────────────────────────────────── */
.fb-field-decorative { background: transparent; }
.fb-field-section-header {}
.fb-section-title {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.375rem;
    margin: 0;
}
.fb-section-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.fb-divider-line {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 0.5rem 0;
}

/* Form Header field */
.fb-field-form-header {}
.fb-fh-branding {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    text-align: center;
}
.fb-fh-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: var(--radius);
}
.fb-fh-school-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
}
.fb-fh-gradient {
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.06), rgba(var(--primary-color-rgb), 0.02));
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}
.fb-fh-name { font-size: 1.125rem; font-weight: 700; color: var(--text-color); text-align: center; }
.fb-fh-info { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.375rem 1rem; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.fb-fh-info-sub { color: var(--text-light); font-style: italic; }

/* Form Header text size variants */
.fb-fh-size-small .fb-fh-name { font-size: 0.9rem; }
.fb-fh-size-small .fb-fh-info { font-size: 0.675rem; }
.fb-fh-size-medium .fb-fh-name { font-size: 1.125rem; }
.fb-fh-size-medium .fb-fh-info { font-size: 0.75rem; }
.fb-fh-size-large .fb-fh-name { font-size: 1.5rem; }
.fb-fh-size-large .fb-fh-info { font-size: 0.875rem; }

/* Grade field (canvas card preview) */
.fb-field-preview-grade {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.375rem;
}
.fb-grade-input-mock {
    width: 3.5rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-color);
    background: var(--bg-color);
}
.fb-grade-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    font-weight: 800;
}
.fb-grade-a { color: #059669; }
.fb-grade-b { color: #2563eb; }
.fb-grade-c { color: #d97706; }
.fb-grade-d { color: #ea580c; }
.fb-grade-f { color: #dc2626; }

/* Grade field (preview panel) */
.fb-preview-grade-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.5rem;
}
.fb-preview-grade-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.fb-preview-grade-input {
    width: 3.75rem;
    padding: 0.35rem 0.4rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-color);
    background: var(--bg-color);
    transition: border-color 0.15s;
    -moz-appearance: textfield;
}
.fb-preview-grade-input::-webkit-inner-spin-button,
.fb-preview-grade-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fb-preview-grade-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1); }
.fb-preview-grade-range { font-size: 0.875rem; color: var(--text-muted); font-weight: 500; }
.fb-preview-grade-letter-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}
.fb-preview-grade-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.625rem;
    font-weight: 800;
    transition: color 0.2s;
}
.fb-preview-grade-scale {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.375rem;
    margin-top: 0.625rem;
}
.fb-preview-grade-tier {
    font-size: 0.675rem;
    padding: 0.125rem 0.5rem;
    border-radius: 1rem;
    background: var(--bg-alt);
    color: var(--text-muted);
}
.fb-preview-grade-tier.fb-grade-a { background: rgba(16,185,129,0.1); color: #059669; }
.fb-preview-grade-tier.fb-grade-b { background: rgba(59,130,246,0.1); color: #2563eb; }
.fb-preview-grade-tier.fb-grade-c { background: rgba(245,158,11,0.1); color: #d97706; }
.fb-preview-grade-tier.fb-grade-d { background: rgba(249,115,22,0.1); color: #ea580c; }
.fb-preview-grade-tier.fb-grade-f { background: rgba(239,68,68,0.1); color: #dc2626; }

/* Grade field (toolbox preview) */
.fb-tp-grade {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0.25rem;
}
.fb-tp-grade-input {
    width: 2.5rem;
    padding: 0.2rem 0.375rem;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-color);
    background: var(--bg-color);
}
.fb-tp-grade-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
}
.fb-tp-grade-b { background: #3b82f6; }
.fb-tp-grade-scale {
    font-size: 0.6rem;
    color: var(--text-light);
    margin-top: 0.125rem;
}

/* Repertoire field */
.fb-field-repertoire {}
.fb-rep-box {
    background: inherit;
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    border-left: 3px solid var(--accent-color);
}
.fb-field-card:not([style*="background"]) .fb-rep-box,
.fb-preview-field:not([style*="background"]) .fb-rep-box {
    background: var(--bg-alt);
}
.fb-rep-title { font-weight: 600; font-size: 0.875rem; color: var(--text-color); display: flex; align-items: center; gap: 0.375rem; margin-bottom: 0.5rem; }
.fb-rep-piece { padding: 0.25rem 0; }
.fb-rep-piece-title { font-size: 0.8125rem; color: var(--text-color); }
.fb-rep-piece-movements { font-size: 0.75rem; color: var(--text-muted); padding-left: 0.5rem; }
.fb-rep-num { font-weight: 600; color: var(--text-muted); margin-right: 0.25rem; }
.fb-rep-years { color: var(--text-muted); font-size: 0.875em; }
.fb-rep-mvmt-list {
    list-style-type: upper-roman;
    padding-left: 1.75rem;
    margin: 0.125rem 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.fb-rep-mvmt-list li { padding: 0.0625rem 0; padding-left: 0.25rem; }
/* Piece size variants */
.fb-rep-size-small .fb-rep-piece-title { font-size: 0.75rem; }
.fb-rep-size-small .fb-rep-piece-movements,
.fb-rep-size-small .fb-rep-mvmt-list { font-size: 0.6875rem; }
.fb-rep-size-large .fb-rep-piece-title { font-size: 1rem; }
.fb-rep-size-large .fb-rep-piece-movements,
.fb-rep-size-large .fb-rep-mvmt-list { font-size: 0.875rem; }

/* ── Standard field previews ───────────────────────────────────────────────── */
.fb-field-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}
.fb-required { color: var(--error); margin-left: 0.125rem; }
.fb-field-desc { font-size: 0.75rem; color: var(--text-muted); margin: 0.125rem 0 0.5rem; }

/* Slider / rating / score preview */
.fb-field-preview-slider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0;
}
.fb-mini-slider-track {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
}
.fb-mini-slider-range {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Stars mini preview (canvas) */
.fb-mini-stars {
    display: flex;
    gap: 0.125rem;
    align-items: center;
    margin-top: 0.25rem;
}
.fb-mini-star { font-size: 0.875rem; line-height: 1; }
.fb-mini-star.fb-star-filled { color: #f59e0b; }
.fb-mini-star.fb-star-empty  { color: #d1d5db; }

/* Circles mini preview (canvas) */
.fb-mini-circles {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}
.fb-mini-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid #d1d5db;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
}
.fb-mini-circle-active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}

/* Buttons mini preview (canvas) */
.fb-mini-buttons {
    display: flex;
    gap: 0.1875rem;
    align-items: center;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}
.fb-mini-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius);
    border: 1px solid #e5e7eb;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-color);
}
.fb-mini-button-active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

/* Rich text / text field preview (canvas mini) */
.fb-field-preview-richtext { margin-top: 0.25rem; }
.fb-richtext-mini-toolbar {
    display: flex;
    gap: 0.125rem;
    padding: 0.25rem 0.375rem;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--bg-alt);
}
.fb-rt-btn { font-size: 0.6875rem; padding: 0.125rem 0.375rem; color: var(--text-muted); cursor: default; }
.fb-rt-sep { width: 1px; background: #e5e7eb; margin: 0 0.25rem; }
.fb-field-preview-textarea {
    min-height: 32px;
    border: 1px solid #e5e7eb;
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--bg-alt);
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 0.25rem 0.375rem;
}
.fb-field-preview-textarea.fb-textarea-plain {
    border-radius: var(--radius);
}
.fb-textarea-placeholder {
    font-size: 0.6875rem;
    color: var(--text-light);
    font-style: italic;
}
.fb-char-count-mini {
    font-size: 0.625rem;
    color: var(--text-light);
    text-align: right;
    padding: 0.125rem 0.375rem;
}

/* Text comment preview (live) */
.fb-richtext-editor .ql-editor {
    min-height: calc(var(--quill-rows, 3) * 1.5em + 0.75rem);
}
.fb-preview-plain-textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    resize: vertical;
    background: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.15s ease;
}
.fb-preview-plain-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.15);
}
.fb-preview-char-count {
    font-size: 0.75rem;
    color: var(--text-light);
    text-align: right;
    padding-top: 0.25rem;
}
.fb-preview-helper-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
    font-style: italic;
}
.fb-prop-hint {
    font-size: 0.6875rem;
    color: var(--text-light);
    margin-top: 0.125rem;
}

/* Checkbox preview */
.fb-field-preview-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-color);
    padding: 0.25rem 0;
}
.fb-preview-checkbox-box {
    width: 16px;
    height: 16px;
    border: 2px solid #d1d5db;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Options (radio, dropdown, multi-select) */
.fb-field-preview-options {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.25rem 0;
}
.fb-preview-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--text-color);
}
.fb-preview-option-indicator {
    width: 14px;
    height: 14px;
    border: 2px solid #d1d5db;
    flex-shrink: 0;
}
.fb-indicator-circle { border-radius: 50%; }
.fb-indicator-square { border-radius: 3px; }
.fb-preview-more {
    font-size: 0.75rem;
    color: var(--text-light);
    padding-left: 1.875rem;
}

/* Rubric preview */
.fb-field-preview-rubric { padding: 0.25rem 0; }
.fb-preview-rubric-tag {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    background: var(--bg-alt);
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Date/time/input preview */
.fb-field-preview-input { padding: 0.25rem 0; }
.fb-preview-input-box {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: var(--text-light);
    background: var(--bg-alt);
}

/* Upload preview */
.fb-field-preview-upload {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px dashed #e5e7eb;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.8125rem;
    justify-content: center;
}

/* Signature preview */
.fb-field-preview-signature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px dashed #e5e7eb;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.8125rem;
    justify-content: center;
}

/* Field weight indicator */
.fb-field-weight {
    font-size: 0.6875rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px solid #f0f0f0;
}

/* ── Drag and Drop states ──────────────────────────────────────────────────── */
.fb-ghost {
    opacity: 0.4;
    border: 2px dashed var(--primary-color) !important;
    background: rgba(var(--primary-color-rgb), 0.05) !important;
}
.fb-ghost .fb-add-between,
.fb-ghost .fb-field-header,
.fb-ghost .fb-insert-popover { display: none !important; }
.fb-dragging {
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transform: rotate(1deg);
}
.fb-sortable-fallback {
    opacity: 0.9;
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
    transform: rotate(1.5deg);
    background: var(--bg-color);
    border-radius: 0.5rem;
    z-index: 9999;
}
.fb-dragging .fb-add-between,
.fb-dragging .fb-field-header { display: none !important; }
.fb-field-resizing {
    user-select: none;
    cursor: nwse-resize;
}

/* Resize handle (bottom-right corner of field card) */
.fb-resize-handle {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: nwse-resize;
    color: var(--text-light);
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 5;
}
.fb-field-card:hover .fb-resize-handle,
.fb-field-card.fb-field-selected .fb-resize-handle {
    opacity: 1;
}
.fb-resize-handle:hover {
    color: var(--primary-color);
}

/* ── Insert Field Popover ──────────────────────────────────────────────────── */
.fb-insert-popover {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    width: 320px;
    max-height: 360px;
    overflow-y: auto;
    background: var(--bg-color);
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.14);
    padding: 0.75rem;
}
.fb-insert-popover-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.25rem 0.5rem;
}
.fb-insert-popover-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem;
}
.fb-insert-popover-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.625rem;
    border-radius: 9999px;
    background: var(--bg-alt);
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-color);
    transition: all 0.1s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fb-insert-popover-item:hover {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}
.fb-insert-popover-item i,
.fb-insert-popover-item svg {
    color: var(--primary-color);
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}
.fb-insert-popover-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--radius);
}
.fb-insert-popover-close:hover { background: var(--bg-alt); color: var(--text-color); }

/* ── Form Settings Modal ───────────────────────────────────────────────────── */
.fb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}
.fb-settings-modal {
    background: var(--bg-color);
    border-radius: 0.75rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    width: 560px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fb-settings-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}
.fb-settings-modal-header h3 {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-color);
}
.fb-settings-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius);
}
.fb-settings-modal-close:hover { background: var(--bg-alt); color: var(--text-color); }
.fb-settings-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}
.fb-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.625rem;
}
.fb-settings-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.fb-settings-field .fb-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    margin-bottom: 0;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    background: var(--bg-color);
}
.fb-type-toggle { display: inline-flex; border: 1px solid #e5e7eb; border-radius: var(--radius); overflow: hidden; background: var(--bg-alt); }
.fb-type-toggle-btn { padding: 0.5rem 1.25rem; font-size: 0.8125rem; font-weight: 500; border: none; background: transparent; color: var(--text-muted); cursor: pointer; transition: all 0.15s; position: relative; }
.fb-type-toggle-btn:not(:last-child) { border-right: 1px solid #e5e7eb; }
.fb-type-toggle-btn:hover:not(.fb-type-toggle-active) { background: rgba(0,0,0,0.03); color: var(--text-color); }
.fb-type-toggle-active { background: var(--primary-color); color: #fff; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.fb-settings-input-with-toggle { display: flex; align-items: center; gap: 0.5rem; }
.fb-settings-input-with-toggle .form-input { flex: 1; min-width: 0; }
.fb-toggle-inline { display: inline-flex !important; align-items: center; padding: 0.4rem 0.625rem !important; border: 1px solid #e5e7eb; border-radius: var(--radius); background: var(--bg-color); gap: 0.375rem !important; font-size: 0.75rem !important; margin-bottom: 0 !important; white-space: nowrap; flex-shrink: 0; }
.fb-toggle-text { color: var(--text-muted); font-weight: 400; }
.fb-settings-field-wide { grid-column: span 3; }
.fb-settings-field-2col { grid-column: span 2; }
.fb-settings-modal-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #e5e7eb;
}
/* Color picker row */
.fb-color-picker-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}
.fb-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    padding: 2px;
    cursor: pointer;
    background: transparent;
    transition: border-color 0.15s ease;
}
.fb-color-swatch:hover { border-color: var(--text-muted); }
.fb-color-swatch-active { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2); }
.fb-color-swatch-inner {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.06);
}
.fb-color-custom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px dashed #d1d5db;
    cursor: pointer;
    color: var(--text-light);
    position: relative;
    overflow: hidden;
}
.fb-color-custom input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    border: none;
}
.fb-swatch-transparent {
    background: repeating-conic-gradient(#d1d5db 0% 25%, transparent 0% 50%) 50% / 8px 8px;
}
/* Icon picker */
.fb-icon-picker-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--bg-alt);
    border-radius: var(--radius);
    background: var(--bg-color);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-color);
    transition: border-color 0.15s ease;
}
.fb-icon-picker-toggle:hover { border-color: var(--text-light); }
.fb-icon-picker-toggle-left {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.fb-icon-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.375rem;
    padding: 0.375rem;
    border: 1px solid var(--bg-alt);
    border-radius: var(--radius);
    background: var(--bg-color);
}
.fb-icon-picker-btn,
.fb-icon-picker-none {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--bg-alt);
    border-radius: var(--radius);
    background: var(--bg-color);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}
.fb-icon-picker-btn:hover,
.fb-icon-picker-none:hover {
    border-color: var(--text-light);
    color: var(--text-color);
    background: var(--bg-alt);
}
.fb-icon-picker-active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.08);
    box-shadow: 0 0 0 1px rgba(var(--primary-color-rgb), 0.2);
}
.fb-field-label-icon {
    flex-shrink: 0;
    color: var(--primary-color);
    opacity: 0.7;
}
.fb-stroke-thickness {
    display: flex;
    gap: 0.25rem;
}
.fb-stroke-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.35rem 0.25rem;
    border: 1px solid var(--bg-alt);
    border-radius: var(--radius);
    background: var(--bg-color);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.fb-stroke-btn:hover { border-color: var(--text-light); }
.fb-stroke-btn-active { border-color: var(--primary-color); background: rgba(var(--primary-color-rgb), 0.04); }
.fb-stroke-preview {
    width: 100%;
    background: var(--text-color);
    border-radius: 1px;
}
.fb-stroke-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1;
}
@media (max-width: 640px) {
    .fb-settings-grid { grid-template-columns: 1fr; }
    .fb-settings-field-wide,
    .fb-settings-field-2col { grid-column: span 1; }
}

/* ── Properties Panel ──────────────────────────────────────────────────────── */
/* Toolbox/Properties content wrappers (inside .fb-toolbox) */
.fb-toolbox-content,
.fb-properties-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.fb-properties-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-color);
    flex-shrink: 0;
}
.fb-properties-close {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}
.fb-properties-close:hover { background: var(--bg-alt); }
.fb-properties-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem;
}
.fb-prop-type-badge { margin-bottom: 0.75rem; }
.fb-prop-group { margin-bottom: 0.75rem; }
.fb-prop-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.fb-prop-label-sm { font-size: 0.6875rem; }
.fb-prop-divider {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    padding-bottom: 0.375rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}
.fb-prop-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--text-color);
}
.fb-prop-toggle input[type="checkbox"] { accent-color: var(--primary-color); }
.fb-prop-row {
    display: flex;
    gap: 0.5rem;
}
.fb-prop-half { flex: 1; }
.fb-prop-hint {
    font-size: 0.6875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}
.fb-prop-option-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.375rem;
}
.fb-prop-option-row .form-input { flex: 1; }
.fb-prop-option-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    flex-shrink: 0;
}
.fb-prop-option-remove:hover { background: rgba(239, 68, 68, 0.1); color: var(--error); }
.fb-prop-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary-color);
    border: 1px dashed rgba(var(--primary-color-rgb), 0.3);
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
}
.fb-prop-add-btn:hover { background: rgba(var(--primary-color-rgb), 0.05); border-color: var(--primary-color); }

/* Alignment button group */
.fb-prop-btn-group {
    display: flex;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    overflow: hidden;
}
.fb-prop-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.375rem;
    background: var(--bg-color);
    border: none;
    border-right: 1px solid #e5e7eb;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.fb-prop-btn:last-child { border-right: none; }
.fb-prop-btn:hover { background: var(--bg-alt); color: var(--text-color); }
.fb-prop-btn.fb-prop-btn-active {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
}

/* Background type tabs (Solid / Gradient) */
.fb-prop-bg-tabs {
    display: flex;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.fb-prop-bg-tab {
    flex: 1;
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    text-align: center;
    background: var(--bg-color);
    border: none;
    border-right: 1px solid #e5e7eb;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
}
.fb-prop-bg-tab:last-child { border-right: none; }
.fb-prop-bg-tab:hover { background: var(--bg-alt); color: var(--text-color); }
.fb-prop-bg-tab.fb-prop-bg-tab-active {
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

/* Display Style selector grid */
.fb-prop-style-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
    margin-top: 0.25rem;
}
.fb-prop-style-grid-3 { grid-template-columns: repeat(3, 1fr); }
.fb-prop-style-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.25rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-muted);
}
.fb-prop-style-card:hover {
    border-color: rgba(var(--primary-color-rgb), 0.4);
    color: var(--text-color);
}
.fb-prop-style-card.fb-prop-style-active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.06);
    color: var(--primary-color);
}
.fb-prop-style-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}
.fb-prop-style-active .fb-prop-style-icon { color: var(--primary-color); }

/* Rubric cell editor */
.fb-rubric-cell-editor { display: flex; flex-direction: column; gap: 0.75rem; }
.fb-rubric-row-editor { }
.fb-rubric-row-label { font-size: 0.75rem; font-weight: 600; color: var(--text-color); margin-bottom: 0.375rem; }
.fb-rubric-cells { display: flex; flex-direction: column; gap: 0.375rem; }
.fb-rubric-cell-input { }
.fb-rubric-cell-label { display: block; font-size: 0.625rem; color: var(--text-light); margin-bottom: 0.125rem; }

/* ── Toggle (show on form) ─────────────────────────────────────────────────── */
.fb-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}
.fb-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.fb-toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: #d1d5db;
    border: 1px solid #b0b5bd;
    border-radius: 9999px;
    transition: background 0.2s ease, border-color 0.2s ease;
    flex-shrink: 0;
}
.fb-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.2s ease;
}
.fb-toggle-input:checked + .fb-toggle-switch {
    background: var(--primary-color);
    border-color: var(--primary-dark);
}
.fb-toggle-input:checked + .fb-toggle-switch::after {
    transform: translateX(16px);
}

/* ── Toast Notifications ───────────────────────────────────────────────────── */
.fb-toast {
    position: fixed;
    top: 64px;
    right: 1.5rem;
    z-index: 200;
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}
.fb-toast-success { background: var(--success); }
.fb-toast-error { background: var(--error); }
.fb-toast-warning { background: var(--warning); }
.fb-toast-info { background: var(--info); }

/* ── Preview mode ──────────────────────────────────────────────────────────── */
.fb-preview-scaler {
    width: 100%;
    margin: 0 auto;
}
.fb-preview {
    padding: 1.5rem;
    border-radius: 0.75rem;
    min-height: 400px;
}
.fb-preview-form {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-flow: dense;
    gap: 0.5rem;
    max-width: 900px;
    margin: 0 auto;
}

/* Preview field grid */
.fb-preview-field { grid-column: span 12; display: flex; }
.fb-preview-field.fb-preview-col-6 { grid-column: span 6; }
.fb-preview-field.fb-preview-col-4 { grid-column: span 4; }
.fb-preview-form > .fb-canvas-branding { grid-column: span 12; }
.fb-preview-title-block { grid-column: span 12; }
.fb-preview-submit { grid-column: span 12; }
.fb-preview-empty { grid-column: span 12; text-align: center; color: var(--text-muted); padding: 3rem; }

/* Preview title */
.fb-preview-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 0.25rem;
}
.fb-preview-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}
.fb-preview-title-block {
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Preview section header */
.fb-preview-section-header {
    padding: 0.5rem 0;
}
.fb-preview-section-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0;
    padding-bottom: 0.375rem;
    border-bottom: 2px solid var(--primary-color);
}
.fb-preview-section-header p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0.375rem 0 0;
}

/* Preview divider */
.fb-preview-divider {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 0.25rem 0;
}

/* Preview criterion card (rating, score, dropdown, rubric) */
.fb-preview-field > div { width: 100%; }
.fb-preview-criterion-card {
    background: inherit;
    border-radius: 0.625rem;
    padding: 0.875rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.fb-preview-field:not([style*="background"]) .fb-preview-criterion-card {
    background: var(--bg-color);
}
.fb-preview-criterion-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.fb-preview-criterion-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}
.fb-preview-criterion-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.fb-preview-criterion-title i,
.fb-preview-criterion-title svg {
    color: var(--primary-color);
    flex-shrink: 0;
}
.fb-preview-criterion-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
}
.fb-preview-criterion-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
}

/* Preview score value (big number) */
.fb-preview-score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 2.5rem;
    text-align: center;
    background: rgba(var(--primary-color-rgb), 0.08);
    border-radius: var(--radius);
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

/* Preview slider */
.fb-preview-slider-container {
    margin: 0.75rem 0 0.5rem;
}
.fb-slider-wrap {
    position: relative;
    padding: 0.25rem 0;
}
.fb-preview-slider-container input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #ef4444 0%, #f59e0b 50%, #10b981 100%);
    outline: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
}
.fb-preview-slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    border: none;
    box-shadow: none;
}
.fb-preview-slider-container input[type="range"]::-moz-range-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    border: none;
    box-shadow: none;
}
.fb-slider-bubble {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    border: 2px solid #fff;
}

/* Preview comment area */
.fb-preview-criterion-comment {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}
.fb-preview-criterion-comment textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    font-size: 0.8125rem;
    resize: vertical;
    background: var(--bg-alt);
    color: var(--text-muted);
}

/* Preview criterion (non-card: text, checkbox, radio, multi_select, date, time, upload, signature) */
.fb-preview-criterion {
    background: inherit;
    border-radius: 0.625rem;
    padding: 0.875rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
}
.fb-preview-field:not([style*="background"]) .fb-preview-criterion {
    background: var(--bg-color);
}

/* Preview checkbox label */
.fb-preview-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-color);
    cursor: default;
}
.fb-preview-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* Preview option lists (radio, multi_select) */
.fb-preview-options-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.fb-preview-radio-option,
.fb-preview-checkbox-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-color);
    cursor: default;
}
.fb-preview-radio-option input,
.fb-preview-checkbox-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* Preview upload zone */
.fb-preview-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 1.5rem;
    border: 2px dashed #d1d5db;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}
.fb-preview-upload-zone i,
.fb-preview-upload-zone svg {
    color: var(--primary-color);
    opacity: 0.6;
}
.fb-preview-upload-zone small {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Preview signature pad */
.fb-preview-signature-pad {
    margin-top: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius);
    overflow: hidden;
}
.fb-preview-signature-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: var(--bg-alt);
}
.fb-preview-signature-tab {
    flex: 1;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    color: var(--text-muted);
    border-right: 1px solid #e5e7eb;
    cursor: default;
}
.fb-preview-signature-tab:last-child { border-right: none; }
.fb-preview-signature-tab.active {
    background: var(--bg-color);
    color: var(--primary-color);
    font-weight: 600;
}
.fb-preview-signature-canvas {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    font-size: 0.875rem;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 2px solid var(--text-light);
    margin: 0 1rem 1rem;
}

/* Interactive score tick marks (preview slider labels) */
.fb-preview-score-labels {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.125rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.fb-preview-score-tick {
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    transition: all 0.15s ease;
    cursor: default;
}
.fb-preview-score-tick.fb-tick-active {
    background: rgba(var(--primary-color-rgb), 0.12);
    color: var(--primary-color);
    font-weight: 600;
}

/* Interactive preview controls */
.fb-preview-slider-container input[type="range"] { cursor: pointer; }
.fb-preview-checkbox-label { cursor: pointer; }
.fb-preview-radio-option,
.fb-preview-checkbox-option { cursor: pointer; }
.fb-preview-signature-tab { cursor: pointer; transition: background 0.15s, color 0.15s; }
.fb-preview-signature-tab:hover { background: rgba(var(--primary-color-rgb), 0.04); }

/* Stars interactive preview */
.fb-preview-stars-row {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    padding: 0.75rem 0 0.25rem;
}
.fb-preview-star-btn {
    background: none;
    border: none;
    padding: 0.125rem;
    cursor: pointer;
    color: #d1d5db;
    transition: color 0.15s ease, transform 0.15s ease;
    line-height: 0;
}
.fb-preview-star-btn:hover { transform: scale(1.2); }
.fb-preview-star-btn.fb-star-active {
    color: #f59e0b;
}
.fb-preview-star-btn.fb-star-active i,
.fb-preview-star-btn.fb-star-active svg {
    fill: #f59e0b;
}

/* Circles interactive preview */
.fb-preview-circles-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 0 0.25rem;
    flex-wrap: wrap;
}
.fb-preview-circle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}
.fb-preview-circle-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.04);
}
.fb-preview-circle-btn.fb-circle-active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.3);
}

/* Buttons interactive preview */
.fb-preview-buttons-row {
    display: flex;
    gap: 0.375rem;
    align-items: stretch;
    padding: 0.75rem 0 0.25rem;
    flex-wrap: wrap;
}
.fb-preview-score-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 2px solid #e5e7eb;
    background: var(--bg-color);
    cursor: pointer;
    transition: all 0.15s ease;
    flex: 1;
    max-width: 120px;
}
.fb-preview-score-btn:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.04);
}
.fb-preview-score-btn.fb-score-btn-active {
    border-color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb), 0.15);
}
.fb-score-btn-num {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}
.fb-score-btn-active .fb-score-btn-num { color: var(--primary-color); }
.fb-score-btn-label {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
    text-align: center;
    line-height: 1.2;
}
.fb-score-btn-active .fb-score-btn-label { color: var(--primary-color); }

/* Preview rubric table */
.fb-preview-rubric-table-wrapper { overflow-x: auto; margin-top: 0.75rem; }
.fb-preview-rubric-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.fb-preview-rubric-table th,
.fb-preview-rubric-table td {
    padding: 0.5rem 0.625rem;
    border: 1px solid #e5e7eb;
    text-align: center;
    vertical-align: top;
}
.fb-preview-rubric-table thead th {
    background: var(--bg-alt);
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-color);
}
.fb-preview-rubric-table thead th small {
    display: block;
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.6875rem;
}
.fb-preview-rubric-table .fb-rubric-row-header {
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    background: var(--bg-alt);
    min-width: 100px;
}
.fb-preview-rubric-table .fb-rubric-cell-select {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}
.fb-preview-rubric-table .fb-rubric-cell-select input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
}
.fb-preview-rubric-table .fb-rubric-cell-desc {
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.3;
}
.fb-preview-rubric-table td.fb-rubric-cell-selected {
    background: rgba(var(--primary-color-rgb), 0.08);
}
.fb-preview-rubric-table td { cursor: pointer; transition: background 0.15s; }
.fb-preview-rubric-table td:not(.fb-rubric-row-header):hover {
    background: rgba(var(--primary-color-rgb), 0.04);
}

/* ── Small form inputs ─────────────────────────────────────────────────────── */
.form-input-sm { font-size: 0.8125rem; padding: 0.3125rem 0.5rem; }
.form-input-xs { width: 52px; font-size: 0.75rem; padding: 0.25rem 0.375rem; text-align: center; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .fb-toolbox {
        width: 220px;
    }
    .fb-canvas-wrapper {
        margin-left: 220px;
        padding: 1rem;
    }
    .fb-container:has(.fb-toolbox[style*="display: none"]) .fb-canvas-wrapper {
        margin-left: 0;
    }
    .fb-toolbox-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .fb-header {
        padding: 0 0.75rem;
    }
    .fb-toolbox {
        width: 200px;
    }
    .fb-canvas-wrapper {
        margin-left: 200px;
        padding: 0.75rem;
    }
    .fb-container:has(.fb-toolbox[style*="display: none"]) .fb-canvas-wrapper {
        margin-left: 0;
    }
    .fb-canvas-drop-wrapper {
        padding: 1rem;
    }
    .fb-canvas-form-title {
        font-size: 1.25rem;
    }
}

/* =============================================================================
   13b. FORM BUILDER - Scale Proficiency Grid
   ============================================================================= */

/* ── Canvas: Key Randomizer (scale_keys) — playing-card style matching proficiency_evaluation.php ── */
.fb-field-scale-keys { padding: 0.75rem; }
.fb-sk-header { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.875rem; color: var(--text-color); margin-bottom: 0.625rem; }
.fb-sk-keys { display: flex; flex-wrap: nowrap; gap: 0.5rem; justify-content: center; margin-top: 0.25rem; }
.fb-sk-key { position: relative; display: flex; align-items: center; justify-content: center; width: 56px; aspect-ratio: 1; background: #fff; border: 2px solid #333; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.fb-sk-key::before { content: ''; position: absolute; top: 25%; left: 0; right: 0; height: 50%; background: repeating-linear-gradient(transparent, transparent 6px, #ddd 6px, #ddd 7.5px); z-index: 0; }
.fb-sk-key-letter { position: relative; z-index: 1; font-size: 1rem; font-weight: 700; color: #333; }
.fb-sk-key-num { position: absolute; top: 3px; right: 5px; font-size: 0.5rem; color: #666; z-index: 2; }
.fb-sk-key-label { position: absolute; bottom: 3px; left: 0; right: 0; font-size: 0.4rem; color: #888; text-align: center; z-index: 2; }
.fb-sk-key-more { border-style: dashed; border-color: #aaa; box-shadow: none; }
.fb-sk-key-more::before { display: none; }
.fb-sk-key-more .fb-sk-key-letter { color: var(--text-muted); font-size: 0.75rem; }

/* ── Canvas: Scale Eval Grid (scale_eval_grid) ──────────────── */
.fb-field-scale-eval-grid { padding: 0.75rem; }
.fb-seg-header { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 0.875rem; color: var(--text-color); margin-bottom: 0.625rem; }
.fb-seg-stats { display: flex; gap: 0.75rem; margin-bottom: 0.5rem; }
.fb-seg-stat { background: rgba(0,0,0,0.04); border-radius: var(--radius); padding: 0.375rem 0.625rem; text-align: center; flex: 1; }
.fb-seg-stat-val { display: block; font-weight: 700; font-size: 1.125rem; color: var(--primary-color); }
.fb-seg-stat-label { display: block; font-size: 0.625rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.fb-seg-elements { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: 0.5rem; }
.fb-seg-element-tag { background: rgba(var(--primary-color-rgb), 0.08); color: var(--primary-color); font-size: 0.6875rem; padding: 0.125rem 0.5rem; border-radius: 999px; font-weight: 500; }
.fb-seg-element-arp { background: rgba(var(--secondary-color-rgb), 0.1); color: var(--secondary-color); }
.fb-seg-mini-grid { overflow: hidden; border-radius: 0.375rem; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.fb-seg-mini-grid table { width: 100%; font-size: 0.6875rem; border-collapse: separate; border-spacing: 0; background: inherit; }
.fb-field-card:not([style*="background"]) .fb-seg-mini-grid table { background: #fff; }
.fb-seg-mini-grid thead { background: #f3f4f6; }
.fb-seg-mini-grid th { padding: 0.25rem 0.375rem; text-align: center; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid #e5e7eb; }
.fb-seg-mini-grid td { padding: 0.25rem 0.375rem; text-align: center; border-bottom: 1px solid #e5e7eb; }
.fb-seg-mini-grid tbody tr:last-child td { border-bottom: none; }
.fb-seg-mini-grid td:first-child { text-align: left; font-weight: 600; }
.fb-seg-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e5e7eb; }
.fb-seg-dot.fb-seg-pass { background: var(--success); }
.fb-seg-dot.fb-seg-fail { background: var(--error); }
.fb-seg-features { margin-top: 0.375rem; }
.fb-seg-feature-tag { font-size: 0.625rem; color: var(--text-muted); font-style: italic; }

/* ── Preview: Key Randomizer — playing-card style matching proficiency_evaluation.php ── */
.fb-preview-scale-keys { background: inherit; border: 1px solid #e5e7eb; border-radius: var(--radius); padding: 1.25rem; }
.fb-preview-field:not([style*="background"]) .fb-preview-scale-keys { background: #fff; }
.fb-preview-sk-header { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1rem; margin-bottom: 1rem; color: var(--text-color); }
.fb-preview-sk-keys { display: flex; gap: 0.75rem; flex-wrap: nowrap; justify-content: center; }
.fb-preview-sk-key { position: relative; flex: 1; aspect-ratio: 1; max-width: 100px; background: #fff; border: 3px solid #333; border-radius: 15px; display: flex; align-items: center; justify-content: center; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,0.25); transition: transform 0.2s, box-shadow 0.2s; }
.fb-preview-sk-key:hover { transform: scale(1.05) rotate(-2deg); box-shadow: 0 10px 24px rgba(0,0,0,0.35); }
.fb-preview-sk-key::before { content: ''; position: absolute; top: 25%; left: 0; right: 0; height: 50%; background: repeating-linear-gradient(transparent, transparent 8px, #ddd 8px, #ddd 10px); z-index: 0; }
.fb-preview-sk-key-letter { position: relative; z-index: 1; font-size: 1.5rem; font-weight: 700; color: #333; }
.fb-preview-sk-key-num { position: absolute; top: 0.35rem; right: 0.4rem; font-size: 0.7rem; color: #333; z-index: 2; }
.fb-preview-sk-key-label { position: absolute; bottom: 0.35rem; left: 0; right: 0; font-size: 0.55rem; color: #666; text-align: center; z-index: 2; }
.fb-preview-sk-key-more { border-style: dashed; border-color: #aaa; box-shadow: none; }
.fb-preview-sk-key-more::before { display: none; }
.fb-preview-sk-key-more .fb-preview-sk-key-letter { color: var(--text-muted); font-size: 1rem; }
.fb-preview-sk-key-evaluated { background: rgba(var(--secondary-color-rgb, 20, 184, 166), 0.15); border-color: var(--secondary-color); }
.fb-preview-sk-key-evaluated .fb-preview-sk-key-letter { color: var(--secondary-dark); }
.fb-preview-sk-key-evaluated .fb-preview-sk-key-label { color: var(--secondary-dark); font-weight: 600; }
.fb-preview-sk-key-evaluated::before { background: repeating-linear-gradient(transparent, transparent 8px, rgba(var(--secondary-color-rgb, 20, 184, 166), 0.2) 8px, rgba(var(--secondary-color-rgb, 20, 184, 166), 0.2) 10px); }

/* ── Preview: Scale Eval Grid — matching proficiency_evaluation.php table ── */
.fb-preview-scale-eval-grid { background: inherit; border: 1px solid #e5e7eb; border-radius: var(--radius); padding: 1.25rem; }
.fb-preview-field:not([style*="background"]) .fb-preview-scale-eval-grid { background: #fff; }
.fb-preview-seg-empty { text-align: center; padding: 2rem 1rem; color: var(--text-muted); }
.fb-preview-seg-empty i, .fb-preview-seg-empty svg { color: #d1d5db; margin: 0 auto 0.75rem; display: block; }
.fb-preview-seg-empty p { margin: 0.25rem 0; font-size: 0.875rem; }
.fb-preview-seg-empty p:first-of-type { font-size: 0.9375rem; }
.fb-preview-seg-header { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: 1rem; margin-bottom: 0.75rem; color: var(--text-color); }
.fb-preview-seg-grid-wrap { overflow-x: auto; margin-bottom: 0.75rem; border-radius: 0.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden; }
.fb-preview-seg-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8125rem; background: inherit; }
.fb-preview-field:not([style*="background"]) .fb-preview-seg-table { background: #fff; }
.fb-preview-seg-table thead { background: #f3f4f6; }
.fb-preview-seg-table th { padding: 0.625rem 0.5rem; text-align: center; font-weight: 600; color: #374151; border-bottom: 2px solid #e5e7eb; font-size: 0.75rem; }
.fb-preview-seg-table td { padding: 0.5rem; text-align: center; border-bottom: 1px solid #e5e7eb; }
.fb-preview-seg-table tbody tr:last-child td { border-bottom: none; }
.fb-preview-seg-table tbody tr:hover { background: #f9fafb; }
.fb-preview-seg-table td:first-child { text-align: left; font-weight: 500; }
.fb-preview-seg-badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 999px; font-size: 0.6875rem; font-weight: 600; }
.fb-preview-seg-pass { background: rgba(16, 185, 129, 0.12); color: #059669; }
.fb-preview-seg-fail { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.fb-preview-seg-pending { background: var(--bg-alt); color: var(--text-light); }
.fb-preview-seg-progress { margin-bottom: 0.5rem; }
.fb-preview-seg-progress-bar { height: 8px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-bottom: 0.375rem; }
.fb-preview-seg-progress-fill { height: 100%; background: linear-gradient(135deg, var(--success), #059669); border-radius: 999px; transition: width 0.3s ease; }
.fb-preview-seg-progress-text { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--text-muted); }
.fb-preview-seg-verdict { font-weight: 600; padding: 0.125rem 0.5rem; border-radius: 0.25rem; font-size: 0.75rem; }
.fb-preview-seg-verdict.fb-preview-seg-pass { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.fb-preview-seg-verdict.fb-preview-seg-fail { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.fb-preview-seg-note { display: flex; align-items: center; gap: 0.25rem; font-size: 0.6875rem; color: var(--text-muted); padding-top: 0.375rem; border-top: 1px solid #f3f4f6; }

/* ── Toolbox hover: Key Randomizer — mini playing-card style ── */
.fb-tp-scale-keys { margin-top: 0.375rem; }
.fb-tp-sk-keys { display: flex; gap: 0.25rem; justify-content: center; margin-bottom: 0.375rem; }
.fb-tp-sk-key { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 1.75rem; height: 1.75rem; border-radius: 5px; background: #fff; border: 1.5px solid #333; font-weight: 700; font-size: 0.625rem; color: #333; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.15); }
.fb-tp-sk-key::before { content: ''; position: absolute; top: 25%; left: 0; right: 0; height: 50%; background: repeating-linear-gradient(transparent, transparent 4px, #ddd 4px, #ddd 5px); z-index: 0; }
.fb-tp-sk-key span { position: relative; z-index: 1; }

/* ── Toolbox hover: Scale Eval Grid ─────────────────────────── */
.fb-tp-scale-eval-grid { margin-top: 0.375rem; }
.fb-tp-seg-pass { color: var(--success); font-weight: 700; font-size: 0.75rem; }
.fb-tp-seg-fail { color: var(--error); font-weight: 700; font-size: 0.75rem; }
.fb-tp-seg-empty { color: var(--text-light); font-size: 0.75rem; }
.fb-tp-seg-modes { font-size: 0.5625rem; color: var(--text-muted); text-align: center; margin-top: 0.25rem; font-style: italic; }

/* ── Canvas: Scale Eval Grid — Checkbox mode (mini checkboxes in table) ── */
.fb-seg-cb { width: 0.875rem; height: 0.875rem; accent-color: var(--primary-color); cursor: default; }

/* ── Canvas: Scale Eval Grid — Attempts mode (compact key sections) ── */
.fb-seg-att-section { background: #fff; border-radius: 0.375rem; box-shadow: 0 1px 2px rgba(0,0,0,0.08); margin-bottom: 0.375rem; overflow: hidden; }
.fb-seg-att-header { background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%); color: #fff; padding: 0.25rem 0.5rem; font-size: 0.6875rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.fb-seg-att-count { font-size: 0.5625rem; font-weight: 500; opacity: 0.9; }
.fb-seg-att-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.fb-seg-att-cell { border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 0.25rem 0.375rem; }
.fb-seg-att-cell:nth-child(3n) { border-right: none; }
.fb-seg-att-cell:nth-last-child(-n+3) { border-bottom: none; }
.fb-seg-att-label { font-size: 0.5625rem; font-weight: 600; color: #374151; margin-bottom: 0.125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-seg-att-toggles { display: flex; gap: 0.125rem; }
.fb-seg-att-toggle { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1rem; border: 1.5px solid #d1d5db; border-radius: 0.15rem; font-size: 0.5rem; font-weight: 700; background: #fff; }
.fb-seg-att-toggle.val-pass { background: #d1fae5; border-color: #34d399; color: #065f46; }
.fb-seg-att-toggle.val-fail { background: #fee2e2; border-color: #f87171; color: #991b1b; }
.fb-seg-att-note { font-size: 0.5625rem; color: var(--text-muted); text-align: center; margin-top: 0.25rem; font-style: italic; }

/* ── Preview: Scale Eval Grid — Checkbox mode (full-size checkboxes) ── */
.fb-preview-seg-cb { width: 1.25rem; height: 1.25rem; accent-color: var(--primary-color); cursor: pointer; }
.fb-preview-seg-cb-table th { font-size: 0.75rem; white-space: nowrap; }

/* ── Preview: Scale Eval Grid — Attempts mode (full-size key sections) ── */
.fb-preview-seg-att-section { background: #fff; border-radius: 0.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 0.75rem; overflow: hidden; }
.fb-preview-seg-att-header { background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%); color: #fff; padding: 0.6rem 1rem; font-size: 1rem; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.fb-preview-seg-att-count { font-size: 0.8rem; font-weight: 500; opacity: 0.9; }
.fb-preview-seg-att-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.fb-preview-seg-att-cell { border-right: 1px solid #e5e7eb; border-bottom: 1px solid #e5e7eb; padding: 0.5rem 0.6rem; }
.fb-preview-seg-att-cell:nth-child(3n) { border-right: none; }
.fb-preview-seg-att-cell:nth-last-child(-n+3) { border-bottom: none; }
.fb-preview-seg-att-label { font-weight: 600; font-size: 0.8rem; color: #1f2937; margin-bottom: 0.35rem; display: flex; align-items: center; justify-content: space-between; }
.fb-preview-seg-att-result { font-size: 0.65rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 0.2rem; display: inline-block; }
.fb-preview-seg-att-result.result-pass { background: #d1fae5; color: #065f46; }
.fb-preview-seg-att-result.result-fail { background: #fee2e2; color: #991b1b; }
.fb-preview-seg-att-result.result-pending { background: #f3f4f6; color: #d1d5db; }
.fb-preview-seg-att-attempts { display: flex; gap: 0.3rem; align-items: center; }
.fb-preview-seg-att-attempt-group { display: inline-flex; align-items: center; gap: 0.15rem; }
.fb-preview-seg-att-num { font-size: 0.65rem; color: #9ca3af; font-weight: 500; min-width: 0.6rem; }
.fb-preview-seg-att-toggle { width: 2rem; height: 1.6rem; border: 2px solid #d1d5db; border-radius: 0.25rem; font-size: 0.72rem; font-weight: 700; background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.15s; padding: 0; line-height: 1; user-select: none; }
.fb-preview-seg-att-toggle:hover { border-color: #9ca3af; background-color: #f9fafb; }
.fb-preview-seg-att-toggle.val-pass { background: #d1fae5; border-color: #34d399; color: #065f46; }
.fb-preview-seg-att-toggle.val-fail { background: #fee2e2; border-color: #f87171; color: #991b1b; }
.fb-preview-seg-att-comment { margin-top: 0.3rem; }
.fb-preview-seg-att-comment textarea { width: 100%; padding: 0.2rem 0.4rem; border: 1px solid #e5e7eb; border-radius: 0.25rem; font-size: 0.72rem; resize: none; min-height: 1.3rem; color: #9ca3af; }

/* =============================================================================
   13. SUCCESS MODAL
   ============================================================================= */

.success-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    animation: successModalFadeIn 0.3s ease forwards;
}

.success-modal-overlay.closing {
    animation: successModalFadeOut 0.3s ease forwards;
}

.success-modal {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem 3rem;
    text-align: center;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    animation: successModalPop 0.3s ease forwards;
}

.success-modal-overlay.closing .success-modal {
    animation: successModalShrink 0.3s ease forwards;
}

.success-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: var(--success, #10b981);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: successModalCheck 0.4s ease 0.2s both;
}

.success-modal-icon svg {
    width: 32px;
    height: 32px;
    stroke: white;
    stroke-width: 3;
    fill: none;
}

.success-modal h3 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-color, #1f2937);
    margin: 0 0 0.5rem;
}

.success-modal p {
    font-size: 0.95rem;
    color: var(--text-muted, #6b7280);
    margin: 0 0 1.5rem;
}

.success-modal-timer {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.success-modal-timer-bar {
    height: 100%;
    background: var(--success, #10b981);
    border-radius: 2px;
    animation: successModalTimer 3s linear forwards;
}

.success-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 2rem;
    background: var(--primary-color, #4f46e5);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.success-modal-btn:hover {
    background: var(--primary-dark, #4338ca);
}

.success-modal-btn:active {
    transform: scale(0.97);
}

@keyframes successModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes successModalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes successModalPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes successModalShrink {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(0.9); opacity: 0; }
}

@keyframes successModalCheck {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

@keyframes successModalTimer {
    from { width: 100%; }
    to { width: 0%; }
}

html.dark-mode .success-modal {
    background: #1f2937;
}

html.dark-mode .success-modal h3 {
    color: #f9fafb;
}

html.dark-mode .success-modal p {
    color: #9ca3af;
}

html.dark-mode .success-modal-timer {
    background: #374151;
}

/* =============================================================================
   SECTION 14: DASHBOARD COMPONENTS
   Shared styles for role-based dashboards (student, faculty, admin, super admin)
   ============================================================================= */

/* ── Hero Banner ── */
.dash-hero {
    background: var(--primary-dark, #0a1628);
    padding: 2rem 2rem 3.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.dash-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--secondary-color, #c9a962), transparent);
}

.dash-hero::before {
    content: '';
    position: absolute;
    top: -30%; right: -5%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(var(--secondary-color-rgb, 201, 169, 98), 0.06) 0%, transparent 70%);
    border-radius: 50%;
}

.dash-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.dash-greeting {
    font-family: var(--font-heading, var(--font-display, 'Cormorant Garamond', Georgia, serif));
    font-size: 1.85rem;
    font-weight: 500;
    margin-bottom: 0.15rem;
    color: #ffffff !important;
}

.dash-subtitle {
    font-size: 0.88rem;
    opacity: 0.55;
    font-weight: 300;
    color: #ffffff !important;
}

.dash-subtitle .gold-accent {
    color: var(--secondary-color, #c9a962);
    opacity: 1;
    font-weight: 400;
}

.dash-hero-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius, 0.375rem);
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid rgba(var(--secondary-color-rgb, 201, 169, 98), 0.3);
    color: var(--secondary-light, #dbc07a);
    background: rgba(var(--secondary-color-rgb, 201, 169, 98), 0.08);
    transition: all 0.2s;
    font-family: var(--font-sans);
    cursor: pointer;
}

.btn-hero:hover {
    background: rgba(var(--secondary-color-rgb, 201, 169, 98), 0.18);
    border-color: rgba(var(--secondary-color-rgb, 201, 169, 98), 0.5);
    color: white;
}

/* ── Dashboard Content Container ── */
.dash-content {
    max-width: 1200px;
    margin: -2rem auto 2rem;
    padding: 0 1.5rem;
    position: relative;
    z-index: 2;
}

/* ── Alert Banners ── */
.dash-alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md, 0.625rem);
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid;
}

.dash-alert.urgent {
    background: #fff1f2;
    color: #e11d48;
    border-color: #ffe4e6;
}

.dash-alert.info {
    background: linear-gradient(135deg, var(--primary-50, #f0f2f7), #e8edf5);
    color: var(--primary-color, #1a2744);
    border-color: #d0d8e8;
}

.dash-alert svg { flex-shrink: 0; opacity: 0.8; }

.dash-alert a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.dash-alert-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-left: auto;
}

.dash-alert-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    background: rgba(255,255,255,0.7);
    border-radius: 5px;
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}

.dash-alert-chip:hover { background: white; }

.dash-alert-action {
    margin-left: auto;
    padding: 0.35rem 0.9rem;
    background: var(--secondary-color, #c9a962);
    color: var(--primary-dark, #0a1628);
    border-radius: var(--radius, 0.375rem);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
    flex-shrink: 0;
}

.dash-alert-action:hover { background: var(--secondary-dark, #b8944d); color: white; }

/* ── Stats Row ── */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.dash-stat-card {
    background: var(--bg-color, white);
    border-radius: var(--radius-md, 0.625rem);
    padding: 1.15rem 1.25rem;
    border: 1px solid var(--border-color, #e5e2da);
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.dash-stat-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md, 0.625rem);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dash-stat-value {
    font-family: var(--font-heading, var(--font-display, serif));
    font-size: 1.65rem;
    font-weight: 600;
    color: var(--primary-color, #1a2744);
    line-height: 1;
}

.dash-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.dash-stat-sub {
    font-size: 0.75rem;
    color: var(--text-light);
}

.dash-stat-progress {
    height: 3px;
    background: var(--bg-dark, #f0ede5);
    border-radius: 3px;
    margin-top: 0.35rem;
    overflow: hidden;
}

.dash-stat-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* ── Section Cards ── */
.dash-section {
    background: var(--bg-color, white);
    border-radius: var(--radius-md, 0.625rem);
    border: 1px solid var(--border-color, #e5e2da);
    overflow: hidden;
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--bg-dark, #f0ede5);
}

.dash-section-title {
    font-family: var(--font-heading, var(--font-display, serif));
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-color, #1a2744);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dash-section-count {
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    background: var(--secondary-50, #fdf9ef);
    color: var(--secondary-dark, #b8944d);
    border-radius: 10px;
    border: 1px solid var(--secondary-100, #f9f0d9);
}

.dash-section-link {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--secondary-dark, #b8944d);
    text-decoration: none;
}

.dash-section-link:hover { text-decoration: underline; color: var(--primary-color); }

.dash-section-body { padding: 0; }

/* ── Grid Layouts ── */
.dash-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dash-three-col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

/* ── Date Separator ── */
.dash-date-sep {
    padding: 0.4rem 1.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-light);
    background: var(--bg-alt, #f5f3ed);
    border-bottom: 1px solid var(--border-color);
}

/* ── Jury List Items ── */
.dash-jury-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--bg-alt, #f5f3ed);
    gap: 0.85rem;
    transition: background 0.1s;
}

.dash-jury-item:last-child { border-bottom: none; }
.dash-jury-item:hover { background: var(--bg-alt, #f5f3ed); }

.dash-jury-time {
    min-width: 52px;
    text-align: center;
    flex-shrink: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-color);
}

.dash-jury-divider {
    width: 3px;
    height: 32px;
    border-radius: 3px;
    flex-shrink: 0;
}

.dash-jury-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary-color);
}

.dash-jury-detail {
    font-size: 0.72rem;
    color: var(--text-light);
}

.dash-jury-action { margin-left: auto; flex-shrink: 0; }

/* ── Small Buttons ── */
.btn-dash-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    border: 1px solid var(--secondary-100, #f9f0d9);
    background: var(--secondary-50, #fdf9ef);
    color: var(--secondary-dark, #b8944d);
    cursor: pointer;
    font-family: var(--font-sans);
}

.btn-dash-sm:hover {
    background: var(--secondary-100, #f9f0d9);
    color: var(--primary-color);
}

/* ── Student Rows ── */
.dash-student-row {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--bg-alt, #f5f3ed);
    gap: 0.65rem;
    transition: background 0.1s;
}

.dash-student-row:last-child { border-bottom: none; }
.dash-student-row:hover { background: var(--bg-alt); }

.dash-student-avatar {
    width: 30px; height: 30px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.dash-student-name {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--primary-color);
    flex: 1;
}

.dash-status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dash-status-dot.green { background: var(--success, #10b981); }
.dash-status-dot.amber { background: var(--warning, #f59e0b); }
.dash-status-dot.red { background: var(--error, #ef4444); }

.dash-status-label {
    font-size: 0.68rem;
    color: var(--text-light);
    min-width: 65px;
}

/* ── Evaluation Rows ── */
.dash-eval-row {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.25rem;
    border-bottom: 1px solid var(--bg-alt, #f5f3ed);
    gap: 0.65rem;
}

.dash-eval-row:last-child { border-bottom: none; }
.dash-eval-row:hover { background: var(--bg-alt); }

.dash-eval-date {
    font-size: 0.7rem;
    color: var(--text-light);
    min-width: 55px;
}

.dash-eval-name {
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--primary-color);
    flex: 1;
}

.dash-eval-instrument {
    font-size: 0.72rem;
    color: var(--text-light);
    min-width: 60px;
}

.dash-eval-faculty {
    font-size: 0.78rem;
    color: var(--text-muted);
    min-width: 90px;
}

.dash-grade-pill {
    font-family: var(--font-heading, var(--font-display, serif));
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    min-width: 30px;
    text-align: center;
}

.dash-grade-pill.high { background: #ecfdf5; color: #047857; }
.dash-grade-pill.mid { background: #fffbeb; color: #d97706; }
.dash-grade-pill.low { background: #fff1f2; color: #e11d48; }

/* ── Quick Actions ── */
.dash-quick-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.25rem;
}

.dash-qa-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    background: var(--bg-alt, #f5f3ed);
    border: 1px solid var(--border-color, #e5e2da);
    border-radius: var(--radius, 0.375rem);
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
    font-family: var(--font-sans);
}

.dash-qa-btn:hover {
    background: var(--secondary-50, #fdf9ef);
    border-color: var(--secondary-100, #f9f0d9);
    color: var(--primary-color);
}

/* ── Action Tiles (admin) ── */
.dash-action-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
}

.dash-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    text-decoration: none;
    color: var(--text-muted);
    border-right: 1px solid var(--bg-dark, #f0ede5);
    transition: all 0.15s;
    text-align: center;
}

.dash-action-tile:last-child { border-right: none; }
.dash-action-tile:hover { background: var(--secondary-50, #fdf9ef); color: var(--primary-color); }

.dash-action-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-md, 0.625rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-action-label {
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.2;
}

/* ── Division Cards (admin) ── */
.dash-division-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
}

.dash-division-card {
    padding: 1.1rem 1.25rem;
    border-right: 1px solid var(--bg-dark, #f0ede5);
    border-bottom: 1px solid var(--bg-dark, #f0ede5);
    transition: background 0.1s;
}

.dash-division-card:nth-child(2n) { border-right: none; }
.dash-division-card:nth-last-child(-n+2) { border-bottom: none; }
.dash-division-card:hover { background: var(--bg-alt); }

.dash-division-name {
    font-family: var(--font-heading, var(--font-display, serif));
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.4rem;
}

.dash-division-stats {
    display: flex;
    gap: 1.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dash-division-stats strong {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85rem;
}

.dash-division-bar {
    height: 3px;
    background: var(--bg-dark, #f0ede5);
    border-radius: 3px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.dash-division-bar-fill {
    height: 100%;
    border-radius: 3px;
}

/* ── Jury Checklist (student) ── */
.dash-checklist {
    background: var(--bg-color, white);
    border-radius: var(--radius-lg, 0.75rem);
    border: 1px solid var(--border-color, #e5e2da);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.dash-checklist-header {
    padding: 1rem 1.35rem;
    border-bottom: 1px solid var(--bg-dark, #f0ede5);
    background: var(--bg-alt, #f5f3ed);
}

.dash-checklist-header-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
    color: var(--primary-color);
}

.dash-checklist-title {
    font-family: var(--font-heading, var(--font-display, serif));
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.dash-checklist-count {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    background: var(--secondary-50, #fdf9ef);
    color: var(--secondary-dark, #b8944d);
    border-radius: 12px;
    border: 1px solid var(--secondary-100, #f9f0d9);
    margin-left: auto;
}

.dash-checklist-progress {
    height: 6px;
    background: var(--bg-dark, #f0ede5);
    border-radius: 6px;
    overflow: hidden;
}

.dash-checklist-progress-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--success, #10b981), var(--secondary-color, #c9a962));
    transition: width 0.6s ease;
}

.dash-checklist-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
}

.dash-step {
    padding: 1.25rem 1.35rem;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
    border-right: 1px solid var(--bg-dark, #f0ede5);
}

.dash-step:last-child { border-right: none; }
.dash-step:hover { filter: brightness(0.97); }

.dash-step.completed {
    background: linear-gradient(180deg, #ecfdf5 0%, #f4fdf9 100%);
}

.dash-step.in-progress {
    background: linear-gradient(180deg, var(--secondary-50, #fdf9ef) 0%, #fffcf5 100%);
}

.dash-step.pending-step {
    background: var(--bg-alt, #f5f3ed);
}

.dash-step-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.dash-step-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius-md, 0.625rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-step.completed .dash-step-icon { background: #d1fae5; color: #059669; }
.dash-step.in-progress .dash-step-icon { background: var(--secondary-100, #f9f0d9); color: var(--secondary-dark, #b8944d); }
.dash-step.pending-step .dash-step-icon { background: var(--bg-dark, #f0ede5); color: var(--text-light); }

.dash-step-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 16px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.dash-step-badge.done { background: #d1fae5; color: #047857; }
.dash-step-badge.pending { background: var(--secondary-100, #f9f0d9); color: var(--secondary-dark, #b8944d); }

.dash-step-title {
    font-family: var(--font-heading, var(--font-display, serif));
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--primary-color);
    margin-bottom: 0.15rem;
}

.dash-step-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.dash-step-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.6rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--secondary-dark, #b8944d);
}

/* ── Jury Status Card (student) ── */
.dash-jury-status {
    background: var(--bg-color, white);
    border-radius: var(--radius-md, 0.625rem);
    border: 1px solid var(--border-color, #e5e2da);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.dash-jury-status-icon {
    width: 64px; height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--secondary-50, #fdf9ef), var(--secondary-100, #f9f0d9));
    color: var(--secondary-dark, #b8944d);
}

.dash-jury-status h2 {
    font-family: var(--font-heading, var(--font-display, serif));
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 0.1rem;
}

.dash-jury-status .jury-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.dash-jury-status .jury-meta strong {
    color: var(--primary-color);
    font-weight: 600;
}

.dash-jury-status-actions {
    margin-left: auto;
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* ── Resource Grid (student) ── */
.dash-resource-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    padding-top: 0.25rem;
}

.dash-resource-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    background: var(--bg-alt, #f5f3ed);
    border-radius: var(--radius, 0.5rem);
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.15s;
    border: 1px solid transparent;
}

.dash-resource-link:hover {
    background: var(--secondary-50, #fdf9ef);
    color: var(--primary-color);
    border-color: var(--secondary-100, #f9f0d9);
}

.dash-resource-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius, 0.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ── Ghost Button ── */
.btn-dash-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius, 0.5rem);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    background: var(--bg-alt, #f5f3ed);
    color: var(--text-muted);
    border: 1px solid var(--border-color, #e5e2da);
    transition: all 0.15s;
    font-family: var(--font-sans);
    cursor: pointer;
}

.btn-dash-ghost:hover {
    background: var(--bg-dark, #f0ede5);
    color: var(--primary-color);
}

/* ── Help Tour Buttons ── */
.btn-tour-light {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color, #e5e2da);
    background: var(--bg-alt, #f5f3ed);
    color: var(--text-muted, #5a6478);
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
}

.btn-tour-light:hover {
    background: var(--secondary-50, #fdf9ef);
    border-color: var(--secondary-color, #c9a962);
    color: var(--primary-color, #1a2744);
}

.btn-tour-dark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(var(--secondary-color-rgb, 201, 169, 98), 0.15);
    color: var(--secondary-light, #dbc07a);
    cursor: pointer;
    padding: 0;
    transition: all 0.15s;
}

.btn-tour-dark:hover {
    background: rgba(var(--secondary-color-rgb, 201, 169, 98), 0.3);
    color: #ffffff;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .dash-three-col { grid-template-columns: 1fr 1fr; }
    .dash-three-col > :last-child { grid-column: span 2; }
    .dash-action-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    /* Hero: break out of wrapper padding for edge-to-edge */
    .dash-hero {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        margin-top: -1.5rem;
        padding: 1.5rem 1rem 3rem;
        border-radius: 0;
    }
    .dash-hero-inner { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .dash-hero-actions { flex-wrap: wrap; width: 100%; }
    .dash-greeting { font-size: 1.4rem; }

    /* Content: tighter side padding */
    .dash-content { padding: 0 0.5rem; margin-top: -1.75rem; }

    /* Stats: 2-col grid */
    .dash-stats { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .dash-stat-card { padding: 0.85rem 1rem; }

    /* Columns: single column */
    .dash-two-col { grid-template-columns: 1fr; }
    .dash-three-col { grid-template-columns: 1fr; }
    .dash-three-col > :last-child { grid-column: span 1; }

    /* Sections: edge-to-edge cards */
    .dash-section { border-radius: var(--radius, 0.375rem); }

    /* Checklist: stack vertically */
    .dash-checklist { border-radius: var(--radius, 0.375rem); }
    .dash-checklist-steps { grid-template-columns: 1fr; }
    .dash-step { border-right: none; border-bottom: 1px solid var(--bg-dark, #f0ede5); }
    .dash-step:last-child { border-bottom: none; }

    /* Jury status: stack */
    .dash-jury-status { flex-direction: column; align-items: flex-start; gap: 1rem; padding: 1.25rem; border-radius: var(--radius, 0.375rem); }
    .dash-jury-status-actions { margin-left: 0; width: 100%; }
    .dash-jury-status-actions .btn-dash-ghost { flex: 1; justify-content: center; }

    /* Resource grid: single column */
    .dash-resource-grid { grid-template-columns: 1fr; }

    /* Alerts: stack */
    .dash-alert { flex-direction: column; align-items: flex-start; }
    .dash-alert-chips, .dash-alert-action { margin-left: 0; margin-top: 0.5rem; }

    /* Action grid */
    .dash-action-grid { grid-template-columns: repeat(2, 1fr); }
    .dash-action-tile { border-bottom: 1px solid var(--bg-dark, #f0ede5); }

    /* Division grid: single column */
    .dash-division-grid { grid-template-columns: 1fr; }
    .dash-division-card { border-right: none; }
}

/* Between 640-768: wrapper has px-4 (1rem), compensate */
@media (min-width: 640px) and (max-width: 768px) {
    .dash-hero {
        margin-left: -1rem;
        margin-right: -1rem;
    }
}

/* Small phones: full edge-to-edge */
@media (max-width: 480px) {
    /* Hero: full bleed */
    .dash-hero {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        padding: 1.25rem 1rem 2.75rem;
    }
    .dash-greeting { font-size: 1.25rem; }
    .dash-subtitle { font-size: 0.8rem; }
    .dash-hero-actions { gap: 0.35rem; }
    .btn-hero { padding: 0.4rem 0.75rem; font-size: 0.75rem; }

    /* Content: minimal side padding */
    .dash-content { padding: 0 0.25rem; margin-top: -1.5rem; }

    /* Stats: single column on very small screens */
    .dash-stats { grid-template-columns: 1fr; gap: 0.4rem; }
    .dash-stat-card { padding: 0.75rem 1rem; gap: 0.65rem; }
    .dash-stat-icon { width: 36px; height: 36px; }
    .dash-stat-value { font-size: 1.4rem; }

    /* Sections: edge-to-edge, no radius */
    .dash-section { border-radius: 0; border-left: none; border-right: none; }
    .dash-checklist { border-radius: 0; border-left: none; border-right: none; }
    .dash-jury-status { border-radius: 0; margin-left: -0.25rem; margin-right: -0.25rem; }
    .dash-alert { border-radius: 0; margin-left: -0.25rem; margin-right: -0.25rem; }

    /* Tighter card padding */
    .dash-section-header { padding: 0.85rem 1rem 0.65rem; }
    .dash-jury-item { padding: 0.65rem 1rem; }
    .dash-student-row { padding: 0.55rem 1rem; }
    .dash-eval-row { padding: 0.55rem 1rem; }
    .dash-date-sep { padding: 0.35rem 1rem; }

    /* Checklist: compact */
    .dash-step { padding: 1rem; }
    .dash-step-title { font-size: 0.88rem; }
    .dash-step-desc { font-size: 0.75rem; }

    /* Resource links: compact */
    .dash-resource-link { padding: 0.55rem 1rem; font-size: 0.82rem; }

    /* Quick actions: scroll horizontally if needed */
    .dash-quick-actions { padding: 0.5rem 0.75rem; gap: 0.4rem; }
    .dash-qa-btn { font-size: 0.72rem; padding: 0.4rem 0.65rem; }

    /* Action tiles: single column */
    .dash-action-grid { grid-template-columns: 1fr 1fr; }
    .dash-action-tile { padding: 0.85rem 0.75rem; }
    .dash-action-label { font-size: 0.75rem; }

    /* Two-col/three-col gap tighter */
    .dash-two-col, .dash-three-col { gap: 0.5rem; }

    /* Eval rows: truncate long names */
    .dash-eval-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
    .dash-eval-instrument { display: none; }
    .dash-eval-faculty { min-width: auto; font-size: 0.72rem; }
    .dash-eval-date { min-width: 45px; }

    /* Jury items: compact on small screens */
    .dash-jury-time { min-width: 45px; font-size: 0.78rem; }
    .dash-jury-name { font-size: 0.82rem; }

    /* Student rows: truncate */
    .dash-student-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
    .dash-status-label { font-size: 0.7rem; }
}

/* =============================================================================
   END OF MAIN.CSS
   ============================================================================= */
