/*
 * ══════════════════════════════════════════════════════════════════════════════
 * benchKIT — Design System v3.1
 * ══════════════════════════════════════════════════════════════════════════════
 *
 * Manufacturing Environment Engineering App Kit
 * Industrial Dark Theme with Aqua Green Accent
 * 
 * Table of Contents:
 * ──────────────────
 * 1. DESIGN TOKENS
 *    1.1 Spacing Scale
 *    1.2 Typography Scale
 *    1.3 Colour Palette
 *    1.4 Semantic Colours
 *    1.5 Borders & Radius
 *    1.6 Shadows & Effects
 *    1.7 Motion & Timing
 *    1.8 Z-Index Layers
 *
 * 2. RESET & BASE
 *    2.1 Box Sizing Reset
 *    2.2 Typography Base
 *    2.3 Scrollbar Styling
 * 
 * 3. LAYOUT
 *    3.1 Container
 *    3.2 Grid System
 *    3.3 Flex Utilities
 * 
 * 4. NAVIGATION
 *    4.1 Main Nav Bar
 *    4.2 Nav Items
 * 
 * 5. COMPONENTS
 *    5.1 Buttons
 *    5.2 Panels & Cards
 *    5.3 Form Controls
 *    5.4 Chips & Badges
 *    5.5 Section Headers
 *    5.6 Modals
 *    5.7 Toast Notifications
 * 
 * 6. UTILITIES
 *    6.1 Spacing
 *    6.2 Text
 *    6.3 Display
 *    6.4 Colours
 * 
 * 7. ANIMATIONS
 *    7.1 Keyframes
 *    7.2 Transitions
 * ══════════════════════════════════════════════════════════════════════════════
 */


