@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-base: #1e1e2e;
    --bg-surface: #27273a;
    --bg-surface-hover: #32324a;
    --bg-secondary: #2f2f43;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(59, 130, 246, 0.25);
    
    --accent-primary: #3b82f6;
    --accent-secondary: #60a5fa;
    --accent-cyan: #22d3ee;
    --accent-teal: #2dd4bf;
    --accent-emerald: #34d399;
    --accent-gold: #fbbf24;
    --accent-red: #f87171;
    --accent-orange: #fb923c;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --shadow-premium: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-accent: 0 0 20px rgba(59, 130, 246, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

h1, h2, h3, h4, .font-display {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 100;
    max-height: 100vh;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    margin-bottom: 32px;
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-accent);
}

.logo-text h2 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    font-size: 11px;
    color: var(--accent-cyan);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom scrollbar for nav-menu */
.nav-menu::-webkit-scrollbar {
    width: 6px;
}
.nav-menu::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.nav-menu::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.nav-item {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13.5px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
}

.nav-item i {
    font-size: 16px;
    transition: transform 0.25s ease;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
    border-color: rgba(255, 255, 255, 0.02);
}

.nav-item:hover i {
    transform: scale(1.08);
}

.nav-item.active {
    color: var(--text-primary);
    background: linear-gradient(90deg, rgba(121, 40, 202, 0.12) 0%, rgba(184, 0, 255, 0.02) 100%);
    border-color: rgba(121, 40, 202, 0.25);
    box-shadow: inset 0 0 10px rgba(121, 40, 202, 0.08);
}

.nav-item.active i {
    color: var(--accent-cyan);
}

/* Accordion Nav Groups */
.nav-group {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid transparent;
    transition: all 0.25s ease;
}

.nav-group-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13.5px;
    transition: all 0.25s ease;
    border-radius: 10px;
}

