:root {
    --ink: #182622;
    --muted: #667872;
    --paper: #f6f8f7;
    --panel: #ffffff;
    --line: #dde5e1;
    --line-strong: #b8c9c1;
    --accent: #0d8068;
    --accent-strong: #075645;
    --blue: #2c6690;
    --red: #aa3f35;
    --gold: #b58a2d;
    --soft: #edf5f2;
    --nav: #13362d;
    --nav-hover: #1d4c40;
    --shadow: 0 14px 36px rgba(21, 33, 28, .10);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", "Noto Kufi Arabic", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
    color: var(--ink);
    background:
        linear-gradient(180deg, #fbfcfc 0%, #eef4f1 100%);
    line-height: 1.65;
}

a { color: var(--blue); text-decoration: none; }

.topbar,
.page,
.footer {
    padding-inline: 44px;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 150px;
    display: flex;
    align-items: center;
    background:
        linear-gradient(90deg, rgba(13, 128, 104, .10), rgba(44, 102, 144, .07) 42%, rgba(181, 138, 45, .10)),
        linear-gradient(180deg, #123a30 0, #123a30 12px, #ffffff 12px, #ffffff 100%);
    border-bottom: 1px solid #cfded7;
    box-shadow: 0 14px 32px rgba(21, 33, 28, .10);
}

.topbar-inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding-top: 12px;
    position: relative;
}

.topbar-inner::after {
    content: "";
    width: min(320px, 28vw);
    height: 3px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--accent), var(--blue), var(--gold));
    position: absolute;
    left: 0;
    bottom: 10px;
}

.identity {
    display: flex;
    align-items: center;
    gap: 24px;
    min-width: 0;
    width: min(920px, 100%);
    margin-left: auto;
    text-align: right;
}

.logo-frame {
    width: 104px;
    height: 104px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 8px;
    border: 1px solid #cbd9d3;
    background: #ffffff;
    box-shadow:
        inset 0 0 0 6px #f5faf7,
        0 8px 20px rgba(21, 33, 28, .10);
}

.logo {
    width: 82px;
    height: 82px;
    object-fit: contain;
}

.brand {
    display: block;
    color: var(--ink);
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.22;
}

.institution {
    margin-top: 9px;
    color: var(--accent-strong);
    font-weight: 700;
    font-size: 18px;
}

.system-subtitle {
    margin-top: 6px;
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
}

.muted { color: var(--muted); }

.identity-text .muted {
    font-size: 12px;
}

.userbar,
.top-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
}

.session-card {
    min-width: 110px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfa;
}

.session-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.session-card strong {
    display: block;
    color: var(--ink);
    font-size: 14px;
    white-space: nowrap;
}

.session-card.wide {
    min-width: 160px;
}

.userbar span,
.badge {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 11px;
    background: #f8fbfa;
    color: #33463e;
    font-size: 13px;
}

.badge {
    background: #eef7fb;
    color: #174f75;
}

.nav {
    position: fixed;
    top: 150px;
    right: 0;
    bottom: 0;
    z-index: 19;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 250px;
    padding: 18px 16px;
    background: var(--nav);
    border-left: 1px solid #0d2b23;
    box-shadow: -10px 18px 38px rgba(19, 54, 45, .16);
    overflow-y: auto;
}

.nav-session {
    margin-top: auto;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    background: rgba(255, 255, 255, .07);
    color: #eaf6f1;
}

.nav-session span,
.nav-session strong,
.nav-session small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-session span {
    font-weight: 800;
}

.nav-session strong,
.nav-session small {
    margin-top: 4px;
    color: #c7ded6;
    font-size: 12px;
}

.nav-session a {
    display: block;
    width: 100%;
    margin-top: 12px;
    border-color: rgba(255, 255, 255, .18);
    background: var(--red);
    color: #fff;
    text-align: center;
}

.nav-title {
    margin: 0 2px 6px;
    color: #b7d1c8;
    font-size: 13px;
    font-weight: 800;
}

.nav a,
.btn,
button {
    min-height: 40px;
    border: 1px solid var(--line-strong);
    background: #ffffff;
    color: var(--ink);
    border-radius: 8px;
    padding: 9px 15px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.nav a {
    display: block;
    width: 100%;
    text-align: right;
    color: #f5fbf8;
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .13);
}

.nav a:hover,
.btn:hover,
button:hover {
    border-color: var(--accent);
    box-shadow: 0 5px 16px rgba(17, 109, 92, .12);
}

