:root {
    --primary-color: #f59e0b;
    --primary-hover: #d97706;
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(15, 23, 42, 0.7);
    --input-border: rgba(255, 255, 255, 0.18);
    --success-color: #10b981;
    --error-color: #ef4444;
    --pending-color: #eab308;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    position: relative;
    padding: 1.25rem;
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
}

.background-shapes {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    top: 0;
    left: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.45;
    animation: float 20s infinite ease-in-out alternate;
}

.shape-1 { width: 420px; height: 420px; background: var(--primary-color); top: -120px; left: -120px; }
.shape-2 { width: 520px; height: 520px; background: #4338ca; bottom: -160px; right: -100px; animation-delay: -5s; }
.shape-3 { width: 320px; height: 320px; background: #0ea5e9; top: 35%; left: 45%; animation-delay: -10s; }

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(45px, 45px) scale(1.08); }
    100% { transform: translate(-45px, 85px) scale(0.92); }
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 20px 45px -12px rgba(0, 0, 0, 0.55);
}

/* Login Page */
.login-container {
    width: 100%;
    max-width: 430px;
    padding: 2.5rem;
    text-align: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}

.logo-icon { font-size: 2rem; }

h1, h2 {
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-color), #fcd34d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.8rem;
    line-height: 1.4;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    text-align: left;
}

.login-hint {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Main App Layout */
.app-wrapper {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Top Navigation Bar */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-brand h2 { font-size: 1.25rem; }
.brand-tag { font-size: 0.75rem; color: var(--text-muted); display: block; }

.nav-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-tab {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    border: 1px solid transparent;
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.09);
}

.nav-tab.active {
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
    border-color: rgba(245, 158, 11, 0.45);
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.user-info {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-name { font-size: 0.88rem; font-weight: 600; }
.user-handle { font-size: 0.75rem; color: var(--text-muted); }

/* Section Cards */
.section-card {
    padding: 1.75rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.section-header h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.section-header p { color: var(--text-muted); font-size: 0.9rem; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kpi-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; }
.kpi-value { font-size: 2rem; font-weight: 700; color: var(--text-color); }
.kpi-sub { font-size: 0.78rem; color: var(--text-muted); }
.success-text { color: var(--success-color); }
.error-text { color: var(--error-color); }
.amber-text { color: #fcd34d; }

/* Split Panels */
.split-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.25rem;
}

.sub-panel {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.25rem;
}

.sub-panel h3 {
    font-size: 1rem;
    margin-bottom: 0.9rem;
    color: #fcd34d;
}

.type-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.type-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    font-size: 0.92rem;
    font-weight: 500;
}

.badge-mini {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
}
.badge-mini.success { background: rgba(16, 185, 129, 0.18); color: var(--success-color); }
.badge-mini.error { background: rgba(239, 68, 68, 0.18); color: var(--error-color); }

/* Upload Bar */
.upload-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    background: rgba(245, 158, 11, 0.07);
    border: 1px dashed rgba(245, 158, 11, 0.45);
    padding: 1rem 1.25rem;
    border-radius: 14px;
    margin-bottom: 1.25rem;
}

.upload-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 0.92rem;
}

.upload-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

input[type="file"] {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Forms & Controls */
.global-controls, .search-controls {
    background: rgba(255, 255, 255, 0.025);
    padding: 1.15rem;
    border-radius: 14px;
    margin-bottom: 1.15rem;
    border: 1px solid var(--glass-border);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

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

label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input[type="date"], input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* Table */
.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--input-bg);
    border-radius: 12px;
    border: 1px solid var(--input-border);
    margin-bottom: 1rem;
}

.mini-table { max-height: 290px; overflow-y: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.88rem;
}

th, td {
    padding: 0.8rem 0.95rem;
    border-bottom: 1px solid var(--glass-border);
    vertical-align: middle;
}

th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.76rem;
    text-transform: uppercase;
    background: rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

.checkbox-col { width: 42px; text-align: center; }
input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.inline-input {
    padding: 0.4rem 0.65rem !important;
    font-size: 0.86rem !important;
}

/* Status Badges */
.status {
    padding: 0.28rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.74rem;
    font-weight: 600;
    display: inline-block;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}
.status.pending { background: rgba(234, 179, 8, 0.2); color: var(--pending-color); }
.status.success { background: rgba(16, 185, 129, 0.2); color: var(--success-color); }
.status.error { background: rgba(239, 68, 68, 0.2); color: var(--error-color); }

/* Pagination & Footer */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 0.86rem;
    color: var(--text-muted);
}
.page-controls { display: flex; gap: 0.5rem; }

.action-footer {
    display: flex;
    gap: 1rem;
    align-items: center;
}

button, .btn-secondary, .btn-primary {
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-primary {
    background: var(--primary-color);
    color: #0f172a;
    border: none;
    padding: 0.85rem 1.4rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.95rem;
    flex: 1;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.09);
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    padding: 0.55rem 1rem;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 500;
}
.btn-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }
.btn-secondary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }
.btn-template { border-color: rgba(245, 158, 11, 0.5); color: #fcd34d; }

/* Progress & Result Banner */
.progress-container {
    margin-top: 1.25rem;
    background: rgba(0, 0, 0, 0.25);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}
#progress-text { margin-bottom: 0.5rem; font-size: 0.88rem; font-weight: 600; text-align: center; }
.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary-color);
    transition: width 0.25s ease;
}

.batch-result-banner {
    margin-top: 1.25rem;
    padding: 1.15rem;
    border-radius: 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.35);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.notification {
    margin-top: 1rem;
    padding: 0.9rem;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}
.notification.success { background: rgba(16, 185, 129, 0.12); color: var(--success-color); border: 1px solid rgba(16, 185, 129, 0.3); }
.notification.error { background: rgba(239, 68, 68, 0.12); color: var(--error-color); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Settings & Info Box */
.muted-note { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.45; }
.info-box {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--glass-border);
    padding: 0.9rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
}
.settings-form { display: flex; flex-direction: column; gap: 0.9rem; }
.help-steps {
    margin-top: 1.2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.help-steps h4 { color: var(--text-color); margin-bottom: 0.4rem; }
.help-steps ol { padding-left: 1.2rem; }

/* Modal Preview */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1.5rem;
}
.modal-card {
    width: 100%;
    max-width: 820px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--glass-border);
}
.modal-body-preview {
    background: #ffffff;
    color: #222222;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.text-center { text-align: center; }
.hidden { display: none !important; }
