/* =====================================================
   TRADESHOW PRO - Native Chaos Edition
   Inspired by nativechaosholding.com dark aesthetic
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Days+One&family=Montserrat:wght@400;500;600;700;800;900&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary: #dc2626;
    --primary-hover: #b91c1c;
    --primary-light: rgba(220, 38, 38, 0.12);
    --primary-glow: rgba(220, 38, 38, 0.25);
    --secondary: #64748b;
    --secondary-hover: #475569;
    --success: #10b981;
    --success-hover: #059669;
    --success-light: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-hover: #d97706;
    --warning-light: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: rgba(239, 68, 68, 0.12);
    --info: #06b6d4;
    --info-hover: #0891b2;
    --info-light: rgba(6, 182, 212, 0.12);

    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #161616;
    --bg-sidebar: #050505;
    --bg-sidebar-hover: #1a1a1a;
    --bg-overlay: rgba(0, 0, 0, 0.7);
    --bg-input: #1a1a1a;

    --text-primary: #f1f1f1;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --text-white: #ffffff;
    --text-sidebar: #94a3b8;
    --text-sidebar-hover: #ffffff;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.04);
    --border-accent: rgba(220, 38, 38, 0.3);

    --border-radius-sm: 6px;
    --border-radius: 10px;
    --border-radius-lg: 14px;
    --border-radius-xl: 20px;
    --border-radius-pill: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 10px 10px -5px rgba(0, 0, 0, 0.4);

    --sidebar-width: 260px;
    --header-height: 64px;

    --font-family: 'Montserrat', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-heading: 'Days One', 'Montserrat', sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light mode (UX-09) */
.light-mode {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #f1f5f9;
    --bg-sidebar-hover: #e2e8f0;
    --bg-overlay: rgba(0, 0, 0, 0.3);
    --bg-input: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --text-white: #0f172a;
    --text-sidebar: #475569;
    --text-sidebar-hover: #0f172a;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.04);
    --border-accent: rgba(220, 38, 38, 0.3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

html, body {
    height: 100%;
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

::selection { background: var(--primary); color: white; }

#app { display: flex; height: 100vh; overflow: hidden; }

/* =====================================================
   SIDEBAR
   ===================================================== */
#sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    z-index: 10;
}

#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); }
#sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

.logo {
    padding: 22px 20px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--primary);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 900;
    color: white;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.logo-text h1 {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-transform: uppercase;
}

.logo-text span {
    font-size: 0.6rem;
    color: var(--text-light);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
}

.nav-menu { list-style: none; padding: 12px 0; flex: 1; }
.nav-menu > li { margin: 1px 8px; }

.nav-menu > li > a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    color: var(--text-sidebar);
    text-decoration: none;
    transition: all var(--transition);
    gap: 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nav-menu > li > a:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-hover);
}

.nav-menu > li > a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}

.nav-menu > li > a .icon {
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

/* Submenu */
.nav-section-toggle { cursor: pointer; }
.nav-section-toggle > a { color: var(--text-sidebar); border-radius: 8px; }
.nav-section-toggle.expanded > a { color: var(--text-sidebar-hover); background: rgba(255,255,255,0.03); }

.nav-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    border-radius: 8px;
}

.nav-section-toggle.expanded .nav-submenu { max-height: 300px; }

.nav-submenu li a {
    padding: 7px 14px 7px 46px;
    font-size: 0.8rem;
    color: var(--text-sidebar);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    transition: all var(--transition);
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.nav-submenu li a:hover { color: var(--text-sidebar-hover); background: rgba(255,255,255,0.03); }
.nav-submenu li a.active { color: var(--primary); font-weight: 600; }
.nav-submenu li a .icon { font-size: 0.8rem; width: 16px; opacity: 0.6; }

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-white);
    transition: opacity var(--transition);
}

.user-info:hover { opacity: 0.8; }

.user-avatar {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.user-details strong { font-size: 0.82rem; color: var(--text-white); display: block; }
.user-details small { font-size: 0.7rem; color: var(--text-light); display: block; text-transform: uppercase; letter-spacing: 0.05em; }

.sidebar-actions {
    display: flex;
    gap: 4px;
    margin-top: 10px;
}

.sidebar-actions button {
    flex: 1;
    font-size: 0.72rem;
    padding: 6px 8px;
    color: var(--text-sidebar);
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all var(--transition);
}

.sidebar-actions button:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-sidebar-hover);
    border-color: rgba(255,255,255,0.15);
}

