/* RPHKAFA design tokens — sampled from the approved reference mockups.
   Emerald green primary, warm gold accent, ivory surface. */
:root {
    --green-900: #0E4429;
    --green-800: #14512F;
    --green-700: #1B6B3A;
    --green-600: #1B7A43;
    --green-500: #2E9E5B;
    --green-100: #E8F5EC;
    --green-50: #F3FAF5;

    --gold-600: #B78A14;
    --gold-500: #D4A017;
    --gold-300: #F2C14E;
    --gold-100: #FDF6E3;

    --ink-900: #101828;
    --ink-700: #344054;
    --ink-500: #667085;
    --ink-300: #98A2B3;

    --surface: #FFFFFF;
    --surface-2: #F4F6F8;
    --surface-3: #EDF1F5;
    --line: #E4E8EE;

    --red-600: #C0392B;
    --red-100: #FDECEA;
    --blue-600: #2563EB;
    --orange-500: #E8871E;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 4px 14px rgba(16, 24, 40, .07);
    --shadow-lg: 0 12px 32px rgba(16, 24, 40, .1);

    --font: "Poppins", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-jawi: "Scheherazade", "Noto Naskh Arabic", "Traditional Arabic", serif;

    --tap: 44px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--ink-900);
    background: var(--surface-2);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--green-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* ---------- Shell ---------- */
.shell {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(180deg, var(--green-800) 0%, var(--green-900) 100%);
    color: #fff;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 22px;
    color: #fff;
    text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-text { font-size: 21px; font-weight: 700; letter-spacing: .2px; }
.brand-text b { color: #fff; }
.brand-text i { color: var(--gold-300); font-style: normal; }

.nav { display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-pill);
    color: rgba(255, 255, 255, .82);
    font-size: 14.5px;
    font-weight: 500;
    min-height: var(--tap);
    transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.nav-item.is-active { background: var(--green-500); color: #fff; font-weight: 600; }
.nav-item svg { flex: 0 0 20px; opacity: .95; }

.sidebar-foot { margin-top: auto; padding: 8px; }
.staging-tag {
    display: inline-block;
    background: var(--gold-500);
    color: #3A2A00;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 1.2px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
}

.main { padding: 26px 30px 90px; max-width: 1220px; width: 100%; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.page-title { font-size: 25px; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.status-chip {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--green-100);
    color: var(--green-700);
}
.status-expired { background: var(--red-100); color: var(--red-600); }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--green-500);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 16px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta b { font-size: 14px; }
.user-meta small { color: var(--ink-500); font-size: 12px; }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink-700);
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 13.5px;
    cursor: pointer;
    min-height: 38px;
}
.btn-ghost:hover { background: var(--surface-3); }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 16px; margin-bottom: 12px; }

.banner {
    background: linear-gradient(105deg, #FFF8E7 0%, #FDF2D6 55%, #EFF8EE 100%);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    overflow: hidden;
}
.banner h2 { color: var(--green-700); font-size: 21px; margin-bottom: 5px; }
.banner p { margin: 0; color: var(--ink-700); font-size: 14px; }
.banner-art { flex: 0 0 auto; }

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.stat {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 13px;
}
.stat-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: grid; place-items: center;
    flex: 0 0 42px;
}
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.blue { background: #E8EFFD; color: var(--blue-600); }
.stat-icon.orange { background: #FDF0E3; color: var(--orange-500); }
.stat-icon.gold { background: var(--gold-100); color: var(--gold-600); }
.stat-body { min-width: 0; }
.stat-label { font-size: 12.5px; color: var(--ink-500); }
.stat-value { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.tile {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 17px 18px;
    box-shadow: var(--shadow-sm);
    color: inherit;
    transition: box-shadow .16s ease, transform .16s ease;
}
.tile:hover { box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); }
.tile-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 46px; }
.tile b { display: block; font-size: 15px; margin-bottom: 2px; }
.tile small { color: var(--ink-500); font-size: 13px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink-700); }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=time], input[type=number], select, textarea {
    width: 100%;
    font-family: inherit;
    font-size: 15px;
    color: var(--ink-900);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    min-height: var(--tap);
    transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(46, 158, 91, .16);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.65; }

.field { margin-bottom: 16px; }
.field-error { color: var(--red-600); font-size: 12.5px; margin-top: 5px; }

.jawi { font-family: var(--font-jawi); direction: rtl; text-align: right; font-size: 19px; line-height: 2; }
.jawi-sm { font-family: var(--font-jawi); direction: rtl; text-align: right; font-size: 16px; line-height: 1.9; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--green-600);
    color: #fff;
    border: 0;
    border-radius: var(--radius-pill);
    padding: 12px 22px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    min-height: var(--tap);
}
.btn:hover { background: var(--green-700); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-outline {
    background: transparent;
    color: var(--green-600);
    border: 1.6px solid var(--green-500);
}
.btn-outline:hover { background: var(--green-50); color: var(--green-700); }
.btn-sm { padding: 8px 15px; font-size: 13.5px; min-height: 38px; }

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-ok { background: var(--green-100); color: var(--green-800); border: 1px solid #BFE6CD; }
.alert-err { background: var(--red-100); color: #8C2318; border: 1px solid #F5C6C0; }
.alert ul { margin: 0; padding-inline-start: 18px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { background: var(--surface-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-500); font-weight: 700; }
table.data tr:last-child td { border-bottom: 0; }

.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); }
.pill-draft { background: var(--surface-3); color: var(--ink-700); }
.pill-final { background: var(--green-100); color: var(--green-700); }
.pill-exam { background: #E8EFFD; color: var(--blue-600); }
.pill-holiday { background: var(--gold-100); color: var(--gold-600); }

/* ---------- Mobile ---------- */
.bottomnav { display: none; }

@media (max-width: 1024px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .main { padding: 18px 16px 96px; }
    .stats { grid-template-columns: repeat(2, 1fr); }

    .bottomnav {
        display: flex;
        position: fixed;
        inset: auto 0 0 0;
        background: var(--surface);
        border-top: 1px solid var(--line);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        z-index: 40;
    }
    .bn-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 7px 2px;
        color: var(--ink-500);
        font-size: 11px;
        font-weight: 600;
        min-height: var(--tap);
    }
    .bn-item.is-active { color: var(--green-600); }
    .bn-item:hover { text-decoration: none; }
}

@media (max-width: 640px) {
    .page-title { font-size: 21px; }
    .tiles { grid-template-columns: 1fr; }
    .banner { flex-direction: column; align-items: flex-start; }
    .banner-art { display: none; }
    .user-meta { display: none; }
    .card { padding: 16px; }
}

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--gold-500); outline-offset: 2px; }