.nav-group-header:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-group-title i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.group-chevron {
    font-size: 11px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Open accordion states */
.nav-group.open {
    background-color: rgba(255, 255, 255, 0.015);
    border-color: var(--border-color);
}

.nav-group.open .nav-group-header {
    color: var(--text-primary);
    font-weight: 600;
}

.nav-group.open .group-chevron {
    transform: rotate(90deg);
    color: var(--accent-cyan);
}

.nav-group-items {
    max-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding-left: 20px;
    border-left: 1px dashed var(--border-color);
    margin-left: 26px;
    gap: 4px;
    margin-bottom: 0;
}

.nav-group.open .nav-group-items {
    max-height: 35vh; /* Responsive max height so it scrolls internally on small screens */
    margin-bottom: 8px;
    margin-top: 2px;
}

/* Custom scrollbar for the module items */
.nav-group-items::-webkit-scrollbar {
    width: 4px;
}
.nav-group-items::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.nav-group-items::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Nav Subgroup Styles */
.nav-subgroup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-subgroup-header:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.subgroup-chevron {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.nav-subgroup.open .subgroup-chevron {
    transform: rotate(90deg);
}

.nav-subgroup-items {
    max-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding-left: 14px;
    border-left: 1px dashed rgba(255,255,255,0.1);
    margin-left: 16px;
    gap: 4px;
}

.nav-subgroup.open .nav-subgroup-items {
    max-height: 25vh;
    margin-top: 4px;
    margin-bottom: 4px;
}

/* Custom scrollbar for subgroup module items */
.nav-subgroup-items::-webkit-scrollbar {
    width: 4px;
}
.nav-subgroup-items::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.nav-subgroup-items::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.nav-subitem {
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.nav-subitem::before {
    content: '';
    position: absolute;
    left: -11px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: all 0.2s ease;
}

.nav-subitem:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-subitem:hover::before {
    background-color: var(--accent-teal);
    box-shadow: 0 0 6px var(--accent-teal);
}

.nav-subitem.active {
    color: var(--text-primary);
    font-weight: 600;
    background-color: rgba(121, 40, 202, 0.08);
}

.nav-subitem.active::before {
    background-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
    transform: translateY(-50%) scale(1.3);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: auto;
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-teal));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #000;
    font-size: 15px;
}

.user-info h4 {
    font-size: 14px;
    font-weight: 600;
}

.user-info p {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Main Content Styling */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.top-bar {
    height: 80px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 700;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn {
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    box-shadow: 0 4px 15px rgba(121, 40, 202, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(121, 40, 202, 0.6);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Content Screens */
.content-screen {
    flex-grow: 1;
    padding: 32px;
    overflow-y: auto;
    display: none;
    min-width: 0;
}

.content-screen.active {
    display: block;
}

/* Dashboard View styling */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-premium);
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(121, 40, 202, 0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--accent-cyan);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.stat-footer {
    font-size: 12px;
    color: var(--accent-emerald);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-footer.negative {
    color: #ff4a5a;
}

.dashboard-sections {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
}

/* Custom Table Styling */
.table-container {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 16px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.01);
}

td {
    padding: 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
}

.badge-success {
    background-color: rgba(0, 245, 160, 0.1);
    color: var(--accent-emerald);
}

.badge-warning {
    background-color: rgba(255, 215, 0, 0.1);
    color: var(--accent-gold);
}

.badge-danger {
    background-color: rgba(255, 74, 90, 0.1);
    color: #ff4a5a;
}

.badge-info {
    background-color: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
}

/* MLM Network styling */
.network-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.override-mode-switch {
    display: flex;
    background-color: var(--bg-surface-hover);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.switch-btn {
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.switch-btn.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
}

.network-view {
    min-height: 500px;
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    padding: 32px;
    background-color: rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-x: auto;
}

.network-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
    width: 100%;
}

.tree-level {
    display: flex;
    justify-content: center;
    gap: 48px;
    width: 100%;
    position: relative;
}

.tree-node {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-premium);
    position: relative;
    transition: all 0.3s ease;
}

.tree-node:hover {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
    transform: translateY(-2px);
}

.tree-node.active-highlight {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 15px rgba(0, 245, 160, 0.3);
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.node-id {
    font-weight: 700;
    font-size: 14px;
    color: var(--text-primary);
}

.node-role {
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    background-color: rgba(255,255,255,0.05);
    border-radius: 4px;
    color: var(--text-secondary);
}

.node-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.node-stat {
    display: flex;
    justify-content: space-between;
}

.node-stat span:last-child {
    font-weight: 600;
    color: var(--text-primary);
}

.node-override-val {
    color: var(--accent-cyan) !important;
}

/* Connective lines helper via absolute CSS lines in network view */
.connector-line {
    position: absolute;
    background-color: var(--text-muted);
    z-index: 1;
}

/* Order Entry form styling */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    box-sizing: border-box;
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* File Upload drag-and-drop container styling */
.uploader-box {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background-color: rgba(255,255,255,0.01);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.uploader-box:hover {
    border-color: var(--accent-primary);
    background-color: rgba(121, 40, 202, 0.02);
}

.uploader-box.dragover {
    border-color: var(--accent-cyan);
    background-color: rgba(0, 242, 254, 0.05);
}

.uploader-box i {
    font-size: 40px;
    color: var(--text-secondary);
}

.uploaded-docs-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.doc-pill {
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
}

.doc-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.doc-remove {
    cursor: pointer;
    color: #ff4a5a;
}

/* AI Checker OCR Simulator View */
.ocr-report {
    background-color: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    font-family: monospace;
    font-size: 12px;
    color: var(--accent-emerald);
    line-height: 1.6;
    overflow-y: auto;
    max-height: 350px;
}

/* Automation Hub styling */
.sync-console {
    background-color: #04050a;
    border-radius: 12px;
    padding: 24px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: var(--accent-cyan);
    height: 300px;
    overflow-y: auto;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.console-line {
    margin-bottom: 8px;
    display: flex;
    gap: 12px;
}

.console-timestamp {
    color: var(--text-muted);
}

.console-success {
    color: var(--accent-emerald);
}

.console-warning {
    color: var(--accent-gold);
}

.console-error {
    color: #ff4a5a;
}

.portal-status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.portal-status-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.portal-logo-container {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background-color: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    border: 1px solid var(--border-color);
}

/* Finance Reconciliation engine styling */
.reconcile-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.reconcile-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.raw-file-picker {
    background-color: var(--bg-surface-hover);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.2s ease;
}

.raw-file-picker:hover {
    border-color: var(--accent-cyan);
    background-color: rgba(0, 242, 254, 0.02);
}

.raw-file-details {
    display: flex;
    align-items: center;
    gap: 16px;
}

.raw-file-icon {
    font-size: 28px;
    color: var(--accent-gold);
}

/* Micro animations */
@keyframes pulseGlow {
    0% { box-shadow: 0 0 10px rgba(121, 40, 202, 0.2); }
    50% { box-shadow: 0 0 25px rgba(121, 40, 202, 0.45); }
    100% { box-shadow: 0 0 10px rgba(121, 40, 202, 0.2); }
}

.pulse-primary {
    animation: pulseGlow 3s infinite ease-in-out;
}

/* Order Management Module Premium Grid Form Styles */
.order-entry-container {
    max-width: 900px !important;
    margin: 0 auto;
}
.form-section-header {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-cyan);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 16px;
    margin-top: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}
.form-section-header i {
    font-size: 14px;
}
.address-card {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-top: 12px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}
.checkbox-label input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}
.brand-category-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}
.document-uploader-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.doc-upload-row {
    display: grid;
    grid-template-columns: 1.5fr 3fr;
    gap: 16px;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px;
    transition: all 0.2s ease;
}
.doc-upload-row:hover {
    border-color: rgba(121, 40, 202, 0.3);
}
.doc-upload-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.doc-file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.doc-file-input-wrapper input[type="file"] {
    display: none;
}
.btn-upload-trigger {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}
.btn-upload-trigger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.uploaded-file-indicator {
    font-size: 11px;
    color: var(--accent-emerald);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}
.uploaded-file-indicator i {
    font-size: 12px;
}
.btn-add-doc {
    background-color: rgba(121, 40, 202, 0.1);
    color: var(--accent-cyan);
    border: 1px dashed var(--accent-primary);
    border-radius: 8px;
    padding: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    margin-top: 8px;
    width: 100%;
}
.btn-add-doc:hover {
    background-color: rgba(121, 40, 202, 0.2);
    border-color: var(--accent-cyan);
}

/* Premium Space-Indigo Glassmorphic Details Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(4, 5, 10, 0.85);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.details-modal {
    background: rgba(15, 18, 37, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(121, 40, 202, 0.1);
    overflow-y: auto;
    padding: 32px;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.modal-overlay.active .details-modal {
    transform: scale(1);
}
.details-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 24px;
}
.details-modal-title h2 {
    font-size: 22px;
    background: linear-gradient(135deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.details-modal-title p {
    font-size: 12px;
    color: var(--accent-cyan);
    margin-top: 4px;
    text-transform: uppercase;
    font-weight: 600;
}
.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.modal-close-btn:hover {
    background-color: rgba(255, 74, 90, 0.1);
    color: #ff4a5a;
    border-color: rgba(255, 74, 90, 0.3);
    transform: rotate(90deg);
}
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
.details-card {
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
}
.details-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    padding-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.details-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12.5px;
    border-bottom: 1px solid rgba(255,255,255,0.01);
    padding-bottom: 4px;
}
.details-item span:first-child {
    color: var(--text-secondary);
}
.details-item span:last-child {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    max-width: 60%;
    word-wrap: break-word;
}
.details-remarks {
    grid-column: span 2;
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
}
.details-docs {
    grid-column: span 2;
    background-color: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
}
.details-docs-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}
.details-doc-pill {
    background-color: rgba(121, 40, 202, 0.06);
    border: 1px solid rgba(121, 40, 202, 0.2);
    color: var(--accent-cyan);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}
.details-doc-pill:hover {
    border-color: var(--accent-cyan);
    background-color: rgba(121, 40, 202, 0.12);
}
.clickable-order-no {
    color: var(--accent-cyan);
    font-weight: 700;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s ease;
}
.clickable-order-no:hover {
    color: var(--accent-secondary);
}
.transition-fade {
    opacity: 1;
    transition: opacity 0.25s ease-in-out;
}
.hidden-section {
    display: none !important;
}
.details-logs-pre {
    grid-column: span 2;
    background-color: #04050a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    font-family: monospace;
    font-size: 11.5px;
    color: var(--accent-emerald);
    line-height: 1.6;
    overflow-y: auto;
    max-height: 250px;
    white-space: pre-wrap;
}

/* Glassmorphic Login Overlay */
#login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at center, rgba(15, 18, 37, 0.9) 0%, rgba(7, 9, 19, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#login-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.login-card {
    width: 420px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--shadow-accent);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(121, 40, 202, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
    box-shadow: var(--shadow-accent);
}

.login-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-secondary);
}