/* Collapsed sidebar (NAV-01) */
    #sidebar.collapsed { width: 60px; }
    #sidebar.collapsed .logo-text,
#sidebar.collapsed .nav-menu a span:not(.icon),
#sidebar.collapsed .nav-menu li.nav-section-toggle > a span:not(.icon),
#sidebar.collapsed .sidebar-footer .user-details,
#sidebar.collapsed .sidebar-footer .sidebar-actions button:not(:first-child),
#sidebar.collapsed .sidebar-actions { display: none; }
#sidebar.collapsed .logo { justify-content: center; padding: 16px 10px; }
#sidebar.collapsed .nav-menu a { justify-content: center; padding: 10px; }
#sidebar.collapsed .nav-menu li.nav-section-toggle > a { justify-content: center; padding: 10px; }
#sidebar.collapsed .sidebar-footer .user-info { justify-content: center; padding: 12px 8px; }
#sidebar.collapsed .sidebar-footer .sidebar-actions button:first-child { padding: 6px; font-size: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
#sidebar.collapsed .sidebar-footer .sidebar-actions button:first-child::after { content: '👤'; font-size: 16px; }
#sidebar.collapsed .nav-submenu { display: none !important; }
#main-content.sidebar-collapsed { margin-left: 60px; } /* shift if layout uses margin */
.sidebar-toggle { font-size: 1.2rem; background: none; border: none; color: var(--text-secondary); cursor: pointer; padding: 4px 8px; border-radius: 6px; display: flex; align-items: center; }
.sidebar-toggle:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* =====================================================
   MAIN CONTENT
   ===================================================== */
#main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-primary); }

#header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 20px; flex: 1; }

.breadcrumb {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-white);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.header-search { position: relative; flex: 1; max-width: 320px; }

.header-search input {
    width: 100%;
    padding: 8px 12px 8px 34px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-pill);
    background: var(--bg-input);
    font-size: 0.82rem;
    color: var(--text-primary);
    transition: all var(--transition);
    font-family: var(--font-family);
}

.header-search input::placeholder { color: var(--text-light); }
.header-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); background: var(--bg-tertiary); }
.header-search::before { content: '\1F50D'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 0.8rem; opacity: 0.3; }

.header-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.event-selector select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-input);
    font-size: 0.82rem;
    color: var(--text-primary);
    min-width: 170px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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 10px center;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all var(--transition);
}

.event-selector select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

#content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    animation: fadeIn 0.25s ease;
}

/* Breadcrumbs (NAV-01) */
.breadcrumbs {
    padding: 10px 28px 0;
    font-size: 0.78rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 4px;
}
.breadcrumbs a { color: var(--text-secondary); text-decoration: none; transition: color 0.2s; }
.breadcrumbs a:hover { color: var(--primary); }
.bc-sep { color: var(--border-color); margin: 0 2px; }
.bc-current { color: var(--text-primary); font-weight: 500; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 20px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover { border-color: rgba(255,255,255,0.12); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-family-heading); }
.card-title {
    font-family: var(--font-family-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.card-actions { display: flex; gap: 8px; }

/* =====================================================
   GRID
   ===================================================== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* =====================================================
   STATS CARDS
   ===================================================== */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.stat-card:hover { border-color: rgba(255,255,255,0.12); transform: translateY(-1px); }

.stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-bottom: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-card .stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.stat-card .stat-change {
    font-size: 0.72rem;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--border-radius-pill);
    font-weight: 600;
}

.stat-card.stat-primary { border-left: 3px solid var(--primary); }
.stat-card.stat-success { border-left: 3px solid var(--success); }
.stat-card.stat-warning { border-left: 3px solid var(--warning); }
.stat-card.stat-danger { border-left: 3px solid var(--danger); }
.stat-card.stat-info { border-left: 3px solid var(--info); }

.stat-change.up { color: var(--success); background: var(--success-light); }
.stat-change.down { color: var(--danger); background: var(--danger-light); }

/* =====================================================
   TABLES
   ===================================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table-container td, .table-container th { padding: 10px 14px; }
.table-container .btn-sm { font-size: 0.78rem; padding: 4px 10px; }
.table-container .form-select { font-size: 0.8rem; padding: 4px 22px 4px 8px; }
thead { position: sticky; top: 0; z-index: 2; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border-color); }

/* Virtual scrolling: defer off-screen row rendering (PERF-05) */
.table-container.virtual-scroll { max-height: 600px; overflow-y: auto; }
.table-container.virtual-scroll tbody tr { content-visibility: auto; contain-intrinsic-size: 48px; }

th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.72rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: rgba(255,255,255,0.03); }
tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
tbody tr:nth-child(even):hover { background: rgba(255,255,255,0.04); }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

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

