/* ==========================================================================
   Admin UI — الهيكل الأساسي للوحة التحكم وصفحة الدخول
   اللون الأساسي يأتي من الإعدادات عبر --primary (partials/theme.blade.php)
   ========================================================================== */

:root {
    --font: 'Tajawal', 'Segoe UI', Tahoma, sans-serif;

    --bg: #f4f5f8;
    --surface: #ffffff;
    --surface-2: #f4f5f8;
    --border: #eceef2;
    --border-strong: #d9dce3;
    --text: #1f2430;
    --text-2: #4a505c;
    --muted: #8a909c;
    --danger: #e5484d;

    --primary-ink: var(--primary);
    --primary-btn: var(--primary);
    --primary-soft: rgba(var(--primary-rgb), .08);
    --primary-soft-2: rgba(var(--primary-rgb), .14);
    --ring: rgba(var(--primary-rgb), .18);

    --tint-rose: #f9e1e1;
    --tint-amber: #fdf0cc;
    --tint-mint: #dcefe3;
    --tint-sky: #dfeaf8;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-pop: 0 12px 32px rgba(16, 24, 40, .12);

    --sb-w: 290px;
    --sb-w-collapsed: 84px;
    --sb-head-h: 98px;
    --gap: 20px;
}

[data-theme="dark"] {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1e222a;
    --border: #262a33;
    --border-strong: #343945;
    --text: #e7e9ee;
    --text-2: #c2c7d0;
    --muted: #8b92a0;

    /* اللون الأساسي قد يكون داكناً (الأسود افتراضياً) فنفتحه ليبقى مقروءاً */
    --primary-ink: color-mix(in srgb, var(--primary) 45%, #ffffff);
    --primary-btn: color-mix(in srgb, var(--primary) 82%, #ffffff);
    --primary-soft: color-mix(in srgb, var(--primary-ink) 14%, transparent);
    --primary-soft-2: color-mix(in srgb, var(--primary-ink) 22%, transparent);
    --ring: color-mix(in srgb, var(--primary-ink) 30%, transparent);

    --tint-rose: rgba(229, 72, 77, .16);
    --tint-amber: rgba(245, 180, 0, .16);
    --tint-mint: rgba(48, 164, 108, .16);
    --tint-sky: rgba(59, 130, 246, .16);

    --shadow: none;
    --shadow-pop: 0 12px 32px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
html { min-height: 100%; }

body.adm,
body.auth {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body.adm h1, body.adm h2, body.adm h3, body.adm h4, body.adm h5, body.adm h6,
body.auth h1, body.auth h2 {
    font-family: var(--font);
    color: var(--text);
}

body.adm a { color: var(--primary-ink); }
body.adm a:hover { color: var(--primary-ink); opacity: .85; }

:focus-visible { outline: 2px solid var(--primary-ink); outline-offset: 2px; }

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

/* Brand mark: الشعار أو حرف بديل */
.adm-brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
    width: 48px; height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--surface);
}
.adm-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
/* الشعار المرفوع يُعرض بنسبته الطبيعية (الدائرة للحرف البديل فقط) */
.adm-brand-logo {
    display: block;
    height: 76px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}
.adm-brand-mark--initial {
    background: var(--primary-btn);
    color: var(--on-primary);
    font-weight: 700; font-size: 20px;
}

/* --------------------------------------------------------------------------
   Sidebar (القائمة الجانبية)
   -------------------------------------------------------------------------- */
.adm-sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 1040;
    width: var(--sb-w);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-inline-end: 1px solid var(--border);
    transition: width .22s ease, transform .22s ease;
}

.adm-sidebar__head {
    height: var(--sb-head-h);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding-inline: 26px 22px;
    border-bottom: 1px solid var(--border);
}

.adm-sidebar__brand {
    display: flex; align-items: center; gap: 12px;
    min-width: 0; max-height: calc(var(--sb-head-h) - 16px);
    color: var(--text);
    text-decoration: none;
}
.adm-sidebar__brand:hover { color: var(--text); opacity: 1; }
.adm-sidebar__name {
    font-weight: 700; font-size: 15px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.adm-sidebar__toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    flex: 0 0 auto;
    border: 0; border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
    font-size: 22px;
    cursor: pointer;
    transition: background .15s, transform .22s;
}
.adm-sidebar__toggle:hover { background: var(--surface-2); color: var(--text); }
.adm-sidebar__close { display: none; }
/* » يشير لاتجاه الطي: في RTL القائمة يمين فالسهم لليسار يعني "اطوِ" */
[dir="ltr"] .adm-sidebar__toggle i { transform: scaleX(-1); }

.adm-sidebar__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 10px 24px;
    scrollbar-width: thin;
}

.adm-nav { list-style: none; margin: 0; padding: 0; }

.adm-nav__label {
    padding: 10px 16px 3px;
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
}

.adm-nav__link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 38px;
    padding: 6px 14px;
    margin-block: 1px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 15.5px;
    font-weight: 500;
    line-height: 1.4;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}