.nav a:hover {
    background: var(--nav-hover);
    border-color: rgba(255, 255, 255, .26);
    box-shadow: none;
}

.btn.primary,
button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn.primary:hover,
button.primary:hover {
    background: var(--accent-strong);
}

.btn.danger,
button.danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.icon-btn {
    min-height: 34px;
    padding: 6px 10px;
}

.page {
    min-height: calc(100vh - 176px);
    padding-top: 28px;
    padding-bottom: 44px;
}

body:has(.nav) .page,
body:has(.nav) .footer {
    margin-right: 250px;
}

.footer {
    padding-top: 18px;
    padding-bottom: 22px;
    color: var(--muted);
    background: #fff;
    border-top: 1px solid var(--line);
}

.section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.section-title h1 {
    margin: 0;
    font-size: 29px;
    line-height: 1.3;
}

.section-title p {
    margin: 5px 0 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
    margin-bottom: 20px;
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(90deg, rgba(255,255,255,.96), rgba(255,255,255,.88)),
        url("cargo.jpg") center/cover no-repeat;
    box-shadow: var(--shadow);
}

.dashboard-hero h1 {
    margin: 4px 0 8px;
    font-size: 34px;
    line-height: 1.25;
}

.dashboard-hero p {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
}

.kicker {
    display: inline-block;
    margin-bottom: 4px;
    color: var(--gold);
    font-weight: 800;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.module-card {
    display: grid;
    gap: 12px;
    min-height: 180px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--accent);
}

.module-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.module-card-top span {
    font-size: 18px;
    font-weight: 800;
}

.module-card-top b {
    min-width: 58px;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--soft);
    color: var(--accent-strong);
    text-align: center;
    font-size: 24px;
}

.module-card p {
    margin: 0;
    color: var(--muted);
}

.module-card .btn {
    justify-self: start;
    align-self: end;
}

.module-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--accent);
}

.module-head h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.25;
}

.module-head p {
    margin: 6px 0 0;
    color: var(--muted);
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.card h1,
.card h2 {
    margin-top: 0;
}

.settings-card {
    position: relative;
    display: block;
    min-height: 132px;
    padding-inline-start: 24px;
    color: var(--ink);
}

.settings-card::before {
    content: "";
    position: absolute;
    inset-block: 20px;
    inset-inline-start: 0;
    width: 4px;
    border-radius: 8px;
    background: var(--accent);
}

.settings-card h2 {
    margin-bottom: 8px;
    font-size: 19px;
}

.settings-card p {
    margin: 0;
    font-size: 13px;
}

.print-sheet {
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.print-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.print-head span {
    color: var(--accent-strong);
    font-size: 13px;
    font-weight: 800;
}

.print-head h1 {
    margin: 6px 0 4px;
    font-size: 34px;
    line-height: 1.25;
}

.print-head p {
    margin: 0;
    color: var(--muted);
    font-weight: 700;
}

.print-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.stat {
    margin: 8px 0 12px;
    color: var(--accent);
    font-size: 34px;
    font-weight: 800;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0 0;
}

.toolbar {
    justify-content: space-between;
    margin-bottom: 16px;
}

.workbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.workbar-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.advanced-search {
    margin: 0 0 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(21, 33, 28, .06);
}

.advanced-search summary {
    cursor: pointer;
    padding: 13px 16px;
    color: var(--accent-strong);
    font-weight: 800;
}

.advanced-search form {
    padding: 0 16px 16px;
}

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

.form-section {
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
}

.form-section h3 {
    margin: 0 0 12px;
    color: var(--accent-strong);
    font-size: 17px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #243a31;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(17, 109, 92, .16);
    border-color: var(--accent);
}

.searchbar {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(100%, 480px);
}

.searchbar input {
    min-width: 0;
}

.table-wrap {
    overflow-x: auto;
    border-top: 1px solid var(--line);
    background: #fff;
}

.data-panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.data-panel-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #fff;
}

.data-panel-head strong {
    display: block;
    font-size: 17px;
}

.data-panel-head span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

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

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: right;
    vertical-align: top;
    font-size: 13px;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef5f2;
    color: #213b31;
    font-weight: 800;
    white-space: nowrap;
}