/* ═══════════════════════════════════════════════════════════════════════════════
   1. DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
    color-scheme: dark;
    /* ─────────────────────────────────────────────────────────────────────────
       1.1 SPACING SCALE (4px base unit)
       Usage: padding, margin, gap
       ───────────────────────────────────────────────────────────────────────── */
    --space-0: 0;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;

    /* ─────────────────────────────────────────────────────────────────────────
       1.2 TYPOGRAPHY SCALE (1.25 Major Third ratio)
       Base: 13px for technical readability
       ───────────────────────────────────────────────────────────────────────── */
    --font-family-mono: 'Courier New', 'Consolas', 'Monaco', monospace;
    --font-family-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --font-2xs: 11px;
    --font-xs: 12px;
    --font-sm: 13px;
    --font-base: 14px;
    --font-md: 16px;
    --font-lg: 20px;
    --font-xl: 24px;
    --font-2xl: 32px;

    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 1.75;

    --tracking-tighter: -0.02em;
    --tracking-tight: -0.01em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
    --tracking-widest: 0.1em;
    --tracking-mega: 0.15em;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 700;
    --font-weight-xbold: 900;

    /* ─────────────────────────────────────────────────────────────────────────
       1.3 COLOUR PALETTE (Neutral + Accent scales)
       Industrial Glass foundation
       ───────────────────────────────────────────────────────────────────────── */

    /* Glass System - New Core Tokens */
    --glass-surface: rgba(30, 32, 35, 0.65);
    --glass-overlay: rgba(40, 44, 48, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.05);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
    --glass-blur: 24px;

    /* Input & Interactive Backgrounds */
    --glass-input: rgba(0, 0, 0, 0.3);
    --glass-hover: rgba(255, 255, 255, 0.05);
    --glass-active: rgba(255, 255, 255, 0.1);

    /* Neutrals - Deep background scale */
    --gray-950: #050505;
    --gray-900: #0f0f0f;
    --gray-850: #141414;
    --gray-800: #1a1a1a;
    --gray-750: #242424;
    --gray-700: #333333;
    --gray-600: #444444;
    --gray-550: #555555;
    --gray-500: #777777;
    --gray-400: #999999;
    --gray-300: #bbbbbb;
    --gray-200: #dddddd;
    --gray-100: #eeeeee;
    --gray-50: #ffffff;

    /* Aqua - Neon Industrial Accent */
    --aqua-950: #001a14;
    --aqua-900: #003329;
    --aqua-800: #004d3d;
    --aqua-700: #006652;
    --aqua-600: #00997a;
    --aqua-500: #00ffcc;
    --aqua-400: #33ffd6;
    --aqua-300: #66ffe0;
    --aqua-200: #99ffeb;
    --aqua-100: #ccfff5;
    --aqua-50: #f5fffd;

    /* Red - Neon Danger */
    --red-900: #330000;
    --red-700: #800000;
    --red-500: #ff3333;
    --red-400: #ff6666;
    --red-100: #ffe6e6;

    /* Green - Neon Success */
    --green-900: #002200;
    --green-700: #005500;
    --green-500: #00ff88;
    --green-400: #66ffaa;
    --green-100: #e6fffa;

    /* Blue - Neon Info */
    --blue-900: #001133;
    --blue-700: #003388;
    --blue-500: #0088ff;
    --blue-400: #66b3ff;
    --blue-100: #e6f2ff;

    /* Cyan - Neon Secondary */
    --cyan-900: #002222;
    --cyan-700: #006666;
    --cyan-500: #00ffff;
    --cyan-400: #66ffff;
    --cyan-100: #e6ffff;

    /* Purple - Neon Special */
    --purple-900: #1a0033;
    --purple-700: #4d0099;
    --purple-500: #9900ff;
    --purple-300: #cc66ff;
    --purple-100: #f2e6ff;

    /* Yellow - Caution */
    --yellow-500: #ffff00;
    --yellow-400: #ffff33;
    --yellow-300: #ffff66;

    /* ─────────────────────────────────────────────────────────────────────────
       1.4 SEMANTIC COLOUR MAPPINGS
       Named tokens for consistent usage
       ───────────────────────────────────────────────────────────────────────── */

    /* Backgrounds */
    --bg-base: var(--gray-950);
    --bg-elevated: var(--glass-surface);
    --bg-surface: var(--glass-surface);
    --bg-overlay: var(--glass-overlay);
    --bg-input: rgba(0, 0, 0, 0.3);
    --bg-hover: rgba(255, 255, 255, 0.05);
    --bg-active: rgba(255, 255, 255, 0.1);

    /* Text */
    --text-primary: var(--gray-50);
    --text-secondary: var(--gray-400);
    --text-muted: var(--gray-500);
    --text-disabled: var(--gray-600);
    --text-inverse: var(--gray-950);
    --text-link: var(--aqua-500);
    --text-link-hover: var(--aqua-400);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-default: var(--glass-border);
    --border-strong: rgba(255, 255, 255, 0.15);
    --border-focus: var(--aqua-500);

    /* Accent */
    --accent: var(--aqua-500);
    --accent-2: #00e5bc;
    --accent-hover: var(--aqua-400);
    --accent-active: var(--aqua-600);
    --accent-muted: var(--aqua-900);
    --accent-subtle: rgba(0, 255, 204, 0.15);

    /* Status Colors */
    --success: var(--green-500);
    --success-hover: var(--green-400);
    --success-muted: var(--green-900);
    --success-subtle: rgba(0, 255, 136, 0.1);

    --danger: var(--red-500);
    --danger-hover: var(--red-400);
    --danger-muted: var(--red-900);
    --danger-subtle: rgba(255, 51, 51, 0.1);

    --warning: var(--cyan-500);
    --warning-hover: var(--cyan-400);
    --warning-muted: var(--cyan-900);
    --warning-subtle: rgba(0, 255, 255, 0.1);

    --info: var(--blue-500);
    --info-hover: var(--blue-400);
    --info-muted: var(--blue-900);
    --info-subtle: rgba(0, 136, 255, 0.1);

    /* Legacy aliases (for backwards compatibility) */
    --bg-dark: var(--bg-base);
    --bg-panel: var(--bg-elevated);
    --border: var(--border-default);
    --input-bg: var(--bg-input);

    /* ─────────────────────────────────────────────────────────────────────────
       1.5 BORDERS & RADIUS
       ───────────────────────────────────────────────────────────────────────── */
    /* ─────────────────────────────────────────────────────────────────────────
       1.5 BORDERS & RADIUS
       ───────────────────────────────────────────────────────────────────────── */
    --border-width-thin: 1px;
    --border-width-medium: 2px;
    --border-width-thick: 3px;

    --radius-none: 0;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* ─────────────────────────────────────────────────────────────────────────
       1.6 SHADOWS & EFFECTS
       ───────────────────────────────────────────────────────────────────────── */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.65);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.7);
    --shadow-2xl: 0 20px 40px rgba(0, 0, 0, 0.8);

    /* Glass Specular & Glow */
    --shadow-glass-inset: inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    --shadow-neon: 0 0 10px var(--accent-subtle), 0 0 20px var(--accent-subtle);

    /* Inset shadows for depth */
    --shadow-inset-sm: inset 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-inset-md: inset 0 2px 4px rgba(0, 0, 0, 0.6);

    /* Glow effects */
    --glow-accent: 0 0 20px rgba(0, 255, 204, 0.4);
    --glow-accent-strong: 0 0 30px rgba(0, 255, 204, 0.6);
    --glow-success: 0 0 20px rgba(0, 255, 136, 0.3);
    --glow-danger: 0 0 20px rgba(255, 51, 51, 0.3);

    /* ─────────────────────────────────────────────────────────────────────────
       1.7 MOTION & TIMING
       ───────────────────────────────────────────────────────────────────────── */
    --duration-instant: 50ms;
    --duration-fast: 100ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    --duration-slower: 400ms;
    --duration-slowest: 500ms;

    --ease-linear: linear;
    --ease-in: cubic-bezier(0.4, 0, 1, 1);
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Composite transitions */
    --transition-fast: var(--duration-fast) var(--ease-out);
    --transition-normal: var(--duration-normal) var(--ease-out);
    --transition-slow: var(--duration-slow) var(--ease-out);

    /* ─────────────────────────────────────────────────────────────────────────
       1.8 Z-INDEX LAYERS
       ───────────────────────────────────────────────────────────────────────── */
    --z-behind: -1;
    --z-base: 0;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 500;
    --z-overlay: 800;
    --z-modal-backdrop: 900;
    --z-modal: 1000;
    --z-popover: 1100;
    --z-toast: 2000;
    --z-tooltip: 2100;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════════ */

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