.btn-primary {
    background: var(--primary);
    color: var(--text-white);
    box-shadow: 0 1px 3px var(--primary-glow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary { background: var(--secondary); color: var(--text-white); }
.btn-secondary:hover { background: var(--secondary-hover); transform: translateY(-1px); }

.btn-success {
    background: var(--success);
    color: var(--text-white);
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.25);
}

.btn-success:hover { background: var(--success-hover); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: var(--text-white); }
.btn-danger:hover { background: var(--danger-hover); transform: translateY(-1px); }

.btn-info { background: var(--info); color: var(--text-white); }
.btn-info:hover { background: var(--info-hover); transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: var(--warning-hover); transform: translateY(-1px); }

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

.btn-outline:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.2); color: var(--text-primary); }

.btn-ghost { background: transparent; color: var(--text-light); padding: 9px 12px; }
.btn-ghost:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 0.72rem; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 0.9rem; border-radius: var(--border-radius-lg); }

.btn-icon {
    width: 34px; height: 34px; padding: 0;
    border-radius: var(--border-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.btn-group { display: inline-flex; gap: 1px; }
.btn-group .btn:first-child { border-radius: var(--border-radius) 0 0 var(--border-radius); }
.btn-group .btn:last-child { border-radius: 0 var(--border-radius) var(--border-radius) 0; }
.btn-group .btn:not(:first-child):not(:last-child) { border-radius: 0; }

.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* =====================================================
   FORMS
   ===================================================== */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-hint { font-size: 0.75rem; color: var(--text-light); margin-top: 4px; }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.88rem;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-input);
    transition: all var(--transition);
    line-height: 1.5;
}

.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: rgba(255,255,255,0.15); }

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

.form-input.error, .form-select.error, .form-textarea.error,
.input-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15); }
.field-error { font-size: 0.75rem; color: var(--danger); margin-top: 4px; }
.field-tip { display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:50%;background:var(--text-light);color:var(--bg-primary);font-size:10px;cursor:pointer;margin-left:4px;vertical-align:middle;font-style:normal; }

/* Pagination (TBL-02) */
.pagination-bar .btn:disabled { opacity: 0.3; cursor: default; }
.editable-cell { cursor: default; }

.form-textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.form-select {
    appearance: none;
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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 12px center;
    cursor: pointer;
}

input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--border-radius-pill);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    gap: 4px;
    white-space: nowrap;
    text-transform: uppercase;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-secondary { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.badge-info { background: var(--info-light); color: var(--info); }

.priority-low { background: rgba(255,255,255,0.06); color: var(--text-secondary); }
.priority-medium { background: var(--primary-light); color: var(--primary); }
.priority-high { background: var(--warning-light); color: var(--warning); }
.priority-critical { background: var(--danger-light); color: var(--danger); }

.status-pending { background: var(--warning-light); color: var(--warning); }
.status-in_progress { background: var(--primary-light); color: var(--primary); }
.status-completed { background: var(--success-light); color: var(--success); }
.status-blocked { background: var(--danger-light); color: var(--danger); }

/* =====================================================
   TABS
   ===================================================== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    gap: 2px;
}

.tab {
    padding: 12px 22px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    font-family: var(--font-family);
    transition: all var(--transition);
    margin-bottom: -1px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* =====================================================
   PROGRESS
   ===================================================== */
.progress { height: 8px; background: rgba(255,255,255,0.06); border-radius: var(--border-radius-pill); overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: var(--border-radius-pill); transition: width 0.5s ease; }
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* =====================================================
   TIMELINE
   ===================================================== */
.timeline { position: relative; padding-left: 32px; }
.timeline::before { content: ''; position: absolute; left: 11px; top: 4px; bottom: 0; width: 2px; background: rgba(255,255,255,0.08); }

.timeline-item { position: relative; margin-bottom: 28px; padding-left: 4px; }

.timeline-item::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2.5px solid var(--primary);
    box-shadow: 0 0 0 3px var(--bg-primary);
}

.timeline-item.completed::before { background: var(--success); border-color: var(--success); }
.timeline-item:hover::before { transform: scale(1.2); transition: transform var(--transition); }

.timeline-date { font-size: 0.75rem; color: var(--text-light); margin-bottom: 4px; font-weight: 500; }
.timeline-title { font-weight: 600; margin-bottom: 4px; font-size: 0.92rem; color: var(--text-white); }
.timeline-description { color: var(--text-secondary); font-size: 0.82rem; line-height: 1.5; }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-slow);
}

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

.modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    max-width: 560px;
    width: 92%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-slow);
}
.modal.resizable { resize: both; overflow: auto; min-width: 320px; min-height: 200px; }

.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal.large { max-width: 860px; }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text-white); text-transform: uppercase; letter-spacing: 0.03em; }

.modal-close {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-light);
    border-radius: var(--border-radius);
    transition: all var(--transition);
    line-height: 1;
}

.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--text-white); }

.modal-body { padding: 24px; overflow-y: auto; flex: 1; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* =====================================================
   TOAST
   ===================================================== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
    min-width: 280px;
    max-width: 400px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info { border-left: 3px solid var(--info); }

@keyframes toastIn { from { transform: translateX(120%) scale(0.9); opacity: 0; } to { transform: translateX(0) scale(1); opacity: 1; } }
@keyframes toastOut { from { transform: translateX(0) scale(1); opacity: 1; } to { transform: translateX(120%) scale(0.9); opacity: 0; } }

.toast { position: relative; overflow: hidden; cursor: pointer; }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 3px; background: currentColor; opacity: 0.25; }

/* Skeleton loader (PERF-01) */
@keyframes skeletonPulse { 0%,100%{opacity:.4} 50%{opacity:.9} }
.skeleton-box { background: var(--bg-tertiary); border-radius: 4px; animation: skeletonPulse 1.4s ease-in-out infinite; display:inline-block; }

/* Table row hover (TBL-04) */
.tbl-row:hover { background: rgba(255,255,255,0.03); }
.tbl-row td:first-child { border-radius: 6px 0 0 6px; }
.tbl-row td:last-child { border-radius: 0 6px 6px 0; }

/* Sticky first column on scrollable tables (TBL-08 / MOB-02) */
.table-container table th:first-child,
.table-container table td:first-child { position: sticky; left: 0; z-index: 3; }
.table-container table thead th:first-child { z-index: 4; background: var(--bg-tertiary); }
.table-container table tbody td:first-child { background: var(--bg-card); }
.table-container table tbody tr:nth-child(even) td:first-child { background: rgba(255,255,255,0.015); }

/* Ensure sticky cells are opaque — no transparent background */
.table-container table th:first-child::after,
.table-container table td:first-child::after {
    content: ''; position: absolute; right: 0; top: 0; bottom: 0;
    width: 1px; background: var(--border-color); pointer-events: none;
}

/* =====================================================
   CHECKLIST
   ===================================================== */
.checklist { list-style: none; }

.checklist li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition);
    border-radius: 6px;
}

.checklist li:hover { background: rgba(255,255,255,0.03); }
.checklist li:last-child { border-bottom: none; }
.checklist input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; flex-shrink: 0; }
.checklist input[type="checkbox"]:checked + label { text-decoration: line-through; color: var(--text-light); }

/* =====================================================
   SEARCH & FILTERS
   ===================================================== */
.search-bar { display: flex; gap: 10px; margin-bottom: 18px; }

.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-input);
    font-size: 0.85rem;
    font-family: var(--font-family);
    color: var(--text-primary);
    transition: all var(--transition);
}

.search-bar input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }

.filters { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-group label { font-size: 0.8rem; color: var(--text-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }

#advanced-filters {
    margin-bottom: 18px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
}

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 24px; }

.pagination button {
    width: 36px; height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: var(--font-family);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination button:hover:not(:disabled):not(.active) { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); color: var(--text-primary); }
.pagination button.active { background: var(--primary); color: var(--text-white); border-color: var(--primary); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state { text-align: center; padding: 60px 24px; color: var(--text-secondary); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 16px; opacity: 0.3; display: block; }
.empty-state h3 { margin-bottom: 8px; color: var(--text-white); font-size: 1.05rem; }
.empty-state p { font-size: 0.85rem; max-width: 400px; margin: 0 auto; line-height: 1.6; color: var(--text-light); }

/* =====================================================
   LOADING
   ===================================================== */
.loading { display: flex; align-items: center; justify-content: center; padding: 60px 24px; flex-direction: column; gap: 16px; }
.loading-text { font-size: 0.85rem; color: var(--text-light); font-weight: 500; }

.spinner {
    width: 30px; height: 30px;
    border: 3px solid rgba(255,255,255,0.06);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* =====================================================
   QUICK ACTIONS
   ===================================================== */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    color: var(--text-primary);
}

.quick-action-btn:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 14px var(--primary-glow); }