tbody tr:nth-child(even) { background: #fbfdfc; }
tbody tr:hover { background: #f0f8f5; }
.row-actions { white-space: nowrap; }
.small {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 13px;
}

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

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.pagination .disabled {
    opacity: .45;
    pointer-events: none;
}

.pagination .active-page {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

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

.detail-item {
    min-height: 86px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(21, 33, 28, .06);
}

.detail-item span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.detail-item strong {
    display: block;
    overflow-wrap: anywhere;
    font-size: 16px;
}

.detail-qr {
    display: grid;
    justify-items: center;
    gap: 8px;
    min-width: 130px;
}

.detail-qr img {
    width: 112px;
    height: 112px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 5px;
}

.detail-qr span {
    color: var(--accent-strong);
    font-weight: 800;
}

.qr-cell {
    display: inline-grid;
    grid-template-columns: 48px minmax(70px, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 130px;
}

.qr-code {
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    padding: 3px;
}

.alert {
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    background: #fff;
}

.alert.success { border-color: #79b894; background: #edf9f2; }
.alert.error { border-color: #df9a91; background: #fff1ef; }
.alert.warning { border-color: #dfbf75; background: #fff8e6; }

.login {
    min-height: calc(100vh - 210px);
    display: grid;
    align-items: center;
}

.login-shell {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 520px);
    overflow: hidden;
    width: min(1120px, 100%);
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 22px 60px rgba(21, 33, 28, .15);
}

.login-visual {
    position: relative;
    min-height: 460px;
    background: #132d26;
}

.login-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .72;
    filter: contrast(1.05) saturate(.85);
}

.visual-caption {
    position: absolute;
    right: 28px;
    bottom: 28px;
    left: 28px;
    display: grid;
    gap: 7px;
    color: #fff;
    background: rgba(10, 28, 22, .72);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 8px;
    padding: 16px;
}

.visual-caption strong {
    font-size: 22px;
}

.login-card {
    display: grid;
    align-content: center;
    padding: 42px;
    background: #fff;
}

.login-logo {
    width: 76px;
    height: 76px;
    object-fit: contain;
    margin-bottom: 14px;
}

.login-card h1 {
    margin: 0 0 6px;
    font-size: 30px;
}

.login-card label {
    margin-top: 16px;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(9, 20, 16, .58);
}

.modal.is-open { display: flex; }

.modal-panel {
    width: min(1080px, 100%);
    max-height: calc(100vh - 44px);
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.modal-small {
    width: min(520px, 100%);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.modal-head h2 {
    margin: 0;
}

@media print {
    .topbar,
    .nav,
    .actions,
    .footer,
    .row-actions,
    .workbar,
    .no-print {
        display: none;
    }
    body {
        background: #fff;
    }
    body:has(.nav) .page,
    body:has(.nav) .footer {
        margin-right: 0;
    }
    .page {
        padding: 0;
        margin: 0;
    }
    .table-wrap,
    .print-sheet {
        box-shadow: none;
    }
    .print-sheet {
        border: 0;
        padding: 0;
    }
}

@media (max-width: 860px) {
    .topbar,
    .nav,
    .page,
    .footer {
        padding-inline: 16px;
    }
    .topbar {
        position: static;
        align-items: stretch;
        min-height: 0;
        padding-top: 18px;
        padding-bottom: 16px;
    }
    .topbar-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .topbar-inner::after {
        width: 100%;
        bottom: -2px;
    }
    .nav {
        position: static;
        width: auto;
        flex-direction: row;
        overflow-x: auto;
        background: var(--nav);
        border-left: 0;
        border-bottom: 1px solid var(--line);
        box-shadow: none;
        padding-top: 12px;
        padding-bottom: 12px;
    }
    .nav-title { display: none; }
    .nav a { width: auto; white-space: nowrap; }
    .nav-session {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: max-content;
        margin-top: 0;
        padding: 6px;
    }
    .nav-session span,
    .nav-session strong,
    .nav-session small,
    .nav-session a {
        margin: 0;
        width: auto;
    }
    body:has(.nav) .page,
    body:has(.nav) .footer {
        margin-right: 0;
    }
    .identity { min-width: 0; align-items: flex-start; gap: 14px; margin-left: 0; }
    .logo-frame { width: 70px; height: 70px; }
    .logo { width: 54px; height: 54px; }
    .brand { font-size: 24px; }
    .institution { font-size: 14px; }
    .system-subtitle { font-size: 12px; }
    .login-shell { grid-template-columns: 1fr; }
    .dashboard-hero { grid-template-columns: 1fr; padding: 18px; }
    .login-visual { min-height: 190px; }
    .login-card { padding: 24px; }
    .section-title { align-items: stretch; }
    .searchbar { width: 100%; }
    th, td { min-width: 130px; }
}