/* ─────────────────────────────────────────────────────────────────────────────
   2.2 Typography Base
   ───────────────────────────────────────────────────────────────────────────── */
html {
    font-size: var(--font-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-family-system);
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: var(--font-base);
    line-height: var(--leading-normal);
    min-height: 100vh;
    overflow-y: scroll;
    padding-top: var(--space-12);
}

/* ─────────────────────────────────────────────────────────────────────────────
   2.3 Scrollbar Styling
   ───────────────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-base);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-base);
}

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


/* ═══════════════════════════════════════════════════════════════════════════════
   3. LAYOUT
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   3.1 Container
   ───────────────────────────────────────────────────────────────────────────── */
/* =============================================================================
   LAYOUT UTILITIES
   ============================================================================= */

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-5) var(--space-5);

    /* Prevent content from hitting absolute edges on ultrawide */
    @media (min-width: 1600px) {
        padding: 0 var(--space-10) var(--space-5);
    }
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 0 var(--space-4);
    margin-top: var(--space-4);
    margin-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
    border-left: 4px solid var(--accent);
}

.app-header__title {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.app-header h1 {
    font-size: var(--font-lg);
    letter-spacing: var(--tracking-mega);
    color: var(--text-primary);
    margin: 0;
    line-height: 1;
    text-transform: uppercase;
}

.app-header .tagline {
    color: var(--text-secondary);
    font-size: var(--font-2xs);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin: 0;
    opacity: 0.8;
}

.app-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-2xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: var(--space-1);
}

.breadcrumb a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

.breadcrumb-separator {
    opacity: 0.3;
}

.section {
    margin-bottom: var(--space-8);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: var(--space-2);
}

.section-header h3 {
    font-size: var(--font-sm);
    letter-spacing: var(--tracking-widest);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 500;
    margin: 0;
}

.flex-row {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}

/* ─────────────────────────────────────────────────────────────────────────────
   3.2 Grid System
   ───────────────────────────────────────────────────────────────────────────── */
.grid-responsive {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--grid-min, 250px), 1fr));
    gap: var(--space-5);
    width: 100%;
}

@media (min-width: 1600px) {

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        /* Adapt instead of hardcoding columns */
    }
}


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

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-5);
}

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