.quick-action-btn .icon {
    font-size: 1.3rem;
    color: var(--primary);
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--border-radius);
}

.quick-action-btn .text { font-weight: 600; font-size: 0.88rem; }
.quick-action-btn .sub { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }

/* =====================================================
   FLOOR PLAN
   ===================================================== */
.booth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; padding: 20px; }

.booth-cell {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.72rem;
    padding: 8px;
    color: var(--text-primary);
}

.booth-cell:hover { border-color: var(--primary); transform: scale(1.05); }
.booth-cell.available { background: var(--success-light); border-color: var(--success); color: var(--success); }
.booth-cell.reserved { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.booth-cell.confirmed { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.booth-cell.occupied { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.1); }

.floor-booth { position: relative; }
.floor-booth:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.4); }
.floor-booth.floor-editor-mode::after { content: '\2630'; position: absolute; top: 2px; left: 2px; font-size: 10px; color: var(--text-light); }
#booth-detail-panel { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 120px); overflow-y: auto; }

/* =====================================================
   AUTHENTICATION
   ===================================================== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #000;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(220, 38, 38, 0.06) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 50%, rgba(220, 38, 38, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.login-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 44px;
    width: 420px;
    max-width: 92%;
    position: relative;
    animation: fadeIn 0.5s ease;
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-logo {
    width: 56px; height: 56px;
    background: var(--primary);
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 900;
    color: white;
    margin: 0 auto 16px;
}

.login-header h1 {
    color: var(--text-white);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

.login-header p { color: var(--text-light); margin-top: 6px; font-size: 0.85rem; }

.login-tabs {
    display: flex;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border-color);
    gap: 0;
}

.login-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-light);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    font-family: var(--font-family);
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.login-form { display: none; }
.login-form.active { display: block; }

.login-btn { width: 100%; padding: 12px; font-size: 0.9rem; margin-top: 8px; border-radius: var(--border-radius); }
.login-error { color: var(--danger); font-size: 0.82rem; margin-bottom: 10px; min-height: 22px; font-weight: 500; }

.login-demo {
    margin-top: 20px;
    padding: 16px 18px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    color: var(--text-light);
    border: 1px solid var(--border-color);
}

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

.login-link { text-align: center; margin-top: 16px; font-size: 0.82rem; }
.login-link a { color: var(--primary); text-decoration: none; font-weight: 500; }
.login-link a:hover { text-decoration: underline; }

/* =====================================================
   NOTIFICATIONS
   ===================================================== */
.theme-toggle {
    background: transparent; border: 1px solid var(--border-color); border-radius: var(--border-radius);
    color: var(--text-secondary); cursor: pointer; padding: 6px 10px; font-size: 1rem;
    line-height: 1; transition: all 0.2s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.light-mode .theme-toggle { border-color: rgba(0,0,0,0.15); }

.notifications-bell {
    position: relative;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--border-radius);
    font-size: 1.2rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.notifications-bell:hover { background: rgba(255,255,255,0.04); }

.notification-badge {
    position: absolute;
    top: -2px; right: 0;
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.notifications-panel {
    position: fixed;
    top: 0; right: -420px;
    width: 380px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: -4px 0 24px rgba(0,0,0,0.5);
    z-index: 1001;
    transition: right var(--transition-slow);
    display: flex;
    flex-direction: column;
}

.notifications-panel.active { right: 0; }

.notifications-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notifications-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-white); text-transform: uppercase; letter-spacing: 0.03em; }

.notifications-list { flex: 1; overflow-y: auto; padding: 16px; }

.notification-item {
    padding: 16px;
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition);
}

.notification-item:hover { background: rgba(255,255,255,0.03); }
.notification-item.unread { border-left: 3px solid var(--primary); background: rgba(220, 38, 38, 0.04); }

.notification-title { font-weight: 600; margin-bottom: 4px; font-size: 0.85rem; color: var(--text-white); }
.notification-message { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 4px; line-height: 1.5; }
.notification-item small { font-size: 0.7rem; color: var(--text-light); }

/* =====================================================
   UTILITIES
   ===================================================== */