body.adm .adm-nav__link { color: var(--text); }
body.adm .adm-nav__link:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
body.adm .adm-nav__link.is-active {
    background: var(--primary-soft);
    color: var(--primary-ink);
}
.adm-nav__icon {
    flex: 0 0 22px;
    font-size: 20px;
    line-height: 1;
    text-align: center;
}
.adm-nav__text { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-nav__chevron { font-size: 18px; color: var(--muted); transition: transform .2s; }
.adm-nav__group.is-open > .adm-nav__link .adm-nav__chevron { transform: rotate(180deg); }

/* المجموعات القابلة للطي مفصولة بخطوط كما في التصميم */
.adm-nav__group {
    border-bottom: 1px solid var(--border);
    margin-inline: -10px;
    padding: 6px 10px;
}
.adm-nav__group + .adm-nav__group { border-top: 0; }
.adm-nav__sub {
    list-style: none;
    margin: 0;
    padding: 0 0 6px;
    padding-inline-start: 34px;
    display: none;
}
.adm-nav__group.is-open > .adm-nav__sub { display: block; }
.adm-nav__sub .adm-nav__link { font-size: 15.5px; min-height: 40px; }

/* حالة القائمة المطوية (ديسكتوب) */
@media (min-width: 992px) {
    .sb-collapsed .adm-sidebar { width: var(--sb-w-collapsed); }
    .sb-collapsed .adm-sidebar__head { flex-direction: column; justify-content: center; gap: 6px; padding-inline: 0; }
    .sb-collapsed .adm-sidebar__name,
    .sb-collapsed .adm-nav__text,
    .sb-collapsed .adm-nav__chevron { display: none; }
    .sb-collapsed .adm-brand-mark { width: 40px; height: 40px; }
    .sb-collapsed .adm-brand-logo { height: auto; max-height: 44px; max-width: 60px; }
    .sb-collapsed .adm-sidebar__toggle { width: 30px; height: 26px; font-size: 18px; }
    .sb-collapsed .adm-sidebar__toggle i { transform: scaleX(-1); }
    [dir="ltr"].sb-collapsed .adm-sidebar__toggle i { transform: none; }
    .sb-collapsed .adm-nav__label { font-size: 0; padding: 10px 0 4px; }
    .sb-collapsed .adm-nav__label::after {
        content: ''; display: block; width: 24px; height: 1px; margin-inline: auto; background: var(--border-strong);
    }
    .sb-collapsed .adm-nav__link { justify-content: center; padding-inline: 0; }
    .sb-collapsed .adm-nav__sub { padding-inline-start: 0; }
    .sb-collapsed .adm-main { margin-inline-start: var(--sb-w-collapsed); }
}

/* --------------------------------------------------------------------------
   Main + Topbar (الناف بار المفصول)
   -------------------------------------------------------------------------- */
.adm-main {
    margin-inline-start: var(--sb-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: var(--gap) var(--gap) 0;
    transition: margin .22s ease;
}

.adm-topbar {
    position: sticky;
    top: var(--gap);
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 78px;
    padding: 12px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* زر فتح القائمة للجوال فقط */
.adm-topbar .adm-topbar__menu { display: none; }

/* Search */
.adm-search { position: relative; flex: 0 1 480px; min-width: 0; }
.adm-search__box {
    display: flex; align-items: center; gap: 10px;
    height: 52px;
    padding-inline: 16px 12px;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: 10px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.adm-search__box:focus-within {
    background: var(--surface);
    border-color: var(--primary-ink);
    box-shadow: 0 0 0 3px var(--ring);
}
.adm-search__icon { font-size: 20px; color: var(--muted); line-height: 1; }
.adm-search__input {
    flex: 1 1 auto; min-width: 0;
    border: 0; outline: 0; background: transparent;
    font-family: inherit; font-size: 16px; color: var(--text);
}
.adm-search__input::placeholder { color: var(--muted); }
.adm-search__input::-webkit-search-cancel-button { display: none; }
.adm-kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 24px; height: 24px; padding: 0 6px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--muted);
    font: 500 12px/1 ui-monospace, Consolas, monospace;
}

.adm-search__panel {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline: 0;
    min-width: 320px;
    max-height: min(70vh, 460px);
    overflow-y: auto;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-pop);
    display: none;
}
.adm-search.is-open .adm-search__panel { display: block; }
.adm-search__group {
    padding: 8px 10px 4px;
    font-size: 12px; font-weight: 700;
    color: var(--muted);
}
.adm-search__item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}
body.adm .adm-search__item { color: var(--text); }
.adm-search__item.is-active,
body.adm .adm-search__item:hover { background: var(--primary-soft); color: var(--text); opacity: 1; }
.adm-search__item-icon {
    flex: 0 0 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--primary-ink);
    font-size: 18px;
}
.adm-search__item-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.adm-search__item-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-search__item-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-search__item mark { background: transparent; color: var(--primary-ink); font-weight: 700; padding: 0; }
.adm-search__empty, .adm-search__loading { padding: 18px 10px; text-align: center; color: var(--muted); font-size: 14px; }
.adm-search__foot {
    display: flex; gap: 14px; flex-wrap: wrap;
    margin-top: 6px; padding: 8px 10px 2px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--muted);
}
.adm-search__foot span { display: inline-flex; align-items: center; gap: 5px; }

/* Topbar actions */
.adm-topbar__actions {
    display: flex; align-items: center; gap: 10px;
    margin-inline-start: auto;
}
.adm-icon-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-size: 21px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.adm-icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.adm-icon-btn .adm-dot {
    position: absolute; top: 9px; inset-inline-end: 10px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--surface);
}
[data-theme="dark"] .adm-theme-toggle .mdi-weather-night,
[data-theme="light"] .adm-theme-toggle .mdi-white-balance-sunny { display: none; }

.adm-user {
    display: inline-flex; align-items: center; gap: 10px;
    height: 54px;
    padding-inline: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background .15s;
}
.adm-user:hover { background: var(--surface-2); }
.adm-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto;
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--primary-btn);
    color: var(--on-primary);
    font-weight: 700; font-size: 18px;
    text-transform: uppercase;
}
.adm-user__meta { display: flex; flex-direction: column; line-height: 1.15; text-align: start; white-space: nowrap; }
.adm-user__name { font-weight: 700; font-size: 16px; }
.adm-user__sub { font-size: 12.5px; color: var(--muted); }
.adm-user__chev { font-size: 18px; color: var(--muted); }

/* Dropdowns (bootstrap) */
body.adm .dropdown-menu {
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-pop);
    font-size: 14.5px;
}
body.adm .dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text);
}
body.adm .dropdown-item:hover, body.adm .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
body.adm .dropdown-item.active, body.adm .dropdown-item:active { background: var(--primary-soft); color: var(--primary-ink); }
body.adm .dropdown-item i { font-size: 18px; }
body.adm .dropdown-divider { border-color: var(--border); margin: 6px 0; }
.adm-dropdown-head { padding: 10px 12px; }
.adm-dropdown-head strong { display: block; }
.adm-dropdown-head small { color: var(--muted); }
.adm-dropdown-empty {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 22px 12px; color: var(--muted); text-align: center; width: 280px;
}
.adm-dropdown-empty i { font-size: 30px; }

