/* ============================================
   Y GROUP UNIFIED PLATFORM — DESIGN SYSTEM
   Brand: Yellow (#FFD500) · Black · White
   Dark Mode: Full support via .dark class
   ============================================ */

/* --- 1. CSS VARIABLES --- */
:root {
    /* Brand */
    --y-yellow: #FFD500;
    --y-yellow-dark: #E6C000;
    --y-yellow-light: #FFF3B0;
    --y-yellow-glow: rgba(255, 213, 0, 0.15);
    --y-black: #000000;
    --y-white: #FFFFFF;

    /* Light mode */
    --bg-primary: #F5F6FA;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F0F1F5;
    --text-primary: #1A1A1A;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border-color: #E5E7EB;
    --border-light: #F3F4F6;

    /* Sidebar */
    --sidebar-bg: #0A0A0A;
    --sidebar-text: #9CA3AF;
    --sidebar-hover: #1A1A1A;
    --sidebar-active: #FFD500;
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;

    /* Topbar */
    --topbar-height: 64px;
    --topbar-bg: #FFFFFF;
    --topbar-border: #E5E7EB;

    /* Status Colors */
    --green: #10B981;
    --green-bg: rgba(16, 185, 129, 0.1);
    --red: #EF4444;
    --red-bg: rgba(239, 68, 68, 0.1);
    --amber: #F59E0B;
    --amber-bg: rgba(245, 158, 11, 0.1);
    --blue: #3B82F6;
    --blue-bg: rgba(59, 130, 246, 0.1);

    /* Effects */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-pill: 100px;
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Dark Mode */
.dark {
    --bg-primary: #0A0A0A;
    --bg-secondary: #141414;
    --bg-tertiary: #1E1E1E;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    --border-color: #2D2D2D;
    --border-light: #1E1E1E;
    --topbar-bg: #141414;
    --topbar-border: #2D2D2D;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
}

/* --- 2. RESET & BASE --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: var(--font);
    color: var(--text-primary);
    line-height: 1.5;
    background: var(--bg-primary);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
[x-cloak] { display: none !important; }

/* --- 3. LAYOUT --- */
.platform-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}

/* --- 4. SIDEBAR --- */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-slow);
    overflow: hidden;
}
.sidebar-collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 72px;
}
.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
}
.logo-mark {
    width: 40px; height: 40px;
    background: var(--y-yellow);
    color: var(--y-black);
    font-size: 22px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    flex-shrink: 0;
}
.logo-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--y-white);
    letter-spacing: 2px;
}
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color var(--transition);
}
.sidebar-toggle:hover {
    color: var(--y-white);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--y-white);
}
.nav-item.active {
    background: rgba(255, 213, 0, 0.1);
    color: var(--y-yellow);
}
.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.nav-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.data-source-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--amber);
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-pill);
    margin-bottom: 8px;
}
.source-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--amber);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.sidebar-version {
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    text-align: center;
}

/* --- 5. MAIN CONTENT --- */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}
.main-expanded {
    margin-left: var(--sidebar-collapsed);
}

/* --- 6. TOP BAR --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 24px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    backdrop-filter: blur(10px);
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}
.page-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-stats {
    display: flex;
    gap: 8px;
}
.stat-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.stat-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
}
.stat-dot-green { background: var(--green); }
.stat-dot-amber { background: var(--amber); }
.stat-dot-red { background: var(--red); }

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: all var(--transition);
}
.icon-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* User Menu */
.user-menu {
    position: relative;
}
.user-avatar {
    width: 36px; height: 36px;
    background: var(--y-yellow);
    color: var(--y-black);
    font-size: 13px;
    font-weight: 800;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition);
}
.user-avatar:hover {
    transform: scale(1.05);
}
.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 220px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 60;
}
.dropdown-header {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dropdown-header strong {
    font-size: 14px;
    color: var(--text-primary);
}
.dropdown-dept {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
}
.dropdown-divider {
    height: 1px;
    background: var(--border-color);
}
.dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background var(--transition);
}
.dropdown-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
.dropdown-item-danger:hover {
    background: var(--red-bg);
    color: var(--red);
}

/* --- 7. PAGE CONTENT --- */
.page-content {
    padding: 24px;
    max-width: 1400px;
}

/* Alerts */
.alerts {
    margin-bottom: 16px;
}
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
}