.login-btn-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 24px;
}

.login-toggle-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
}

.login-toggle-tab.active {
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    box-shadow: 0 4px 15px rgba(121, 40, 202, 0.3);
}

/* Commission Grid Styling */
.commission-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 16px;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    max-height: 240px;
    overflow-y: auto;
}

.comm-rate-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
}

.comm-rate-box label {
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comm-rate-input {
    width: 100%;
    background: #090a12;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px;
    color: #fff;
    font-size: 11px;
    text-align: center;
}

.comm-rate-input:focus {
    border-color: var(--accent-cyan);
    outline: none;
}

/* Payment Type Checkboxes Grid */
.payment-checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.payment-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    background: rgba(255,255,255,0.015);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.payment-checkbox-label:hover {
    background: rgba(255,255,255,0.03);
    color: #fff;
}

.payment-checkbox-label input {
    accent-color: var(--accent-primary);
}

/* Promotion Campaigns Download layout */
.promo-campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.campaign-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.campaign-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, transparent, rgba(121,40,202,0.1));
    border-radius: 50% 0 0 0;
}

.campaign-card:hover {
    transform: translateY(-4px);
    border-color: rgba(121, 40, 202, 0.3);
    background: rgba(255, 255, 255, 0.03);
}

.campaign-card h4 {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 700;
}

