:root {
    --gold: #d4a017;
    --gold-dark: #b3860f;
    --gold-light: #fdf3d9;
    --ink: #2b2b2b;
    --muted: #6b6b6b;
    --danger: #c0392b;
    --success: #1e8a4c;
    --border-radius: 16px;
    --navy: #0f1c3f;
    --navy-dark: #0a1530;
    --navy-light: #1c2f5e;
    --on-navy-muted: #aab6d6;
}

* { box-sizing: border-box; }

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--navy);
    color: var(--ink);
    margin: 0;
}

.navbar {
    background: var(--navy-dark);
    border-bottom: 3px solid var(--gold);
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    text-decoration: none;
}

.navbar .brand .dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gold);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
}

.navbar .nav-links a {
    margin-inline-start: 18px;
    text-decoration: none;
    color: #fff;
    font-weight: 600;
}

.navbar .nav-links a.logout { color: #ff8a80; }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

.card {
    background: #fff;
    border: 1px solid #eee2c0;
    border-radius: var(--border-radius);
    padding: 22px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.auth-card {
    max-width: 460px;
    margin: 60px auto;
}

h1, h2, h3 { margin-top: 0; }

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

.stat-box {
    background: var(--gold-light);
    border: 1px solid var(--gold);
    border-radius: var(--border-radius);
    padding: 16px;
    text-align: center;
}

.stat-box .num {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gold-dark);
}

.stat-box .label {
    color: var(--muted);
    font-size: 0.9rem;
}

label {
    display: block;
    margin: 12px 0 6px;
    font-weight: 600;
    font-size: 0.92rem;
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9d0ad;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold);
}

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

.btn {
    display: inline-block;
    background: var(--gold);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.15s;
}

.btn:hover { background: var(--gold-dark); }

.btn.secondary {
    background: #fff;
    color: var(--ink);
    border: 1px solid #ccc;
}

.btn.danger { background: var(--danger); }

.btn.small { padding: 6px 14px; font-size: 0.85rem; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th, td {
    padding: 10px 12px;
    text-align: right;
    border-bottom: 1px solid #eee2c0;
    font-size: 0.92rem;
}

th { background: var(--gold-light); font-weight: 700; }

tr:hover td { background: #fffdf5; }

.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge.نشطة { background: #e3f6ea; color: var(--success); }
.badge.متوقفة { background: #fdf0d5; color: #b26a00; }
.badge.منتهية { background: #fbe4e2; color: var(--danger); }

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.search-form {
    display: flex;
    gap: 8px;
    flex: 1;
}

.search-form input, .search-form select { width: auto; }

.flash {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 14px;
    font-weight: 600;
}

.flash.success { background: #e3f6ea; color: var(--success); }
.flash.danger { background: #fbe4e2; color: var(--danger); }
.flash.warning { background: #fdf0d5; color: #b26a00; }
.flash.info { background: #eef2fb; color: #2b4b9e; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 24px;
}

.detail-grid .item .k { color: var(--muted); font-size: 0.82rem; }
.detail-grid .item .v { font-weight: 700; }

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--muted);
}

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0ead0;
}

f