/* --------------------------------------------------------------------------
   Content
   -------------------------------------------------------------------------- */
.adm-content { flex: 1 0 auto; padding: 0 10px 24px; }

.adm-page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin: 32px 0 22px;
}
.adm-page-head__main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.adm-page-head__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-page-title { margin: 0; font-size: 25px; font-weight: 700; line-height: 1.3; }

/* Breadcrumb */
.adm-breadcrumb__list {
    display: flex; align-items: center; flex-wrap: wrap;
    margin: 0; padding: 0; list-style: none;
    font-size: 14px; line-height: 1.4;
}
.adm-breadcrumb__item { display: inline-flex; align-items: center; min-width: 0; }
.adm-breadcrumb__item + .adm-breadcrumb__item::before {
    /* السهم اتجاهي: ينعكس في RTL */
    content: '';
    width: 16px; height: 16px; margin-inline: 6px;
    background: var(--muted);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 3.5 10.5 8 6 12.5' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    opacity: .7;
}
[dir="rtl"] .adm-breadcrumb__item + .adm-breadcrumb__item::before { transform: scaleX(-1); }
.adm-breadcrumb__link,
.adm-breadcrumb__current {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 4px; margin-inline: -4px;
    border-radius: 6px;
    white-space: nowrap;
}
body.adm .adm-breadcrumb__link { color: var(--muted); text-decoration: none; }
body.adm .adm-breadcrumb__link:hover { color: var(--text); background: var(--surface-2); opacity: 1; }
.adm-breadcrumb__current { color: var(--text-2); font-weight: 500; }
.adm-breadcrumb i { font-size: 16px; line-height: 1; }

.adm-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gap);
}
.adm-stat {
    display: flex; flex-direction: column; align-items: flex-start;
    min-height: 190px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}
a.adm-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); color: var(--text); opacity: 1; }
.adm-stat__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px;
    border-radius: var(--radius);
    color: var(--primary-ink);
    font-size: 26px;
    margin-bottom: auto;
}
.adm-stat__icon--rose { background: var(--tint-rose); }
.adm-stat__icon--amber { background: var(--tint-amber); }
.adm-stat__icon--mint { background: var(--tint-mint); }
.adm-stat__icon--sky { background: var(--tint-sky); }
.adm-stat__label { margin-top: 24px; font-size: 16px; color: var(--text-2); }
.adm-stat__value { font-size: 28px; font-weight: 700; line-height: 1.3; }

.adm-footer {
    padding: 18px 10px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13.5px;
    text-align: center;
}

/* Bootstrap/Adminto components inside pages → match the new look */
body.adm .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    color: var(--text);
}
body.adm .card-box { background: transparent; box-shadow: none; padding: 20px; margin-bottom: 0; }
body.adm .table { color: var(--text); --bs-table-bg: transparent; border-color: var(--border); }
body.adm .table > :not(caption) > * > * { border-color: var(--border); background: transparent; color: var(--text); }
body.adm .table thead th { background: var(--surface-2); font-weight: 700; color: var(--text-2); }

body.adm .btn { border-radius: var(--radius-sm); font-family: inherit; }
body.adm .btn-primary,
body.adm .btn-purple,
body.adm .btn-success,
body.auth .btn-primary {
    background: var(--primary-btn);
    border-color: var(--primary-btn);
    color: var(--on-primary);
}
body.adm .btn-primary:hover, body.adm .btn-purple:hover, body.adm .btn-success:hover,
body.auth .btn-primary:hover { filter: brightness(1.12); color: var(--on-primary); }

body.adm .form-control,
body.adm .form-select {
    border-color: var(--border-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--text);
}
body.adm .form-control:focus,
body.adm .form-select:focus {
    border-color: var(--primary-ink);
    box-shadow: 0 0 0 3px var(--ring);
}
body.adm .form-check-input:checked { background-color: var(--primary-btn); border-color: var(--primary-btn); }
body.adm .page-item.active .page-link { background: var(--primary-btn); border-color: var(--primary-btn); color: var(--on-primary); }
body.adm .modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text); }

/* --------------------------------------------------------------------------
   Login (صفحة الدخول)
   -------------------------------------------------------------------------- */
body.auth { min-height: 100vh; display: flex; position: relative; }
body.auth *, body.auth *::before, body.auth *::after { box-sizing: border-box; }
.auth-wrap {
    width: 100%;
    max-width: 520px;
    margin: auto;
    padding: 40px 16px;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 34px; }
.auth-brand .adm-brand-mark { width: 60px; height: 60px; box-shadow: 0 0 0 1px var(--border); }
.auth-brand .adm-brand-logo { height: 110px; max-width: 260px; }
.auth-brand__name { margin: 0; font-size: 19px; font-weight: 700; color: var(--text); }

