:root {
    --primary-navy: #0f2e5a;
    --primary-blue: #1d4ed8;
    --accent-teal: #0d9488;
    --accent-gold: #d97706;
    --bg-main: #f1f5f9;
    --card-bg: #ffffff;
    --sidebar-bg: #0a192f;
    --sidebar-hover: #172a46;
    --text-heading: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --border-light: #e2e8f0;
    --success: #15803d;
    --success-bg: #dcfce7;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --warning: #b45309;
    --warning-bg: #fef3c7;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-body);
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling - Dark Navy Professional */
.sidebar {
    width: 270px;
    background: var(--sidebar-bg);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    flex-shrink: 0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.15);
    border-right: 1px solid rgba(255,255,255,0.06);
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 24px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #1d4ed8 0%, #0d9488 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 10px rgba(29, 78, 216, 0.4);
    flex-shrink: 0;
}

.brand-text h2 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
    line-height: 1.2;
}

.brand-text p {
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 3px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    transition: 0.2s;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.nav-item.active {
    background: linear-gradient(90deg, #1d4ed8 0%, #2563eb 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35);
}

.nav-item.active svg {
    color: #ffffff;
}

.user-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
}

.logout-btn {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    transition: 0.2s;
}

.logout-btn:hover {
    background: #dc2626;
    color: white;
}

/* Main Content Wrapper */
.main-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100vh;
}

.top-bar {
    background: white;
    padding: 18px 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.top-bar h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-heading);
}

.content-body {
    padding: 32px 36px;
    flex-grow: 1;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: white;
    padding: 22px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border-light);
    border-left: 4px solid #1d4ed8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.stat-card.emerald { border-left-color: #059669; }
.stat-card.amber { border-left-color: #d97706; }
.stat-card.crimson { border-left-color: #dc2626; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.blue { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-icon.amber { background: #fef3c7; color: #d97706; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }

.stat-icon svg { width: 24px; height: 24px; }

.stat-info h4 {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
}

.stat-info .stat-number {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--text-heading);
}

/* Panel Card */
.panel-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    margin-bottom: 24px;
}

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

.panel-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h3 svg {
    width: 22px;
    height: 22px;
    color: #1d4ed8;
}

/* Buttons */
.btn {
    padding: 9px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s ease-in-out;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: #1d4ed8;
    color: white;
}
.btn-primary:hover {
    background: #1e40af;
}

.btn-teal {
    background: #0d9488;
    color: white;
}
.btn-teal:hover {
    background: #0f766e;
}

.btn-danger {
    background: #dc2626;
    color: white;
}
.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-body);
}
.btn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid #fde68a; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.badge-blue { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-teal { background: #ccfbf1; color: #0f766e; border: 1px solid #99f6e4; }

/* Switch Toggle */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .25s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .25s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: #1d4ed8;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal-content {
    background: white;
    width: 92%;
    max-width: 650px;
    border-radius: 14px;
    padding: 26px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-heading);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
    outline: none;
    transition: border 0.15s;
    color: var(--text-heading);
}

.form-control:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
}

/* Special text areas for Arabic / Mandarin */
.text-arabic {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    direction: rtl;
    text-align: right;
    font-size: 1.35rem;
    line-height: 1.8;
}

.text-mandarin {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    font-size: 1.2rem;
}

/* Image Paste Box */
.paste-box {
    border: 2px dashed #93c5fd;
    background: #f8fafc;
    padding: 18px;
    border-radius: 10px;
    text-align: center;
    color: #1d4ed8;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
}

.paste-box:hover {
    background: #eff6ff;
    border-color: #3b82f6;
}

.preview-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid var(--border);
}

/* Upload Document Area */
.import-box {
    border: 2px dashed #14b8a6;
    background: #f0fdfa;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 18px;
}