/* --- 8. HOME DASHBOARD --- */
.home-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Welcome Banner */
.welcome-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    background: linear-gradient(135deg, var(--y-black) 0%, #1A1A1A 100%);
    border-radius: var(--radius-lg);
    color: var(--y-white);
}
.welcome-heading {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}
.welcome-text {
    font-size: 14px;
    color: rgba(255,255,255,0.7);
}
.welcome-text strong {
    color: var(--y-yellow);
}
.welcome-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 213, 0, 0.15);
    border: 1px solid rgba(255, 213, 0, 0.3);
    border-radius: var(--radius-pill);
    color: var(--y-yellow);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}
.badge-icon {
    font-size: 18px;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.stat-trend {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}
.trend-green { color: var(--green); }
.trend-amber { color: var(--amber); }
.trend-red { color: var(--red); }
.trend-neutral { color: var(--text-muted); }

/* Module Cards */
.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.modules-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.module-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all var(--transition-slow);
    border-top: 4px solid var(--border-color);
    cursor: pointer;
}
.module-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.module-card-yellow { border-top-color: var(--y-yellow); }
.module-card-green { border-top-color: var(--green); }
.module-card-blue { border-top-color: var(--blue); }
.module-card-red { border-top-color: var(--red); }
.module-card-amber { border-top-color: var(--amber); }
.module-card-dark { border-top-color: #6B7280; }
.module-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.module-disabled:hover {
    transform: none;
    box-shadow: none;
}
.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.module-icon {
    font-size: 32px;
}
.module-badge {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-active {
    background: var(--green-bg);
    color: var(--green);
}
.badge-coming-soon {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.module-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}
.module-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}
.module-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}
.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.metric-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}
.module-action {
    font-size: 13px;
    font-weight: 600;
    color: var(--y-yellow);
    transition: color var(--transition);
}
.module-card:hover .module-action {
    color: var(--y-yellow-dark);
}

/* System Status */
.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}
.status-indicator {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-connected .status-indicator { background: var(--green); }
.status-pending .status-indicator { background: var(--amber); }
.status-offline .status-indicator { background: var(--red); }
.status-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.status-detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

/* --- 9. LOGIN PAGE --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}
.login-container {
    display: flex;
    width: 100%;
    max-width: 960px;
    min-height: 600px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}
.login-brand {
    flex: 1;
    background: linear-gradient(135deg, #000000 0%, #1A1A1A 100%);
    padding: 48px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--y-white);
}
.login-logo-mark {
    width: 56px; height: 56px;
    background: var(--y-yellow);
    color: var(--y-black);
    font-size: 30px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    margin-bottom: 24px;
}
.brand-title {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 3px;
    margin-bottom: 4px;
}
.brand-tagline {
    font-size: 16px;
    color: var(--y-yellow);
    font-weight: 500;
    margin-bottom: 40px;
}
.brand-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.brand-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255,255,255,0.8);
}
.feature-icon {
    font-size: 20px;
}
.brand-footer {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
}

.login-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}
.login-form-wrapper {
    width: 100%;
    max-width: 340px;
}
.login-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}
.login-alert {
    padding: 10px 14px;
    background: var(--red-bg);
    color: var(--red);
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.form-input {
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--y-yellow);
    box-shadow: 0 0 0 3px var(--y-yellow-glow);
}
.form-input::placeholder {
    color: var(--text-muted);
}
.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--y-yellow);
    color: var(--y-black);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}
.login-btn:hover {
    background: var(--y-yellow-dark);
    transform: translateY(-1px);
}
.login-btn:active {
    transform: translateY(0);
}
.login-footer-text {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-muted);
}

/* --- 10. ERROR PAGES --- */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}
.error-fullscreen {
    min-height: 100vh;
    background: #0A0A0A;
}
.error-content {
    text-align: center;
}
.error-logo {
    width: 64px; height: 64px;
    background: var(--y-yellow);
    color: var(--y-black);
    font-size: 36px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 24px;
}
.error-code {
    display: block;
    font-size: 72px;
    font-weight: 900;
    color: var(--y-yellow);
    line-height: 1;
}
.error-title {
    font-size: 24px;
    font-weight: 700;
    margin: 12px 0;
    color: var(--text-primary);
}
.error-fullscreen .error-title { color: #fff; }
.error-message {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 400px;
}
.error-fullscreen .error-message { color: #888; }
.error-btn {
    display: inline-block;
    padding: 12px 28px;
    background: var(--y-yellow);
    color: var(--y-black);
    font-weight: 700;
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: background var(--transition);
}
.error-btn:hover {
    background: var(--y-yellow-dark);
}

/* --- 11. MODULE PAGE LAYOUT (shared by all modules) --- */
.module-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.module-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.module-header-bar h2 {
    font-size: 20px;
    font-weight: 700;
}

/* Data Cards */
.data-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.data-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.data-card-body {
    padding: 20px;
}
.data-card-footer {
    padding: 12px 20px;
    background: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}
.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}
.data-table tr:hover td {
    background: var(--bg-tertiary);
}

/* RAG Badges */
.rag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.rag-green { background: var(--green-bg); color: var(--green); }
.rag-amber { background: var(--amber-bg); color: var(--amber); }
.rag-red { background: var(--red-bg); color: var(--red); }

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Stale Data Banner */
.stale-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--amber-bg);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--amber);
    font-weight: 500;
}

