:root {
    --bg-dark: #0a0e17;
    --bg-card: #151923;
    --bg-card-hover: #1a1f2e;
    --text-primary: #e8ecff;
    --text-secondary: #9aa4cd;
    --border: rgba(99, 102, 241, 0.2);
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --accent: #00d4ff;
    --accent-2: #ff3df0;
    --accent-3: #7cffb2;
    --shadow: 0 10px 30px rgba(99, 102, 241, 0.15);
    --radius: 16px;
}

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

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    background: radial-gradient(1200px 800px at 10% -10%, rgba(99, 102, 241, 0.15), transparent 60%),
        radial-gradient(1000px 600px at 90% 10%, rgba(0, 212, 255, 0.1), transparent 60%),
        linear-gradient(180deg, #0a0e17, #0e1330 55%, #111a3d);
    color: var(--text-primary);
    min-height: 100vh;
}

/* Icon Styling */
i.fas,
i.far,
i.fab {
    vertical-align: -0.15em;
}

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

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.nav-item i,
button i,
.footer-link i,
.toast i {
    margin-right: 0.5rem;
}

.status-bar i {
    margin-right: 0.5rem;
}

.lock-note i {
    margin-right: 0.35rem;
    width: 0.8em;
    height: 0.8em;
}


header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: saturate(120%) blur(16px);
    background: linear-gradient(180deg, rgba(10, 14, 23, 0.9), rgba(10, 14, 23, 0.7));
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-notice {
    flex: 1;
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #ffc107;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.menu-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1;
}

.menu-toggle i {
    width: 24px;
    height: 24px;
}

.dashboard-layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, rgba(21, 25, 35, 0.8), rgba(16, 20, 32, 0.7));
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-item:hover,
.nav-item.active {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateX(5px);
}

.main-content {
    flex: 1;
    padding: 2rem 1.5rem;
    overflow-x: hidden;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.compact-controls {
    background: linear-gradient(180deg, rgba(21, 25, 35, 0.85), rgba(16, 20, 32, 0.75));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.control-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-group.compact {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 180px;
    flex: 1;
}

.form-group.compact label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.form-group.compact input[type="text"],
.form-group.compact input[type="date"] {
    padding: 0.65rem 0.85rem;
    background: rgba(10, 14, 23, 0.9);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.button-group-compact {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.btn-run {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-run:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-export {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem;
    width: 42px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--primary-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-export:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.status-bar-compact {
    margin-top: 1rem;
    padding: 0.6rem 0.85rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-bar-compact i {
    width: 16px;
    height: 16px;
}

.panel {
    background: linear-gradient(180deg, rgba(21, 25, 35, 0.85), rgba(16, 20, 32, 0.75));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

input[type="text"],
input[type="date"] {
    padding: 0.75rem 1rem;
    background: rgba(10, 14, 23, 0.9);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.custom-select {
    position: relative;
}

.select-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(10, 14, 23, 0.9);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.select-arrow {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--text-secondary);
    transition: transform 0.3s ease;
}

.custom-select.open .select-arrow {
    transform: rotate(180deg);
}

.select-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    background: rgba(21, 25, 35, 0.98);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 50;
    display: none;
}

.select-menu::-webkit-scrollbar {
    width: 8px;
}

.select-menu::-webkit-scrollbar-track {
    background: rgba(10, 14, 23, 0.5);
    border-radius: 4px;
}

.select-menu::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.select-menu::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.custom-select.open .select-menu {
    display: block;
}

.select-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.select-option:last-child {
    border-bottom: none;
}

.select-option:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1), rgba(0, 212, 255, 0.08));
}

.select-option.selected {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(0, 212, 255, 0.1));
    font-weight: 700;
}

.button-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(0, 212, 255, 0.15));
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: linear-gradient(180deg, rgba(21, 25, 35, 0.8), rgba(16, 20, 32, 0.7));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.15rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: radial-gradient(400px 120px at -10% -30%, rgba(99, 102, 241, 0.2), transparent 55%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
}

table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    background: linear-gradient(180deg, rgba(16, 22, 40, 0.85), rgba(12, 18, 36, 0.78));
}

thead th {
    background: linear-gradient(180deg, rgba(23, 30, 56, 0.9), rgba(18, 26, 48, 0.9));
    color: var(--text-secondary);
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1rem;
    text-align: right;
    cursor: pointer;
    transition: all 0.3s ease;
}

thead th:first-child {
    text-align: left;
}

thead th:hover {
    color: var(--primary-light);
}

tbody td {
    padding: 1rem;
    text-align: right;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
}

tbody td:first-child {
    text-align: left;
}

tbody tr:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(0, 212, 255, 0.05));
}