@media (max-width: 768px) {

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

/* ─────────────────────────────────────────────────────────────────────────────
   3.3 Flex Utilities
   ───────────────────────────────────────────────────────────────────────────── */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.items-start {
    align-items: flex-start;
}

.items-center {
    align-items: center;
}

.items-end {
    align-items: flex-end;
}

.justify-start {
    justify-content: flex-start;
}

.justify-center {
    justify-content: center;
}

.justify-end {
    justify-content: flex-end;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-5 {
    gap: var(--space-5);
}

.gap-6 {
    gap: var(--space-6);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   4. NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   4.1 Main Nav Bar
   ───────────────────────────────────────────────────────────────────────────── */
.bench-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--space-12);
    background: rgba(30, 32, 35, 0.4);
    backdrop-filter: blur(var(--glass-blur, 24px));
    -webkit-backdrop-filter: blur(var(--glass-blur, 24px));
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    z-index: var(--z-fixed);
    display: flex;
    align-items: center;
    font-family: var(--font-family-mono);
}

.nav-scroll-container {
    display: flex;
    height: 100%;
    align-items: center;
    overflow-x: visible;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0 var(--space-5);
    margin: 0 auto;
    max-width: 2000px;
    width: 100%;
}

.nav-scroll-container::-webkit-scrollbar {
    display: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   4.2 Nav Items
   ───────────────────────────────────────────────────────────────────────────── */
.nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: var(--space-12);
    padding: 0 var(--space-5);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-sm);
    letter-spacing: var(--tracking-wide);
    transition: all var(--transition-normal);
    border-bottom: 2px solid transparent;
    position: relative;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.nav-item.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: linear-gradient(to top, var(--accent-subtle), transparent);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* 4.3 Nav Dropdowns */
.nav-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: rgba(30, 32, 35, 0.9);
    backdrop-filter: blur(var(--glass-blur, 24px));
    -webkit-backdrop-filter: blur(var(--glass-blur, 24px));
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    z-index: var(--z-dropdown);
    padding: var(--space-1) 0;
}

.nav-dropdown:last-child .nav-dropdown-content {
    left: auto;
    right: 0;
}

.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content {
    display: flex;
}

.nav-dropdown-header {
    padding: var(--space-3) var(--space-5) var(--space-1);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    opacity: 0.9;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-5);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-sm);
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.nav-dropdown-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-left-color: var(--accent);
}

.nav-dropdown-item.active {
    color: var(--accent);
    background: var(--accent-subtle);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-left-color: var(--accent);
}

.nav-dropdown-item .nav-icon {
    font-size: var(--font-sm);
    opacity: 0.7;
}

.nav-item-chevron {
    font-size: 8px;
    opacity: 0.5;
    margin-left: 2px;
}

.nav-icon {
    font-size: var(--font-md);
    line-height: 1;
    display: block;
}

.nav-text {
    font-weight: var(--font-weight-normal);
}

@media (max-width: 600px) {
    .nav-item {
        padding: var(--space-3) var(--space-4);
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   4.3 File Storage Controls
   ───────────────────────────────────────────────────────────────────────────── */

.file-picker-btn {
    position: fixed;
    top: calc(var(--space-12) / 2);
    transform: translateY(-50%);
    right: 20px;
    z-index: calc(var(--z-fixed, 100) + 1);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-xs);
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    height: 28px;
    display: flex;
    align-items: center;
}

.file-picker-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.file-save-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-sticky, 500);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-xs);
    font-family: var(--font-family-mono);
    pointer-events: none;
    opacity: 0.7;
    transition: opacity var(--transition-fast), border-color var(--transition-fast);
}

.file-save-status.flash {
    border-color: var(--accent);
    opacity: 1;
}

.file-save-status .status-icon {
    font-size: var(--font-sm);
}

.file-save-status .status-text {
    color: var(--text-primary);
}

.file-save-status .status-time {
    color: var(--text-muted);
    margin-left: var(--space-2);
    padding-left: var(--space-2);
    border-left: 1px solid var(--border);
}

@media (max-width: 768px) {
    .file-picker-btn {
        top: 8px;
        right: 12px;
        font-size: var(--font-2xs);
        padding: var(--space-1) var(--space-2);
    }

    .file-save-status {
        bottom: 12px;
        right: 12px;
        font-size: var(--font-2xs);
        padding: var(--space-1) var(--space-2);
    }

    .file-save-status .status-time {
        display: none;
    }
}


/* ─────────────────────────────────────────────────────────────────────────────
   4.4 Nav File Status Indicator
   ───────────────────────────────────────────────────────────────────────────── */

.nav-file-status {
    position: absolute;
    right: var(--space-5);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    font-size: 11px;
    font-family: var(--font-family-mono);
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    user-select: none;
    flex-shrink: 0;
}

.nav-file-status .status-icon {
    display: flex;
    align-items: center;
    line-height: 1;
}