.campaign-card .campaign-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.campaign-card .campaign-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    flex-grow: 1;
}

.campaign-flyer-preview {
    width: 100%;
    height: 140px;
    background: #0d0f1e;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.campaign-flyer-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

.campaign-flyer-preview .no-flyer {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.campaign-card .btn-download {
    width: 100%;
    padding: 10px;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.03);
    color: var(--accent-cyan);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.campaign-card .btn-download:hover {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}

/* Tree view Focused search */
.tree-search-panel {
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.tree-search-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    color: #fff;
    font-size: 13px;
}

.tree-search-input:focus {
    border-color: var(--accent-primary);
    outline: none;
}

/* Suspended Row style */
tr.suspended-row {
    opacity: 0.55;
    background: rgba(255, 74, 90, 0.02) !important;
}

tr.suspended-row td {
    color: var(--text-secondary);
}

/* Auto generate Sequence Tag */
.seq-badge {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: 700;
    font-size: 11.5px;
}

/* Operator override dialog */
.override-alert-box {
    background: rgba(255, 215, 0, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.override-alert-header {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-gold);
    font-weight: 700;
    font-size: 14px;
}

.override-alert-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.override-alert-actions {
    display: flex;
    gap: 10px;
}

/* Agent Details Modal Drawer */
.agent-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: rgba(15, 18, 37, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    z-index: 10000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.agent-drawer.active {
    right: 0;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.drawer-header h3 {
    font-size: 18px;
    color: var(--text-primary);
}

.drawer-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
}

.drawer-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.drawer-field label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.drawer-field span {
    font-size: 13.5px;
    color: var(--text-primary);
    font-weight: 500;
}

.drawer-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

/* Toggle Switch Styles for Catalog Active/Suspended Toggle */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 22px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .theme-slider {
    background-color: rgba(0, 242, 254, 0.2);
    border-color: var(--accent-cyan);
}

input:checked + .theme-slider:before {
    transform: translateX(22px);
    background-color: var(--accent-cyan);
}



/* Sales Dashboard Layout */
.sales-dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.sales-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.kpi-trend {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 13px;
    font-weight: 600;
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    margin-bottom: 15px;
}

.kpi-card h4 {
    margin: 0 0 5px 0;
    font-size: 24px;
    color: var(--text-primary);
}

.kpi-card p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.sales-chart-panel, .recent-orders-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* Sales Sidebar */
.sales-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-card {
    background: linear-gradient(145deg, var(--bg-surface), #1a1e2e);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-primary);
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.p-stat h5 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.p-stat p {
    margin: 5px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.recent-sales-list {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 20px;
    flex-grow: 1;
}

.agent-list-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.agent-list-item:last-child {
    border-bottom: none;
}

.agent-list-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--accent-cyan);
}

.agent-list-info flex-grow: 1 {}
.agent-list-info h5 { margin: 0; font-size: 14px; }
.agent-list-info p { margin: 2px 0 0; font-size: 12px; color: var(--text-secondary); }
.agent-list-score { font-weight: 600; color: var(--accent-emerald); font-size: 14px; }

/* Enable global text selection for data elements */
body, table, td, th, span, div, p, label, input, textarea {
    user-select: text;
    -webkit-user-select: text;
}

/* Keep text selection disabled on specific UI elements */
.btn, .nav-item, .nav-subitem, .logo-container, .modal-close-btn, .checkbox-label, .form-section-header, button {
    user-select: none !important;
    -webkit-user-select: none !important;
}


/* Base Form Controls */
select, input, textarea {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    outline: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

select:focus, input:focus, textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px var(--border-glow);
}

select option {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    padding: 8px;
}

/* Fix specific classes if they exist */
.form-control, .form-input {
    background-color: var(--bg-surface-hover) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.form-control option, .form-input option {
    background-color: var(--bg-surface-hover) !important;
    color: var(--text-primary) !important;
}


/* --- AUTOMATION HUB REDESIGN --- */
.hub-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.hub-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
    margin-top: 16px;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.glass-panel::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

.glass-panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

.glass-panel .panel-icon-container {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
    box-shadow: inset 0 0 12px rgba(255,255,255,0.1);
}

.glow-btn-master {
    background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
    border: none;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
}

.glow-btn-master:hover {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.6);
    transform: scale(1.02);
}

.app-icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
}

.app-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 16px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
}

.app-icon-btn i {
    font-size: 28px;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.2s ease;
}

.app-icon-btn:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    transform: translateY(-2px);
}

.app-icon-btn:hover i {
    transform: scale(1.1);
}

.dashed-upload-zone {
    border: 2px dashed rgba(255,255,255,0.15);
    border-radius: 12px;
    background: rgba(0,0,0,0.15);
    padding: 20px;
    text-align: center;
    transition: all 0.2s ease;
}


.dashed-upload-zone:hover {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.05);
}


/* Unified Table Responsiveness */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}
.table-responsive table {
    width: 100%;
    min-width: 800px; /* Ensures tables don't squash too much */
}
/* Ensure table text doesnt wrap awkwardly */
.nss-table th, .nss-table td {
    white-space: nowrap;
}
/* Unified Pagination Controls */
.global-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    margin-top: 15px;
    border-radius: 0 0 10px 10px;
    flex-wrap: wrap;
    gap: 10px;
}
.global-pagination-info {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}
.global-pagination-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}
.global-pagination-btn {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.global-pagination-btn:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}
.global-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.global-pagination-btn.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}