.status-bar {
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.instruction-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(0, 212, 255, 0.03));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.instruction-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.code-snippet {
    background: rgba(10, 14, 23, 0.95);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin: 0.75rem 0;
    position: relative;
    overflow-x: auto;
}

.code-snippet code {
    color: var(--accent-3);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary);
    border: none;
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    color: white;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.3s ease;
}

.copy-btn i {
    margin-right: 0.3rem;
    width: 14px;
    height: 14px;
}

.copy-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 1.5rem 0;
}

.lock-note {
    font-size: 0.8rem;
    color: #8fb1ff;
    margin-top: 0.25rem;
    display: inline-flex;
    align-items: center;
}

/* Dual Table Layout */
.dual-table-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.table-card {
    background: linear-gradient(180deg, rgba(21, 25, 35, 0.85), rgba(16, 20, 32, 0.75));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(0, 212, 255, 0.1));
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-light);
    position: sticky;
    top: 0;
    z-index: 20;
}

.table-header i {
    width: 18px;
    height: 18px;
}

.compact-table-wrapper {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.compact-table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.compact-table-wrapper::-webkit-scrollbar-track {
    background: rgba(10, 14, 23, 0.5);
}

.compact-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.compact-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

.compact-table-wrapper table {
    width: 100%;
    border-collapse: collapse;
    min-width: unset;
}

.compact-table-wrapper thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(23, 30, 56, 0.95), rgba(18, 26, 48, 0.95));
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.7rem 0.5rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    position: relative;
}

.compact-table-wrapper thead th::after {
    content: '';
    position: absolute;
    right: 0.3rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: 0.3;
}

.compact-table-wrapper thead th.sort-desc::after {
    border-top: 5px solid var(--primary-light);
    opacity: 1;
}

.compact-table-wrapper thead th.sort-asc::after {
    border-bottom: 5px solid var(--primary-light);
    opacity: 1;
}

.compact-table-wrapper thead th:first-child {
    text-align: left;
    padding-left: 0.75rem;
}

.compact-table-wrapper thead th:hover {
    color: var(--primary-light);
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.15));
}

.compact-table-wrapper tbody td {
    padding: 0.65rem 0.5rem;
    text-align: right;
    border-top: 1px solid rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.compact-table-wrapper tbody td:first-child {
    text-align: left;
    font-weight: 600;
    color: var(--primary-light);
    padding-left: 0.75rem;
}

.compact-table-wrapper tbody tr:hover {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(0, 212, 255, 0.05));
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 70px;
        z-index: 90;
        transition: left 0.3s ease;
        box-shadow: var(--shadow);
    }

    .sidebar.open {
        left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .header-notice {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .logo {
        font-size: 1.2rem;
    }

    .header-notice {
        display: none;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .page-subtitle {
        font-size: 0.85rem;
    }

    .control-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-group.compact {
        min-width: 100%;
    }

    .button-group-compact {
        width: 100%;
    }

    .btn-run {
        flex: 1;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .dual-table-container {
        grid-template-columns: 1fr;
    }

    .compact-table-wrapper {
        max-height: 400px;
    }
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 80;
}

.overlay.active {
    display: block;
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
    display: none;
    align-items: center;
    z-index: 1000;
}

.toast.show {
    display: flex;
}

footer {
    background: linear-gradient(180deg, rgba(21, 25, 35, 0.9), rgba(16, 20, 32, 0.9));
    border-top: 1px solid var(--border);
    padding: 2rem 1.5rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.footer-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}