.auth-card {
    padding: 30px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.auth-title { margin: 0 0 28px; text-align: center; font-size: 27px; font-weight: 700; }

.auth-field { margin-bottom: 22px; }
.auth-label { display: block; margin-bottom: 8px; font-size: 17px; color: var(--text-2); }
.auth-label .req { color: var(--danger); margin-inline-start: 2px; }
.auth-input-wrap { position: relative; }
.auth-input {
    display: block; width: 100%;
    height: 47px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit; font-size: 16px;
    transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus { outline: 0; border-color: var(--primary-ink); box-shadow: 0 0 0 3px var(--ring); }
/* البريد يُكتب LTR لكن يبدأ من جهة الكتابة العربية مثل باقي الحقول */
[dir="rtl"] .auth-input[dir="ltr"] { text-align: right; }
/* تعبئة المتصفح التلقائية: نلغي الخلفية الزرقاء */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
    caret-color: var(--text);
    transition: background-color 9999s ease-out 0s;
}
.auth-input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px var(--surface) inset, 0 0 0 3px var(--ring); }
.auth-input.is-invalid { border-color: var(--danger); }
.auth-input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(229, 72, 77, .18); }
.auth-input--pw { padding-inline-end: 46px; }
.auth-eye {
    position: absolute; top: 50%; inset-inline-end: 6px; transform: translateY(-50%);
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 6px; background: transparent;
    color: var(--muted); font-size: 20px; cursor: pointer;
}
.auth-eye:hover { color: var(--text); background: var(--surface-2); }
.auth-error { margin-top: 6px; font-size: 13.5px; color: var(--danger); }
.auth-alert {
    margin-bottom: 20px; padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(229, 72, 77, .08);
    color: var(--danger);
    font-size: 14px;
}

.auth-check { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 24px; cursor: pointer; font-size: 17px; color: var(--text-2); user-select: none; }
.auth-check input {
    appearance: none; -webkit-appearance: none;
    width: 20px; height: 20px; margin: 0;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: var(--surface-2);
    display: inline-grid; place-content: center;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.auth-check input::after {
    /* علامة الصح رمز عالمي: لا تنعكس في RTL */
    content: '';
    width: 12px; height: 12px;
    background: var(--on-primary);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 4.9 8.6 9.5 3.6' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 4.9 8.6 9.5 3.6' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    transform: scale(0);
    transition: transform .12s;
}
.auth-check input:checked { background: var(--primary-btn); border-color: var(--primary-btn); }
.auth-check input:checked::after { transform: scale(1); }
.auth-check input:focus-visible { box-shadow: 0 0 0 3px var(--ring); outline: 0; }

.auth-submit {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; height: 47px;
    border: 0; border-radius: var(--radius-sm);
    background: var(--primary-btn);
    color: var(--on-primary);
    font-family: inherit; font-size: 17px; font-weight: 500;
    cursor: pointer;
    transition: filter .15s, transform .05s;
}
.auth-submit:hover { filter: brightness(1.12); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { opacity: .75; cursor: progress; }
.auth-spinner {
    width: 16px; height: 16px;
    border: 2px solid currentColor; border-top-color: transparent;
    border-radius: 50%;
    animation: adm-spin .7s linear infinite;
}
@keyframes adm-spin { to { transform: rotate(360deg); } }

/* مبدّل اللغة في زاوية الصفحة */
.auth-lang {
    position: absolute;
    top: 20px;
    inset-inline-end: 20px;
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px;
    padding-inline: 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-size: 14px; font-weight: 500;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: background .15s, border-color .15s, color .15s;
}
.auth-lang:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.auth-lang i { font-size: 18px; color: var(--muted); }

/* ==========================================================================
   Components — مكونات مشتركة لكل الصفحات
   ========================================================================== */

/* Buttons */
.adm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px;
    padding-inline: 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit; font-size: 15px; font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, border-color .15s, filter .15s, color .15s;
}
.adm-btn i { font-size: 19px; line-height: 1; }
body.adm .adm-btn--primary { background: var(--primary-btn); border-color: var(--primary-btn); color: var(--on-primary); }
body.adm .adm-btn--primary:hover { filter: brightness(1.12); color: var(--on-primary); opacity: 1; }
body.adm .adm-btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
body.adm .adm-btn--ghost:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); opacity: 1; }
body.adm .adm-btn--danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.adm-btn:disabled { opacity: .7; cursor: progress; }

/* Panel (card) */
.adm-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.adm-panel + .adm-panel { margin-top: var(--gap); }
.adm-perm-grid > .adm-panel { margin-top: 0; }
.adm-perm-catalog { overflow: hidden; }
.adm-panel__head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.adm-panel__title { margin: 0; font-size: 17px; font-weight: 700; }
.adm-panel__title .req { color: var(--danger); margin-inline-start: 2px; }
.adm-panel__sub { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.adm-panel__body { padding: 20px; }
.adm-panel__foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

/* Filter (search inside lists) */
.adm-filter {
    position: relative;
    display: flex; align-items: center;
    width: min(100%, 320px);
}
.adm-filter__icon {
    position: absolute; inset-inline-start: 12px;
    font-size: 19px; color: var(--muted); pointer-events: none;
}
.adm-filter__input {
    width: 100%; height: 40px;
    padding-inline: 38px 34px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit; font-size: 14.5px;
    transition: border-color .15s, box-shadow .15s;
}
.adm-filter__input:focus { outline: 0; border-color: var(--primary-ink); box-shadow: 0 0 0 3px var(--ring); }
.adm-filter__input::-webkit-search-cancel-button { display: none; }
.adm-filter__clear {
    position: absolute; inset-inline-end: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 6px;
    color: var(--muted); font-size: 16px;
}
body.adm .adm-filter__clear { color: var(--muted); }
body.adm .adm-filter__clear:hover { background: var(--surface-2); color: var(--text); opacity: 1; }

/* Table */
/* position: relative يجعل العناصر المطلقة داخل الجدول (مثل adm-sr-only) تُقص داخله ولا توسّع الصفحة */
.adm-table-wrap { position: relative; overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.adm-table th {
    padding: 11px 20px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px; font-weight: 500;
    text-align: start;
    white-space: nowrap;
}
.adm-table td {
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}
.adm-table tbody tr:last-child td { border-bottom: 0; }
.adm-table tbody tr { transition: background .12s; }
.adm-table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.adm-table .is-end { text-align: end; }
.adm-table .is-num { font-variant-numeric: tabular-nums; }
.adm-table .is-muted { color: var(--muted); }

.adm-cell-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.adm-cell-user__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
/* داخل الجداول: لا تُكسر الأسماء والأرقام كلمةً كلمة؛ الجدول يتمرر أفقياً داخل بطاقته بدلاً من ذلك */
.adm-table .adm-cell-user__text { min-width: 150px; }
.adm-table .adm-cell-user__name, .adm-table .adm-asset { white-space: nowrap; }
.adm-cell-user__name { font-weight: 500; }
.adm-cell-user__sub { font-size: 13px; color: var(--muted); }
body.adm a.adm-cell-link { color: var(--text); text-decoration: none; }
body.adm a.adm-cell-link:hover { color: var(--primary-ink); opacity: 1; }

.adm-user-list { list-style: none; margin: 0; padding: 6px 0; }
.adm-user-list li { display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.adm-user-list li + li { border-top: 1px solid var(--border); }

/* Avatar sizes */
.adm-avatar--sm { width: 34px; height: 34px; font-size: 14px; }
.adm-avatar--lg { width: 64px; height: 64px; font-size: 26px; }

/* Row actions: أيقونات موحدة */
.adm-actions { display: inline-flex; align-items: center; gap: 4px; }
.adm-action {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border: 0; border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 19px; line-height: 1;
    cursor: pointer;
    transition: background .15s, color .15s;
}
body.adm a.adm-action { color: var(--muted); }
body.adm .adm-action:hover { background: var(--surface-2); color: var(--text); opacity: 1; }
body.adm .adm-action--danger:hover { background: rgba(229, 72, 77, .1); color: var(--danger); }
.adm-action.is-disabled { opacity: .35; cursor: not-allowed; }
body.adm .adm-action.is-disabled:hover { background: transparent; color: var(--muted); }

/* Badges */
.adm-badge {
    display: inline-flex; align-items: center; gap: 5px;
    height: 24px; padding-inline: 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12.5px; font-weight: 500;
    white-space: nowrap;
}
.adm-badge i { font-size: 14px; }
.adm-badge--primary { background: var(--primary-soft); color: var(--primary-ink); }
.adm-badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.adm-badges { display: flex; flex-wrap: wrap; gap: 6px; }

/* Empty state */
.adm-empty[hidden] { display: none; }
.adm-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; text-align: center; }
.adm-empty__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--surface-2); color: var(--muted); font-size: 28px;
}
.adm-empty__title { margin: 0; font-weight: 500; color: var(--text-2); }
.adm-empty__body { color: var(--muted); font-size: 14px; }