.nav-file-status .status-text {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Force consistent icon size */
.nav-file-status .status-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Ensure background transparency doesn't conflict with index gradients */
.nav-file-status {
    background: var(--bg-surface);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* File active — green accent */
.nav-file-active {
    color: var(--success);
    border-color: var(--success-subtle);
    background: color-mix(in srgb, var(--success) 8%, var(--bg-surface));
}

/* File locked — needs user click to unlock */
.nav-file-locked {
    color: var(--danger);
    border-color: var(--danger-subtle);
    background: rgba(255, 51, 51, 0.05);
    animation: nav-pulse 2s ease-in-out infinite;
}

.nav-file-locked:hover {
    background: rgba(255, 51, 51, 0.12);
    border-color: var(--danger);
}

/* Local storage fallback — subtle/muted */
.nav-file-local {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Saving — subtle opacity pulse */
.nav-file-saving {
    opacity: 0.5;
}

/* Saved — brief bright flash */
.nav-file-saved {
    border-color: var(--success) !important;
    transition: border-color 0.15s ease-out;
}

@keyframes nav-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

@media (max-width: 600px) {
    .nav-file-status .status-text {
        max-width: 100px;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   5. COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   5.1 Buttons
   ───────────────────────────────────────────────────────────────────────────── */

/* Base Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-sm);
    font-weight: var(--font-weight-normal);
    letter-spacing: var(--tracking-wide);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn:active {
    transform: translateY(1px);
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

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

/* Button Variants */
.btn-accent,
.btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}

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

.btn--ghost {
    background: transparent;
    border-color: var(--border-default);
    color: var(--text-secondary);
}

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

.btn--danger {
    color: var(--danger);
    border-color: var(--danger);
}

.btn--danger:hover {
    background: var(--danger-subtle);
    border-color: var(--danger-hover);
    color: var(--danger-hover);
}

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

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

/* Button Sizes */
.btn-small,
.btn--sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-xs);
}

.btn--lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-base);
}

/* Icon Button */
.btn-icon {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

/* Toggle Button */
.btn-toggle {
    background: var(--bg-base);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    font-family: inherit;
    font-size: var(--font-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-toggle:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-toggle.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

/* Button States */
.btn.copied,
.btn--copied {
    background: var(--success);
    border-color: var(--success);
    color: var(--text-inverse);
}

/* ─────────────────────────────────────────────────────────────────────────────
   5.2 Panels & Cards
   ───────────────────────────────────────────────────────────────────────────── */

/* Panel (static container) */
.panel {
    background: var(--bg-elevated);
    backdrop-filter: blur(var(--glass-blur, 24px));
    -webkit-backdrop-filter: blur(var(--glass-blur, 24px));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.panel-header,
.panel__header {
    font-size: var(--font-xs);
    letter-spacing: var(--tracking-wider);
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-subtle);
}

.panel__body {
    padding: var(--space-4);
}

/* Card (interactive) */
.card {
    background: var(--bg-elevated);
    backdrop-filter: blur(var(--glass-blur, 24px));
    -webkit-backdrop-filter: blur(var(--glass-blur, 24px));
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    transition: all var(--transition-normal);
}

.card--interactive {
    cursor: pointer;
}

.card--interactive:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card--selected {
    border-color: var(--accent);
    box-shadow: var(--glow-accent);
}

/* App Card (hub page) */
.app-card {
    background: var(--bg-elevated);
    backdrop-filter: blur(var(--glass-blur, 24px));
    -webkit-backdrop-filter: blur(var(--glass-blur, 24px));
    border: 1px solid var(--border-default);
    padding: var(--space-5);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    color: inherit;
    display: block;
}

.app-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.app-card .app-icon {
    font-size: 28px;
    margin-bottom: var(--space-3);
}

.app-card h3 {
    font-size: var(--font-base);
    letter-spacing: var(--tracking-wide);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    font-weight: var(--font-weight-normal);
}

.app-card p {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

.app-card .app-tag {
    display: inline-block;
    margin-top: var(--space-3);
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-2xs);
    letter-spacing: var(--tracking-wide);
    background: var(--bg-base);
    border: 1px solid var(--border-default);
}

.app-card .app-tag.new {
    border-color: var(--success);
    color: var(--success);
}

.app-card .app-tag.soon {
    border-color: var(--text-muted);
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   5.3 Form Controls
   ───────────────────────────────────────────────────────────────────────────── */

/* Control Group */
.control-group {
    margin-bottom: var(--space-3);
}

.control-group label,
.form-label {
    display: block;
    font-size: var(--font-xs);
    letter-spacing: var(--tracking-wide);
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}

/* Text Inputs */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select,
.form-input,
.form-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-3);
    font-family: inherit;
    font-size: var(--font-sm);
    transition: border-color var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus,
.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

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

/* Colour Input */
input[type="color"] {
    width: 40px;
    height: 32px;
    padding: 2px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: var(--radius-sm);
}

/* Checkbox / Radio */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--font-sm);
}

.checkbox-label input {
    cursor: pointer;
    accent-color: var(--accent);
}

/* ─────────────────────────────────────────────────────────────────────────────
   5.4 Chips & Badges
   ───────────────────────────────────────────────────────────────────────────── */
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border: 2px solid var(--border-default);
    border-left-width: 4px;
    font-size: var(--font-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chip:hover {
    border-color: var(--accent);
}

.chip.copied {
    border-color: var(--success);
    background: var(--success-subtle);
}

/* Chip Colours */
.chip--blue {
    border-left-color: var(--blue-500);
}

.chip--green {
    border-left-color: var(--green-500);
}

.chip--yellow {
    border-left-color: var(--yellow-500);
}

.chip--cyan {
    border-left-color: var(--cyan-500);
}

.chip--red {
    border-left-color: var(--red-500);
}

.chip--purple {
    border-left-color: var(--purple-500);
}

.chip--gray {
    border-left-color: var(--gray-500);
}

/* Legacy colour classes (backwards compatibility) */
.color-blue {
    border-left-color: var(--blue-500);
}

.color-green {
    border-left-color: var(--green-500);
}

.color-yellow {
    border-left-color: var(--yellow-500);
}

.color-cyan {
    border-left-color: var(--cyan-500);
}

.color-red {
    border-left-color: var(--red-500);
}

.color-purple {
    border-left-color: var(--purple-500);
}

.color-gray {
    border-left-color: var(--gray-500);
}

/* Badge */
.badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-2xs);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--tracking-wide);
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: var(--radius-sm);
}

