:root {
    --uni-blue: #a9a9a9;
    --uni-blue-dark: #808080;
    --uni-blue-light: #e8e8e8;
    --accent: #e11d48;
    --success: #15803d;
    --gold: #f59e0b;
    --ink: #1f2937;
    --muted: #64748b;
    --card-border: #d5d5d5;
    --bg: #eeeeee;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Tahoma, "Arial", "Noto Kufi Arabic", sans-serif;
    background: var(--bg);
    color: var(--ink);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: #6a6a6a; }

/* ------------------------------------------------------------- Header */

.app-header {
    background: linear-gradient(135deg, #505050 0%, #6a6a6a 55%, #7a7a7a 100%);
    color: #fff;
    padding: 0.6rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .brand {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.app-header .brand img { height: 46px; width: 46px; object-fit: contain; }

.brand-mark {
    flex: 0 0 44px; height: 44px; width: 44px; border-radius: 50%;
    background: #fff; color: var(--uni-blue); font-weight: 800; font-size: 1.25rem;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 3px rgba(255,255,255,.25);
}

.brand-mark-lg {
    display: inline-flex; align-items: center; justify-content: center;
    width: 84px; height: 84px; border-radius: 50%;
    background: linear-gradient(135deg, var(--uni-blue-dark), var(--uni-blue));
    color: #fff; font-weight: 800; font-size: 2.4rem;
    border: 3px solid #fff; box-shadow: 0 10px 26px rgba(4, 26, 60, .35);
}

.app-header .brand .title { line-height: 1.25; }

.app-header .brand .title strong { font-size: 1.05rem; display: block; }

.app-header .brand .title span { font-size: .8rem; opacity: .85; display: block; }

.app-header .actions { display: flex; align-items: center; gap: .6rem; }

.user-chip {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.25);
    padding: .35rem .8rem;
    border-radius: 999px;
    font-size: .85rem;
}

/* ------------------------------------------------------------- Layout */

.main-wrap { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

/* --------------------------------------------------------------- Login */

.login-wrap { min-height: 100vh; display: flex; flex-direction: column; background: #fff; }

.login-header {
    position: relative;
    display: flex; align-items: center; justify-content: flex-start;
    background: linear-gradient(160deg, #505050 0%, #6a6a6a 55%, #7a7a7a 100%);
    padding: 1.25rem 1.6rem;
    box-shadow: 0 6px 22px rgba(0, 0, 0, .25);
}

.login-logo { height: 72px; width: 72px; object-fit: contain; flex: 0 0 auto; }

.login-header-txt { position: absolute; left: 50%; transform: translateX(-50%); color: #fff; text-align: center; line-height: 1.35; white-space: nowrap; }

.login-uni-name { display: block; font-size: 1.55rem; font-weight: 800; }

.login-card-title { display: block; font-size: 1.05rem; font-weight: 700; margin-top: .25rem; opacity: .96; }

.login-page {
    flex: 1; width: 100%;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 2rem 1.5rem 3rem;
    background:
        radial-gradient(1200px 600px at 85% -10%, rgba(80,90,100,.08), transparent 60%),
        linear-gradient(180deg, #f2f4f7 0%, #fff 60%);
}

.login-body { width: 100%; max-width: 470px; text-align: center; }

.login-instruct {
    font-size: 1.25rem; font-weight: 700; color: #1e2126;
    margin: 0 0 1.5rem; line-height: 1.6;
}

.login-card {
    width: 100%;
    background: #fff;
    border-radius: 18px;
    border: 1px solid var(--card-border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .14);
    padding: 1.8rem 1.9rem 2rem;
    text-align: center;
}

.login-card .logo-img { width: 84px; height: 84px; border-radius: 50%; border: 3px solid var(--uni-blue-light); }

.login-card h1 { font-size: 1.35rem; color: var(--uni-blue-dark); margin: .9rem 0 .15rem; }

.login-card .subtitle { color: var(--muted); font-size: .92rem; margin-bottom: 1.6rem; }

.login-card .field { text-align: right; margin-bottom: 1.1rem; }

.login-card .field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; color: var(--ink); }

.login-card .input-group-text { background: var(--uni-blue-light); border-color: var(--card-border); color: var(--uni-blue); }

.login-card .form-control { border-radius: 999px; padding: .62rem 1rem; }

.login-card .form-control:focus { border-color: var(--uni-blue); box-shadow: 0 0 0 .2rem rgba(169,169,169,.35); }

.login-card .btn-login { background: var(--uni-blue-dark); border: none; padding: .66rem; font-size: 1.05rem; font-weight: 700; border-radius: 999px; width: 100%; color: #fff; }

.login-card .btn-login:hover { background: #696969; }

.login-body .error-box {
    background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
    border-radius: 10px; padding: .7rem .9rem; font-size: .9rem; margin-bottom: 1rem; text-align: right;
}

.login-body .foot { margin-top: 1.4rem; font-size: .8rem; color: var(--muted); }

/* -------------------------------------------------------------- Wizard */

.wizard { display: grid; grid-template-columns: 290px 1fr; gap: 1.25rem; align-items: start; }

@media (max-width: 900px) {
    .wizard { grid-template-columns: 1fr; }
}

.card {
    background: #fff;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .06);
}

.steps-nav {
    position: sticky; top: 88px; padding: 1.1rem .9rem;
    background: linear-gradient(180deg, #505050 0%, #6a6a6a 100%);
    border: none; color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .25);
}

@media (max-width: 900px) { .steps-nav { position: static; } }

.steps-nav .nav-title { font-weight: 700; color: #fff; padding: 0 .35rem .5rem; font-size: .95rem; letter-spacing: .02em; }

.steps-nav ol { list-style: none; margin: 0; padding: 0; counter-reset: step; }

.steps-nav li {
    display: flex; align-items: center; gap: .65rem;
    padding: .62rem .55rem; border-radius: 12px; cursor: pointer;
    transition: background .15s; position: relative;
}

.steps-nav li:hover { background: rgba(255,255,255,.18); }

.steps-nav li.active { background: rgba(255,255,255,.22); box-shadow: inset 3px 0 0 #fff; }

.steps-nav li.locked { opacity: .55; cursor: not-allowed; }

.steps-nav .num {
    flex: 0 0 30px; height: 30px; border-radius: 50%;
    background: rgba(255,255,255,.25); color: #fff; font-weight: 700; font-size: .9rem;
    display: inline-flex; align-items: center; justify-content: center;
}

.steps-nav li.done .num { background: var(--success); color: #fff; }

.steps-nav li.error .num { background: var(--accent); color: #fff; }

    .steps-nav li.active .num { background: #fff; color: var(--uni-blue-dark); box-shadow: 0 0 0 4px rgba(255,255,255,.3); }

.steps-nav li.error .num::after { content: "!"; }

.steps-nav li.done .num::after { content: "✓"; }

.steps-nav .lbl { font-size: .95rem; color: #fff; }

.steps-nav li .badge-count { display: none; }

.steps-nav .hint { font-size: .75rem; color: rgba(255,255,255,.85); padding: .6rem .35rem 0; }

/* ----------------------------------------------------------- Step card */

.step-card { display: none; padding: 1.5rem 1.6rem 1.6rem; }

.step-card.active { display: block; }

.step-card .step-head { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }

.step-card .step-head .ic {
    width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
    background: var(--uni-blue-light); color: var(--uni-blue);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}

.step-card .step-head h2 { font-size: 1.15rem; margin: 0; color: var(--uni-blue-dark); font-weight: 700; }

.step-card .step-head p { margin: 0; font-size: .85rem; color: var(--muted); }

.step-card h3.section-title {
    font-size: .95rem; font-weight: 700; color: var(--uni-blue-dark);
    border-bottom: 2px solid var(--uni-blue-light); padding-bottom: .45rem; margin: 1.4rem 0 .95rem;
}

/* --------------------------------------------------------- Form fields */

.form-label { font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }

.form-label .req { color: var(--accent); }

.form-control, .form-select {
    border: 1.5px solid var(--card-border); border-radius: 999px; min-height: 44px;
    padding: .55rem 1rem; font-size: .95rem;
    background: #fff; color: var(--ink);
    box-shadow: inset 0 1px 3px rgba(0,0,0,.06);
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--uni-blue); box-shadow: 0 0 0 .2rem rgba(169,169,169,.35);
    outline: none;
}

.form-control:disabled, .form-select:disabled { background: #f1f5f9; color: #334155; opacity: 1; }

.input-group-text { border-radius: 999px; background: var(--uni-blue-light); color: var(--uni-blue-dark); border: 1.5px solid var(--card-border); }

.form-check .form-check-input:checked { background-color: var(--uni-blue-dark); border-color: var(--uni-blue-dark); }

.form-hint { font-size: .78rem; color: var(--muted); margin-top: .25rem; }

/* --------------------------------------------------------------- Photo */

.photo-drop {
    border: 2px dashed var(--card-border); border-radius: 16px;
    padding: 1.4rem; text-align: center; cursor: pointer; transition: all .15s;
    background: var(--uni-blue-light);
}

.photo-drop:hover, .photo-drop.dragover { border-color: var(--uni-blue); background: #e4e6ea; }

.photo-drop.photo-locked { cursor: default; pointer-events: none; background: #fff; border-style: solid; }

.photo-drop.photo-locked:hover, .photo-drop.photo-locked.dragover { border-color: var(--card-border); background: #fff; }

.photo-drop img.preview { max-height: 220px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }

.photo-drop .ph { font-size: 2.6rem; color: var(--uni-blue); }

.photo-drop .ph-label { font-weight: 600; color: var(--uni-blue-dark); }

/* ---------------------------------------------------------------- Msg */

.alert { border-radius: 12px; }

.app-message { margin-bottom: 1rem; }

/* ------------------------------------------------------------- Buttons */

.btn-primary-uni { background: var(--uni-blue-dark); border-color: var(--uni-blue-dark); color: #fff; font-weight: 700; border-radius: 999px; }

.btn-primary-uni:hover { background: #696969; border-color: #696969; color: #fff; }

.btn-success-uni { background: var(--success); border-color: var(--success); color: #fff; font-weight: 700; border-radius: 12px; }

.btn-success-uni:hover { background: #166534; color: #fff; }

.btn-ghost { border-radius: 999px; color: var(--uni-blue-dark); border-color: var(--card-border); font-weight: 600; }

.btn-ghost:hover { background: var(--uni-blue-light); color: var(--uni-blue-dark); }

.wizard-footer { display: flex; flex-direction: row; justify-content: center; align-items: center; gap: .8rem; margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--card-border); }

/* --------------------------------------------------------------- Review */

.review-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem 1.2rem; }

.review-item { font-size: .9rem; border-bottom: 1px dashed #e2e8f0; padding-bottom: .35rem; }

.review-item dt { color: var(--muted); font-size: .78rem; margin: 0; }

.review-item dd { font-weight: 600; margin: 0; color: var(--ink); }

.agree-box {
    background: #fff8e6; border: 2px solid #e2a716;
    border-radius: 14px; padding: 1rem 1.2rem;
}
.agree-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; }
.agree-ic {
    flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%;
    background: #e2a716; color: #fff; font-weight: 700; font-size: 1.05rem;
    display: flex; align-items: center; justify-content: center;
}
.agree-head strong { font-size: 1.05rem; color: var(--ink); }
.req-badge {
    background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700;
    border-radius: 999px; padding: .22rem .65rem; line-height: 1;
}
.agree-body { display: flex; align-items: flex-start; gap: .75rem; margin: 0; }
.agree-check { flex: 0 0 26px; width: 26px !important; height: 26px !important; margin-top: .1rem !important; }
.agree-label { font-size: 1.02rem; font-weight: 700; color: var(--ink); line-height: 1.75; cursor: pointer; }

.step-errors { margin: 0.4rem 0 0; color: var(--accent); font-size: .92rem; font-weight: 600; }

.step-errors li { margin-bottom: .2rem; }

.step-errors.flash-hint { animation: flash-err .9s ease 2; border-radius: 6px; padding: .15rem .3rem; }

@keyframes flash-err { 0%, 100% { background: transparent; } 50% { background: #ffe4e6; } }

.step-card.has-errors { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.step-card.has-errors .step-head { border-bottom-color: var(--accent); }

/* ------------------------------------------------------------ Basic info */

.basic-head {
    display: flex; align-items: center; gap: .8rem; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--card-border);
}
.basic-avatar {
    flex: 0 0 50px; height: 50px; width: 50px; border-radius: 50%;
    background: linear-gradient(135deg, var(--uni-blue-dark), var(--uni-blue));
    color: #fff; font-weight: 800; font-size: 1.4rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.basic-id { flex: 1; display: flex; flex-direction: column; line-height: 1.35; }
.basic-id strong { font-size: 1.05rem; color: var(--ink); }
.basic-id span { font-size: .82rem; color: var(--muted); }
.mode-badge { font-size: .78rem; padding: .35rem .7rem; border-radius: 999px; white-space: nowrap; }
.basic-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: .5rem .8rem;
    padding: .9rem 1.3rem;
}
.basic-grid small { display: block; font-size: .78rem; color: var(--muted); }
.basic-grid b { font-size: .92rem; }

.query-box {
    background: var(--uni-blue-light); border: 1px solid var(--card-border);
    border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1rem;
}

/* Query-first screen for new Jordanian records */
.query-gate { max-width: 820px; margin: 0 auto 1rem; padding: 1.5rem 1.6rem 1.6rem; }

.query-gate .gate-head { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }

.query-gate .gate-head .ic {
    width: 40px; height: 40px; border-radius: 12px; flex: 0 0 40px;
    background: var(--uni-blue-light); color: var(--uni-blue);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.15rem;
}

.query-gate .gate-head h2 { font-size: 1.15rem; margin: 0; color: var(--uni-blue-dark); font-weight: 700; }

.query-gate .gate-head p { margin: 0; font-size: .85rem; color: var(--muted); }

.query-gate .query-box { margin-bottom: .4rem; }

/* ------------------------------------------------------------ Mobile */

@media (max-width: 900px) {
    /* Step navigation becomes a compact horizontal chip row on tablets/phones */
    .steps-nav ol { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .35rem; }
    .steps-nav li { flex: 0 0 auto; white-space: nowrap; }
}

@media (max-width: 576px) {
    .main-wrap { padding: 1rem .7rem 2rem; }

    /* Top header wraps instead of overflowing */
    .app-header { flex-wrap: wrap; gap: .35rem .7rem; padding: .55rem .8rem; }
    .app-header .brand { gap: .55rem; }
    .app-header .brand img { height: 38px; width: 38px; }
    .app-header .brand .title strong { font-size: .95rem; }
    .app-header .brand .title span { font-size: .7rem; }
    .user-chip { font-size: .78rem; padding: .25rem .6rem; }

    /* Login header: centered nowrap text can overflow — drop it to normal flow */
    .login-header { padding: 1rem .9rem; }
    .login-logo { height: 56px; width: 56px; }
    .login-header-txt { position: static; transform: none; white-space: normal; text-align: right; }
    .login-uni-name { font-size: 1.1rem; }
    .login-card-title { font-size: .88rem; margin-top: .15rem; }
    .login-page { padding: 1.4rem 1rem 2rem; }
    .login-card { padding: 1.25rem 1rem 1.4rem; }
    .login-instruct { font-size: 1.05rem; }

    /* Cards breathe a bit tighter on phones */
    .basic-head { padding: .85rem 1rem; }
    .basic-grid { padding: .7rem 1rem; }
    .step-card { padding: 1.1rem 1rem 1.2rem; }
    .query-gate { padding: 1.1rem 1rem 1.2rem; }
    .query-box { padding: .85rem .9rem; }
    .wizard-footer { flex-wrap: wrap; gap: .5rem; }
}

/* -------------------------------------------------------------- Footer */

.app-footer {
    text-align: center; padding: .8rem 1rem; font-size: .78rem;
    color: var(--muted); background: #fff; border-top: 1px solid var(--card-border);
}