/* Tabs */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}
.tab-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    transition: color var(--transition);
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--text-primary); }
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 2px;
    background: var(--y-yellow);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.empty-state-text {
    font-size: 14px;
}

/* --- 12. RESPONSIVE — MOBILE-FIRST ENHANCEMENTS --- */

/* Buttons (used in topbar + templates) */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    border: none;
    white-space: nowrap;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-yellow { background: var(--y-yellow); color: var(--y-black); }
.btn-yellow:hover { background: var(--y-yellow-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--y-yellow); color: var(--y-yellow); }

/* Tablet */
@media (max-width: 1200px) {
    .modules-container { grid-template-columns: repeat(2, 1fr); }
    .quick-stats { grid-template-columns: repeat(2, 1fr); }
    .status-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 768px) {
    /* Sidebar: off-canvas drawer */
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
        width: var(--sidebar-width);
    }
    .sidebar:not(.sidebar-collapsed) {
        transform: translateX(0);
    }
    .sidebar-collapsed {
        transform: translateX(-100%);
    }
    .main-wrapper, .main-expanded {
        margin-left: 0;
    }
    .mobile-menu-btn { display: flex; }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }

    /* Layout */
    .modules-container { grid-template-columns: 1fr; }
    .quick-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .status-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; gap: 12px; }
    .grid-3 { grid-template-columns: 1fr; }

    /* Topbar */
    .topbar { padding: 0 12px; height: 56px; }
    .page-title { font-size: 16px; }
    .topbar-right .btn { display: none; }  /* hide action buttons on mobile */

    /* Page Content — tighter padding */
    .page-content { padding: 12px; }
    .module-page { gap: 16px; }

    /* Stat Cards — compact */
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .stat-label { font-size: 12px; }
    .stat-trend { font-size: 11px; margin-top: 4px; }

    /* Data Cards — edge-to-edge on mobile */
    .data-card { border-radius: var(--radius-sm); }
    .data-card-header { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
    .data-card-title { font-size: 14px; }
    .data-card-body { padding: 14px; }
    .data-card-footer { padding: 10px 14px; }

    /* Tables → Responsive Card Layout on mobile */
    .data-table { font-size: 12px; }
    .data-table th { padding: 8px 10px; font-size: 10px; }
    .data-table td { padding: 8px 10px; }

    /* Responsive table: horizontal scroll wrapper */
    .data-card-body[style*="padding: 0"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Module header */
    .module-header-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
    .module-header-bar h2 { font-size: 17px; }

    /* Charts: shorter on mobile */
    .chart-container { height: 220px !important; }

    /* Welcome banner */
    .welcome-banner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 20px;
    }
    .welcome-heading { font-size: 18px; }

    /* Login */
    .login-container { flex-direction: column; max-width: 440px; }
    .login-brand { padding: 24px; }
    .brand-features { display: none; }
    .login-form-panel { padding: 24px; }
    .login-title { font-size: 22px; }

    /* RAG badges — touch friendly */
    .rag-badge { padding: 4px 12px; font-size: 11px; }

    /* Stale banner */
    .stale-banner { font-size: 12px; padding: 10px 12px; }
}

/* Small phones */
@media (max-width: 480px) {
    .quick-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 20px; }
    .page-content { padding: 8px; }
    .topbar { padding: 0 10px; }
    .page-title { font-size: 14px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .data-card { border-radius: 8px; }
}

/* --- 12b. MOBILE-FIRST ISSUE BROWSER --- */

/* Mobile-friendly filter bar */
@media (max-width: 768px) {
    .filter-row {
        flex-direction: column !important;
        gap: 8px !important;
    }
    .filter-group {
        min-width: 100% !important;
        flex: unset !important;
    }
    .filter-input, .filter-select {
        padding: 10px 14px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }
    /* Collapsible filters on mobile */
    .filter-form .filter-row {
        display: none;
    }
    .filter-form.open .filter-row {
        display: flex;
    }
    .filter-toggle-btn {
        display: flex !important;
    }
}