.badge--muted {
    background: var(--bg-surface);
    color: var(--text-secondary);
}

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

.badge--danger {
    background: var(--danger);
}

/* ─────────────────────────────────────────────────────────────────────────────
   5.5 Section Headers
   ───────────────────────────────────────────────────────────────────────────── */
.section-header {
    font-size: var(--font-sm);
    letter-spacing: var(--tracking-widest);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border-default);
    text-transform: uppercase;
}

.section {
    margin-bottom: var(--space-8);
}

.section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3);
}

.section__title {
    font-size: var(--font-sm);
    letter-spacing: var(--tracking-wider);
    color: var(--text-secondary);
    text-transform: uppercase;
}

.section__actions {
    display: flex;
    gap: var(--space-3);
}

/* Header */
header {
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

header h1 {
    font-size: var(--font-lg);
    letter-spacing: var(--tracking-wider);
    color: var(--accent);
    font-weight: var(--font-weight-normal);
    text-transform: uppercase;
}

header .tagline,
.tagline {
    color: var(--text-secondary);
    font-size: var(--font-sm);
    margin-top: var(--space-1);
    letter-spacing: var(--tracking-wide);
}

/* Hub Header */
.hub-header {
    text-align: center;
    padding: var(--space-10) var(--space-5);
    border-bottom: 1px solid var(--border-default);
    margin-bottom: var(--space-8);
}

.hub-header h1 {
    font-size: var(--font-xl);
    letter-spacing: var(--tracking-mega);
    color: var(--accent);
    margin-bottom: var(--space-3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   5.6 Modals
   ───────────────────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: var(--z-modal-backdrop);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-2xl);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-default);
}

.modal-header h3 {
    font-size: var(--font-sm);
    letter-spacing: var(--tracking-wide);
    font-weight: var(--font-weight-normal);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-lg);
    cursor: pointer;
    padding: var(--space-1);
    transition: color var(--transition-fast);
}

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

.modal-body {
    flex: 1;
    overflow: auto;
    padding: var(--space-4);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border-default);
}

/* ─────────────────────────────────────────────────────────────────────────────
   5.7 Toast Notifications
   ───────────────────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: var(--space-8);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 204, 102, 0.85);
    /* Default green, will be overridden by JS */
    color: var(--text-inverse);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    font-weight: var(--font-weight-bold);
    opacity: 0;
    transition: all var(--duration-normal) var(--ease-out);
    z-index: var(--z-toast);
    pointer-events: none;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast--error {
    background: var(--danger);
    color: #fff;
}

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


/* ═══════════════════════════════════════════════════════════════════════════════
   6. UTILITIES
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   6.1 Spacing Utilities
   ───────────────────────────────────────────────────────────────────────────── */
.m-0 {
    margin: 0;
}

.m-1 {
    margin: var(--space-1);
}

.m-2 {
    margin: var(--space-2);
}

.m-3 {
    margin: var(--space-3);
}

.m-4 {
    margin: var(--space-4);
}