/* Premium Global Pagination Styles */
.global-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: rgba(30, 41, 59, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0 0 12px 12px;
    margin-top: 5px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.global-pagination-info {
    font-size: 0.9rem;
    font-weight: 500;
    color: #94a3b8;
    letter-spacing: 0.5px;
}
.global-pagination-buttons {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.global-pagination-btn {
    padding: 0.4rem 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.global-pagination-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: transparent;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.global-pagination-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}
.global-pagination-btn.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
.global-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(15, 23, 42, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}


.data-table th, .data-table td {
    white-space: nowrap;
    padding: 12px 16px;
}


/* Global Pagination Styles */

/* Unified Table Responsiveness */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}
.table-responsive table {
    width: 100%;
    min-width: 800px; /* Ensures tables don't squash too much */
}
/* Ensure table text doesnt wrap awkwardly */
.nss-table th, .nss-table td {
    white-space: nowrap;
}
/* Unified Pagination Controls */
.global-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    margin-top: 15px;
    border-radius: 0 0 10px 10px;
    flex-wrap: wrap;
    gap: 10px;
}
.global-pagination-info {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}
.global-pagination-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}
.global-pagination-btn {
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.global-pagination-btn:hover:not(:disabled) {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}
.global-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.global-pagination-btn.active {
    background: var(--accent-cyan);
    color: #000;
    border-color: var(--accent-cyan);
}



/* Keep nested navigation clickable when the sidebar needs to scroll. */
.nav-subitem, .nav-subgroup, .nav-subgroup-header { flex-shrink: 0; }
#sidebar-menu-toggle { display: none; }
@media (max-width: 850px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 10000; transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar-open .sidebar { transform: translateX(0); }
    #sidebar-menu-toggle { display: block; position: fixed; top: 8px; left: 8px; z-index: 10001; background: #292640; color: white; border: 1px solid #666; border-radius: 6px; padding: 7px 11px; font-size: 20px; cursor: pointer; }
    .top-bar { padding-left: 60px; padding-right: 12px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
    .dashboard-sections { grid-template-columns: 1fr; }
}

/* Keep category headings attached to the Rover report's scrolling viewport.
   The inner responsive wrapper must not capture sticky positioning. */
.rover-report-scroll > .table-responsive {
    overflow: visible;
}
.rover-report-scroll > .table-responsive > table {
    border-collapse: separate;
    border-spacing: 0;
}
.rover-report-scroll > .table-responsive > table > thead > tr > th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-surface, #27273a);
    box-shadow: 0 1px 0 var(--border-color);
}

/* Mobile compositing budget: full-screen backdrop blur allocates expensive
   offscreen surfaces on high-DPR phones. Keep all controls and scrolling. */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
    *, *::before, *::after {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
    }
    #login-overlay { background: #101322; transition: none; }
    .agent-drawer { background: #171a2b; }
    .glass-panel { background: #222338; transition-property: color, background-color, border-color; }
    .login-card::before { display: none; }
    .agent-drawer:not(.active) { visibility: hidden; pointer-events: none; }
    .content-screen:not(.active) { display: none !important; }
}