.text-muted { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-info { color: var(--info); }
.text-sm { font-size: 0.82rem; }
.text-xs { font-size: 0.72rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =====================================================
   BULK EDIT TOOLBAR
   ===================================================== */
.bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    font-size: 0.85rem;
}
.bulk-toolbar [id$="-bulk-count"],
.bulk-toolbar #phase-bulk-count {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 100px;
}
.bulk-toolbar .form-select {
    padding: 4px 24px 4px 8px;
    font-size: 0.82rem;
}
.bulk-check, .phase-bulk-check {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* =====================================================
   APPENDIX INLINE (native reference integration)
   ===================================================== */
.appendix-inline {
    border-radius: 4px;
    margin-bottom: 8px;
}
.appendix-inline-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.15s;
}
.appendix-inline-header:hover { background: var(--bg-tertiary); }
.appendix-inline-header .arrow { font-size: 0.7rem; color: var(--text-secondary); }
.appendix-inline-body { padding: 4px 8px 8px 22px; }
.appendix-inline-body.open { display: block !important; }

/* =====================================================
    RISK HEAT MAP (RISK-01)
    ===================================================== */
.risk-heatmap { overflow-x: auto; margin-bottom: 24px; }
.risk-heatmap table { font-size: 0.78rem; }
.risk-heatmap th { text-align: center; font-size: 0.65rem; padding: 8px 6px; }
.risk-heatmap th:first-child { text-align: right; min-width: 90px; }
.risk-heatmap td { text-align: center; padding: 8px 6px; font-weight: 600; font-size: 0.82rem; border: 1px solid rgba(255,255,255,0.06); }
.risk-heatmap .hm-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 60px; cursor: default; border-radius: 4px; padding: 4px; }
.risk-heatmap .hm-cell .hm-count { font-size: 1.1rem; font-weight: 800; }
.risk-heatmap .hm-cell .hm-label { font-size: 0.6rem; opacity: 0.6; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.risk-heatmap .hm-extreme { background: rgba(220,38,38,0.35); color: #fca5a5; }
.risk-heatmap .hm-high { background: rgba(245,158,11,0.3); color: #fcd34d; }
.risk-heatmap .hm-medium { background: rgba(234,179,8,0.2); color: #fde047; }
.risk-heatmap .hm-low { background: rgba(34,197,94,0.2); color: #86efac; }
.risk-heatmap .hm-verylow { background: rgba(34,197,94,0.1); color: #bbf7d0; }
.risk-heatmap .hm-empty { opacity: 0.15; }

/* =====================================================
    GANTT CHART (CYC-01)
    ===================================================== */
.gantt-chart { overflow-x: auto; margin-bottom: 24px; }
.gantt-chart table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.gantt-chart th { text-align: left; padding: 6px 8px; background: var(--bg-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-light); white-space: nowrap; }
.gantt-chart td { padding: 4px 8px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.gantt-chart .gantt-label { min-width: 140px; font-weight: 500; color: var(--text-primary); }
.gantt-chart .gantt-track { position: relative; height: 28px; min-width: 400px; }
.gantt-chart .gantt-bar { position: absolute; top: 4px; height: 20px; border-radius: 4px; display: flex; align-items: center; padding: 0 6px; font-size: 0.65rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; transition: opacity 0.2s; }
.gantt-chart .gantt-bar:hover { opacity: 0.8; }
.gantt-chart .gantt-bar.completed { background: var(--success) !important; }
.gantt-chart .gantt-bar.overdue { box-shadow: 0 0 0 2px var(--danger); }
.gantt-chart .gantt-milestone { position: absolute; top: 2px; width: 12px; height: 12px; border-radius: 50%; transform: translateX(-50%); z-index: 2; border: 2px solid; }
.gantt-chart .gantt-week { position: absolute; top: 0; height: 100%; border-left: 1px solid rgba(255,255,255,0.04); }
.gantt-chart .gantt-week-label { position: absolute; top: -16px; font-size: 0.6rem; color: var(--text-light); transform: translateX(-50%); white-space: nowrap; }
.gantt-arrow { position: absolute; height: 2px; background: var(--text-light); z-index: 1; }
.gantt-arrow::after { content: ''; position: absolute; right: 0; top: -4px; border: 5px solid transparent; border-left-color: var(--text-light); }

/* =====================================================
    PRODUCTION CYCLE / PHASE TIMELINE
    ===================================================== */
.phase-timeline .phase-card { border-radius: 8px; overflow: hidden; transition: transform 0.15s; }
.phase-timeline .phase-card:hover { transform: translateX(4px); }
.phase-timeline .phase-card.danger { background: rgba(239,68,68,0.05); }
.phase-timeline .phase-card .card-header { padding: 16px; cursor: pointer; }
.phase-timeline .phase-card .progress { margin: 0; border-radius: 0; background: transparent; }
.phase-timeline .phase-card .progress .progress-bar { border-radius: 0; transition: width 0.5s ease; }

/* =====================================================
   PERMISSIONS EDITOR
   ===================================================== */
.role-permissions-editor table { font-size: 0.82rem; }
.role-permissions-editor .perm-cell { transition: background .15s; cursor: pointer; }
.role-permissions-editor .perm-cell:hover { opacity: 0.85; }
.role-permissions-editor th { text-transform: uppercase; letter-spacing: 0.05em; }
.role-permissions-editor td:first-child { font-weight: 500; }
.role-permissions-editor .perm-check { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }

@media (max-width: 1024px) {
    #sidebar { width: 60px; }
    .logo-text, .logo span, .nav-menu li a span:not(.icon) { display: none; }
    .nav-menu > li > a { justify-content: center; padding: 14px; border-radius: 0; }
    .nav-menu > li { margin: 0; }
    .sidebar-footer { display: none; }
    .nav-submenu, .nav-section-toggle > a span:not(.icon) { display: none; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .header-search { display: none; }
    .event-selector select { min-width: 130px; }
    #content { padding: 20px; }
}

@media (max-width: 768px) {
    #header { padding: 0 16px; }
    html, body { font-size: 13px; }
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    #content { padding: 16px; }
    .card { padding: 18px; }
    .header-actions .btn { display: none; }
    .event-selector select { min-width: 110px; font-size: 0.78rem; padding: 6px 28px 6px 10px; }
    .modal { max-width: 98%; }
    .login-container { padding: 28px 24px; }
    .notifications-panel { width: 100%; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .quick-actions { grid-template-columns: 1fr; }
    .breadcrumb { font-size: 0.82rem; }
    .search-bar { flex-direction: column; }
    .filters { flex-direction: column; align-items: stretch; }
    .filter-group { flex-direction: column; align-items: stretch; }
    .bulk-toolbar { flex-direction: column; align-items: stretch; }
    th, td { padding: 8px 10px; font-size: 0.78rem; }
    .table-container { margin: 0 -8px; border-radius: 0; }
}

@media (max-width: 480px) {
    #sidebar { width: 0; overflow: hidden; border-right: none; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; transition: width 0.25s ease; background: var(--bg-sidebar); display: flex; flex-direction: column; }
    #sidebar.active { width: var(--sidebar-width); border-right: 1px solid var(--border-color); overflow-y: auto; overflow-x: hidden; }
    #sidebar.active.collapsed { width: var(--sidebar-width) !important; } /* override desktop collapsed width */

    /* Mobile slide-out menu */
    #mobile-menu { position: fixed; top: 0; left: 0; width: 85%; max-width: 320px; height: 100vh; z-index: 101; background: var(--bg-sidebar); transform: translateX(-100%); transition: transform 0.25s ease; display: flex; flex-direction: column; }
    #mobile-menu.open { transform: translateX(0); }
    .mobile-menu-header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border-color); }
    .mobile-menu-close { background: none; border: none; color: var(--text-secondary); font-size: 1.3rem; cursor: pointer; margin-left: auto; padding: 4px 8px; }
    .mobile-nav { flex: 1; overflow-y: auto; padding: 8px 0; list-style: none; }
    .mobile-nav a { display: flex; align-items: center; gap: 12px; padding: 14px 20px; color: var(--text-sidebar); text-decoration: none; font-family: var(--font-family); font-size: 0.95rem; font-weight: 500; transition: background 0.15s; }
    .mobile-nav a:hover, .mobile-nav a.active { background: var(--bg-sidebar-hover); color: var(--primary); }
    .mobile-nav a .icon { font-size: 1.1rem; width: 24px; text-align: center; }

    /* Hide desktop sidebar on mobile */
    #sidebar .logo-text, #sidebar .nav-menu a span:not(.icon),
    #sidebar .sidebar-footer .user-details, #sidebar .sidebar-actions { display: none; }
    #sidebar.active .logo-text, #sidebar.active .nav-menu a span:not(.icon),
    #sidebar.active .sidebar-footer .user-details, #sidebar.active .sidebar-actions { display: block; }
    #sidebar.active .nav-menu a span:not(.icon) { display: inline; }
    #sidebar.active .sidebar-footer .user-details { display: block; }
    #sidebar .logo { justify-content: center; padding: 16px 10px; }
    #sidebar.active .logo { justify-content: flex-start; padding: 22px 20px 18px; }
    #sidebar .nav-menu a { justify-content: center; padding: 12px; }
    #sidebar.active .nav-menu a { justify-content: flex-start; padding: 10px 14px; }
    #sidebar .sidebar-footer { display: none; }
    #sidebar.active .sidebar-footer { display: block; }
    #sidebar .nav-submenu { display: none !important; }
    #sidebar.active .nav-submenu { display: block !important; }

    #sidebar-overlay { display: none; }
    #sidebar-overlay.active { display: block; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); z-index: 99; }

    #header { padding: 0 12px; height: 52px; }
    #content { padding: 12px; }
    html, body { font-size: 12px; }
    .card { padding: 14px; border-radius: var(--border-radius); }
    .card-header { flex-direction: column; gap: 8px; align-items: flex-start; }
    .card-actions { width: 100%; }
    .card-actions .btn { flex: 1; font-size: 0.7rem; padding: 8px 10px; }
    .stat-card { padding: 14px 16px; }
    .stat-card .stat-value { font-size: 1.2rem; }
    .grid { gap: 12px; }
    .modal { width: 100%; max-width: 100%; max-height: 100vh; border-radius: 0; }
    .modal.large { max-width: 100%; }
    .modal-body { padding: 16px; }
    .modal-header { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; flex-direction: column; }
    .modal-footer .btn { width: 100%; }
    .header-search { display: none; }
    .event-selector select { min-width: 90px; font-size: 0.72rem; padding: 4px 24px 4px 8px; }
    .header-actions { gap: 6px; }
    .notifications-bell { padding: 4px 6px; font-size: 1rem; }
    .login-container { padding: 24px 18px; max-width: 100%; border-radius: 0; min-height: 100vh; border: none; }
    .login-page::before { display: none; }
    .breadcrumbs { padding: 8px 12px 0; font-size: 0.7rem; }
    .breadcrumb { font-size: 0.75rem; }
    .tabs { overflow-x: auto; gap: 0; }
    .tab { padding: 10px 14px; font-size: 0.75rem; white-space: nowrap; }
    th, td { padding: 6px 8px; font-size: 0.72rem; }
    .pagination { gap: 4px; }
    .pagination button { width: 30px; height: 30px; font-size: 0.72rem; }
    .empty-state { padding: 40px 16px; }
    .loading { padding: 40px 16px; }
    .toast { min-width: auto; max-width: 100%; margin: 0 8px; font-size: 0.8rem; }
    #toast-container { right: 8px; left: 8px; bottom: 12px; }
    .timeline { padding-left: 24px; }
    .quick-action-btn { padding: 14px 16px; }
    .quick-action-btn .icon { width: 34px; height: 34px; font-size: 1.1rem; }
    .notifications-panel { width: 100%; }
    .sidebar-toggle { display: none; } /* hamburger shown as separate mobile button */
    .mobile-menu-btn { display: flex !important; } /* see next rule */
}

.mobile-menu-btn { display: none; }
@media (max-width: 480px) {
    .mobile-menu-btn { display: flex !important; align-items: center; justify-content: center; font-size: 1.4rem; width: 40px; height: 40px; padding: 0; }
    .bottom-tabs {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0;
        height: 56px; background: var(--bg-secondary); border-top: 1px solid var(--border-color);
        z-index: 50; justify-content: space-around; align-items: center;
    }
    .bottom-tabs a {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 2px; color: var(--text-light); text-decoration: none; font-size: 0.55rem;
        text-transform: uppercase; letter-spacing: 0.04em; padding: 4px 8px;
        transition: color 0.2s; min-width: 50px;
    }
    .bottom-tabs a .tab-icon { font-size: 1.1rem; line-height: 1; }
    .bottom-tabs a.active { color: var(--primary); }
    .bottom-tabs a:hover { color: var(--text-primary); }
    #app { padding-bottom: 56px; }
}

/* Color-blind accessible palette (UX-08) — uses blue/orange instead of red/green */
body.color-blind-friendly :root, .color-blind-friendly { --success: #0077BB; --danger: #EE7733; --warning: #EECC66; --info: #009988; --primary: #332288; --primary-hover: #225577; }

/* Tour overlay (UX-06) */
.tour-overlay { animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* Print styles for floor plan (FLR-04) */
@media print {
    body { background: white !important; }
    #sidebar, .bottom-tabs, .btn, .card-header button, .page-header button, .badge, .notification-bell { display: none !important; }
    #app, #content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
    .card { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; }
    #floor-plan { transform: scale(1) !important; background: white !important; }
    .gantt-chart { max-width: 100% !important; }
    * { color: #000 !important; }
}