/* Mobile issue cards (replace table rows) */
@media (max-width: 768px) {
    .issue-table-mobile .data-table thead { display: none; }
    .issue-table-mobile .data-table,
    .issue-table-mobile .data-table tbody,
    .issue-table-mobile .data-table tr,
    .issue-table-mobile .data-table td {
        display: block;
        width: 100%;
    }
    .issue-table-mobile .data-table tr {
        padding: 12px 14px;
        border-bottom: 1px solid var(--border-light);
        position: relative;
    }
    .issue-table-mobile .data-table td {
        padding: 2px 0;
        border: none;
        font-size: 13px;
    }
    .issue-table-mobile .data-table tr:hover td {
        background: transparent;
    }
}

/* Issue detail mobile */
@media (max-width: 768px) {
    .meta-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .meta-card { padding: 10px; }
    .meta-label { font-size: 10px; }
    .meta-value { font-size: 13px; }

    .issue-header .issue-title { font-size: 17px; }
    .issue-header-top { gap: 6px; }

    /* Tabs: scrollable on mobile */
    .tab-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        white-space: nowrap;
        gap: 0;
    }
    .tab-bar::-webkit-scrollbar { display: none; }
    .tab-item { padding: 10px 14px; font-size: 12px; flex-shrink: 0; }

    /* Timeline */
    .timeline { padding-left: 20px; }
    .timeline-dot { width: 12px; height: 12px; left: -20px; }

    /* Comments */
    .comment-item { padding: 12px 0; }
    .comment-body { font-size: 13px; }
}

/* Issue list mobile card view */
@media (max-width: 768px) {
    .mobile-issue-card {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 14px;
        border-bottom: 1px solid var(--border-light);
    }
    .mobile-issue-card:active {
        background: var(--bg-tertiary);
    }
    .mobile-issue-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
    }
    .mobile-issue-key {
        font-weight: 700;
        color: var(--y-yellow);
        font-size: 13px;
    }
    .mobile-issue-summary {
        font-size: 14px;
        font-weight: 500;
        line-height: 1.4;
    }
    .mobile-issue-meta {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        font-size: 12px;
        color: var(--text-muted);
    }
    .mobile-issue-meta span {
        display: inline-flex;
        align-items: center;
        gap: 3px;
    }
}

/* Epic cards mobile */
@media (max-width: 768px) {
    .epic-progress .progress-labels {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
    }
    .epic-stats {
        flex-direction: column;
        gap: 6px;
        font-size: 12px;
    }
}

/* Pagination mobile */
@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    .page-btn { padding: 6px 12px; font-size: 12px; }
}

/* --- 12c. TOUCH ENHANCEMENTS --- */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-item { padding: 14px 12px; min-height: 48px; }
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; }
    .filter-input, .filter-select { min-height: 44px; }
    .tab-item { min-height: 44px; }
    .data-table td { padding: 12px 10px; }

    /* Remove hover effects that cause sticky hover on touch */
    .stat-card:hover { transform: none; }
    .module-card:hover { transform: none; box-shadow: none; }
    .data-table tr:hover td { background: transparent; }

    /* Active states instead */
    .stat-card:active { transform: scale(0.98); }
    .module-card:active { transform: scale(0.98); }
    .nav-item:active { background: var(--sidebar-hover); }
    .mobile-issue-card:active { background: rgba(255,213,0,0.05); }
}

/* --- 12d. SAFE AREA (notched phones) --- */
@supports (padding: env(safe-area-inset-bottom)) {
    .page-content {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
    .sidebar {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* --- 12e. PULL-TO-REFRESH visual cue --- */
.pull-indicator {
    display: none;
    text-align: center;
    padding: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

/* --- 12f. MOBILE BOTTOM ACTION BAR --- */
.mobile-action-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    gap: 4px;
    justify-content: space-around;
}
.mobile-action-bar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
    min-width: 56px;
}
.mobile-action-bar a .bar-icon { font-size: 20px; }
.mobile-action-bar a.active { color: var(--y-yellow); }
.mobile-action-bar a:active { background: rgba(255,213,0,0.05); }

@media (max-width: 768px) {
    .mobile-action-bar { display: flex; }
    /* Add bottom padding so content doesn't hide behind bar */
    .page-content { padding-bottom: 80px; }
}

/* --- 13. UTILITY CLASSES --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'SF Mono', 'Consolas', monospace; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-yellow { color: var(--y-yellow); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none; }