/* Pagination */
body.adm .pagination { margin: 0; gap: 4px; }
body.adm .page-link {
    min-width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 8px !important;
    background: var(--surface); color: var(--text);
}
body.adm .page-link:hover { background: var(--surface-2); }
body.adm .page-item.disabled .page-link { opacity: .5; background: var(--surface); }
.adm-pager-info { font-size: 13.5px; color: var(--muted); }

/* Forms */
.adm-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.adm-form-grid .is-full { grid-column: 1 / -1; }
.adm-field { display: flex; flex-direction: column; gap: 7px; }
.adm-field--narrow { max-width: 460px; }
.adm-label { font-size: 14.5px; font-weight: 500; color: var(--text-2); }
.adm-label .req { color: var(--danger); margin-inline-start: 2px; }
.adm-input {
    width: 100%; height: 44px;
    padding-inline: 12px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit; font-size: 15px;
    transition: border-color .15s, box-shadow .15s;
}
.adm-input:focus { outline: 0; border-color: var(--primary-ink); box-shadow: 0 0 0 3px var(--ring); }
.adm-input.is-invalid { border-color: var(--danger); }
[dir="rtl"] .adm-input[dir="ltr"] { text-align: right; }
.adm-hint { font-size: 13px; color: var(--muted); }
.adm-input.adm-textarea { height: auto; min-height: 44px; padding-block: 10px; line-height: 1.6; resize: vertical; }
.adm-filters--grow, .adm-panel__head > .adm-filters { flex: 1 1 auto; }
img.adm-avatar { object-fit: cover; }
.adm-error { font-size: 13px; color: var(--danger); }
.adm-form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Input with leading icon */
.adm-input-icon { position: relative; }
.adm-input-icon > i {
    position: absolute; top: 50%; inset-inline-start: 12px; transform: translateY(-50%);
    font-size: 19px; color: var(--muted); pointer-events: none;
}
.adm-input-icon .adm-input { padding-left: 40px; }
/* الحشوة تتبع جهة الأيقونة (اتجاه الصفحة) وليس اتجاه الحقل، لأن حقول الهاتف والبريد LTR */
[dir="rtl"] .adm-input-icon .adm-input { padding-left: 12px; padding-right: 40px; }
.adm-form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Image upload */
.adm-upload {
    display: flex; align-items: center; gap: 14px;
    padding: 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.adm-upload__preview {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 64px; height: 64px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 0 0 1px var(--border);
    overflow: hidden;
}
.adm-upload__preview img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.adm-upload__fallback { font-size: 24px; font-weight: 700; color: var(--muted); }
.adm-upload__body { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.adm-upload__btn { height: 36px; font-size: 14px; }
.adm-upload__name { font-size: 13px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-upload:focus-within { border-color: var(--primary-ink); box-shadow: 0 0 0 3px var(--ring); }

/* Color picker */
.adm-color { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-color__picker {
    width: 48px; height: 44px; padding: 3px;
    border: 1px solid var(--border-strong); border-radius: 10px;
    background: var(--surface); cursor: pointer;
}
.adm-input.adm-color__hex { width: 130px; font-family: ui-monospace, Consolas, monospace; text-transform: lowercase; }
.adm-swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-inline-start: 6px; }
.adm-swatch {
    width: 28px; height: 28px; padding: 0;
    border: 2px solid var(--surface); border-radius: 50%;
    background: var(--swatch);
    box-shadow: 0 0 0 1px var(--border-strong);
    cursor: pointer;
    transition: transform .12s;
}
.adm-swatch:hover { transform: scale(1.1); }
.adm-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--text); }

/* Choice cards (اختيار الأدوار للمستخدم) */
.adm-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.adm-choice { position: relative; display: block; cursor: pointer; }
.adm-choice input { position: absolute; opacity: 0; pointer-events: none; }
.adm-choice__box {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.adm-choice__box > i { font-size: 20px; color: var(--muted); }
.adm-choice__text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.adm-choice__title { font-weight: 500; }
.adm-choice__sub { font-size: 12.5px; color: var(--muted); }
.adm-choice:hover .adm-choice__box { border-color: var(--muted); }
.adm-choice input:checked + .adm-choice__box { border-color: var(--primary-ink); background: var(--primary-soft); box-shadow: inset 0 0 0 1px var(--primary-ink); }
.adm-choice input:checked + .adm-choice__box > i { color: var(--primary-ink); }
.adm-choice input:focus-visible + .adm-choice__box { box-shadow: 0 0 0 3px var(--ring); }

/* Checkbox (مربع اختيار موحّد، يدعم الحالة الوسطية) */
.adm-check {
    appearance: none; -webkit-appearance: none;
    flex: 0 0 auto;
    width: 18px; height: 18px; margin: 0;
    border: 1.5px solid var(--border-strong);
    border-radius: 5px;
    background: var(--surface);
    display: inline-grid; place-content: center;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.adm-check::after {
    content: '';
    width: 12px; height: 12px;
    background: var(--on-primary);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 4.9 8.6 9.5 3.6' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 4.9 8.6 9.5 3.6' fill='none' stroke='%23000' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
    transform: scale(0);
    transition: transform .1s;
}
.adm-check:checked,
.adm-check:indeterminate { background: var(--primary-btn); border-color: var(--primary-btn); }
.adm-check:checked::after { transform: scale(1); }
.adm-check:indeterminate::after {
    -webkit-mask: none; mask: none;
    width: 8px; height: 2px; border-radius: 1px;
    transform: scale(1);
}
.adm-check:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.adm-check:disabled { opacity: .5; cursor: not-allowed; }

/* Permission matrix — فئات وتحتها الإجراءات */
.adm-perm-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.adm-perm-toolbar__end { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adm-perm-count { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.adm-perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.adm-perm-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.adm-perm-group.is-full { border-color: color-mix(in srgb, var(--primary-ink) 45%, var(--border)); }
.adm-perm-group[hidden] { display: none; }
.adm-perm-group__head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.adm-perm-group__head.is-static { cursor: default; }
.adm-perm-group__icon {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 38px; height: 38px;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--primary-ink);
    font-size: 20px;
}
.adm-perm-group__text { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.adm-perm-group__title { font-weight: 700; font-size: 15.5px; }
.adm-perm-group__desc { font-size: 13px; color: var(--muted); }
.adm-perm-group__count {
    font-size: 12.5px; color: var(--muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.adm-perm-group__body { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
.adm-perm-item {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding-inline: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: border-color .12s, background .12s;
}
.adm-perm-item:hover { border-color: var(--muted); }
.adm-perm-item:has(.adm-check:checked) { border-color: var(--primary-ink); background: var(--primary-soft); }
.adm-perm-item[hidden] { display: none; }

/* عرض الصلاحيات (قراءة فقط) */
.adm-perm-state { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: 10px; border-radius: 8px; font-size: 13.5px; }
.adm-perm-state i { font-size: 16px; }
.adm-perm-state.is-on { background: var(--primary-soft); color: var(--primary-ink); }
.adm-perm-state.is-off { background: var(--surface-2); color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.adm-key {
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12.5px;
    color: var(--text-2);
    background: var(--surface-2);
    padding: 2px 7px;
    border-radius: 6px;
    direction: ltr;
    unicode-bidi: isolate;
}

/* Callout */
.adm-callout {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--text-2);
    font-size: 14px;
}
.adm-callout > i { font-size: 20px; color: var(--primary-ink); line-height: 1.2; }

/* Detail list */
.adm-dl { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; margin: 0; font-size: 14.5px; }
.adm-dl dt { color: var(--muted); font-weight: 400; }
.adm-dl dd { margin: 0; color: var(--text); }

/* Profile header */
.adm-profile { display: flex; align-items: center; gap: 16px; }
.adm-profile__name { margin: 0; font-size: 19px; font-weight: 700; }
.adm-profile__sub { color: var(--muted); font-size: 14px; }

/* Modal */
.adm-modal .modal-content { border-radius: var(--radius-lg); }
.adm-modal .modal-body { padding: 26px 24px 10px; text-align: center; }
.adm-modal .modal-footer { border: 0; padding: 12px 24px 22px; justify-content: center; gap: 8px; }
.adm-modal .modal-footer .btn { min-width: 110px; height: 40px; border-radius: 10px; }
.adm-modal__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 52px; height: 52px; border-radius: 50%;
    font-size: 26px; margin-bottom: 12px;
}
.adm-modal__icon--danger { background: rgba(229, 72, 77, .12); color: var(--danger); }
.adm-modal__title { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.adm-modal__text { margin: 0; color: var(--text-2); font-size: 14.5px; }
body.adm .btn-light { background: var(--surface-2); border-color: var(--border); color: var(--text); }
body.adm .btn-danger { background: var(--danger); border-color: var(--danger); }

/* Two-column layout for detail pages */
.adm-split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--gap); align-items: start; }

@media (max-width: 1199.98px) {
    .adm-split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 991.98px) {
    .adm-perm-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767.98px) {
    .adm-form-grid, .adm-form-grid--3 { grid-template-columns: minmax(0, 1fr); }
    .adm-filter { width: 100%; }
    .adm-table th, .adm-table td { padding-inline: 14px; }
    .adm-hide-sm { display: none; }
    .adm-panel__head, .adm-panel__body { padding-inline: 16px; }
}

/* Error pages */
.adm-error-page { max-width: 480px; text-align: center; }
.adm-error-page__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 72px; height: 72px; border-radius: 20px;
    background: var(--surface); box-shadow: 0 0 0 1px var(--border);
    color: var(--primary-ink); font-size: 36px;
}
.adm-error-page__code { margin: 18px 0 2px; font-size: 14px; font-weight: 700; letter-spacing: .12em; color: var(--muted); font-variant-numeric: tabular-nums; }
.adm-error-page__title { margin: 0 0 10px; font-size: 26px; font-weight: 700; color: var(--text); }
.adm-error-page__text { margin: 0 auto 28px; max-width: 400px; color: var(--text-2); font-size: 16px; }
.adm-error-page__actions { display: flex; flex-direction: column; align-items: center; gap: 10px; }
a.adm-error-page__btn { width: auto; padding-inline: 22px; text-decoration: none; }
a.adm-error-page__btn:hover { color: var(--on-primary); }
.adm-error-page__back { border: 0; background: none; color: var(--muted); font: inherit; font-size: 14.5px; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.adm-error-page__back:hover { color: var(--text); background: var(--surface); }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
    .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991.98px) {
    .adm-sidebar { transform: translateX(-100%); }
    .sb-mobile-open .adm-sidebar { box-shadow: var(--shadow-pop); }
    [dir="rtl"] .adm-sidebar { transform: translateX(100%); }
    .sb-mobile-open .adm-sidebar { transform: none; }
    .adm-sidebar__toggle { display: none; }
    .adm-sidebar__close { display: inline-flex; }
    .sb-mobile-open, .sb-mobile-open body { overflow: hidden; }
    .adm-backdrop {
        position: fixed; inset: 0; z-index: 1035;
        background: rgba(15, 17, 21, .45);
        opacity: 0; pointer-events: none; transition: opacity .2s;
    }
    .sb-mobile-open .adm-backdrop { opacity: 1; pointer-events: auto; }
    .adm-main { margin-inline-start: 0; padding: 12px 12px 0; }
    .adm-topbar { top: 12px; padding: 10px 12px; gap: 10px; min-height: 66px; }
    .adm-topbar .adm-topbar__menu { display: inline-flex; }
    .adm-search { flex: 1 1 auto; }
    .adm-search__box { height: 46px; }
    .adm-kbd { display: none; }
    .adm-user__meta, .adm-user__chev { display: none; }
    .adm-user { padding: 3px; height: auto; }
    .adm-icon-btn { width: 42px; height: 42px; }
    .adm-content { padding-inline: 4px; }
    .adm-page-head { margin-top: 24px; }
}

@media (max-width: 575.98px) {
    .adm-stats { grid-template-columns: minmax(0, 1fr); }
    .adm-stat { min-height: 0; }
    .adm-topbar__actions .adm-hide-xs { display: none; }
    .auth-card { padding: 22px 18px; }
    .auth-lang { top: 12px; inset-inline-end: 12px; height: 36px; }
    .auth-title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   Equipment module — شارات الحالة، التبويبات، الفلاتر، Select2، الطباعة
   ========================================================================== */

/* Status badges */
.adm-badge--success { background: rgba(48, 164, 108, .12); color: #1f7a4d; }
.adm-badge--warning { background: rgba(245, 158, 11, .14); color: #a35c00; }
.adm-badge--danger  { background: rgba(229, 72, 77, .12); color: #c6282d; }
.adm-badge--neutral { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
[data-theme="dark"] .adm-badge--success { color: #5fd49a; }
[data-theme="dark"] .adm-badge--warning { color: #f5b544; }
[data-theme="dark"] .adm-badge--danger  { color: #ff7b7f; }

/* رقم المعدة: يُعزل اتجاهه حتى لا تنقلب الشرطة، دون تغيير محاذاة السطر (يبقى في جهة البداية) */
.adm-asset { font-family: ui-monospace, Consolas, monospace; font-weight: 700; letter-spacing: .02em; unicode-bidi: isolate; }
input.adm-asset { unicode-bidi: normal; }
.adm-text-danger { color: var(--danger); }
.adm-nowrap { white-space: nowrap; }

/* KPI row with 5 cards */
.adm-stats--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.adm-stats--5 .adm-stat { min-height: 150px; }
.adm-stat__icon--slate { background: var(--surface-2); }
.adm-stat.is-alert .adm-stat__value { color: var(--danger); }
.adm-section-gap { margin-top: var(--gap); }

/* Tabs (segmented) */
.adm-tabs {
    display: inline-flex; gap: 4px; flex-wrap: wrap;
    padding: 4px;
    border-radius: 12px;
    background: var(--surface-2);
}
.adm-tab {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding-inline: 14px;
    border-radius: 9px;
    color: var(--text-2);
    font-size: 14.5px; font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
body.adm a.adm-tab { color: var(--text-2); }
body.adm a.adm-tab:hover { color: var(--text); opacity: 1; }
body.adm a.adm-tab.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--border); }
.adm-tab__count {
    min-width: 22px; height: 20px; padding-inline: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px;
    background: var(--border);
    font-size: 12px; font-variant-numeric: tabular-nums;
}
.adm-tab.is-active .adm-tab__count { background: var(--primary-soft); color: var(--primary-ink); }
.adm-tab__count.is-danger { background: rgba(229, 72, 77, .14); color: var(--danger); }

/* Filters bar */
.adm-filters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px 14px;
    align-items: end;
}
.adm-filters .adm-field { gap: 5px; }
.adm-filters .adm-label { font-size: 13px; }
.adm-filters .adm-input, .adm-filters select.adm-input { height: 40px; font-size: 14px; }
.adm-filters__actions { display: flex; gap: 8px; }
.adm-filters__actions .adm-btn { height: 40px; }
select.adm-input { appearance: auto; padding-inline: 10px; }

/* Quick presets (موعد الإرجاع) */
.adm-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.adm-chip {
    height: 30px; padding-inline: 12px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-family: inherit; font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.adm-chip:hover { border-color: var(--primary-ink); color: var(--primary-ink); }

/* Summary card (العهدة الحالية / المعدة المختارة) */
.adm-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px 20px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.adm-summary__item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.adm-summary__label { font-size: 12.5px; color: var(--muted); }
.adm-summary__value { font-weight: 500; overflow-wrap: anywhere; }
.adm-summary.is-danger { border-color: rgba(229, 72, 77, .35); background: rgba(229, 72, 77, .05); }

/* Step layout for issue/return */
.adm-steps { display: grid; gap: 18px; }
.adm-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 14px; align-items: start; }
.adm-step__num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary-ink);
    font-weight: 700; font-variant-numeric: tabular-nums;
}
.adm-step__body { display: grid; gap: 14px; min-width: 0; }
.adm-step__title { margin: 6px 0 0; font-size: 15.5px; font-weight: 700; }

/* Alert */
.adm-alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14.5px;
}
.adm-alert > i { font-size: 20px; line-height: 1.2; }
.adm-alert--danger { background: rgba(229, 72, 77, .08); color: #b4232a; }
.adm-alert--warning { background: rgba(245, 158, 11, .1); color: #8a4f00; }
.adm-alert--info { background: var(--primary-soft); color: var(--text-2); }
[data-theme="dark"] .adm-alert--danger { color: #ff9a9d; }
[data-theme="dark"] .adm-alert--warning { color: #f5b544; }

/* Worker photo */
.adm-photo { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--border); }

/* --------------------------------------------------------------------------
   Select2 — مطابقة التصميم
   -------------------------------------------------------------------------- */
body.adm .select2-container { width: 100% !important; font-family: inherit; }
body.adm .select2-container--default .select2-selection--single {
    height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: var(--surface);
    display: flex; align-items: center;
}
body.adm .adm-filters .select2-container--default .select2-selection--single { height: 40px; }
body.adm .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text); line-height: normal; padding-inline: 12px 34px; font-size: 15px;
}
body.adm .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--muted); }
body.adm .select2-container--default .select2-selection--single .select2-selection__arrow { height: 100%; top: 0; width: 30px; }
body.adm .select2-container--default .select2-selection--single .select2-selection__clear {
    color: var(--muted); font-size: 18px; margin-inline: 6px; float: none; position: absolute; inset-inline-end: 26px; top: 50%; transform: translateY(-50%);
}
body.adm .select2-container--default.select2-container--focus .select2-selection--single,
body.adm .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--primary-ink);
    box-shadow: 0 0 0 3px var(--ring);
}
body.adm .is-invalid + .select2-container .select2-selection--single { border-color: var(--danger); }
.select2-dropdown {
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    background: var(--surface) !important;
    box-shadow: var(--shadow-pop);
    overflow: hidden;
    font-family: var(--font);
    color: var(--text);
}
.select2-container--open .select2-dropdown--below { margin-top: 6px; }
.select2-container--open .select2-dropdown--above { margin-top: -6px; }
.select2-search--dropdown { padding: 8px; background: var(--surface) !important; }
.select2-container--default .select2-search--dropdown .select2-search__field {
    height: 38px; padding-inline: 10px;
    border: 1px solid var(--border-strong) !important;
    border-radius: 8px;
    background: var(--surface) !important; color: var(--text) !important;
    font-family: inherit; font-size: 14.5px;
    outline: 0;
}
.select2-results { background: var(--surface); }
.select2-container--default .select2-search--dropdown .select2-search__field:focus { border-color: var(--primary-ink) !important; box-shadow: 0 0 0 3px var(--ring); }
.select2-results__options { padding: 4px 6px 6px; }
.select2-container--default .select2-results__option { padding: 8px 10px; border-radius: 8px; font-size: 14.5px; }
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--primary-soft) !important; color: var(--text) !important; }
.select2-container--default .select2-results__option[aria-selected=true],
.select2-container--default .select2-results__option--selected { background: var(--surface-2); }
.select2-container--default .select2-results__option--disabled { color: var(--muted); }
.select2-results__message, .select2-results__option--load-more { color: var(--muted); }
.adm-s2 { display: flex; flex-direction: column; line-height: 1.35; }
.adm-s2__title { font-weight: 500; }
.adm-s2__sub { font-size: 12.5px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Print — طباعة التقارير والسجل
   -------------------------------------------------------------------------- */
.adm-print-head { display: none; }

@media print {
    @page { size: A4 landscape; margin: 12mm; }
    body.adm { background: #fff !important; font-size: 11.5px; }
    .adm-sidebar, .adm-backdrop, .adm-topbar, .adm-footer, .adm-page-head__actions,
    .adm-breadcrumb, .adm-no-print, .adm-actions, .swal2-container { display: none !important; }
    .adm-main { margin: 0 !important; padding: 0 !important; }
    .adm-content { padding: 0 !important; }
    .adm-page-head { margin: 0 0 8px; }
    .adm-page-title { font-size: 18px; }
    .adm-panel, .adm-summary { box-shadow: none !important; border-color: #ccc !important; break-inside: avoid; }
    .adm-table th { background: #f1f1f1 !important; color: #333 !important; }
    .adm-table td, .adm-table th { padding: 6px 8px; border-color: #ddd !important; }
    .adm-table tr { break-inside: avoid; }
    .adm-badge { box-shadow: inset 0 0 0 1px #bbb !important; background: transparent !important; color: #000 !important; }
    .adm-print-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-bottom: 8px; margin-bottom: 10px; border-bottom: 2px solid #000; }
    .adm-print-head__name { font-size: 16px; font-weight: 700; }
    .adm-print-head__meta { font-size: 11px; color: #444; text-align: end; }
    a { color: inherit !important; text-decoration: none !important; }
    .adm-table-wrap { overflow: visible !important; }
}

@media (max-width: 1399.98px) {
    .adm-stats--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    .adm-stats--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* 5 بطاقات في عمودين: الإجمالي بعرض كامل ثم 2×2 */
    .adm-stats--5 > :first-child { grid-column: 1 / -1; min-height: 0; }
    .adm-step { grid-template-columns: minmax(0, 1fr); }
    .adm-step__num { display: none; }
    .adm-tabs { width: 100%; }
}