.m-5 {
    margin: var(--space-5);
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: var(--space-1);
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-3 {
    margin-top: var(--space-3);
}

.mt-4 {
    margin-top: var(--space-4);
}

.mt-5 {
    margin-top: var(--space-5);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mt-8 {
    margin-top: var(--space-8);
}

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: var(--space-1);
}

.mb-2 {
    margin-bottom: var(--space-2);
}

.mb-3 {
    margin-bottom: var(--space-3);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-5 {
    margin-bottom: var(--space-5);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.mb-8 {
    margin-bottom: var(--space-8);
}

.ml-0 {
    margin-left: 0;
}

.ml-1 {
    margin-left: var(--space-1);
}

.ml-2 {
    margin-left: var(--space-2);
}

.ml-3 {
    margin-left: var(--space-3);
}

.ml-4 {
    margin-left: var(--space-4);
}

.mr-0 {
    margin-right: 0;
}

.mr-1 {
    margin-right: var(--space-1);
}

.mr-2 {
    margin-right: var(--space-2);
}

.mr-3 {
    margin-right: var(--space-3);
}

.mr-4 {
    margin-right: var(--space-4);
}

.p-0 {
    padding: 0;
}

.p-1 {
    padding: var(--space-1);
}

.p-2 {
    padding: var(--space-2);
}

.p-3 {
    padding: var(--space-3);
}

.p-4 {
    padding: var(--space-4);
}

.p-5 {
    padding: var(--space-5);
}

.pt-0 {
    padding-top: 0;
}

.pt-1 {
    padding-top: var(--space-1);
}

.pt-2 {
    padding-top: var(--space-2);
}

.pt-3 {
    padding-top: var(--space-3);
}

.pt-4 {
    padding-top: var(--space-4);
}

.pt-5 {
    padding-top: var(--space-5);
}

.pb-0 {
    padding-bottom: 0;
}

.pb-1 {
    padding-bottom: var(--space-1);
}

.pb-2 {
    padding-bottom: var(--space-2);
}

.pb-3 {
    padding-bottom: var(--space-3);
}

.pb-4 {
    padding-bottom: var(--space-4);
}

.pb-5 {
    padding-bottom: var(--space-5);
}

.px-0 {
    padding-left: 0;
    padding-right: 0;
}

.px-1 {
    padding-left: var(--space-1);
    padding-right: var(--space-1);
}

.px-2 {
    padding-left: var(--space-2);
    padding-right: var(--space-2);
}

.px-3 {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
}

.px-4 {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.px-5 {
    padding-left: var(--space-5);
    padding-right: var(--space-5);
}

.py-0 {
    padding-top: 0;
    padding-bottom: 0;
}

.py-1 {
    padding-top: var(--space-1);
    padding-bottom: var(--space-1);
}

.py-2 {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
}

.py-3 {
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
}

.py-4 {
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
}

.py-5 {
    padding-top: var(--space-5);
    padding-bottom: var(--space-5);
}

/* ─────────────────────────────────────────────────────────────────────────────
   6.2 Text Utilities
   ───────────────────────────────────────────────────────────────────────────── */
.text-xs {
    font-size: var(--font-xs);
}

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

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

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

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

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

.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

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

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

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

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

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

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

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

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

.font-normal {
    font-weight: var(--font-weight-normal);
}

.font-medium {
    font-weight: var(--font-weight-medium);
}

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

.uppercase {
    text-transform: uppercase;
}

.lowercase {
    text-transform: lowercase;
}

.capitalize {
    text-transform: capitalize;
}

.tracking-tight {
    letter-spacing: var(--tracking-tight);
}

.tracking-normal {
    letter-spacing: var(--tracking-normal);
}

.tracking-wide {
    letter-spacing: var(--tracking-wide);
}

.tracking-wider {
    letter-spacing: var(--tracking-wider);
}

.tracking-widest {
    letter-spacing: var(--tracking-widest);
}

.leading-none {
    line-height: var(--leading-none);
}

.leading-tight {
    line-height: var(--leading-tight);
}

.leading-normal {
    line-height: var(--leading-normal);
}

.leading-relaxed {
    line-height: var(--leading-relaxed);
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   6.3 Display Utilities
   ───────────────────────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.block {
    display: block;
}

.inline {
    display: inline;
}

.inline-block {
    display: inline-block;
}

.flex {
    display: flex;
}

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

.grid {
    display: grid;
}

.invisible {
    visibility: hidden;
}

.visible {
    visibility: visible;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-auto {
    overflow: auto;
}

.overflow-scroll {
    overflow: scroll;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

.min-w-0 {
    min-width: 0;
}

.min-h-0 {
    min-height: 0;
}

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.fixed {
    position: fixed;
}

.sticky {
    position: sticky;
}

/* ─────────────────────────────────────────────────────────────────────────────
   6.4 Border & Shape Utilities
   ───────────────────────────────────────────────────────────────────────────── */
.border {
    border: 1px solid var(--border-default);
}

.border-t {
    border-top: 1px solid var(--border-default);
}

.border-b {
    border-bottom: 1px solid var(--border-default);
}

.border-l {
    border-left: 1px solid var(--border-default);
}

.border-r {
    border-right: 1px solid var(--border-default);
}

.border-0 {
    border: none;
}

.rounded {
    border-radius: var(--radius-md);
}

.rounded-sm {
    border-radius: var(--radius-sm);
}

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

.rounded-xl {
    border-radius: var(--radius-xl);
}

.rounded-full {
    border-radius: var(--radius-full);
}

.rounded-none {
    border-radius: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   6.5 Interactive Utilities
   ───────────────────────────────────────────────────────────────────────────── */
.cursor-pointer {
    cursor: pointer;
}

.cursor-default {
    cursor: default;
}

.cursor-not-allowed {
    cursor: not-allowed;
}

.cursor-grab {
    cursor: grab;
}

.cursor-grabbing {
    cursor: grabbing;
}

.pointer-events-none {
    pointer-events: none;
}

.pointer-events-auto {
    pointer-events: auto;
}

.select-none {
    user-select: none;
}

.select-text {
    user-select: text;
}

.select-all {
    user-select: all;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   7. ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   7.1 Keyframes
   ───────────────────────────────────────────────────────────────────────────── */
@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

@keyframes slide-up {
    from {
        transform: translateY(10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slide-down {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes success-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 204, 102, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(0, 204, 102, 0);
    }
}

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

    to {
        transform: rotate(360deg);
    }
}

@keyframes copy-blip {
    0% {
        transform: scale(1);
        background: rgba(0, 204, 102, 0.2);
    }

    30% {
        transform: scale(1.05);
        background: rgba(0, 204, 102, 0.4);
    }

    100% {
        transform: scale(1);
        background: transparent;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   7.2 Animation Utilities
   ───────────────────────────────────────────────────────────────────────────── */
.animate-fade-in {
    animation: fade-in var(--duration-normal) var(--ease-out);
}

.animate-slide-up {
    animation: slide-up var(--duration-normal) var(--ease-out);
}

.animate-pulse {
    animation: pulse 2s var(--ease-in-out) infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.is-success {
    animation: success-pulse 0.6s var(--ease-out);
}

.is-copied {
    animation: copy-blip 0.2s var(--ease-out) forwards !important;
    color: var(--success) !important;
}

/* Transitions */
.transition-none {
    transition: none;
}

.transition-all {
    transition: all var(--transition-normal);
}

.transition-colors {
    transition: color, background-color, border-color var(--transition-fast);
}

.transition-opacity {
    transition: opacity var(--transition-normal);
}

.transition-transform {
    transition: transform var(--transition-normal);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   8. FOOTER
   ═══════════════════════════════════════════════════════════════════════════════ */
footer {
    margin-top: var(--space-5);
    padding: var(--space-4) var(--space-5);
    background: rgba(30, 32, 35, 0.4);
    backdrop-filter: blur(var(--glass-blur, 24px));
    -webkit-backdrop-filter: blur(var(--glass-blur, 24px));
    border-top: 1px solid var(--border-default);
    text-align: center;
    font-size: var(--font-2xs);
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Toolbar (Action Bar)
   ───────────────────────────────────────────────────────────────────────────── */
.toolbar {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
    align-items: center;
}

.toolbar.left {
    justify-content: flex-start;
}

.toolbar.between {
    justify-content: space-between;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Hub Actions
   ───────────────────────────────────────────────────────────────────────────── */
.hub-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-top: var(--space-8);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-default);
}

/* ═════════════════════════════════════════════════════════════════════
   Shared footer spans (rendered by shared/footer.js)
   ═════════════════════════════════════════════════════════════════════ */

.bk-footer-main {
    /* Inherits all styling from the parent <footer> — no overrides needed. */
}

.bk-footer-version {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.92em;
    opacity: 0.6;
    cursor: pointer;
    transition: opacity 0.15s ease;
    user-select: all;
}

.bk-footer-version:hover {
    opacity: 1;
}